diff options
| author | kei519 <masaki.keigo.q00@kyoto-u.jp> | 2024-12-05 12:06:14 +0900 |
|---|---|---|
| committer | kei519 <masaki.keigo.q00@kyoto-u.jp> | 2024-12-05 13:06:34 +0900 |
| commit | 892d5850fb7a6b9e8ddabbf0c5db3292aef19667 (patch) | |
| tree | c977b8d5cb0e333393f49de0b44fc2451740470f | |
| parent | acabb5248231987ae1f0c215208d1005a5db402d (diff) | |
| download | rust-892d5850fb7a6b9e8ddabbf0c5db3292aef19667.tar.gz rust-892d5850fb7a6b9e8ddabbf0c5db3292aef19667.zip | |
Add a new test ui/incoherent-inherent-impls/no-other-unrelated-errors to check E0116 does not cause unrelated errors
rustc xxx (we do not know) to 1.82.0 emits unrelated errors when E0116 is present (see #125814). We do not know what caused and fixed it, but add a test to confirm rustc does not cause the same error in the future.
| -rw-r--r-- | tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs | 8 | ||||
| -rw-r--r-- | tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs new file mode 100644 index 00000000000..8eaa0c9194a --- /dev/null +++ b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs @@ -0,0 +1,8 @@ +// E0116 caused other unrelated errors, so check no unrelated errors are emmitted. + +fn main() { + let x = "hello"; + x.split(" "); +} + +impl Vec<usize> {} //~ ERROR E0116 diff --git a/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr new file mode 100644 index 00000000000..2a33262f838 --- /dev/null +++ b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr @@ -0,0 +1,11 @@ +error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined + --> $DIR/no-other-unrelated-errors.rs:8:1 + | +LL | impl Vec<usize> {} + | ^^^^^^^^^^^^^^^ impl for type defined outside of crate + | + = note: define and implement a trait or new type instead + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0116`. |
