diff --git a/tests/ui/errors/remap-path-prefix-sysroot.rs b/tests/ui/errors/remap-path-prefix-sysroot.rs index 1b8a9d1f0e6f1..6aec12c3d7a44 100644 --- a/tests/ui/errors/remap-path-prefix-sysroot.rs +++ b/tests/ui/errors/remap-path-prefix-sysroot.rs @@ -1,12 +1,18 @@ -// run-fail -// check-run-results - -// exec-env:RUST_BACKTRACE=full // revisions: with-remap without-remap // compile-flags: -g -Ztranslate-remapped-path-to-local-path=yes // [with-remap]compile-flags: --remap-path-prefix={{rust-src-base}}=remapped // [without-remap]compile-flags: +// error-pattern: E0507 + +use std::thread; +struct Worker { + thread: thread::JoinHandle<()>, +} -fn main() { - Vec::::with_capacity(!0); +impl Drop for Worker { + fn drop(&mut self) { + self.thread.join().unwrap(); + } } + +pub fn main(){} \ No newline at end of file diff --git a/tests/ui/errors/remap-path-prefix-sysroot.with-remap.run.stderr b/tests/ui/errors/remap-path-prefix-sysroot.with-remap.run.stderr deleted file mode 100644 index b54529fd0f5d6..0000000000000 --- a/tests/ui/errors/remap-path-prefix-sysroot.with-remap.run.stderr +++ /dev/null @@ -1,36 +0,0 @@ -thread 'main' panicked at library/alloc/src/raw_vec.rs:545:5: -capacity overflow -stack backtrace: - 0: 0x1056a1fb0 - ::fmt::h34ddcf7e122b89ac - 1: 0x1056f9714 - core::fmt::write::hd1aeea4ff96546ca - 2: 0x1056a59e4 - std::io::Write::write_fmt::h17b1090c1278c55b - 3: 0x1056a1e20 - std::sys_common::backtrace::print::hfafdd06e00730994 - 4: 0x1056c218c - std::panicking::default_hook::{{closure}}::h97a3d80e798f2ed6 - 5: 0x1056c1f6c - std::panicking::default_hook::hda0f04e04c8eb266 - 6: 0x1056c25d0 - std::panicking::rust_panic_with_hook::hf66d5a2176bf0f70 - 7: 0x1056a27f4 - std::panicking::begin_panic_handler::{{closure}}::haacaa3525d299c3a - 8: 0x1056a21e0 - std::sys_common::backtrace::__rust_end_short_backtrace::h87e6f3e754a75849 - 9: 0x1056c2334 - _rust_begin_unwind - 10: 0x1057167f8 - core::panicking::panic_fmt::h02ef70cf9926e63a - 11: 0x1056f45c4 - alloc::raw_vec::capacity_overflow::h4447458ef5d0325b - 12: 0x10498b250 - alloc::raw_vec::RawVec::allocate_in::he48752b99f53b509 - at remapped/library/alloc/src/raw_vec.rs:177:27 - 13: 0x10498adac - alloc::raw_vec::RawVec::with_capacity_in::h0f23d7d992348ac1 - at remapped/library/alloc/src/raw_vec.rs:130:9 - 14: 0x10498adac - alloc::vec::Vec::with_capacity_in::h8aa83d89b81dd67c - at remapped/library/alloc/src/vec/mod.rs:670:20 - 15: 0x10498adac - alloc::vec::Vec::with_capacity::h9bcc7d8009345416 - at remapped/library/alloc/src/vec/mod.rs:479:9 - 16: 0x10498b7ac - remap_path_prefix_sysroot::main::hc6dc31a7bd7adcd2 - at remapped/tests/ui/errors/remap-path-prefix-sysroot.rs:11:5 - 17: 0x10498aa28 - core::ops::function::FnOnce::call_once::hc6cd7e6e6c0a39ec - at remapped/library/core/src/ops/function.rs:250:5 - 18: 0x10498a938 - std::sys_common::backtrace::__rust_begin_short_backtrace::h00cfadb0500687d9 - at remapped/library/std/src/sys_common/backtrace.rs:155:18 - 19: 0x10498a9cc - std::rt::lang_start::{{closure}}::hdaed3a6f285f5688 - at remapped/library/std/src/rt.rs:167:18 - 20: 0x1056c227c - std::panicking::try::hfb03667ecc24ab29 - 21: 0x1056ae9e4 - std::rt::lang_start_internal::he5e74d4e4d2cb01e - 22: 0x10498a998 - std::rt::lang_start::hdf7d4c5cfb24235f - at remapped/library/std/src/rt.rs:166:17 - 23: 0x10498b7e4 - _main diff --git a/tests/ui/errors/remap-path-prefix-sysroot.with-remap.stderr b/tests/ui/errors/remap-path-prefix-sysroot.with-remap.stderr new file mode 100644 index 0000000000000..59bbfffedaf9f --- /dev/null +++ b/tests/ui/errors/remap-path-prefix-sysroot.with-remap.stderr @@ -0,0 +1,17 @@ +error[E0507]: cannot move out of `self.thread` which is behind a mutable reference + --> remapped/tests/ui/errors/remap-path-prefix-sysroot.rs:14:9 + | +LL | self.thread.join().unwrap(); + | ^^^^^^^^^^^ ------ `self.thread` moved due to this method call + | | + | move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait + | +note: `JoinHandle::::join` takes ownership of the receiver `self`, which moves `self.thread` + --> remapped/library/std/src/thread/mod.rs:LL:COL + | +LL | pub fn join(self) -> Result { + | ^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/errors/remap-path-prefix-sysroot.without-remap.run.stderr b/tests/ui/errors/remap-path-prefix-sysroot.without-remap.run.stderr deleted file mode 100644 index 6670bb72da75a..0000000000000 --- a/tests/ui/errors/remap-path-prefix-sysroot.without-remap.run.stderr +++ /dev/null @@ -1,36 +0,0 @@ -thread 'main' panicked at library/alloc/src/raw_vec.rs:545:5: -capacity overflow -stack backtrace: - 0: 0x103ce1fb0 - ::fmt::h34ddcf7e122b89ac - 1: 0x103d39714 - core::fmt::write::hd1aeea4ff96546ca - 2: 0x103ce59e4 - std::io::Write::write_fmt::h17b1090c1278c55b - 3: 0x103ce1e20 - std::sys_common::backtrace::print::hfafdd06e00730994 - 4: 0x103d0218c - std::panicking::default_hook::{{closure}}::h97a3d80e798f2ed6 - 5: 0x103d01f6c - std::panicking::default_hook::hda0f04e04c8eb266 - 6: 0x103d025d0 - std::panicking::rust_panic_with_hook::hf66d5a2176bf0f70 - 7: 0x103ce27f4 - std::panicking::begin_panic_handler::{{closure}}::haacaa3525d299c3a - 8: 0x103ce21e0 - std::sys_common::backtrace::__rust_end_short_backtrace::h87e6f3e754a75849 - 9: 0x103d02334 - _rust_begin_unwind - 10: 0x103d567f8 - core::panicking::panic_fmt::h02ef70cf9926e63a - 11: 0x103d345c4 - alloc::raw_vec::capacity_overflow::h4447458ef5d0325b - 12: 0x102fcb250 - alloc::raw_vec::RawVec::allocate_in::he48752b99f53b509 - at $SRC_DIR_REAL/alloc/src/raw_vec.rs:LL:COL - 13: 0x102fcadac - alloc::raw_vec::RawVec::with_capacity_in::h0f23d7d992348ac1 - at $SRC_DIR_REAL/alloc/src/raw_vec.rs:LL:COL - 14: 0x102fcadac - alloc::vec::Vec::with_capacity_in::h8aa83d89b81dd67c - at $SRC_DIR_REAL/alloc/src/vec/mod.rs:LL:COL - 15: 0x102fcadac - alloc::vec::Vec::with_capacity::h9bcc7d8009345416 - at $SRC_DIR_REAL/alloc/src/vec/mod.rs:LL:COL - 16: 0x102fcb7ac - remap_path_prefix_sysroot::main::hc6dc31a7bd7adcd2 - at $DIR/remap-path-prefix-sysroot.rs:11:5 - 17: 0x102fcaa28 - core::ops::function::FnOnce::call_once::hc6cd7e6e6c0a39ec - at $SRC_DIR_REAL/core/src/ops/function.rs:LL:COL - 18: 0x102fca938 - std::sys_common::backtrace::__rust_begin_short_backtrace::h00cfadb0500687d9 - at $SRC_DIR_REAL/std/src/sys_common/backtrace.rs:LL:COL - 19: 0x102fca9cc - std::rt::lang_start::{{closure}}::hdaed3a6f285f5688 - at $SRC_DIR_REAL/std/src/rt.rs:LL:COL - 20: 0x103d0227c - std::panicking::try::hfb03667ecc24ab29 - 21: 0x103cee9e4 - std::rt::lang_start_internal::he5e74d4e4d2cb01e - 22: 0x102fca998 - std::rt::lang_start::hdf7d4c5cfb24235f - at $SRC_DIR_REAL/std/src/rt.rs:LL:COL - 23: 0x102fcb7e4 - _main diff --git a/tests/ui/errors/remap-path-prefix-sysroot.without-remap.stderr b/tests/ui/errors/remap-path-prefix-sysroot.without-remap.stderr new file mode 100644 index 0000000000000..ae674ee2990e6 --- /dev/null +++ b/tests/ui/errors/remap-path-prefix-sysroot.without-remap.stderr @@ -0,0 +1,17 @@ +error[E0507]: cannot move out of `self.thread` which is behind a mutable reference + --> $DIR/remap-path-prefix-sysroot.rs:14:9 + | +LL | self.thread.join().unwrap(); + | ^^^^^^^^^^^ ------ `self.thread` moved due to this method call + | | + | move occurs because `self.thread` has type `JoinHandle<()>`, which does not implement the `Copy` trait + | +note: `JoinHandle::::join` takes ownership of the receiver `self`, which moves `self.thread` + --> $SRC_DIR_REAL/std/src/thread/mod.rs:LL:COL + | +LL | pub fn join(self) -> Result { + | ^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0507`.