Uh oh!
There was an error while loading. Please reload this page.
add AnonConst as potential parent_item - #71477
Conversation
There was a problem hiding this comment.
This help message was incorrect.
There was a problem hiding this comment.
estebank
commented
Apr 23, 2020
It'd be nice if we changed |
lcnr
commented
Apr 23, 2020
Can implement it in a separate PR 👍 |
eddyb
commented
Apr 30, 2020
I don't think this is the right approach, |
lcnr
commented
Apr 30, 2020
This PR is needed for https://github.com/rust-lang/rust/blob/4b575996168edbc5b7ad46229f5ed3bfee35484c/src/test/ui/const-generics/type-dependent/const-arg-in-const-arg.rs#70 (#71154 uses it to get the correct typeck_tables)
rust/src/librustc_middle/hir/map/mod.rs Line 564 in bf45975 which currently results in wrong diagnostics in rust/src/librustc_typeck/check/demand.rs Lines 597 to 601 in 413a129 What do you want to use instead? |
eddyb
commented
May 1, 2020
You want to loop through the parents with If you want to be more efficient you could probably add an cc @ecstatic-morse@oli-obk@wesleywiser on |
lcnr
commented
May 1, 2020
I now use the following in #71154: pubfnenclosing_body_owner(&self,hir_id:HirId) -> HirId{for(parent, _)inself.parent_iter(hir_id){ifletSome(body) = self.maybe_body_owned_by(parent){returnself.body_owner(body);}}bug!("no `enclosing_body_owner` for hir_id `{}`", hir_id);}This means that this PR now only fixes incorrect suggestions afaict. Don't fully understand when |
lcnr
commented
May 19, 2020
Closing this for now as this is not the correct approach. Will try and make a more general fix for |
Fix `is_const_context`, update `check_for_cast` A better version of rust-lang#71477 Adds `fn enclosing_body_owner` and uses it in `is_const_context`. `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect. Renames `is_const_context` to `is_inside_const_context`. I also updated `check_for_cast` in the second commit, so r? @estebank (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
Fix `is_const_context`, update `check_for_cast` A better version of rust-lang#71477 Adds `fn enclosing_body_owner` and uses it in `is_const_context`. `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect. Renames `is_const_context` to `is_inside_const_context`. I also updated `check_for_cast` in the second commit, so r? @estebank (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
This prevents some help messages in const contexts, due to
rust/src/librustc_typeck/check/demand.rs
Lines 597 to 601 in 413a129
considering that the check in
is_const_contextwas previously unreachable,this is actually a bugfix 😆
rust/src/librustc_middle/hir/map/mod.rs
Line 563 in 413a129
r? @eddyb cc @estebank