Auto merge of #60649 - Xanewok:save-analysis-assoc-const-ice, r=oli-obk
save-analysis: Fix ICE when processing associated constant Closes #59134 Closes https://github.com/rust-lang/rls/issues/1449 Thanks @swgillespie for helping tracking this down and fixing it! r? @eddyb
This commit is contained in:
commit
a9ec99f420
5 changed files with 48 additions and 4 deletions
|
|
@ -463,10 +463,12 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
|
|||
}
|
||||
|
||||
// walk type and init value
|
||||
self.visit_ty(typ);
|
||||
if let Some(expr) = expr {
|
||||
self.visit_expr(expr);
|
||||
}
|
||||
self.nest_tables(id, |v| {
|
||||
v.visit_ty(typ);
|
||||
if let Some(expr) = expr {
|
||||
v.visit_expr(expr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// FIXME tuple structs should generate tuple-specific data.
|
||||
|
|
|
|||
12
src/test/ui/save-analysis/issue-59134-0.rs
Normal file
12
src/test/ui/save-analysis/issue-59134-0.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// compile-flags: -Zsave-analysis
|
||||
|
||||
// Check that this doesn't ICE when processing associated const (field expr).
|
||||
|
||||
pub fn f() {
|
||||
trait Trait {}
|
||||
impl Trait {
|
||||
const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus`
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
9
src/test/ui/save-analysis/issue-59134-0.stderr
Normal file
9
src/test/ui/save-analysis/issue-59134-0.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0425]: cannot find value `bogus` in this scope
|
||||
--> $DIR/issue-59134-0.rs:8:27
|
||||
|
|
||||
LL | const FLAG: u32 = bogus.field;
|
||||
| ^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
12
src/test/ui/save-analysis/issue-59134-1.rs
Normal file
12
src/test/ui/save-analysis/issue-59134-1.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// compile-flags: -Zsave-analysis
|
||||
|
||||
// Check that this doesn't ICE when processing associated const (type).
|
||||
|
||||
fn func() {
|
||||
trait Trait {
|
||||
type MyType;
|
||||
const CONST: Self::MyType = bogus.field; //~ ERROR cannot find value `bogus`
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
9
src/test/ui/save-analysis/issue-59134-1.stderr
Normal file
9
src/test/ui/save-analysis/issue-59134-1.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0425]: cannot find value `bogus` in this scope
|
||||
--> $DIR/issue-59134-1.rs:8:37
|
||||
|
|
||||
LL | const CONST: Self::MyType = bogus.field;
|
||||
| ^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue