diff --git a/tests/ui/README.md b/tests/ui/README.md index 11003bbef9928..344b0b2500df9 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -113,12 +113,6 @@ See [Tracking Issue for autodiff #124509](https://github.com/rust-lang/rust/issu Tests for automatic referencing and dereferencing behavior, such as automatically adding reference operations (`&` or `&mut`) to make a value match a method's receiver type. Sometimes abbreviated as "auto-ref" or "auto-deref". -## `tests/ui/auxiliary/`: Auxiliary files for tests directly under `tests/ui`. - -This top-level `auxiliary` subdirectory contains support files for tests immediately under `tests/ui/`. - -**FIXME(#133895)**: tests immediately under `tests/ui/` should be rehomed to more suitable subdirectories, after which this subdirectory can be removed. - ## `tests/ui/backtrace/`: Backtraces Runtime panics and error handling generate backtraces to assist in debugging and diagnostics. @@ -542,12 +536,6 @@ These tests are about very different topics, only unified by the fact that they Accompanies `tests/ui/error-codes/`, exercises the `--explain` cli flag. -## `tests/ui/explicit/`: Errors involving the concept of "explicit" - -This category contains three tests: two which are about the specific error `explicit use of destructor method`, and one which is about explicit annotation of lifetimes: https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime/explicit.html. - -**FIXME**: Rehome the two tests about the destructor method with `drop`-related categories, and rehome the last test with a category related to lifetimes. - ## `tests/ui/explicit-tail-calls/` Exercises `#![feature(explicit_tail_calls)]` and the `become` keyword. See [Explicit Tail Calls #3407](https://github.com/rust-lang/rfcs/pull/3407). @@ -733,10 +721,6 @@ See [Instrument coverage | The rustc book](https://doc.rust-lang.org/rustc/instr See [Tracking issue for `-Z instrument-xray` #102921](https://github.com/rust-lang/rust/issues/102921). -## `tests/ui/interior-mutability/` - -**FIXME**: contains a single test, probably better rehomed. - ## `tests/ui/internal/` Tests for `internal_unstable` and the attribute header `#![feature(allow_internal_unstable)]`, which lets compiler developers mark features as internal to the compiler, and unstable for standard library use. @@ -759,16 +743,6 @@ Various tests related to rejecting invalid inputs. Tests for checking that invalid usage of compiler flags are rejected. -## `tests/ui/invalid-module-declaration/` - -**FIXME**: Consider merging into module/resolve directories. - -## `tests/ui/invalid-self-argument/`: `self` as a function argument incorrectly - -Tests with erroneous ways of using `self`, such as having it not be the first argument, or using it in a non-associated function (no `impl` or `trait`). - -**FIXME**: Maybe merge with `ui/self`. - ## `tests/ui/io-checks/` Contains a single test. The test tries to output a file into an invalid directory with `-o`, then checks that the result is an error, not an internal compiler error. diff --git a/tests/ui/explicit/explicit-call-to-dtor.fixed b/tests/ui/drop/explicit-call-to-dtor.fixed similarity index 71% rename from tests/ui/explicit/explicit-call-to-dtor.fixed rename to tests/ui/drop/explicit-call-to-dtor.fixed index 4c4142c79811d..167f557a6125a 100644 --- a/tests/ui/explicit/explicit-call-to-dtor.fixed +++ b/tests/ui/drop/explicit-call-to-dtor.fixed @@ -1,6 +1,6 @@ //@ run-rustfix struct Foo { - x: isize + x: isize, } impl Drop for Foo { @@ -12,5 +12,5 @@ impl Drop for Foo { fn main() { let x = Foo { x: 3 }; println!("{}", x.x); - drop(x); //~ ERROR explicit use of destructor method + drop(x); //~ ERROR explicit use of destructor method } diff --git a/tests/ui/explicit/explicit-call-to-dtor.rs b/tests/ui/drop/explicit-call-to-dtor.rs similarity index 71% rename from tests/ui/explicit/explicit-call-to-dtor.rs rename to tests/ui/drop/explicit-call-to-dtor.rs index 262dde54c7f6a..2c4e013f5c94d 100644 --- a/tests/ui/explicit/explicit-call-to-dtor.rs +++ b/tests/ui/drop/explicit-call-to-dtor.rs @@ -1,6 +1,6 @@ //@ run-rustfix struct Foo { - x: isize + x: isize, } impl Drop for Foo { @@ -12,5 +12,5 @@ impl Drop for Foo { fn main() { let x = Foo { x: 3 }; println!("{}", x.x); - x.drop(); //~ ERROR explicit use of destructor method + x.drop(); //~ ERROR explicit use of destructor method } diff --git a/tests/ui/explicit/explicit-call-to-dtor.stderr b/tests/ui/drop/explicit-call-to-dtor.stderr similarity index 100% rename from tests/ui/explicit/explicit-call-to-dtor.stderr rename to tests/ui/drop/explicit-call-to-dtor.stderr diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed b/tests/ui/drop/explicit-call-to-supertrait-dtor.fixed similarity index 81% rename from tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed rename to tests/ui/drop/explicit-call-to-supertrait-dtor.fixed index 57cb858aa0895..1526f7b46ea1b 100644 --- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed +++ b/tests/ui/drop/explicit-call-to-supertrait-dtor.fixed @@ -4,7 +4,7 @@ #![allow(dropping_references)] struct Foo { - x: isize + x: isize, } #[allow(drop_bounds)] @@ -20,7 +20,7 @@ impl Drop for Foo { impl Bar for Foo { fn blah(&self) { - drop(self); //~ ERROR explicit use of destructor method + drop(self); //~ ERROR explicit use of destructor method } } diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs b/tests/ui/drop/explicit-call-to-supertrait-dtor.rs similarity index 80% rename from tests/ui/explicit/explicit-call-to-supertrait-dtor.rs rename to tests/ui/drop/explicit-call-to-supertrait-dtor.rs index bb29e49524205..2de3d008aaaea 100644 --- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs +++ b/tests/ui/drop/explicit-call-to-supertrait-dtor.rs @@ -4,7 +4,7 @@ #![allow(dropping_references)] struct Foo { - x: isize + x: isize, } #[allow(drop_bounds)] @@ -20,7 +20,7 @@ impl Drop for Foo { impl Bar for Foo { fn blah(&self) { - self.drop(); //~ ERROR explicit use of destructor method + self.drop(); //~ ERROR explicit use of destructor method } } diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/tests/ui/drop/explicit-call-to-supertrait-dtor.stderr similarity index 100% rename from tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr rename to tests/ui/drop/explicit-call-to-supertrait-dtor.stderr diff --git a/tests/ui/explicit/explicit-self-lifetime-mismatch.rs b/tests/ui/explicit/explicit-self-lifetime-mismatch.rs deleted file mode 100644 index aa5e352b6ebef..0000000000000 --- a/tests/ui/explicit/explicit-self-lifetime-mismatch.rs +++ /dev/null @@ -1,22 +0,0 @@ -//@ dont-require-annotations: NOTE - -struct Foo<'a,'b> { - x: &'a isize, - y: &'b isize, -} - -impl<'a,'b> Foo<'a,'b> { - fn bar(self: - Foo<'b,'a> - //~^ ERROR mismatched `self` parameter type - //~| NOTE expected struct `Foo<'a, 'b>` - //~| NOTE found struct `Foo<'b, 'a>` - //~| NOTE lifetime mismatch - //~| ERROR mismatched `self` parameter type - //~| NOTE expected struct `Foo<'a, 'b>` - //~| NOTE found struct `Foo<'b, 'a>` - //~| NOTE lifetime mismatch - ) {} -} - -fn main() {} diff --git a/tests/ui/explicit/explicit-self-lifetime-mismatch.stderr b/tests/ui/explicit/explicit-self-lifetime-mismatch.stderr deleted file mode 100644 index a20901e8c74d2..0000000000000 --- a/tests/ui/explicit/explicit-self-lifetime-mismatch.stderr +++ /dev/null @@ -1,41 +0,0 @@ -error[E0308]: mismatched `self` parameter type - --> $DIR/explicit-self-lifetime-mismatch.rs:10:12 - | -LL | Foo<'b,'a> - | ^^^^^^^^^^ lifetime mismatch - | - = note: expected struct `Foo<'a, 'b>` - found struct `Foo<'b, 'a>` -note: the lifetime `'b` as defined here... - --> $DIR/explicit-self-lifetime-mismatch.rs:8:9 - | -LL | impl<'a,'b> Foo<'a,'b> { - | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/explicit-self-lifetime-mismatch.rs:8:6 - | -LL | impl<'a,'b> Foo<'a,'b> { - | ^^ - -error[E0308]: mismatched `self` parameter type - --> $DIR/explicit-self-lifetime-mismatch.rs:10:12 - | -LL | Foo<'b,'a> - | ^^^^^^^^^^ lifetime mismatch - | - = note: expected struct `Foo<'a, 'b>` - found struct `Foo<'b, 'a>` -note: the lifetime `'a` as defined here... - --> $DIR/explicit-self-lifetime-mismatch.rs:8:6 - | -LL | impl<'a,'b> Foo<'a,'b> { - | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/explicit-self-lifetime-mismatch.rs:8:9 - | -LL | impl<'a,'b> Foo<'a,'b> { - | ^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/invalid-module-declaration/auxiliary/foo/bar.rs b/tests/ui/invalid-module-declaration/auxiliary/foo/bar.rs deleted file mode 100644 index bcfd7dc0ade75..0000000000000 --- a/tests/ui/invalid-module-declaration/auxiliary/foo/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod baz; diff --git a/tests/ui/invalid-module-declaration/auxiliary/foo/mod.rs b/tests/ui/invalid-module-declaration/auxiliary/foo/mod.rs deleted file mode 100644 index 46f285ca47d69..0000000000000 --- a/tests/ui/invalid-module-declaration/auxiliary/foo/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod bar; diff --git a/tests/ui/invalid-module-declaration/invalid-module-declaration.rs b/tests/ui/invalid-module-declaration/invalid-module-declaration.rs deleted file mode 100644 index 1c6c282f4b7e6..0000000000000 --- a/tests/ui/invalid-module-declaration/invalid-module-declaration.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod auxiliary { - mod foo; -} - -fn main() {} - -//~? ERROR file not found for module `baz` diff --git a/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr b/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr deleted file mode 100644 index a8f65883d6364..0000000000000 --- a/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0583]: file not found for module `baz` - --> $DIR/auxiliary/foo/bar.rs:1:1 - | -LL | pub mod baz; - | ^^^^^^^^^^^^ - | - = help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs" or "$DIR/auxiliary/foo/bar/baz/mod.rs" - = note: if there is a `mod baz` elsewhere in the crate already, import it with `use crate::...` instead - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0583`. diff --git a/tests/ui/invalid-self-argument/bare-fn-start.rs b/tests/ui/invalid-self-argument/bare-fn-start.rs deleted file mode 100644 index 7c580bc5a5dea..0000000000000 --- a/tests/ui/invalid-self-argument/bare-fn-start.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn a(&self) { } -//~^ ERROR `self` parameter is only allowed in associated functions -//~| NOTE not semantically valid as function parameter -//~| NOTE associated functions are those in `impl` or `trait` definitions - -fn main() { } diff --git a/tests/ui/invalid-self-argument/bare-fn-start.stderr b/tests/ui/invalid-self-argument/bare-fn-start.stderr deleted file mode 100644 index bf7160bcd2d35..0000000000000 --- a/tests/ui/invalid-self-argument/bare-fn-start.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: `self` parameter is only allowed in associated functions - --> $DIR/bare-fn-start.rs:1:6 - | -LL | fn a(&self) { } - | ^^^^^ not semantically valid as function parameter - | - = note: associated functions are those in `impl` or `trait` definitions - -error: aborting due to 1 previous error - diff --git a/tests/ui/invalid-self-argument/bare-fn.rs b/tests/ui/invalid-self-argument/bare-fn.rs deleted file mode 100644 index 342bdc31a7c82..0000000000000 --- a/tests/ui/invalid-self-argument/bare-fn.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn b(foo: u32, &mut self) { } -//~^ ERROR unexpected `self` parameter in function -//~| NOTE must be the first parameter of an associated function - -fn main() { } diff --git a/tests/ui/invalid-self-argument/bare-fn.stderr b/tests/ui/invalid-self-argument/bare-fn.stderr deleted file mode 100644 index 7abb56602d4bc..0000000000000 --- a/tests/ui/invalid-self-argument/bare-fn.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: unexpected `self` parameter in function - --> $DIR/bare-fn.rs:1:16 - | -LL | fn b(foo: u32, &mut self) { } - | ^^^^^^^^^ must be the first parameter of an associated function - -error: aborting due to 1 previous error - diff --git a/tests/ui/invalid-self-argument/trait-fn.rs b/tests/ui/invalid-self-argument/trait-fn.rs deleted file mode 100644 index 5ccea589561cb..0000000000000 --- a/tests/ui/invalid-self-argument/trait-fn.rs +++ /dev/null @@ -1,11 +0,0 @@ -struct Foo {} - -impl Foo { - fn c(foo: u32, self) {} - //~^ ERROR unexpected `self` parameter in function - //~| NOTE must be the first parameter of an associated function - - fn good(&mut self, foo: u32) {} -} - -fn main() { } diff --git a/tests/ui/invalid-self-argument/trait-fn.stderr b/tests/ui/invalid-self-argument/trait-fn.stderr deleted file mode 100644 index c9d0a338ef428..0000000000000 --- a/tests/ui/invalid-self-argument/trait-fn.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: unexpected `self` parameter in function - --> $DIR/trait-fn.rs:4:20 - | -LL | fn c(foo: u32, self) {} - | ^^^^ must be the first parameter of an associated function - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-17740.rs b/tests/ui/issues/issue-17740.rs deleted file mode 100644 index 20a73756ea3ea..0000000000000 --- a/tests/ui/issues/issue-17740.rs +++ /dev/null @@ -1,20 +0,0 @@ -//@ dont-require-annotations: NOTE - -struct Foo<'a> { - data: &'a[u8], -} - -impl <'a> Foo<'a>{ - fn bar(self: &mut Foo) { - //~^ ERROR mismatched `self` parameter type - //~| NOTE expected struct `Foo<'a>` - //~| NOTE found struct `Foo<'_>` - //~| NOTE lifetime mismatch - //~| ERROR mismatched `self` parameter type - //~| NOTE expected struct `Foo<'a>` - //~| NOTE found struct `Foo<'_>` - //~| NOTE lifetime mismatch - } -} - -fn main() {} diff --git a/tests/ui/issues/issue-17740.stderr b/tests/ui/issues/issue-17740.stderr deleted file mode 100644 index 198d7d5b37cc7..0000000000000 --- a/tests/ui/issues/issue-17740.stderr +++ /dev/null @@ -1,41 +0,0 @@ -error[E0308]: mismatched `self` parameter type - --> $DIR/issue-17740.rs:8:18 - | -LL | fn bar(self: &mut Foo) { - | ^^^^^^^^ lifetime mismatch - | - = note: expected struct `Foo<'a>` - found struct `Foo<'_>` -note: the anonymous lifetime defined here... - --> $DIR/issue-17740.rs:8:23 - | -LL | fn bar(self: &mut Foo) { - | ^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/issue-17740.rs:7:7 - | -LL | impl <'a> Foo<'a>{ - | ^^ - -error[E0308]: mismatched `self` parameter type - --> $DIR/issue-17740.rs:8:18 - | -LL | fn bar(self: &mut Foo) { - | ^^^^^^^^ lifetime mismatch - | - = note: expected struct `Foo<'a>` - found struct `Foo<'_>` -note: the lifetime `'a` as defined here... - --> $DIR/issue-17740.rs:7:7 - | -LL | impl <'a> Foo<'a>{ - | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined here - --> $DIR/issue-17740.rs:8:23 - | -LL | fn bar(self: &mut Foo) { - | ^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lifetimes/explicit-self-lifetime-mismatch.rs b/tests/ui/lifetimes/explicit-self-lifetime-mismatch.rs new file mode 100644 index 0000000000000..88b9d86a9fdf6 --- /dev/null +++ b/tests/ui/lifetimes/explicit-self-lifetime-mismatch.rs @@ -0,0 +1,41 @@ +//@ dont-require-annotations: NOTE +//! regression test for + +struct Foo<'a, 'b> { + x: &'a isize, + y: &'b isize, +} + +impl<'a, 'b> Foo<'a, 'b> { + fn bar( + self: Foo<'b, 'a>, + //~^ ERROR mismatched `self` parameter type + //~| NOTE expected struct `Foo<'a, 'b>` + //~| NOTE found struct `Foo<'b, 'a>` + //~| NOTE lifetime mismatch + //~| ERROR mismatched `self` parameter type + //~| NOTE expected struct `Foo<'a, 'b>` + //~| NOTE found struct `Foo<'b, 'a>` + //~| NOTE lifetime mismatch + ) { + } +} + +struct Bar<'a> { + data: &'a [u8], +} + +impl<'a> Bar<'a> { + fn bar(self: &mut Bar) { + //~^ ERROR mismatched `self` parameter type + //~| NOTE expected struct `Bar<'a>` + //~| NOTE found struct `Bar<'_>` + //~| NOTE lifetime mismatch + //~| ERROR mismatched `self` parameter type + //~| NOTE expected struct `Bar<'a>` + //~| NOTE found struct `Bar<'_>` + //~| NOTE lifetime mismatch + } +} + +fn main() {} diff --git a/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr b/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr new file mode 100644 index 0000000000000..ebd6383cb4de5 --- /dev/null +++ b/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr @@ -0,0 +1,79 @@ +error[E0308]: mismatched `self` parameter type + --> $DIR/explicit-self-lifetime-mismatch.rs:11:15 + | +LL | self: Foo<'b, 'a>, + | ^^^^^^^^^^^ lifetime mismatch + | + = note: expected struct `Foo<'a, 'b>` + found struct `Foo<'b, 'a>` +note: the lifetime `'b` as defined here... + --> $DIR/explicit-self-lifetime-mismatch.rs:9:10 + | +LL | impl<'a, 'b> Foo<'a, 'b> { + | ^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/explicit-self-lifetime-mismatch.rs:9:6 + | +LL | impl<'a, 'b> Foo<'a, 'b> { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/explicit-self-lifetime-mismatch.rs:11:15 + | +LL | self: Foo<'b, 'a>, + | ^^^^^^^^^^^ lifetime mismatch + | + = note: expected struct `Foo<'a, 'b>` + found struct `Foo<'b, 'a>` +note: the lifetime `'a` as defined here... + --> $DIR/explicit-self-lifetime-mismatch.rs:9:6 + | +LL | impl<'a, 'b> Foo<'a, 'b> { + | ^^ +note: ...does not necessarily outlive the lifetime `'b` as defined here + --> $DIR/explicit-self-lifetime-mismatch.rs:9:10 + | +LL | impl<'a, 'b> Foo<'a, 'b> { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/explicit-self-lifetime-mismatch.rs:29:18 + | +LL | fn bar(self: &mut Bar) { + | ^^^^^^^^ lifetime mismatch + | + = note: expected struct `Bar<'a>` + found struct `Bar<'_>` +note: the anonymous lifetime defined here... + --> $DIR/explicit-self-lifetime-mismatch.rs:29:23 + | +LL | fn bar(self: &mut Bar) { + | ^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/explicit-self-lifetime-mismatch.rs:28:6 + | +LL | impl<'a> Bar<'a> { + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/explicit-self-lifetime-mismatch.rs:29:18 + | +LL | fn bar(self: &mut Bar) { + | ^^^^^^^^ lifetime mismatch + | + = note: expected struct `Bar<'a>` + found struct `Bar<'_>` +note: the lifetime `'a` as defined here... + --> $DIR/explicit-self-lifetime-mismatch.rs:28:6 + | +LL | impl<'a> Bar<'a> { + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/explicit-self-lifetime-mismatch.rs:29:23 + | +LL | fn bar(self: &mut Bar) { + | ^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/self/invalid-self-argument.rs b/tests/ui/self/invalid-self-argument.rs new file mode 100644 index 0000000000000..fef687e194cbb --- /dev/null +++ b/tests/ui/self/invalid-self-argument.rs @@ -0,0 +1,22 @@ +//! regression test for + +fn a(&self) {} +//~^ ERROR `self` parameter is only allowed in associated functions +//~| NOTE not semantically valid as function parameter +//~| NOTE associated functions are those in `impl` or `trait` definitions + +fn b(foo: u32, &mut self) {} +//~^ ERROR unexpected `self` parameter in function +//~| NOTE must be the first parameter of an associated function + +struct Foo {} + +impl Foo { + fn c(foo: u32, self) {} + //~^ ERROR unexpected `self` parameter in function + //~| NOTE must be the first parameter of an associated function + + fn good(&mut self, foo: u32) {} +} + +fn main() {} diff --git a/tests/ui/self/invalid-self-argument.stderr b/tests/ui/self/invalid-self-argument.stderr new file mode 100644 index 0000000000000..c92e5b2492bff --- /dev/null +++ b/tests/ui/self/invalid-self-argument.stderr @@ -0,0 +1,22 @@ +error: unexpected `self` parameter in function + --> $DIR/invalid-self-argument.rs:8:16 + | +LL | fn b(foo: u32, &mut self) {} + | ^^^^^^^^^ must be the first parameter of an associated function + +error: unexpected `self` parameter in function + --> $DIR/invalid-self-argument.rs:15:20 + | +LL | fn c(foo: u32, self) {} + | ^^^^ must be the first parameter of an associated function + +error: `self` parameter is only allowed in associated functions + --> $DIR/invalid-self-argument.rs:3:6 + | +LL | fn a(&self) {} + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error: aborting due to 3 previous errors + diff --git a/tests/ui/interior-mutability/interior-mutability.rs b/tests/ui/traits/catch-unwind-cell-interior-mut.rs similarity index 79% rename from tests/ui/interior-mutability/interior-mutability.rs rename to tests/ui/traits/catch-unwind-cell-interior-mut.rs index 7e4fe76852d76..cfc52322399fd 100644 --- a/tests/ui/interior-mutability/interior-mutability.rs +++ b/tests/ui/traits/catch-unwind-cell-interior-mut.rs @@ -1,3 +1,4 @@ +//! related issue: //@ compile-flags: -Zwrite-long-types-to-disk=yes use std::cell::Cell; use std::panic::catch_unwind; diff --git a/tests/ui/interior-mutability/interior-mutability.stderr b/tests/ui/traits/catch-unwind-cell-interior-mut.stderr similarity index 91% rename from tests/ui/interior-mutability/interior-mutability.stderr rename to tests/ui/traits/catch-unwind-cell-interior-mut.stderr index b307d608a1fd9..6f58c880554a6 100644 --- a/tests/ui/interior-mutability/interior-mutability.stderr +++ b/tests/ui/traits/catch-unwind-cell-interior-mut.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - --> $DIR/interior-mutability.rs:6:18 + --> $DIR/catch-unwind-cell-interior-mut.rs:7:18 | LL | catch_unwind(|| { x.set(23); }); | ------------ ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary @@ -11,7 +11,7 @@ note: required because it appears within the type `Cell` --> $SRC_DIR/core/src/cell.rs:LL:COL = note: required for `&Cell` to implement `UnwindSafe` note: required because it's used within this closure - --> $DIR/interior-mutability.rs:6:18 + --> $DIR/catch-unwind-cell-interior-mut.rs:7:18 | LL | catch_unwind(|| { x.set(23); }); | ^^