diff options
| author | bors <bors@rust-lang.org> | 2020-01-04 18:39:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-04 18:39:14 +0000 |
| commit | 760ce94c69ca510d44087291c311296f6d9ccdf5 (patch) | |
| tree | a1268072a6fad12c2758f30c8409adb3ea087c20 /src/test | |
| parent | cd8377d37e9bc47f9a5a982c41705a7800cbb51d (diff) | |
| parent | 0bbe11089ccdb575d3f7d5a6c83eb3d2810eef29 (diff) | |
Auto merge of #67874 - Dylan-DPC:rollup-xy6bkoe, r=Dylan-DPC
Rollup of 4 pull requests Successful merges: - #67137 (libstd uses `core::panic::Location` where possible.) - #67709 (Introduce an option for disabling deduplication of diagnostics) - #67775 (Make "use $crate" a hard error) - #67812 (Tweak and extend internal BTreeMap documentation, including debug asserts.) Failed merges: r? @ghost
Diffstat (limited to 'src/test')
13 files changed, 71 insertions, 29 deletions
diff --git a/src/test/mir-opt/retain-never-const.rs b/src/test/mir-opt/retain-never-const.rs index 04394dcdf13..8e9bae8569f 100644 --- a/src/test/mir-opt/retain-never-const.rs +++ b/src/test/mir-opt/retain-never-const.rs @@ -6,6 +6,7 @@ #![feature(const_panic)] #![feature(never_type)] +#![warn(const_err)] struct PrintName<T>(T); diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr index 2212b7d75d2..3493b7c54c4 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr @@ -10,7 +10,7 @@ error: internal compiler error: mutable allocation in constant LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:345:17 +thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:347:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. error: internal compiler error: unexpected panic diff --git a/src/test/ui/deduplicate-diagnostics.deduplicate.stderr b/src/test/ui/deduplicate-diagnostics.deduplicate.stderr new file mode 100644 index 00000000000..1acfce50622 --- /dev/null +++ b/src/test/ui/deduplicate-diagnostics.deduplicate.stderr @@ -0,0 +1,8 @@ +error: cannot find derive macro `Unresolved` in this scope + --> $DIR/deduplicate-diagnostics.rs:4:10 + | +LL | #[derive(Unresolved)] + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/deduplicate-diagnostics.duplicate.stderr b/src/test/ui/deduplicate-diagnostics.duplicate.stderr new file mode 100644 index 00000000000..325da3b5d91 --- /dev/null +++ b/src/test/ui/deduplicate-diagnostics.duplicate.stderr @@ -0,0 +1,14 @@ +error: cannot find derive macro `Unresolved` in this scope + --> $DIR/deduplicate-diagnostics.rs:4:10 + | +LL | #[derive(Unresolved)] + | ^^^^^^^^^^ + +error: cannot find derive macro `Unresolved` in this scope + --> $DIR/deduplicate-diagnostics.rs:4:10 + | +LL | #[derive(Unresolved)] + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/deduplicate-diagnostics.rs b/src/test/ui/deduplicate-diagnostics.rs new file mode 100644 index 00000000000..4a1f503d757 --- /dev/null +++ b/src/test/ui/deduplicate-diagnostics.rs @@ -0,0 +1,8 @@ +// revisions: duplicate deduplicate +//[duplicate] compile-flags: -Z deduplicate-diagnostics=no + +#[derive(Unresolved)] //~ ERROR cannot find derive macro `Unresolved` in this scope + //[duplicate]~| ERROR cannot find derive macro `Unresolved` in this scope +struct S; + +fn main() {} diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs index 6deaeb81179..d625163dc7e 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs @@ -6,10 +6,9 @@ macro_rules! m { struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate` } - use $crate; // OK - //~^ WARN `$crate` may not be imported + use $crate; //~ ERROR `$crate` may not be imported use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` - //~^ WARN `$crate` may not be imported + //~^ ERROR `$crate` may not be imported } } diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr index 5d4f39086ce..f5a5f13f912 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr @@ -8,7 +8,7 @@ LL | m!(); | ----- in this macro invocation error: expected identifier, found reserved identifier `$crate` - --> $DIR/dollar-crate-is-keyword.rs:11:23 + --> $DIR/dollar-crate-is-keyword.rs:10:23 | LL | use $crate as $crate; | ^^^^^^ expected identifier, found reserved identifier @@ -16,27 +16,23 @@ LL | use $crate as $crate; LL | m!(); | ----- in this macro invocation -warning: `$crate` may not be imported +error: `$crate` may not be imported --> $DIR/dollar-crate-is-keyword.rs:9:9 | -LL | use $crate; // OK +LL | use $crate; | ^^^^^^^^^^^ ... LL | m!(); | ----- in this macro invocation - | - = note: `use $crate;` was erroneously allowed and will become a hard error in a future release -warning: `$crate` may not be imported - --> $DIR/dollar-crate-is-keyword.rs:11:9 +error: `$crate` may not be imported + --> $DIR/dollar-crate-is-keyword.rs:10:9 | LL | use $crate as $crate; | ^^^^^^^^^^^^^^^^^^^^^ ... LL | m!(); | ----- in this macro invocation - | - = note: `use $crate;` was erroneously allowed and will become a hard error in a future release -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors diff --git a/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs b/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs index 8727c9d1ca6..74c6e501c91 100644 --- a/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs +++ b/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs @@ -22,7 +22,7 @@ //[thin]compile-flags: -C lto=thin //[fat]compile-flags: -C lto=fat -#![feature(core_panic, panic_internals)] +#![feature(core_panic)] // (For some reason, reproducing the LTO issue requires pulling in std // explicitly this way.) @@ -50,9 +50,7 @@ fn main() { } let _guard = Droppable; - let s = "issue-64655-allow-unwind-when-calling-panic-directly.rs"; - let location = core::panic::Location::internal_constructor(s, 17, 4); - core::panicking::panic("???", &location); + core::panicking::panic("???"); }); let wait = handle.join(); diff --git a/src/test/ui/imports/import-crate-var.rs b/src/test/ui/imports/import-crate-var.rs index b9d146d3735..aac5a15d3e6 100644 --- a/src/test/ui/imports/import-crate-var.rs +++ b/src/test/ui/imports/import-crate-var.rs @@ -1,10 +1,8 @@ -// check-pass // aux-build:import_crate_var.rs #[macro_use] extern crate import_crate_var; fn main() { m!(); - //~^ WARN `$crate` may not be imported - //~| NOTE `use $crate;` was erroneously allowed and will become a hard error + //~^ ERROR `$crate` may not be imported } diff --git a/src/test/ui/imports/import-crate-var.stderr b/src/test/ui/imports/import-crate-var.stderr index 2f8c845156a..85f15ad4648 100644 --- a/src/test/ui/imports/import-crate-var.stderr +++ b/src/test/ui/imports/import-crate-var.stderr @@ -1,9 +1,10 @@ -warning: `$crate` may not be imported - --> $DIR/import-crate-var.rs:7:5 +error: `$crate` may not be imported + --> $DIR/import-crate-var.rs:6:5 | LL | m!(); | ^^^^^ | - = note: `use $crate;` was erroneously allowed and will become a hard error in a future release - = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to previous error diff --git a/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs b/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs index 0a79aea376f..090e912c1d0 100644 --- a/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs +++ b/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs @@ -4,16 +4,16 @@ #[inline(never)] #[track_caller] -fn defeat_const_prop() -> &'static core::panic::Location<'static> { +fn codegen_caller_loc() -> &'static core::panic::Location<'static> { core::panic::Location::caller() } macro_rules! caller_location_from_macro { - () => (defeat_const_prop()); + () => (codegen_caller_loc()); } fn main() { - let loc = defeat_const_prop(); + let loc = codegen_caller_loc(); assert_eq!(loc.file(), file!()); assert_eq!(loc.line(), 16); assert_eq!(loc.column(), 15); diff --git a/src/test/ui/rfc-2091-track-caller/diverging-caller-location.rs b/src/test/ui/rfc-2091-track-caller/diverging-caller-location.rs new file mode 100644 index 00000000000..1fb75ef35ff --- /dev/null +++ b/src/test/ui/rfc-2091-track-caller/diverging-caller-location.rs @@ -0,0 +1,19 @@ +// run-fail + +//! This test ensures that `#[track_caller]` can be applied directly to diverging functions, as +//! the tracking issue says: https://github.com/rust-lang/rust/issues/47809#issue-292138490. +//! Because the annotated function must diverge and a panic keeps that faster than an infinite loop, +//! we don't inspect the location returned -- it would be difficult to distinguish between the +//! explicit panic and a failed assertion. That it compiles and runs is enough for this one. + +#![feature(track_caller)] + +#[track_caller] +fn doesnt_return() -> ! { + let _location = core::panic::Location::caller(); + panic!("huzzah"); +} + +fn main() { + doesnt_return(); +} diff --git a/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs b/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs index 8436ee510a5..76a380ed3e3 100644 --- a/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs +++ b/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(const_fn, track_caller)] +#![feature(track_caller)] use std::panic::Location; |
