forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not ICE on field access check on expr with
ty::Error
Fix rust-lang#123428
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
trait Foo {} | ||
impl<T> Foo for T {} | ||
|
||
fn main() { | ||
let array = [(); { loop {} }]; //~ ERROR constant evaluation is taking a long time | ||
|
||
let tup = (7,); | ||
let x: &dyn Foo = &tup.0; | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/ui/consts/do-not-ice-on-field-access-of-err-type.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error: constant evaluation is taking a long time | ||
--> $DIR/do-not-ice-on-field-access-of-err-type.rs:5:24 | ||
| | ||
LL | let array = [(); { loop {} }]; | ||
| ^^^^^^^ | ||
| | ||
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval. | ||
If your compilation actually takes a long time, you can safely allow the lint. | ||
help: the constant being evaluated | ||
--> $DIR/do-not-ice-on-field-access-of-err-type.rs:5:22 | ||
| | ||
LL | let array = [(); { loop {} }]; | ||
| ^^^^^^^^^^^ | ||
= note: `#[deny(long_running_const_eval)]` on by default | ||
|
||
error: aborting due to 1 previous error | ||
|