Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f51ce75

Browse files
Rollup merge of #123516 - estebank:issue-123428, r=compiler-errors
Do not ICE on field access check on expr with `ty::Error` Fix #123428
2 parents 84dca15 + 97ea48c commit f51ce75

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

‎compiler/rustc_passes/src/dead.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
153153
self.insert_def_id(def.non_enum_variant().fields[index].did);
154154
}
155155
ty::Tuple(..) => {}
156-
_ => span_bug!(lhs.span, "named field access on non-ADT"),
156+
ty::Error(_) => {}
157+
kind => span_bug!(lhs.span, "named field access on non-ADT: {kind:?}"),
157158
}
158159
}
159160

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
trait Foo {}
2+
impl<T> Foo for T {}
3+
4+
fn main() {
5+
let array = [(); { loop {} }]; //~ ERROR constant evaluation is taking a long time
6+
7+
let tup = (7,);
8+
let x: &dyn Foo = &tup.0;
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: constant evaluation is taking a long time
2+
--> $DIR/do-not-ice-on-field-access-of-err-type.rs:5:24
3+
|
4+
LL | let array = [(); { loop {} }];
5+
| ^^^^^^^
6+
|
7+
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
8+
If your compilation actually takes a long time, you can safely allow the lint.
9+
help: the constant being evaluated
10+
--> $DIR/do-not-ice-on-field-access-of-err-type.rs:5:22
11+
|
12+
LL | let array = [(); { loop {} }];
13+
| ^^^^^^^^^^^
14+
= note: `#[deny(long_running_const_eval)]` on by default
15+
16+
error: aborting due to 1 previous error
17+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /