4

Check node kind to avoid ICE in `check_expr_return()` by FabianWolff · Pull Requ...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/86728
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

FabianWolff commented 9 days ago

This PR fixes #86721. The ICE described there is apparently due to a misunderstanding:

let encl_item_id = self.tcx.hir().get_parent_item(expr.hir_id); let encl_item = self.tcx.hir().expect_item(encl_item_id);

Intuitively, one would think that calling expect_item() after get_parent_item() should succeed, but as it turns out, get_parent_item() can also return foreign, trait, and impl items as well as crates, whereas expect_item() specifically expects a Node::Item. I have therefore added an extra check to prevent this ICE.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK