diff options
Diffstat (limited to 'tests/ui/rust-2018')
8 files changed, 144 insertions, 8 deletions
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs index 0b3de0df2..d2254acb3 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs @@ -365,4 +365,24 @@ mod unions { } } +// https://github.com/rust-lang/rust/issues/106870 +mod multiple_predicates_with_same_span { + macro_rules! m { + ($($name:ident)+) => { + struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); + //~^ ERROR: outlives requirements can be inferred + struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; + //~^ ERROR: outlives requirements can be inferred + struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; + //~^ ERROR: outlives requirements can be inferred + struct Interleaved<'a, $($name,)+>(&'a ($($name,)+)) + where + (): Sized, + $($name: 'a, $name: 'a, )+ //~ ERROR: outlives requirements can be inferred + $($name: 'a, $name: 'a, )+; + } + } + m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); +} + fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index 251d74094..f5ec287d2 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -819,5 +819,61 @@ LL - union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: LL + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { | -error: aborting due to 68 previous errors +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:372:38 + | +LL | struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); + | ^^^^ help: remove these bounds +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:374:64 + | +LL | struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; + | ^^^^^^^^^^^^^^^^^^ help: remove these bounds +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:376:86 + | +LL | struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; + | ^^^^^^^^^ help: remove these bounds +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:381:19 + | +LL | $($name: 'a, $name: 'a, )+ + | ^^^^^^^^^ ^^^^^^^^^ +LL | $($name: 'a, $name: 'a, )+; + | ^^^^^^^^^ ^^^^^^^^^ +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- + | | + | in this macro invocation + | in this macro invocation + | in this macro invocation + | in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these bounds + | +LL ~ $(, , )+ +LL ~ $(, , )+; + | + +error: aborting due to 72 previous errors diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed index 13645244d..868bdf2e0 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed @@ -791,5 +791,14 @@ struct StaticRef<T: 'static> { field: &'static T } +struct TrailingCommaInWhereClause<'a, T, U> +where + T: 'a, + + //~^ ERROR outlives requirements can be inferred +{ + tee: T, + yoo: &'a U +} fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.rs b/tests/ui/rust-2018/edition-lint-infer-outlives.rs index d9486ba66..75783764a 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.rs +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.rs @@ -791,5 +791,14 @@ struct StaticRef<T: 'static> { field: &'static T } +struct TrailingCommaInWhereClause<'a, T, U> +where + T: 'a, + U: 'a, + //~^ ERROR outlives requirements can be inferred +{ + tee: T, + yoo: &'a U +} fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr index faa9f21e3..e655fb484 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr @@ -1,8 +1,8 @@ error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:26:31 + --> $DIR/edition-lint-infer-outlives.rs:797:5 | -LL | struct TeeOutlivesAy<'a, T: 'a> { - | ^^^^ help: remove this bound +LL | U: 'a, + | ^^^^^^ help: remove this bound | note: the lint level is defined here --> $DIR/edition-lint-infer-outlives.rs:4:9 @@ -11,6 +11,12 @@ LL | #![deny(explicit_outlives_requirements)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:26:31 + | +LL | struct TeeOutlivesAy<'a, T: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:31:40 | LL | struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { @@ -916,5 +922,5 @@ error: outlives requirements can be inferred LL | union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { | ^^^^^^^^ help: remove this bound -error: aborting due to 152 previous errors +error: aborting due to 153 previous errors diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed index 832632268..15e0ccc52 100644 --- a/tests/ui/rust-2018/remove-extern-crate.fixed +++ b/tests/ui/rust-2018/remove-extern-crate.fixed @@ -23,6 +23,7 @@ extern crate alloc; fn main() { another_name::mem::drop(3); another::foo(); + with_visibility::foo(); remove_extern_crate::foo!(); bar!(); alloc::vec![5]; @@ -37,3 +38,12 @@ mod another { remove_extern_crate::foo!(); } } + +mod with_visibility { + pub use core; //~ WARNING `extern crate` is not idiomatic + + pub fn foo() { + core::mem::drop(4); + remove_extern_crate::foo!(); + } +} diff --git a/tests/ui/rust-2018/remove-extern-crate.rs b/tests/ui/rust-2018/remove-extern-crate.rs index bbb84cd46..aec0bc7c3 100644 --- a/tests/ui/rust-2018/remove-extern-crate.rs +++ b/tests/ui/rust-2018/remove-extern-crate.rs @@ -23,6 +23,7 @@ extern crate alloc; fn main() { another_name::mem::drop(3); another::foo(); + with_visibility::foo(); remove_extern_crate::foo!(); bar!(); alloc::vec![5]; @@ -37,3 +38,12 @@ mod another { remove_extern_crate::foo!(); } } + +mod with_visibility { + pub extern crate core; //~ WARNING `extern crate` is not idiomatic + + pub fn foo() { + core::mem::drop(4); + remove_extern_crate::foo!(); + } +} diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr index bde4c1808..d07358e47 100644 --- a/tests/ui/rust-2018/remove-extern-crate.stderr +++ b/tests/ui/rust-2018/remove-extern-crate.stderr @@ -12,10 +12,26 @@ LL | #![warn(rust_2018_idioms)] = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` warning: `extern crate` is not idiomatic in the new edition - --> $DIR/remove-extern-crate.rs:32:5 + --> $DIR/remove-extern-crate.rs:33:5 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + | ^^^^^^^^^^^^^^^^^^ + | +help: convert it to a `use` + | +LL | use core; + | ~~~ + +warning: `extern crate` is not idiomatic in the new edition + --> $DIR/remove-extern-crate.rs:43:5 + | +LL | pub extern crate core; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: convert it to a `use` + | +LL | pub use core; + | ~~~ -warning: 2 warnings emitted +warning: 3 warnings emitted |