diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-03 21:29:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-03 21:29:45 +0100 |
| commit | 326839bf7f962495b79bdd93dfb886194a5ba13c (patch) | |
| tree | 528eeab4deaf2c10e62cb3fa565c6cce98a296a0 /tests | |
| parent | 2a8fc94697b088f153a5c5f0aad5e56160ed5e96 (diff) | |
| parent | 4f773af1cc17621e7c52afba6be2db21b2f3aba5 (diff) | |
| download | rust-326839bf7f962495b79bdd93dfb886194a5ba13c.tar.gz rust-326839bf7f962495b79bdd93dfb886194a5ba13c.zip | |
Rollup merge of #120616 - fmease:fix-ice-const-eval-fail-undef-field-access, r=compiler-errors
Fix ICE on field access on a tainted type after const-eval failure Fixes #120615. r? oli-obk or compiler
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.rs | 5 | ||||
| -rw-r--r-- | tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.stderr | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.rs b/tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.rs new file mode 100644 index 00000000000..3f1f208459d --- /dev/null +++ b/tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.rs @@ -0,0 +1,5 @@ +// Regression test for issue #120615. + +fn main() { + [(); loop {}].field; //~ ERROR constant evaluation is taking a long time +} diff --git a/tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.stderr b/tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.stderr new file mode 100644 index 00000000000..9d62bbc2187 --- /dev/null +++ b/tests/ui/consts/const-eval/field-access-after-const-eval-fail-in-ty.stderr @@ -0,0 +1,17 @@ +error: constant evaluation is taking a long time + --> $DIR/field-access-after-const-eval-fail-in-ty.rs:4:10 + | +LL | [(); loop {}].field; + | ^^^^^^^ + | + = 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/field-access-after-const-eval-fail-in-ty.rs:4:10 + | +LL | [(); loop {}].field; + | ^^^^^^^ + = note: `#[deny(long_running_const_eval)]` on by default + +error: aborting due to 1 previous error + |
