Skip to content

Commit c503285

Browse files
committed
Rollup merge of rust-lang#60806 - Xanewok:beta-save-analysis-assoc-const-ice, r=pietroalbini
2 parents d32bd05 + ae22067 commit c503285

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

src/librustc_save_analysis/dump_visitor.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,12 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
463463
}
464464

465465
// walk type and init value
466-
self.visit_ty(typ);
467-
if let Some(expr) = expr {
468-
self.visit_expr(expr);
469-
}
466+
self.nest_tables(id, |v| {
467+
v.visit_ty(typ);
468+
if let Some(expr) = expr {
469+
v.visit_expr(expr);
470+
}
471+
});
470472
}
471473

472474
// FIXME tuple structs should generate tuple-specific data.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// compile-flags: -Zsave-analysis
2+
3+
// Check that this doesn't ICE when processing associated const (field expr).
4+
5+
pub fn f() {
6+
trait Trait {}
7+
impl Trait {
8+
const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus`
9+
}
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0425]: cannot find value `bogus` in this scope
2+
--> $DIR/issue-59134-0.rs:8:27
3+
|
4+
LL | const FLAG: u32 = bogus.field;
5+
| ^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0425`.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// compile-flags: -Zsave-analysis
2+
3+
// Check that this doesn't ICE when processing associated const (type).
4+
5+
fn func() {
6+
trait Trait {
7+
type MyType;
8+
const CONST: Self::MyType = bogus.field; //~ ERROR cannot find value `bogus`
9+
}
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0425]: cannot find value `bogus` in this scope
2+
--> $DIR/issue-59134-1.rs:8:37
3+
|
4+
LL | const CONST: Self::MyType = bogus.field;
5+
| ^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)