From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/rust-2018/async-ident-allowed.rs | 11 + tests/ui/rust-2018/async-ident-allowed.stderr | 17 + tests/ui/rust-2018/async-ident.fixed | 79 ++ tests/ui/rust-2018/async-ident.rs | 79 ++ tests/ui/rust-2018/async-ident.stderr | 142 ++++ tests/ui/rust-2018/auxiliary/baz.rs | 5 + .../auxiliary/edition-lint-infer-outlives-macro.rs | 6 + tests/ui/rust-2018/auxiliary/edition-lint-paths.rs | 12 + .../auxiliary/macro-use-warned-against.rs | 2 + .../auxiliary/macro-use-warned-against2.rs | 1 + .../ui/rust-2018/auxiliary/remove-extern-crate.rs | 9 + .../auxiliary/suggestions-not-always-applicable.rs | 13 + .../auxiliary/trait-import-suggestions.rs | 5 + tests/ui/rust-2018/dyn-keyword.fixed | 10 + tests/ui/rust-2018/dyn-keyword.rs | 10 + tests/ui/rust-2018/dyn-keyword.stderr | 16 + tests/ui/rust-2018/dyn-trait-compatibility.rs | 8 + tests/ui/rust-2018/dyn-trait-compatibility.stderr | 19 + .../edition-lint-fully-qualified-paths.fixed | 26 + .../edition-lint-fully-qualified-paths.rs | 26 + .../edition-lint-fully-qualified-paths.stderr | 25 + .../edition-lint-infer-outlives-macro.fixed | 137 +++ .../rust-2018/edition-lint-infer-outlives-macro.rs | 137 +++ .../edition-lint-infer-outlives-macro.stderr | 110 +++ .../edition-lint-infer-outlives-multispan.rs | 368 +++++++++ .../edition-lint-infer-outlives-multispan.stderr | 823 ++++++++++++++++++ .../ui/rust-2018/edition-lint-infer-outlives.fixed | 795 ++++++++++++++++++ tests/ui/rust-2018/edition-lint-infer-outlives.rs | 795 ++++++++++++++++++ .../rust-2018/edition-lint-infer-outlives.stderr | 920 +++++++++++++++++++++ .../edition-lint-nested-empty-paths.fixed | 34 + .../rust-2018/edition-lint-nested-empty-paths.rs | 34 + .../edition-lint-nested-empty-paths.stderr | 52 ++ tests/ui/rust-2018/edition-lint-nested-paths.fixed | 31 + tests/ui/rust-2018/edition-lint-nested-paths.rs | 31 + .../ui/rust-2018/edition-lint-nested-paths.stderr | 43 + tests/ui/rust-2018/edition-lint-paths-2018.rs | 10 + tests/ui/rust-2018/edition-lint-paths.fixed | 77 ++ tests/ui/rust-2018/edition-lint-paths.rs | 77 ++ tests/ui/rust-2018/edition-lint-paths.stderr | 88 ++ .../rust-2018/edition-lint-uninferable-outlives.rs | 30 + .../rust-2018/extern-crate-idiomatic-in-2018.fixed | 28 + .../ui/rust-2018/extern-crate-idiomatic-in-2018.rs | 28 + .../extern-crate-idiomatic-in-2018.stderr | 15 + tests/ui/rust-2018/extern-crate-idiomatic.fixed | 18 + tests/ui/rust-2018/extern-crate-idiomatic.rs | 18 + .../extern-crate-referenced-by-self-path.fixed | 17 + .../extern-crate-referenced-by-self-path.rs | 17 + tests/ui/rust-2018/extern-crate-rename.fixed | 18 + tests/ui/rust-2018/extern-crate-rename.rs | 18 + tests/ui/rust-2018/extern-crate-rename.stderr | 16 + tests/ui/rust-2018/extern-crate-submod.fixed | 25 + tests/ui/rust-2018/extern-crate-submod.rs | 25 + tests/ui/rust-2018/extern-crate-submod.stderr | 16 + tests/ui/rust-2018/future-proofing-locals.rs | 50 ++ tests/ui/rust-2018/future-proofing-locals.stderr | 56 ++ tests/ui/rust-2018/issue-51008-1.rs | 15 + tests/ui/rust-2018/issue-51008.rs | 15 + tests/ui/rust-2018/issue-52202-use-suggestions.rs | 13 + .../rust-2018/issue-52202-use-suggestions.stderr | 21 + tests/ui/rust-2018/issue-54006.rs | 13 + tests/ui/rust-2018/issue-54006.stderr | 17 + ...issue-54400-unused-extern-crate-attr-span.fixed | 14 + .../issue-54400-unused-extern-crate-attr-span.rs | 15 + ...ssue-54400-unused-extern-crate-attr-span.stderr | 18 + tests/ui/rust-2018/local-path-suggestions-2015.rs | 26 + .../rust-2018/local-path-suggestions-2015.stderr | 12 + tests/ui/rust-2018/local-path-suggestions-2018.rs | 21 + .../rust-2018/local-path-suggestions-2018.stderr | 17 + tests/ui/rust-2018/macro-use-warned-against.rs | 14 + tests/ui/rust-2018/macro-use-warned-against.stderr | 27 + tests/ui/rust-2018/proc-macro-crate-in-paths.rs | 16 + tests/ui/rust-2018/remove-extern-crate.fixed | 39 + tests/ui/rust-2018/remove-extern-crate.rs | 39 + tests/ui/rust-2018/remove-extern-crate.stderr | 21 + .../suggestions-not-always-applicable.fixed | 23 + .../rust-2018/suggestions-not-always-applicable.rs | 23 + tests/ui/rust-2018/trait-import-suggestions.rs | 31 + tests/ui/rust-2018/trait-import-suggestions.stderr | 55 ++ tests/ui/rust-2018/try-ident.fixed | 15 + tests/ui/rust-2018/try-ident.rs | 15 + tests/ui/rust-2018/try-ident.stderr | 26 + tests/ui/rust-2018/try-macro.fixed | 18 + tests/ui/rust-2018/try-macro.rs | 18 + tests/ui/rust-2018/try-macro.stderr | 17 + .../uniform-paths/ambiguity-macros-nested.rs | 21 + .../uniform-paths/ambiguity-macros-nested.stderr | 25 + .../ui/rust-2018/uniform-paths/ambiguity-macros.rs | 19 + .../uniform-paths/ambiguity-macros.stderr | 25 + .../ui/rust-2018/uniform-paths/ambiguity-nested.rs | 16 + .../uniform-paths/ambiguity-nested.stderr | 21 + tests/ui/rust-2018/uniform-paths/ambiguity.rs | 12 + tests/ui/rust-2018/uniform-paths/ambiguity.stderr | 21 + .../uniform-paths/auxiliary/cross-crate.rs | 5 + .../auxiliary/issue-55779-extern-trait.rs | 1 + .../uniform-paths/auxiliary/issue-56596-2.rs | 1 + .../uniform-paths/auxiliary/issue-56596.rs | 1 + .../uniform-paths/auxiliary/issue-87932-a.rs | 3 + .../uniform-paths/block-scoped-shadow-nested.rs | 20 + .../block-scoped-shadow-nested.stderr | 24 + .../rust-2018/uniform-paths/block-scoped-shadow.rs | 21 + .../uniform-paths/block-scoped-shadow.stderr | 60 ++ tests/ui/rust-2018/uniform-paths/cross-crate.rs | 12 + .../ui/rust-2018/uniform-paths/cross-crate.stderr | 38 + tests/ui/rust-2018/uniform-paths/deadlock.rs | 8 + tests/ui/rust-2018/uniform-paths/deadlock.stderr | 24 + tests/ui/rust-2018/uniform-paths/fn-local-enum.rs | 13 + .../ui/rust-2018/uniform-paths/from-decl-macro.rs | 12 + tests/ui/rust-2018/uniform-paths/issue-54253.rs | 17 + .../ui/rust-2018/uniform-paths/issue-54253.stderr | 9 + tests/ui/rust-2018/uniform-paths/issue-55779.rs | 29 + tests/ui/rust-2018/uniform-paths/issue-56596-2.rs | 11 + tests/ui/rust-2018/uniform-paths/issue-56596.rs | 12 + .../ui/rust-2018/uniform-paths/issue-56596.stderr | 19 + tests/ui/rust-2018/uniform-paths/issue-87932.rs | 15 + .../ui/rust-2018/uniform-paths/issue-87932.stderr | 18 + tests/ui/rust-2018/uniform-paths/macro-rules.rs | 43 + .../ui/rust-2018/uniform-paths/macro-rules.stderr | 35 + tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs | 21 + .../rust-2018/uniform-paths/prelude-fail-2.stderr | 68 ++ tests/ui/rust-2018/uniform-paths/prelude-fail.rs | 6 + .../ui/rust-2018/uniform-paths/prelude-fail.stderr | 9 + tests/ui/rust-2018/uniform-paths/prelude.rs | 22 + tests/ui/rust-2018/uniform-paths/redundant.rs | 20 + tests/ui/rust-2018/unresolved-asterisk-imports.rs | 6 + .../rust-2018/unresolved-asterisk-imports.stderr | 9 + 125 files changed, 6864 insertions(+) create mode 100644 tests/ui/rust-2018/async-ident-allowed.rs create mode 100644 tests/ui/rust-2018/async-ident-allowed.stderr create mode 100644 tests/ui/rust-2018/async-ident.fixed create mode 100644 tests/ui/rust-2018/async-ident.rs create mode 100644 tests/ui/rust-2018/async-ident.stderr create mode 100644 tests/ui/rust-2018/auxiliary/baz.rs create mode 100644 tests/ui/rust-2018/auxiliary/edition-lint-infer-outlives-macro.rs create mode 100644 tests/ui/rust-2018/auxiliary/edition-lint-paths.rs create mode 100644 tests/ui/rust-2018/auxiliary/macro-use-warned-against.rs create mode 100644 tests/ui/rust-2018/auxiliary/macro-use-warned-against2.rs create mode 100644 tests/ui/rust-2018/auxiliary/remove-extern-crate.rs create mode 100644 tests/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs create mode 100644 tests/ui/rust-2018/auxiliary/trait-import-suggestions.rs create mode 100644 tests/ui/rust-2018/dyn-keyword.fixed create mode 100644 tests/ui/rust-2018/dyn-keyword.rs create mode 100644 tests/ui/rust-2018/dyn-keyword.stderr create mode 100644 tests/ui/rust-2018/dyn-trait-compatibility.rs create mode 100644 tests/ui/rust-2018/dyn-trait-compatibility.stderr create mode 100644 tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed create mode 100644 tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs create mode 100644 tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives.fixed create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives.rs create mode 100644 tests/ui/rust-2018/edition-lint-infer-outlives.stderr create mode 100644 tests/ui/rust-2018/edition-lint-nested-empty-paths.fixed create mode 100644 tests/ui/rust-2018/edition-lint-nested-empty-paths.rs create mode 100644 tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr create mode 100644 tests/ui/rust-2018/edition-lint-nested-paths.fixed create mode 100644 tests/ui/rust-2018/edition-lint-nested-paths.rs create mode 100644 tests/ui/rust-2018/edition-lint-nested-paths.stderr create mode 100644 tests/ui/rust-2018/edition-lint-paths-2018.rs create mode 100644 tests/ui/rust-2018/edition-lint-paths.fixed create mode 100644 tests/ui/rust-2018/edition-lint-paths.rs create mode 100644 tests/ui/rust-2018/edition-lint-paths.stderr create mode 100644 tests/ui/rust-2018/edition-lint-uninferable-outlives.rs create mode 100644 tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed create mode 100644 tests/ui/rust-2018/extern-crate-idiomatic-in-2018.rs create mode 100644 tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr create mode 100644 tests/ui/rust-2018/extern-crate-idiomatic.fixed create mode 100644 tests/ui/rust-2018/extern-crate-idiomatic.rs create mode 100644 tests/ui/rust-2018/extern-crate-referenced-by-self-path.fixed create mode 100644 tests/ui/rust-2018/extern-crate-referenced-by-self-path.rs create mode 100644 tests/ui/rust-2018/extern-crate-rename.fixed create mode 100644 tests/ui/rust-2018/extern-crate-rename.rs create mode 100644 tests/ui/rust-2018/extern-crate-rename.stderr create mode 100644 tests/ui/rust-2018/extern-crate-submod.fixed create mode 100644 tests/ui/rust-2018/extern-crate-submod.rs create mode 100644 tests/ui/rust-2018/extern-crate-submod.stderr create mode 100644 tests/ui/rust-2018/future-proofing-locals.rs create mode 100644 tests/ui/rust-2018/future-proofing-locals.stderr create mode 100644 tests/ui/rust-2018/issue-51008-1.rs create mode 100644 tests/ui/rust-2018/issue-51008.rs create mode 100644 tests/ui/rust-2018/issue-52202-use-suggestions.rs create mode 100644 tests/ui/rust-2018/issue-52202-use-suggestions.stderr create mode 100644 tests/ui/rust-2018/issue-54006.rs create mode 100644 tests/ui/rust-2018/issue-54006.stderr create mode 100644 tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed create mode 100644 tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs create mode 100644 tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr create mode 100644 tests/ui/rust-2018/local-path-suggestions-2015.rs create mode 100644 tests/ui/rust-2018/local-path-suggestions-2015.stderr create mode 100644 tests/ui/rust-2018/local-path-suggestions-2018.rs create mode 100644 tests/ui/rust-2018/local-path-suggestions-2018.stderr create mode 100644 tests/ui/rust-2018/macro-use-warned-against.rs create mode 100644 tests/ui/rust-2018/macro-use-warned-against.stderr create mode 100644 tests/ui/rust-2018/proc-macro-crate-in-paths.rs create mode 100644 tests/ui/rust-2018/remove-extern-crate.fixed create mode 100644 tests/ui/rust-2018/remove-extern-crate.rs create mode 100644 tests/ui/rust-2018/remove-extern-crate.stderr create mode 100644 tests/ui/rust-2018/suggestions-not-always-applicable.fixed create mode 100644 tests/ui/rust-2018/suggestions-not-always-applicable.rs create mode 100644 tests/ui/rust-2018/trait-import-suggestions.rs create mode 100644 tests/ui/rust-2018/trait-import-suggestions.stderr create mode 100644 tests/ui/rust-2018/try-ident.fixed create mode 100644 tests/ui/rust-2018/try-ident.rs create mode 100644 tests/ui/rust-2018/try-ident.stderr create mode 100644 tests/ui/rust-2018/try-macro.fixed create mode 100644 tests/ui/rust-2018/try-macro.rs create mode 100644 tests/ui/rust-2018/try-macro.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity.rs create mode 100644 tests/ui/rust-2018/uniform-paths/ambiguity.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs create mode 100644 tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs create mode 100644 tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs create mode 100644 tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs create mode 100644 tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs create mode 100644 tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs create mode 100644 tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs create mode 100644 tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/cross-crate.rs create mode 100644 tests/ui/rust-2018/uniform-paths/cross-crate.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/deadlock.rs create mode 100644 tests/ui/rust-2018/uniform-paths/deadlock.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/fn-local-enum.rs create mode 100644 tests/ui/rust-2018/uniform-paths/from-decl-macro.rs create mode 100644 tests/ui/rust-2018/uniform-paths/issue-54253.rs create mode 100644 tests/ui/rust-2018/uniform-paths/issue-54253.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/issue-55779.rs create mode 100644 tests/ui/rust-2018/uniform-paths/issue-56596-2.rs create mode 100644 tests/ui/rust-2018/uniform-paths/issue-56596.rs create mode 100644 tests/ui/rust-2018/uniform-paths/issue-56596.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/issue-87932.rs create mode 100644 tests/ui/rust-2018/uniform-paths/issue-87932.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/macro-rules.rs create mode 100644 tests/ui/rust-2018/uniform-paths/macro-rules.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs create mode 100644 tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/prelude-fail.rs create mode 100644 tests/ui/rust-2018/uniform-paths/prelude-fail.stderr create mode 100644 tests/ui/rust-2018/uniform-paths/prelude.rs create mode 100644 tests/ui/rust-2018/uniform-paths/redundant.rs create mode 100644 tests/ui/rust-2018/unresolved-asterisk-imports.rs create mode 100644 tests/ui/rust-2018/unresolved-asterisk-imports.stderr (limited to 'tests/ui/rust-2018') diff --git a/tests/ui/rust-2018/async-ident-allowed.rs b/tests/ui/rust-2018/async-ident-allowed.rs new file mode 100644 index 000000000..8efcfbb70 --- /dev/null +++ b/tests/ui/rust-2018/async-ident-allowed.rs @@ -0,0 +1,11 @@ +// edition:2015 + +#![deny(rust_2018_compatibility)] + +// Don't make a suggestion for a raw identifier replacement unless raw +// identifiers are enabled. + +fn main() { + let async = 3; //~ ERROR: is a keyword + //~^ WARN this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/async-ident-allowed.stderr b/tests/ui/rust-2018/async-ident-allowed.stderr new file mode 100644 index 000000000..992b29750 --- /dev/null +++ b/tests/ui/rust-2018/async-ident-allowed.stderr @@ -0,0 +1,17 @@ +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident-allowed.rs:9:9 + | +LL | let async = 3; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 +note: the lint level is defined here + --> $DIR/async-ident-allowed.rs:3:9 + | +LL | #![deny(rust_2018_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[deny(keyword_idents)]` implied by `#[deny(rust_2018_compatibility)]` + +error: aborting due to previous error + diff --git a/tests/ui/rust-2018/async-ident.fixed b/tests/ui/rust-2018/async-ident.fixed new file mode 100644 index 000000000..e909c7907 --- /dev/null +++ b/tests/ui/rust-2018/async-ident.fixed @@ -0,0 +1,79 @@ +#![allow(dead_code, unused_variables, unused_macro_rules, bad_style)] +#![deny(keyword_idents)] + +// edition:2015 +// run-rustfix + +fn r#async() {} //~ ERROR async +//~^ WARN this is accepted in the current edition + +macro_rules! foo { + ($foo:ident) => {}; + ($r#async:expr, r#async) => {}; + //~^ ERROR async + //~| ERROR async + //~| WARN this is accepted in the current edition + //~| WARN this is accepted in the current edition +} + +foo!(r#async); + //~^ ERROR async + //~| WARN this is accepted in the current edition + +mod dont_lint_raw { + fn r#async() {} +} + +mod async_trait { + trait r#async {} + //~^ ERROR async + //~| WARN this is accepted in the current edition + struct MyStruct; + impl r#async for MyStruct {} + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +mod async_static { + static r#async: u32 = 0; + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +mod async_const { + const r#async: u32 = 0; + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +struct Foo; +impl Foo { fn r#async() {} } + //~^ ERROR async + //~| WARN this is accepted in the current edition + +fn main() { + struct r#async {} + //~^ ERROR async + //~| WARN this is accepted in the current edition + let r#async: r#async = r#async {}; + //~^ ERROR async + //~| WARN this is accepted in the current edition + //~| ERROR async + //~| WARN this is accepted in the current edition + //~| ERROR async + //~| WARN this is accepted in the current edition +} + +#[macro_export] +macro_rules! produces_async { + () => (pub fn r#async() {}) + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +#[macro_export] +macro_rules! consumes_async { + (r#async) => (1) + //~^ ERROR async + //~| WARN this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/async-ident.rs b/tests/ui/rust-2018/async-ident.rs new file mode 100644 index 000000000..2bfbc3871 --- /dev/null +++ b/tests/ui/rust-2018/async-ident.rs @@ -0,0 +1,79 @@ +#![allow(dead_code, unused_variables, unused_macro_rules, bad_style)] +#![deny(keyword_idents)] + +// edition:2015 +// run-rustfix + +fn async() {} //~ ERROR async +//~^ WARN this is accepted in the current edition + +macro_rules! foo { + ($foo:ident) => {}; + ($async:expr, async) => {}; + //~^ ERROR async + //~| ERROR async + //~| WARN this is accepted in the current edition + //~| WARN this is accepted in the current edition +} + +foo!(async); + //~^ ERROR async + //~| WARN this is accepted in the current edition + +mod dont_lint_raw { + fn r#async() {} +} + +mod async_trait { + trait async {} + //~^ ERROR async + //~| WARN this is accepted in the current edition + struct MyStruct; + impl async for MyStruct {} + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +mod async_static { + static async: u32 = 0; + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +mod async_const { + const async: u32 = 0; + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +struct Foo; +impl Foo { fn async() {} } + //~^ ERROR async + //~| WARN this is accepted in the current edition + +fn main() { + struct async {} + //~^ ERROR async + //~| WARN this is accepted in the current edition + let async: async = async {}; + //~^ ERROR async + //~| WARN this is accepted in the current edition + //~| ERROR async + //~| WARN this is accepted in the current edition + //~| ERROR async + //~| WARN this is accepted in the current edition +} + +#[macro_export] +macro_rules! produces_async { + () => (pub fn async() {}) + //~^ ERROR async + //~| WARN this is accepted in the current edition +} + +#[macro_export] +macro_rules! consumes_async { + (async) => (1) + //~^ ERROR async + //~| WARN this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/async-ident.stderr b/tests/ui/rust-2018/async-ident.stderr new file mode 100644 index 000000000..d15250c54 --- /dev/null +++ b/tests/ui/rust-2018/async-ident.stderr @@ -0,0 +1,142 @@ +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:7:4 + | +LL | fn async() {} + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 +note: the lint level is defined here + --> $DIR/async-ident.rs:2:9 + | +LL | #![deny(keyword_idents)] + | ^^^^^^^^^^^^^^ + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:12:7 + | +LL | ($async:expr, async) => {}; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:12:19 + | +LL | ($async:expr, async) => {}; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:19:6 + | +LL | foo!(async); + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:28:11 + | +LL | trait async {} + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:32:10 + | +LL | impl async for MyStruct {} + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:38:12 + | +LL | static async: u32 = 0; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:44:11 + | +LL | const async: u32 = 0; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:50:15 + | +LL | impl Foo { fn async() {} } + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:55:12 + | +LL | struct async {} + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:58:9 + | +LL | let async: async = async {}; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:58:16 + | +LL | let async: async = async {}; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:58:24 + | +LL | let async: async = async {}; + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:69:19 + | +LL | () => (pub fn async() {}) + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: `async` is a keyword in the 2018 edition + --> $DIR/async-ident.rs:76:6 + | +LL | (async) => (1) + | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +error: aborting due to 15 previous errors + diff --git a/tests/ui/rust-2018/auxiliary/baz.rs b/tests/ui/rust-2018/auxiliary/baz.rs new file mode 100644 index 000000000..b317c8a45 --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/baz.rs @@ -0,0 +1,5 @@ +// This file is used as part of the local-path-suggestions.rs test. + +pub mod foobar { + pub struct Baz; +} diff --git a/tests/ui/rust-2018/auxiliary/edition-lint-infer-outlives-macro.rs b/tests/ui/rust-2018/auxiliary/edition-lint-infer-outlives-macro.rs new file mode 100644 index 000000000..d45fa10f0 --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/edition-lint-infer-outlives-macro.rs @@ -0,0 +1,6 @@ +pub fn foo() {} + +#[macro_export] +macro_rules! gimme_a { + ($($mac:tt)*) => { $($mac)* { 'a } } +} diff --git a/tests/ui/rust-2018/auxiliary/edition-lint-paths.rs b/tests/ui/rust-2018/auxiliary/edition-lint-paths.rs new file mode 100644 index 000000000..dd22df89e --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/edition-lint-paths.rs @@ -0,0 +1,12 @@ +pub fn foo() {} + +#[macro_export] +macro_rules! macro_2015 { + () => { + use edition_lint_paths as other_name; + use edition_lint_paths::foo as other_foo; + fn check_macro_2015() { + ::edition_lint_paths::foo(); + } + } +} diff --git a/tests/ui/rust-2018/auxiliary/macro-use-warned-against.rs b/tests/ui/rust-2018/auxiliary/macro-use-warned-against.rs new file mode 100644 index 000000000..b497c74e6 --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/macro-use-warned-against.rs @@ -0,0 +1,2 @@ +#[macro_export] +macro_rules! foo { () => () } diff --git a/tests/ui/rust-2018/auxiliary/macro-use-warned-against2.rs b/tests/ui/rust-2018/auxiliary/macro-use-warned-against2.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/macro-use-warned-against2.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/ui/rust-2018/auxiliary/remove-extern-crate.rs b/tests/ui/rust-2018/auxiliary/remove-extern-crate.rs new file mode 100644 index 000000000..890af683a --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/remove-extern-crate.rs @@ -0,0 +1,9 @@ +#[macro_export] +macro_rules! foo { + () => () +} + +#[macro_export] +macro_rules! bar { + () => () +} diff --git a/tests/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs b/tests/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs new file mode 100644 index 000000000..7472443dc --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn foo(_attr: TokenStream, _f: TokenStream) -> TokenStream { + "pub fn foo() -> ::Foo { ::Foo }".parse().unwrap() +} diff --git a/tests/ui/rust-2018/auxiliary/trait-import-suggestions.rs b/tests/ui/rust-2018/auxiliary/trait-import-suggestions.rs new file mode 100644 index 000000000..d356f3294 --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/trait-import-suggestions.rs @@ -0,0 +1,5 @@ +pub trait Baz { + fn baz(&self) { } +} + +impl Baz for u32 { } diff --git a/tests/ui/rust-2018/dyn-keyword.fixed b/tests/ui/rust-2018/dyn-keyword.fixed new file mode 100644 index 000000000..044824cbb --- /dev/null +++ b/tests/ui/rust-2018/dyn-keyword.fixed @@ -0,0 +1,10 @@ +// edition:2015 +// run-rustfix + +#![allow(unused_variables)] +#![deny(keyword_idents)] + +fn main() { + let r#dyn = (); //~ ERROR dyn + //~^ WARN this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/dyn-keyword.rs b/tests/ui/rust-2018/dyn-keyword.rs new file mode 100644 index 000000000..5989cfa1c --- /dev/null +++ b/tests/ui/rust-2018/dyn-keyword.rs @@ -0,0 +1,10 @@ +// edition:2015 +// run-rustfix + +#![allow(unused_variables)] +#![deny(keyword_idents)] + +fn main() { + let dyn = (); //~ ERROR dyn + //~^ WARN this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/dyn-keyword.stderr b/tests/ui/rust-2018/dyn-keyword.stderr new file mode 100644 index 000000000..b6f5b10cf --- /dev/null +++ b/tests/ui/rust-2018/dyn-keyword.stderr @@ -0,0 +1,16 @@ +error: `dyn` is a keyword in the 2018 edition + --> $DIR/dyn-keyword.rs:8:9 + | +LL | let dyn = (); + | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 +note: the lint level is defined here + --> $DIR/dyn-keyword.rs:5:9 + | +LL | #![deny(keyword_idents)] + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rust-2018/dyn-trait-compatibility.rs b/tests/ui/rust-2018/dyn-trait-compatibility.rs new file mode 100644 index 000000000..377c85fef --- /dev/null +++ b/tests/ui/rust-2018/dyn-trait-compatibility.rs @@ -0,0 +1,8 @@ +// edition:2018 + +type A0 = dyn; +type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn` +type A2 = dyn; //~ERROR expected identifier, found `<` +type A3 = dyn<::dyn>; + +fn main() {} diff --git a/tests/ui/rust-2018/dyn-trait-compatibility.stderr b/tests/ui/rust-2018/dyn-trait-compatibility.stderr new file mode 100644 index 000000000..cf4d6c19c --- /dev/null +++ b/tests/ui/rust-2018/dyn-trait-compatibility.stderr @@ -0,0 +1,19 @@ +error: expected identifier, found keyword `dyn` + --> $DIR/dyn-trait-compatibility.rs:4:16 + | +LL | type A1 = dyn::dyn; + | ^^^ expected identifier, found keyword + | +help: escape `dyn` to use it as an identifier + | +LL | type A1 = dyn::r#dyn; + | ++ + +error: expected identifier, found `<` + --> $DIR/dyn-trait-compatibility.rs:5:14 + | +LL | type A2 = dyn; + | ^ expected identifier + +error: aborting due to 2 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed new file mode 100644 index 000000000..85d106bc1 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.fixed @@ -0,0 +1,26 @@ +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +mod foo { + pub(crate) trait Foo { + type Bar; + } + + pub(crate) struct Baz {} + + impl Foo for Baz { + type Bar = (); + } +} + +fn main() { + let _: ::Bar = (); + //~^ ERROR absolute paths must start with + //~| this is accepted in the current edition + + let _: ::Bar = (); + //~^ ERROR absolute paths must start with + //~| this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs new file mode 100644 index 000000000..9ff3c2e5f --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.rs @@ -0,0 +1,26 @@ +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +mod foo { + pub(crate) trait Foo { + type Bar; + } + + pub(crate) struct Baz {} + + impl Foo for Baz { + type Bar = (); + } +} + +fn main() { + let _: ::Bar = (); + //~^ ERROR absolute paths must start with + //~| this is accepted in the current edition + + let _: <::foo::Baz as foo::Foo>::Bar = (); + //~^ ERROR absolute paths must start with + //~| this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr new file mode 100644 index 000000000..e1709db09 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr @@ -0,0 +1,25 @@ +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-fully-qualified-paths.rs:19:25 + | +LL | let _: ::Bar = (); + | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 +note: the lint level is defined here + --> $DIR/edition-lint-fully-qualified-paths.rs:4:9 + | +LL | #![deny(absolute_paths_not_starting_with_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-fully-qualified-paths.rs:23:13 + | +LL | let _: <::foo::Baz as foo::Foo>::Bar = (); + | ^^^^^^^^^^ help: use `crate`: `crate::foo::Baz` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: aborting due to 2 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed new file mode 100644 index 000000000..8cdb08e81 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed @@ -0,0 +1,137 @@ +// edition:2018 +// aux-build:edition-lint-infer-outlives-macro.rs +// run-rustfix + +#![deny(explicit_outlives_requirements)] +#![allow(dead_code)] + +#[macro_use] +extern crate edition_lint_infer_outlives_macro; + +// Test that the lint does not fire if the predicate is from the local crate, +// but all the bounds are from an external macro. +macro_rules! make_foo { + ($a:tt) => { + struct Foo<$a, 'b: $a> { + foo: &$a &'b (), + } + + struct FooWhere<$a, 'b> where 'b: $a { + foo: &$a &'b (), + } + } +} + +gimme_a! {make_foo!} + +struct Bar<'a, 'b> { + //~^ ERROR: outlives requirements can be inferred + bar: &'a &'b (), +} + +struct BarWhere<'a, 'b> { + //~^ ERROR: outlives requirements can be inferred + bar: &'a &'b (), +} + +// Test that the lint *does* fire if the predicate is contained in a local macro. +mod everything_inside { + macro_rules! m { + ('b: 'a) => { + struct Foo<'a, 'b>(&'a &'b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<'a, 'b>(&'a &'b ()) ; + //~^ ERROR: outlives requirements can be inferred + struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, ; + //~^ ERROR: outlives requirements can be inferred + }; + } + m!('b: 'a); +} + +mod inner_lifetime_outside_colon_inside { + macro_rules! m { + ($b:lifetime: 'a) => { + struct Foo<'a, $b>(&'a &$b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<'a, $b>(&'a &$b ()) ; + //~^ ERROR: outlives requirements can be inferred + struct Baz<'a, $b>(&'a &$b ()) where (): Sized, ; + //~^ ERROR: outlives requirements can be inferred + } + } + m!('b: 'a); +} + +mod outer_lifetime_outside_colon_inside { + macro_rules! m { + ('b: $a:lifetime) => { + struct Foo<$a, 'b: $a>(&$a &'b ()); + struct Bar<$a, 'b>(&$a &'b ()) where 'b: $a; + struct Baz<$a, 'b>(&$a &'b ()) where (): Sized, 'b: $a; + } + } + m!('b: 'a); +} + +mod both_lifetimes_outside_colon_inside { + macro_rules! m { + ($b:lifetime: $a:lifetime) => { + struct Foo<$a, $b: $a>(&$a &$b ()); + struct Bar<$a, $b>(&$a &$b ()) where $b: $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b: $a; + } + } + m!('b: 'a); +} + +mod everything_outside { + macro_rules! m { + ($b:lifetime $colon:tt $a:lifetime) => { + struct Foo<$a, $b $colon $a>(&$a &$b ()); + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + } + } + m!('b: 'a); +} + +mod everything_outside_with_tt_inner { + macro_rules! m { + ($b:tt $colon:tt $a:lifetime) => { + struct Foo<$a, $b $colon $a>(&$a &$b ()); + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + } + } + m!('b: 'a); +} + +// FIXME: These should be consistent. +mod everything_outside_with_tt_outer { + macro_rules! m { + ($b:lifetime $colon:tt $a:tt) => { + struct Foo<$a, $b >(&$a &$b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + } + } + m!('b: 'a); +} + +mod everything_outside_with_tt_both { + macro_rules! m { + ($b:tt $colon:tt $a:tt) => { + struct Foo<$a, $b >(&$a &$b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<$a, $b>(&$a &$b ()) where ; + //~^ ERROR: outlives requirements can be inferred + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, ; + //~^ ERROR: outlives requirements can be inferred + } + } + m!('b: 'a); +} + +fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs new file mode 100644 index 000000000..647906c2d --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs @@ -0,0 +1,137 @@ +// edition:2018 +// aux-build:edition-lint-infer-outlives-macro.rs +// run-rustfix + +#![deny(explicit_outlives_requirements)] +#![allow(dead_code)] + +#[macro_use] +extern crate edition_lint_infer_outlives_macro; + +// Test that the lint does not fire if the predicate is from the local crate, +// but all the bounds are from an external macro. +macro_rules! make_foo { + ($a:tt) => { + struct Foo<$a, 'b: $a> { + foo: &$a &'b (), + } + + struct FooWhere<$a, 'b> where 'b: $a { + foo: &$a &'b (), + } + } +} + +gimme_a! {make_foo!} + +struct Bar<'a, 'b: 'a> { + //~^ ERROR: outlives requirements can be inferred + bar: &'a &'b (), +} + +struct BarWhere<'a, 'b> where 'b: 'a { + //~^ ERROR: outlives requirements can be inferred + bar: &'a &'b (), +} + +// Test that the lint *does* fire if the predicate is contained in a local macro. +mod everything_inside { + macro_rules! m { + ('b: 'a) => { + struct Foo<'a, 'b: 'a>(&'a &'b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<'a, 'b>(&'a &'b ()) where 'b: 'a; + //~^ ERROR: outlives requirements can be inferred + struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, 'b: 'a; + //~^ ERROR: outlives requirements can be inferred + }; + } + m!('b: 'a); +} + +mod inner_lifetime_outside_colon_inside { + macro_rules! m { + ($b:lifetime: 'a) => { + struct Foo<'a, $b: 'a>(&'a &$b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<'a, $b>(&'a &$b ()) where $b: 'a; + //~^ ERROR: outlives requirements can be inferred + struct Baz<'a, $b>(&'a &$b ()) where (): Sized, $b: 'a; + //~^ ERROR: outlives requirements can be inferred + } + } + m!('b: 'a); +} + +mod outer_lifetime_outside_colon_inside { + macro_rules! m { + ('b: $a:lifetime) => { + struct Foo<$a, 'b: $a>(&$a &'b ()); + struct Bar<$a, 'b>(&$a &'b ()) where 'b: $a; + struct Baz<$a, 'b>(&$a &'b ()) where (): Sized, 'b: $a; + } + } + m!('b: 'a); +} + +mod both_lifetimes_outside_colon_inside { + macro_rules! m { + ($b:lifetime: $a:lifetime) => { + struct Foo<$a, $b: $a>(&$a &$b ()); + struct Bar<$a, $b>(&$a &$b ()) where $b: $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b: $a; + } + } + m!('b: 'a); +} + +mod everything_outside { + macro_rules! m { + ($b:lifetime $colon:tt $a:lifetime) => { + struct Foo<$a, $b $colon $a>(&$a &$b ()); + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + } + } + m!('b: 'a); +} + +mod everything_outside_with_tt_inner { + macro_rules! m { + ($b:tt $colon:tt $a:lifetime) => { + struct Foo<$a, $b $colon $a>(&$a &$b ()); + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + } + } + m!('b: 'a); +} + +// FIXME: These should be consistent. +mod everything_outside_with_tt_outer { + macro_rules! m { + ($b:lifetime $colon:tt $a:tt) => { + struct Foo<$a, $b $colon $a>(&$a &$b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + } + } + m!('b: 'a); +} + +mod everything_outside_with_tt_both { + macro_rules! m { + ($b:tt $colon:tt $a:tt) => { + struct Foo<$a, $b $colon $a>(&$a &$b ()); + //~^ ERROR: outlives requirements can be inferred + struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + //~^ ERROR: outlives requirements can be inferred + struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + //~^ ERROR: outlives requirements can be inferred + } + } + m!('b: 'a); +} + +fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr new file mode 100644 index 000000000..734ae6879 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr @@ -0,0 +1,110 @@ +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-macro.rs:27:18 + | +LL | struct Bar<'a, 'b: 'a> { + | ^^^^ help: remove this bound + | +note: the lint level is defined here + --> $DIR/edition-lint-infer-outlives-macro.rs:5:9 + | +LL | #![deny(explicit_outlives_requirements)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-macro.rs:32:24 + | +LL | struct BarWhere<'a, 'b> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-macro.rs:41:30 + | +LL | struct Foo<'a, 'b: 'a>(&'a &'b ()); + | ^^^^ help: remove this bound +... +LL | m!('b: 'a); + | ---------- 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-macro.rs:43:44 + | +LL | struct Bar<'a, 'b>(&'a &'b ()) where 'b: 'a; + | ^^^^^^^^^^^^ help: remove this bound +... +LL | m!('b: 'a); + | ---------- 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-macro.rs:45:61 + | +LL | struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, 'b: 'a; + | ^^^^^^ help: remove this bound +... +LL | m!('b: 'a); + | ---------- 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-macro.rs:55:30 + | +LL | struct Foo<'a, $b: 'a>(&'a &$b ()); + | ^^^^ help: remove this bound +... +LL | m!('b: 'a); + | ---------- 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-macro.rs:57:44 + | +LL | struct Bar<'a, $b>(&'a &$b ()) where $b: 'a; + | ^^^^^^^^^^^^ help: remove this bound +... +LL | m!('b: 'a); + | ---------- 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-macro.rs:59:61 + | +LL | struct Baz<'a, $b>(&'a &$b ()) where (): Sized, $b: 'a; + | ^^^^^^ help: remove this bound +... +LL | m!('b: 'a); + | ---------- 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-macro.rs:114:31 + | +LL | struct Foo<$a, $b $colon $a>(&$a &$b ()); + | ^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-macro.rs:126:31 + | +LL | struct Foo<$a, $b $colon $a>(&$a &$b ()); + | ^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-macro.rs:128:50 + | +LL | struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-macro.rs:130:61 + | +LL | struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; + | ^^^^^^^^^^^^ help: remove this bound + +error: aborting due to 12 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs new file mode 100644 index 000000000..0b3de0df2 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs @@ -0,0 +1,368 @@ +#![allow(unused)] +#![deny(explicit_outlives_requirements)] + + +// These examples should live in edition-lint-infer-outlives.rs, but are split +// into this separate file because they can't be `rustfix`'d (and thus, can't +// be part of a `run-rustfix` test file) until rust-lang-nursery/rustfix#141 +// is solved + +mod structs { + use std::fmt::Debug; + + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> + where U: 'a + Debug + 'b, 'b: 'a + //~^ ERROR outlives requirements can be inferred + { + tee: T, + yoo: &'a &'b U + } +} + +mod tuple_structs { + use std::fmt::Debug; + + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereAyTeeYooWhereAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) + where U: 'a + Debug + 'b, 'b: 'a; + //~^ ERROR outlives requirements can be inferred +} + +mod enums { + use std::fmt::Debug; + + enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, }, + W(&'a &'b U), + } + + enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T, yoo: &'b U }, + W, + } + + enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + V(&'a T, &'b U), + W, + } + + enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W(&'b U), + } + + enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a T, &'b U), + W, + } + + enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W(&'b U) + } + + enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T, yoo: &'b U }, + W, + } + + enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a T, &'b U), + W, + } + + enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W, + } + + enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a &'b U), + } + + enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + } +} + +mod unions { + use std::fmt::Debug; + + union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: &'b U + } + + union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } +} + +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 new file mode 100644 index 000000000..251d74094 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -0,0 +1,823 @@ +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:13:47 + | +LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { + | ^^^^^ ^^^^^ + | +note: the lint level is defined here + --> $DIR/edition-lint-infer-outlives-multispan.rs:2:9 + | +LL | #![deny(explicit_outlives_requirements)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove these bounds + | +LL - struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { +LL + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:18:61 + | +LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { +LL + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:23:53 + | +LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { +LL + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:29:48 + | +LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { +LL + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:35:48 + | +LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { +LL + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:41:46 + | +LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { + | ^^^^ ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { +LL + struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:47:67 + | +LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { +LL + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:53:53 + | +LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { +LL + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:59:53 + | +LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { +LL + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:65:69 + | +LL | struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { +LL + struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:71:69 + | +LL | struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { +LL + struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:77:38 + | +LL | struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { + | ^^^^ ^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { +LL + struct BeeOutlivesAyTeeBee<'a, 'b, T> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:82:40 + | +LL | struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { + | ^^^^ ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { +LL + struct BeeOutlivesAyTeeAyBee<'a, 'b, T> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:87:55 + | +LL | struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { +LL + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:92:68 + | +LL | struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { + | ^^^^^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { +LL + struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:97:58 + | +LL | struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { +LL + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:104:18 + | +LL | where U: 'a + Debug + 'b, 'b: 'a + | ^^^^^ ^^^^^ ^^^^^^ + | +help: remove these bounds + | +LL - where U: 'a + Debug + 'b, 'b: 'a +LL + where U: Debug, + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:115:47 + | +LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T); + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T); +LL + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:118:72 + | +LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b; + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b; +LL + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:121:53 + | +LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U); + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U); +LL + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:124:48 + | +LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U); + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U); +LL + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug>(&'a T, &'b U); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:127:48 + | +LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U); + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U); +LL + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug>(&'a T, &'b U); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:130:46 + | +LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b; + | ^^^^ ^^^^^^^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b; +LL + struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U>(&'a T, &'b U) ; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:133:81 + | +LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b; + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b; +LL + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:136:53 + | +LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug; + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug; +LL + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:139:53 + | +LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b; + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b; +LL + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:142:75 + | +LL | struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug; + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug; +LL + struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:145:75 + | +LL | struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b; + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b; +LL + struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:148:38 + | +LL | struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T); + | ^^^^ ^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T); +LL + struct BeeOutlivesAyTeeBee<'a, 'b, T>(&'a &'b T); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:151:40 + | +LL | struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T); + | ^^^^ ^^^^^^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T); +LL + struct BeeOutlivesAyTeeAyBee<'a, 'b, T>(&'a &'b T); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:154:55 + | +LL | struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T); + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T); +LL + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:157:71 + | +LL | struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b; + | ^^^^^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b; +LL + struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:160:58 + | +LL | struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U); + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U); +LL + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:164:18 + | +LL | where U: 'a + Debug + 'b, 'b: 'a; + | ^^^^^ ^^^^^ ^^^^^^ + | +help: remove these bounds + | +LL - where U: 'a + Debug + 'b, 'b: 'a; +LL + where U: Debug, ; + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:171:45 + | +LL | enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { +LL + enum TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:176:59 + | +LL | enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { +LL + enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:181:51 + | +LL | enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { +LL + enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:187:46 + | +LL | enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { +LL + enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:193:46 + | +LL | enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { +LL + enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:199:44 + | +LL | enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { + | ^^^^ ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { +LL + enum TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:205:65 + | +LL | enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { +LL + enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:211:51 + | +LL | enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { +LL + enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:217:51 + | +LL | enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { +LL + enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:223:67 + | +LL | enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { +LL + enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:229:67 + | +LL | enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { +LL + enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:235:36 + | +LL | enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { + | ^^^^ ^^^^ + | +help: remove these bounds + | +LL - enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { +LL + enum BeeOutlivesAyTeeBee<'a, 'b, T> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:240:38 + | +LL | enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { + | ^^^^ ^^^^^^^^^ + | +help: remove these bounds + | +LL - enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { +LL + enum BeeOutlivesAyTeeAyBee<'a, 'b, T> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:246:53 + | +LL | enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { +LL + enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:251:66 + | +LL | enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { + | ^^^^^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { +LL + enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:256:56 + | +LL | enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { +LL + enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:262:75 + | +LL | enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { + | ^^^^^ ^^^^^ ^^^^^^ + | +help: remove these bounds + | +LL - enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { +LL + enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:271:46 + | +LL | union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { +LL + union TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:276:60 + | +LL | union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { +LL + union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:281:52 + | +LL | union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { +LL + union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:287:47 + | +LL | union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { +LL + union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:293:47 + | +LL | union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { +LL + union TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:299:45 + | +LL | union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { + | ^^^^ ^^^^^^^^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { +LL + union TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:305:66 + | +LL | union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { + | ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { +LL + union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:311:52 + | +LL | union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { +LL + union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:317:52 + | +LL | union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { + | ^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { +LL + union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:323:68 + | +LL | union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { +LL + union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:329:68 + | +LL | union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { + | ^^^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { +LL + union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:335:37 + | +LL | union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { + | ^^^^ ^^^^ + | +help: remove these bounds + | +LL - union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { +LL + union BeeOutlivesAyTeeBee<'a, 'b, T> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:340:39 + | +LL | union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { + | ^^^^ ^^^^^^^^^ + | +help: remove these bounds + | +LL - union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { +LL + union BeeOutlivesAyTeeAyBee<'a, 'b, T> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:345:54 + | +LL | union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { +LL + union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:350:67 + | +LL | union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { + | ^^^^^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { +LL + union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:355:57 + | +LL | union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { + | ^^^^ ^^^^^ ^^^^^ + | +help: remove these bounds + | +LL - union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { +LL + union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { + | + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:361:76 + | +LL | union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { + | ^^^^^ ^^^^^ ^^^^^^ + | +help: remove these bounds + | +LL - union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { +LL + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { + | + +error: aborting due to 68 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed new file mode 100644 index 000000000..13645244d --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed @@ -0,0 +1,795 @@ +// run-rustfix + +#![allow(unused)] +#![deny(explicit_outlives_requirements)] + +// Programmatically generated examples! +// +// Exercise outlives bounds for each of the following parameter/position +// combinations— +// +// • one generic parameter (T) bound inline +// • one parameter (T) with a where clause +// • two parameters (T and U), both bound inline +// • two parameters (T and U), one bound inline, one with a where clause +// • two parameters (T and U), both with where clauses +// +// —and for every permutation of 1 or 2 lifetimes to outlive and 0 or 1 trait +// bounds distributed among said parameters (subject to no where clause being +// empty and the struct having at least one lifetime). +// +// —and for each of tuple structs, enums and unions. + +mod structs { + use std::fmt::Debug; + + struct TeeOutlivesAy<'a, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeOutlivesAyIsDebug<'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeIsDebugOutlivesAy<'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeOutlivesAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereOutlivesAy<'a, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeWhereOutlivesAyIsDebug<'a, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeWhereOutlivesAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeYooOutlivesAy<'a, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooOutlivesAyIsDebug<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeOutlivesAyYooIsDebug<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: U + } + + struct TeeYooOutlivesAyBee<'a, 'b, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: U + } + + struct TeeYooWhereOutlivesAy<'a, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: U + } + + struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: U + } + + struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: U + } + + struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: U + } + + struct BeeOutlivesAy<'a, 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + struct BeeWhereOutlivesAy<'a, 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + struct BeeOutlivesAyTee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeOutlivesAyTeeDebug<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } +} + +mod tuple_structs { + use std::fmt::Debug; + + struct TeeOutlivesAy<'a, T>(&'a T); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyIsDebug<'a, T: Debug>(&'a T); + //~^ ERROR outlives requirements can be inferred + + struct TeeIsDebugOutlivesAy<'a, T: Debug>(&'a T); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBee<'a, 'b, T>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAy<'a, T>(&'a T) ; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyIsDebug<'a, T>(&'a T) where T: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereIsDebugOutlivesAy<'a, T>(&'a T) where T: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyBee<'a, 'b, T>(&'a &'b T) ; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T>(&'a &'b T) where T: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAy<'a, T, U>(T, &'a U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyIsDebug<'a, T, U: Debug>(T, &'a U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug>(T, &'a U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooIsDebug<'a, T, U: Debug>(&'a T, U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug>(&'a &'b T, U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAy<'a, T, U>(T, &'a U) ; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyIsDebug<'a, T, U>(T, &'a U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereIsDebugOutlivesAy<'a, T, U>(T, &'a U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) ; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAy<'a, 'b>(&'a &'b ()); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAy<'a, 'b>(&'a &'b ()) ; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTee<'a, 'b, T>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTee<'a, 'b, T>(&'a &'b T) ; + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T>(&'a &'b T) ; + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T>(&'a &'b T) ; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTeeDebug<'a, 'b, T: Debug>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T>(&'a &'b T) where T: Debug; + //~^ ERROR outlives requirements can be inferred +} + +mod enums { + use std::fmt::Debug; + + enum TeeOutlivesAy<'a, T> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + } + + enum TeeOutlivesAyIsDebug<'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + V(&'a T), + } + + enum TeeIsDebugOutlivesAy<'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W, + } + + enum TeeOutlivesAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum TeeWhereOutlivesAy<'a, T> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W, + } + + enum TeeWhereOutlivesAyIsDebug<'a, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a T), + W, + } + + enum TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + } + + enum TeeWhereOutlivesAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W, + } + + enum TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum TeeYooOutlivesAy<'a, T, U> { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a U), + } + + enum TeeYooOutlivesAyIsDebug<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a U }, + W, + } + + enum TeeYooIsDebugOutlivesAy<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V(T, &'a U), + W, + } + + enum TeeOutlivesAyYooIsDebug<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W(U), + } + + enum TeeYooOutlivesAyBee<'a, 'b, T, U> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V(T, &'a &'b U), + W, + } + + enum TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T, U), + W, + } + + enum TeeYooWhereOutlivesAy<'a, T, U> { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a U), + } + + enum TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a U }, + W, + } + + enum TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V(T, &'a U), + W, + } + + enum TeeOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W(U), + } + + enum TeeYooWhereOutlivesAyBee<'a, 'b, T, U> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V(T, &'a &'b U), + W, + } + + enum TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a &'b U), + } + + enum TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T, yoo: U }, + W, + } + + enum TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a T, U), + W, + } + + enum TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W(U), + } + + enum BeeOutlivesAy<'a, 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b () }, + } + + enum BeeWhereOutlivesAy<'a, 'b> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b ()), + } + + enum BeeOutlivesAyTee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W, + } + + enum BeeWhereOutlivesAyTee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum BeeOutlivesAyTeeDebug<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } +} + +mod unions { + use std::fmt::Debug; + + union TeeOutlivesAy<'a, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeOutlivesAyIsDebug<'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeIsDebugOutlivesAy<'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeOutlivesAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeOutlivesAyBeeIsDebug<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereOutlivesAy<'a, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeWhereOutlivesAyIsDebug<'a, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeWhereOutlivesAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeYooOutlivesAy<'a, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooOutlivesAyIsDebug<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooIsDebugOutlivesAy<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeOutlivesAyYooIsDebug<'a, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: *const U + } + + union TeeYooOutlivesAyBee<'a, 'b, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeOutlivesAyBeeYooIsDebug<'a, 'b, T, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: *const U + } + + union TeeYooWhereOutlivesAy<'a, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: *const U + } + + union TeeYooWhereOutlivesAyBee<'a, 'b, T, U> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: *const U + } + + union TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: *const U + } + + union TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: *const U + } + + union BeeOutlivesAy<'a, 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + union BeeWhereOutlivesAy<'a, 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + union BeeOutlivesAyTee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeOutlivesAyTeeDebug<'a, 'b, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } +} + + +// But outlives inference for 'static lifetimes is under a separate +// feature-gate for now +// (https://github.com/rust-lang/rust/issues/44493#issuecomment-407846046). +struct StaticRef { + field: &'static T +} + + +fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.rs b/tests/ui/rust-2018/edition-lint-infer-outlives.rs new file mode 100644 index 000000000..d9486ba66 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.rs @@ -0,0 +1,795 @@ +// run-rustfix + +#![allow(unused)] +#![deny(explicit_outlives_requirements)] + +// Programmatically generated examples! +// +// Exercise outlives bounds for each of the following parameter/position +// combinations— +// +// • one generic parameter (T) bound inline +// • one parameter (T) with a where clause +// • two parameters (T and U), both bound inline +// • two parameters (T and U), one bound inline, one with a where clause +// • two parameters (T and U), both with where clauses +// +// —and for every permutation of 1 or 2 lifetimes to outlive and 0 or 1 trait +// bounds distributed among said parameters (subject to no where clause being +// empty and the struct having at least one lifetime). +// +// —and for each of tuple structs, enums and unions. + +mod structs { + use std::fmt::Debug; + + struct TeeOutlivesAy<'a, T: 'a> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereOutlivesAy<'a, T> where T: 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + struct TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + struct TeeYooOutlivesAy<'a, T, U: 'a> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: U + } + + struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: U + } + + struct TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a U + } + + struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: U + } + + struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: T, + yoo: &'a &'b U + } + + struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: U + } + + struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: U + } + + struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: U + } + + struct BeeOutlivesAy<'a, 'b: 'a> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + struct BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + struct BeeOutlivesAyTee<'a, 'b: 'a, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } +} + +mod tuple_structs { + use std::fmt::Debug; + + struct TeeOutlivesAy<'a, T: 'a>(&'a T); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug>(&'a T); + //~^ ERROR outlives requirements can be inferred + + struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a>(&'a T); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAy<'a, T>(&'a T) where T: 'a; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyIsDebug<'a, T>(&'a T) where T: 'a + Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereIsDebugOutlivesAy<'a, T>(&'a T) where T: Debug + 'a; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: 'a + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T>(&'a &'b T) where T: 'a + 'b + Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: Debug + 'a + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAy<'a, T, U: 'a>(T, &'a U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug>(T, &'a U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a>(T, &'a U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug>(&'a T, U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b>(T, &'a &'b U); + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug>(&'a &'b T, U); + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAy<'a, T, U>(T, &'a U) where U: 'a; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyIsDebug<'a, T, U>(T, &'a U) where U: 'a + Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereIsDebugOutlivesAy<'a, T, U>(T, &'a U) where U: Debug + 'a; + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U>(&'a T, U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b + Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug + 'a + 'b; + //~^ ERROR outlives requirements can be inferred + + struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U>(&'a &'b T, U) where U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where T: 'a, U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct TeeWhereAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where T: 'a + 'b, U: Debug; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAy<'a, 'b: 'a>(&'a &'b ()); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAy<'a, 'b>(&'a &'b ()) where 'b: 'a; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTee<'a, 'b: 'a, T>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTee<'a, 'b, T>(&'a &'b T) where 'b: 'a; + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'b; + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + 'b; + //~^ ERROR outlives requirements can be inferred + + struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug>(&'a &'b T); + //~^ ERROR outlives requirements can be inferred + + struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: Debug; + //~^ ERROR outlives requirements can be inferred +} + +mod enums { + use std::fmt::Debug; + + enum TeeOutlivesAy<'a, T: 'a> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + } + + enum TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { + //~^ ERROR outlives requirements can be inferred + V(&'a T), + } + + enum TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W, + } + + enum TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum TeeWhereOutlivesAy<'a, T> where T: 'a { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W, + } + + enum TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a T), + W, + } + + enum TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + } + + enum TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W, + } + + enum TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum TeeYooOutlivesAy<'a, T, U: 'a> { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a U), + } + + enum TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a U }, + W, + } + + enum TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { + //~^ ERROR outlives requirements can be inferred + V(T, &'a U), + W, + } + + enum TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W(U), + } + + enum TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + V(T, &'a &'b U), + W, + } + + enum TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T, U), + W, + } + + enum TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a U), + } + + enum TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a U }, + W, + } + + enum TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { + //~^ ERROR outlives requirements can be inferred + V(T, &'a U), + W, + } + + enum TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a T }, + W(U), + } + + enum TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + V { tee: T, yoo: &'a &'b U }, + W, + } + + enum TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { + //~^ ERROR outlives requirements can be inferred + V(T, &'a &'b U), + W, + } + + enum TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { + //~^ ERROR outlives requirements can be inferred + V { tee: T }, + W(&'a &'b U), + } + + enum TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T, yoo: U }, + W, + } + + enum TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a T, U), + W, + } + + enum TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W(U), + } + + enum BeeOutlivesAy<'a, 'b: 'a> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b () }, + } + + enum BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b ()), + } + + enum BeeOutlivesAyTee<'a, 'b: 'a, T> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + W, + } + + enum BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } + + enum BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + W, + } + + enum BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + V { tee: &'a &'b T }, + } + + enum BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { + //~^ ERROR outlives requirements can be inferred + V(&'a &'b T), + } +} + +mod unions { + use std::fmt::Debug; + + union TeeOutlivesAy<'a, T: 'a> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereOutlivesAy<'a, T> where T: 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a T + } + + union TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T + } + + union TeeYooOutlivesAy<'a, T, U: 'a> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: *const U + } + + union TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: *const U + } + + union TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a U + } + + union TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: *const U + } + + union TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: *const T, + yoo: &'a &'b U + } + + union TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: *const U + } + + union TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a T, + yoo: *const U + } + + union TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + yoo: *const U + } + + union BeeOutlivesAy<'a, 'b: 'a> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + union BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b (), + } + + union BeeOutlivesAyTee<'a, 'b: 'a, T> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } + + union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { + //~^ ERROR outlives requirements can be inferred + tee: &'a &'b T, + } +} + + +// But outlives inference for 'static lifetimes is under a separate +// feature-gate for now +// (https://github.com/rust-lang/rust/issues/44493#issuecomment-407846046). +struct StaticRef { + field: &'static T +} + + +fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr new file mode 100644 index 000000000..faa9f21e3 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr @@ -0,0 +1,920 @@ +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:26:31 + | +LL | struct TeeOutlivesAy<'a, T: 'a> { + | ^^^^ help: remove this bound + | +note: the lint level is defined here + --> $DIR/edition-lint-infer-outlives.rs:4:9 + | +LL | #![deny(explicit_outlives_requirements)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:31:40 + | +LL | struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:36:45 + | +LL | struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:41:38 + | +LL | struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:46:47 + | +LL | struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:51:52 + | +LL | struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:56:37 + | +LL | struct TeeWhereOutlivesAy<'a, T> where T: 'a { + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:61:54 + | +LL | struct TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:66:59 + | +LL | struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:71:44 + | +LL | struct TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { + | ^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:76:61 + | +LL | struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:81:66 + | +LL | struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:86:37 + | +LL | struct TeeYooOutlivesAy<'a, T, U: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:92:46 + | +LL | struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:98:51 + | +LL | struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:104:41 + | +LL | struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:110:44 + | +LL | struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:116:53 + | +LL | struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:122:58 + | +LL | struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:128:48 + | +LL | struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:134:43 + | +LL | struct TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:140:60 + | +LL | struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:146:65 + | +LL | struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:152:46 + | +LL | struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:158:50 + | +LL | struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { + | ^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:164:67 + | +LL | struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:170:72 + | +LL | struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:176:53 + | +LL | struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:182:62 + | +LL | struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { + | ^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:188:69 + | +LL | struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { + | ^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:194:32 + | +LL | struct BeeOutlivesAy<'a, 'b: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:199:38 + | +LL | struct BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:204:35 + | +LL | struct BeeOutlivesAyTee<'a, 'b: 'a, T> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:209:44 + | +LL | struct BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:214:52 + | +LL | struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { + | ^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:219:54 + | +LL | struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:224:40 + | +LL | struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:229:61 + | +LL | struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { + | ^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:238:31 + | +LL | struct TeeOutlivesAy<'a, T: 'a>(&'a T); + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:241:40 + | +LL | struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug>(&'a T); + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:244:45 + | +LL | struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a>(&'a T); + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:247:38 + | +LL | struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b>(&'a &'b T); + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:250:47 + | +LL | struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug>(&'a &'b T); + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:253:52 + | +LL | struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b>(&'a &'b T); + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:256:45 + | +LL | struct TeeWhereOutlivesAy<'a, T>(&'a T) where T: 'a; + | ^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:259:61 + | +LL | struct TeeWhereOutlivesAyIsDebug<'a, T>(&'a T) where T: 'a + Debug; + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:262:66 + | +LL | struct TeeWhereIsDebugOutlivesAy<'a, T>(&'a T) where T: Debug + 'a; + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:265:56 + | +LL | struct TeeWhereOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: 'a + 'b; + | ^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:268:72 + | +LL | struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T>(&'a &'b T) where T: 'a + 'b + Debug; + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:271:77 + | +LL | struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T>(&'a &'b T) where T: Debug + 'a + 'b; + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:274:37 + | +LL | struct TeeYooOutlivesAy<'a, T, U: 'a>(T, &'a U); + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:277:46 + | +LL | struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug>(T, &'a U); + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:280:51 + | +LL | struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a>(T, &'a U); + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:283:41 + | +LL | struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug>(&'a T, U); + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:286:44 + | +LL | struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b>(T, &'a &'b U); + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:289:53 + | +LL | struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug>(T, &'a &'b U); + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:292:58 + | +LL | struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b>(T, &'a &'b U); + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:295:48 + | +LL | struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug>(&'a &'b T, U); + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:298:54 + | +LL | struct TeeYooWhereOutlivesAy<'a, T, U>(T, &'a U) where U: 'a; + | ^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:301:70 + | +LL | struct TeeYooWhereOutlivesAyIsDebug<'a, T, U>(T, &'a U) where U: 'a + Debug; + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:304:75 + | +LL | struct TeeYooWhereIsDebugOutlivesAy<'a, T, U>(T, &'a U) where U: Debug + 'a; + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:307:46 + | +LL | struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U>(&'a T, U) where U: Debug; + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:310:65 + | +LL | struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b; + | ^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:313:81 + | +LL | struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + 'b + Debug; + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:316:86 + | +LL | struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug + 'a + 'b; + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:319:53 + | +LL | struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U>(&'a &'b T, U) where U: Debug; + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:322:72 + | +LL | struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U>(&'a T, U) where T: 'a, U: Debug; + | ^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:325:75 + | +LL | struct TeeWhereAyBeeYooWhereIsDebug<'a, 'b, T, U>(&'a &'b T, U) where T: 'a + 'b, U: Debug; + | ^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:328:32 + | +LL | struct BeeOutlivesAy<'a, 'b: 'a>(&'a &'b ()); + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:331:51 + | +LL | struct BeeWhereOutlivesAy<'a, 'b>(&'a &'b ()) where 'b: 'a; + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:334:35 + | +LL | struct BeeOutlivesAyTee<'a, 'b: 'a, T>(&'a &'b T); + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:337:56 + | +LL | struct BeeWhereOutlivesAyTee<'a, 'b, T>(&'a &'b T) where 'b: 'a; + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:340:64 + | +LL | struct BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'b; + | ^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:343:66 + | +LL | struct BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + 'b; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:346:40 + | +LL | struct BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug>(&'a &'b T); + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:349:72 + | +LL | struct BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: Debug; + | ^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:356:29 + | +LL | enum TeeOutlivesAy<'a, T: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:361:38 + | +LL | enum TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:366:43 + | +LL | enum TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:372:36 + | +LL | enum TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:378:45 + | +LL | enum TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:383:50 + | +LL | enum TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:388:35 + | +LL | enum TeeWhereOutlivesAy<'a, T> where T: 'a { + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:394:52 + | +LL | enum TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:400:57 + | +LL | enum TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:405:42 + | +LL | enum TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { + | ^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:410:59 + | +LL | enum TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:416:64 + | +LL | enum TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:422:35 + | +LL | enum TeeYooOutlivesAy<'a, T, U: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:428:44 + | +LL | enum TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:434:49 + | +LL | enum TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:440:39 + | +LL | enum TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:446:42 + | +LL | enum TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:452:51 + | +LL | enum TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:458:56 + | +LL | enum TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:464:46 + | +LL | enum TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:470:41 + | +LL | enum TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:476:58 + | +LL | enum TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:482:63 + | +LL | enum TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:488:44 + | +LL | enum TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:494:48 + | +LL | enum TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { + | ^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:500:65 + | +LL | enum TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:506:70 + | +LL | enum TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:512:51 + | +LL | enum TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:518:60 + | +LL | enum TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { + | ^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:524:67 + | +LL | enum TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { + | ^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:530:30 + | +LL | enum BeeOutlivesAy<'a, 'b: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:535:36 + | +LL | enum BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:540:33 + | +LL | enum BeeOutlivesAyTee<'a, 'b: 'a, T> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:546:42 + | +LL | enum BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:552:50 + | +LL | enum BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { + | ^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:557:52 + | +LL | enum BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:563:38 + | +LL | enum BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:568:59 + | +LL | enum BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { + | ^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:577:30 + | +LL | union TeeOutlivesAy<'a, T: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:582:39 + | +LL | union TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:587:44 + | +LL | union TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:592:37 + | +LL | union TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:597:46 + | +LL | union TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:602:51 + | +LL | union TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:607:36 + | +LL | union TeeWhereOutlivesAy<'a, T> where T: 'a { + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:612:53 + | +LL | union TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:617:58 + | +LL | union TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:622:43 + | +LL | union TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { + | ^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:627:60 + | +LL | union TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:632:65 + | +LL | union TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:637:36 + | +LL | union TeeYooOutlivesAy<'a, T, U: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:643:45 + | +LL | union TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:649:50 + | +LL | union TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:655:40 + | +LL | union TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:661:43 + | +LL | union TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:667:52 + | +LL | union TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:673:57 + | +LL | union TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:679:47 + | +LL | union TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:685:42 + | +LL | union TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { + | ^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:691:59 + | +LL | union TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:697:64 + | +LL | union TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { + | ^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:703:45 + | +LL | union TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:709:49 + | +LL | union TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { + | ^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:715:66 + | +LL | union TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:721:71 + | +LL | union TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { + | ^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:727:52 + | +LL | union TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { + | ^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:733:61 + | +LL | union TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { + | ^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:739:68 + | +LL | union TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { + | ^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:745:31 + | +LL | union BeeOutlivesAy<'a, 'b: 'a> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:750:37 + | +LL | union BeeWhereOutlivesAy<'a, 'b> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:755:34 + | +LL | union BeeOutlivesAyTee<'a, 'b: 'a, T> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:760:43 + | +LL | union BeeWhereOutlivesAyTee<'a, 'b, T> where 'b: 'a { + | ^^^^^^^^^^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:765:51 + | +LL | union BeeWhereOutlivesAyTeeWhereBee<'a, 'b, T> where 'b: 'a, T: 'b { + | ^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:770:53 + | +LL | union BeeWhereOutlivesAyTeeWhereAyBee<'a, 'b, T> where 'b: 'a, T: 'a + 'b { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these bounds + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:775:39 + | +LL | union BeeOutlivesAyTeeDebug<'a, 'b: 'a, T: Debug> { + | ^^^^ help: remove this bound + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:780:60 + | +LL | union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { + | ^^^^^^^^ help: remove this bound + +error: aborting due to 152 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-nested-empty-paths.fixed b/tests/ui/rust-2018/edition-lint-nested-empty-paths.fixed new file mode 100644 index 000000000..f25d46ce3 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-nested-empty-paths.fixed @@ -0,0 +1,34 @@ +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] +#![allow(unused_imports)] +#![allow(dead_code)] + +pub(crate) mod foo { + pub(crate) mod bar { + pub(crate) mod baz { } + pub(crate) mod baz1 { } + + pub(crate) struct XX; + } +} + +use crate::foo::{bar::{baz::{}}}; +//~^ ERROR absolute paths must start with +//~| WARN this is accepted in the current edition + +use crate::foo::{bar::{XX, baz::{}}}; +//~^ ERROR absolute paths must start with +//~| WARN this is accepted in the current edition +//~| ERROR absolute paths must start with +//~| WARN this is accepted in the current edition + +use crate::foo::{bar::{baz::{}, baz1::{}}}; +//~^ ERROR absolute paths must start with +//~| WARN this is accepted in the current edition +//~| ERROR absolute paths must start with +//~| WARN this is accepted in the current edition + +fn main() { +} diff --git a/tests/ui/rust-2018/edition-lint-nested-empty-paths.rs b/tests/ui/rust-2018/edition-lint-nested-empty-paths.rs new file mode 100644 index 000000000..9be1680c1 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-nested-empty-paths.rs @@ -0,0 +1,34 @@ +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] +#![allow(unused_imports)] +#![allow(dead_code)] + +pub(crate) mod foo { + pub(crate) mod bar { + pub(crate) mod baz { } + pub(crate) mod baz1 { } + + pub(crate) struct XX; + } +} + +use foo::{bar::{baz::{}}}; +//~^ ERROR absolute paths must start with +//~| WARN this is accepted in the current edition + +use foo::{bar::{XX, baz::{}}}; +//~^ ERROR absolute paths must start with +//~| WARN this is accepted in the current edition +//~| ERROR absolute paths must start with +//~| WARN this is accepted in the current edition + +use foo::{bar::{baz::{}, baz1::{}}}; +//~^ ERROR absolute paths must start with +//~| WARN this is accepted in the current edition +//~| ERROR absolute paths must start with +//~| WARN this is accepted in the current edition + +fn main() { +} diff --git a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr new file mode 100644 index 000000000..8769cbb35 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr @@ -0,0 +1,52 @@ +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-empty-paths.rs:17:5 + | +LL | use foo::{bar::{baz::{}}}; + | ^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}}}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 +note: the lint level is defined here + --> $DIR/edition-lint-nested-empty-paths.rs:4:9 + | +LL | #![deny(absolute_paths_not_starting_with_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-empty-paths.rs:21:5 + | +LL | use foo::{bar::{XX, baz::{}}}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{XX, baz::{}}}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-empty-paths.rs:21:5 + | +LL | use foo::{bar::{XX, baz::{}}}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{XX, baz::{}}}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-empty-paths.rs:27:5 + | +LL | use foo::{bar::{baz::{}, baz1::{}}}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}, baz1::{}}}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-empty-paths.rs:27:5 + | +LL | use foo::{bar::{baz::{}, baz1::{}}}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}, baz1::{}}}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: aborting due to 5 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.fixed b/tests/ui/rust-2018/edition-lint-nested-paths.fixed new file mode 100644 index 000000000..a04937ae8 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-nested-paths.fixed @@ -0,0 +1,31 @@ +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +use crate::foo::{a, b}; +//~^ ERROR absolute paths must start with +//~| this is accepted in the current edition +//~| ERROR absolute paths must start with +//~| this is accepted in the current edition + +mod foo { + pub(crate) fn a() {} + pub(crate) fn b() {} + pub(crate) fn c() {} +} + +fn main() { + a(); + b(); + + { + use crate::foo::{self as x, c}; + //~^ ERROR absolute paths must start with + //~| this is accepted in the current edition + //~| ERROR absolute paths must start with + //~| this is accepted in the current edition + x::a(); + c(); + } +} diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.rs b/tests/ui/rust-2018/edition-lint-nested-paths.rs new file mode 100644 index 000000000..e622a8e24 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-nested-paths.rs @@ -0,0 +1,31 @@ +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +use foo::{a, b}; +//~^ ERROR absolute paths must start with +//~| this is accepted in the current edition +//~| ERROR absolute paths must start with +//~| this is accepted in the current edition + +mod foo { + pub(crate) fn a() {} + pub(crate) fn b() {} + pub(crate) fn c() {} +} + +fn main() { + a(); + b(); + + { + use foo::{self as x, c}; + //~^ ERROR absolute paths must start with + //~| this is accepted in the current edition + //~| ERROR absolute paths must start with + //~| this is accepted in the current edition + x::a(); + c(); + } +} diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-paths.stderr new file mode 100644 index 000000000..354a6fe32 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-nested-paths.stderr @@ -0,0 +1,43 @@ +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-paths.rs:6:5 + | +LL | use foo::{a, b}; + | ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 +note: the lint level is defined here + --> $DIR/edition-lint-nested-paths.rs:4:9 + | +LL | #![deny(absolute_paths_not_starting_with_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-paths.rs:6:5 + | +LL | use foo::{a, b}; + | ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-paths.rs:23:13 + | +LL | use foo::{self as x, c}; + | ^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{self as x, c}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-nested-paths.rs:23:13 + | +LL | use foo::{self as x, c}; + | ^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{self as x, c}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: aborting due to 4 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-paths-2018.rs b/tests/ui/rust-2018/edition-lint-paths-2018.rs new file mode 100644 index 000000000..2005d8f4d --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-paths-2018.rs @@ -0,0 +1,10 @@ +// build-pass (FIXME(62277): could be check-pass?) +// edition:2018 +// compile-flags:--extern edition_lint_paths +// aux-build:edition-lint-paths.rs + +#![deny(absolute_paths_not_starting_with_crate)] + +edition_lint_paths::macro_2015!(); // OK + +fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-paths.fixed b/tests/ui/rust-2018/edition-lint-paths.fixed new file mode 100644 index 000000000..47f82c51d --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-paths.fixed @@ -0,0 +1,77 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] +#![allow(unused)] + +extern crate edition_lint_paths; + +pub mod foo { + use edition_lint_paths; + use crate::bar::Bar; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + + use super::bar::Bar2; + use crate::bar::Bar3; + + use crate::bar; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + + use crate::bar as something_else; + + use crate::{main, Bar as SomethingElse}; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + //~| ERROR absolute + //~| WARN this is accepted in the current edition + //~| ERROR absolute + //~| WARN this is accepted in the current edition + + use crate::{main as another_main, Bar as SomethingElse2}; + + pub fn test() {} + + pub trait SomeTrait {} +} + +use crate::bar::Bar; +//~^ ERROR absolute +//~| WARN this is accepted in the current edition + +pub mod bar { + use edition_lint_paths as foo; + pub struct Bar; + pub type Bar2 = Bar; + pub type Bar3 = Bar; +} + +mod baz { + use crate::*; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition +} + +impl crate::foo::SomeTrait for u32 {} +//~^ ERROR absolute +//~| WARN this is accepted in the current edition + +fn main() { + let x = crate::bar::Bar; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + + let x = bar::Bar; + let x = crate::bar::Bar; + let x = self::bar::Bar; + foo::test(); + + { + use edition_lint_paths as bar; + edition_lint_paths::foo(); + bar::foo(); + ::edition_lint_paths::foo(); + } +} diff --git a/tests/ui/rust-2018/edition-lint-paths.rs b/tests/ui/rust-2018/edition-lint-paths.rs new file mode 100644 index 000000000..e278983da --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-paths.rs @@ -0,0 +1,77 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] +#![allow(unused)] + +extern crate edition_lint_paths; + +pub mod foo { + use edition_lint_paths; + use bar::Bar; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + + use super::bar::Bar2; + use crate::bar::Bar3; + + use bar; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + + use crate::bar as something_else; + + use {main, Bar as SomethingElse}; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + //~| ERROR absolute + //~| WARN this is accepted in the current edition + //~| ERROR absolute + //~| WARN this is accepted in the current edition + + use crate::{main as another_main, Bar as SomethingElse2}; + + pub fn test() {} + + pub trait SomeTrait {} +} + +use bar::Bar; +//~^ ERROR absolute +//~| WARN this is accepted in the current edition + +pub mod bar { + use edition_lint_paths as foo; + pub struct Bar; + pub type Bar2 = Bar; + pub type Bar3 = Bar; +} + +mod baz { + use *; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition +} + +impl ::foo::SomeTrait for u32 {} +//~^ ERROR absolute +//~| WARN this is accepted in the current edition + +fn main() { + let x = ::bar::Bar; + //~^ ERROR absolute + //~| WARN this is accepted in the current edition + + let x = bar::Bar; + let x = crate::bar::Bar; + let x = self::bar::Bar; + foo::test(); + + { + use edition_lint_paths as bar; + edition_lint_paths::foo(); + bar::foo(); + ::edition_lint_paths::foo(); + } +} diff --git a/tests/ui/rust-2018/edition-lint-paths.stderr b/tests/ui/rust-2018/edition-lint-paths.stderr new file mode 100644 index 000000000..42652be94 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-paths.stderr @@ -0,0 +1,88 @@ +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:12:9 + | +LL | use bar::Bar; + | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 +note: the lint level is defined here + --> $DIR/edition-lint-paths.rs:5:9 + | +LL | #![deny(absolute_paths_not_starting_with_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:19:9 + | +LL | use bar; + | ^^^ help: use `crate`: `crate::bar` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:25:9 + | +LL | use {main, Bar as SomethingElse}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:25:9 + | +LL | use {main, Bar as SomethingElse}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:25:9 + | +LL | use {main, Bar as SomethingElse}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:40:5 + | +LL | use bar::Bar; + | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:52:9 + | +LL | use *; + | ^ help: use `crate`: `crate::*` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:57:6 + | +LL | impl ::foo::SomeTrait for u32 {} + | ^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::SomeTrait` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/edition-lint-paths.rs:62:13 + | +LL | let x = ::bar::Bar; + | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 + +error: aborting due to 9 previous errors + diff --git a/tests/ui/rust-2018/edition-lint-uninferable-outlives.rs b/tests/ui/rust-2018/edition-lint-uninferable-outlives.rs new file mode 100644 index 000000000..950ad1f50 --- /dev/null +++ b/tests/ui/rust-2018/edition-lint-uninferable-outlives.rs @@ -0,0 +1,30 @@ +// build-pass (FIXME(62277): could be check-pass?) + +#![allow(unused)] +#![deny(explicit_outlives_requirements)] + +// A case where we can't infer the outlives requirement. Example copied from +// RFC 2093. +// (https://rust-lang.github.io/rfcs/2093-infer-outlives.html +// #where-explicit-annotations-would-still-be-required) + + +trait MakeRef<'a> { + type Type; +} + +impl<'a, T> MakeRef<'a> for Vec + where T: 'a // still required +{ + type Type = &'a T; +} + + +struct Foo<'a, T> + where T: 'a // still required, not inferred from `field` +{ + field: as MakeRef<'a>>::Type +} + + +fn main() {} diff --git a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed new file mode 100644 index 000000000..e51ce5d1d --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed @@ -0,0 +1,28 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix +// compile-flags:--extern edition_lint_paths +// edition:2018 + +// The "normal case". Ideally we would remove the `extern crate` here, +// but we don't. + +#![deny(rust_2018_idioms)] +#![allow(dead_code)] + + +//~^ ERROR unused extern crate + +// Shouldn't suggest changing to `use`, as `bar` +// would no longer be added to the prelude which could cause +// compilation errors for imports that use `bar` in other +// modules. See #57672. +extern crate edition_lint_paths as bar; + +fn main() { + // This is not considered to *use* the `extern crate` in Rust 2018: + use edition_lint_paths::foo; + foo(); + + // But this should be a use of the (renamed) crate: + crate::bar::foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.rs b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.rs new file mode 100644 index 000000000..debbf085d --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.rs @@ -0,0 +1,28 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix +// compile-flags:--extern edition_lint_paths +// edition:2018 + +// The "normal case". Ideally we would remove the `extern crate` here, +// but we don't. + +#![deny(rust_2018_idioms)] +#![allow(dead_code)] + +extern crate edition_lint_paths; +//~^ ERROR unused extern crate + +// Shouldn't suggest changing to `use`, as `bar` +// would no longer be added to the prelude which could cause +// compilation errors for imports that use `bar` in other +// modules. See #57672. +extern crate edition_lint_paths as bar; + +fn main() { + // This is not considered to *use* the `extern crate` in Rust 2018: + use edition_lint_paths::foo; + foo(); + + // But this should be a use of the (renamed) crate: + crate::bar::foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr new file mode 100644 index 000000000..bb50ec3f5 --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr @@ -0,0 +1,15 @@ +error: unused extern crate + --> $DIR/extern-crate-idiomatic-in-2018.rs:12:1 + | +LL | extern crate edition_lint_paths; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | +note: the lint level is defined here + --> $DIR/extern-crate-idiomatic-in-2018.rs:9:9 + | +LL | #![deny(rust_2018_idioms)] + | ^^^^^^^^^^^^^^^^ + = note: `#[deny(unused_extern_crates)]` implied by `#[deny(rust_2018_idioms)]` + +error: aborting due to previous error + diff --git a/tests/ui/rust-2018/extern-crate-idiomatic.fixed b/tests/ui/rust-2018/extern-crate-idiomatic.fixed new file mode 100644 index 000000000..3111b1dab --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-idiomatic.fixed @@ -0,0 +1,18 @@ +// run-pass +// aux-build:edition-lint-paths.rs +// compile-flags:--extern edition_lint_paths +// run-rustfix + +// The "normal case". Ideally we would remove the `extern crate` here, +// but we don't. + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +extern crate edition_lint_paths; + +use edition_lint_paths::foo; + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-idiomatic.rs b/tests/ui/rust-2018/extern-crate-idiomatic.rs new file mode 100644 index 000000000..3111b1dab --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-idiomatic.rs @@ -0,0 +1,18 @@ +// run-pass +// aux-build:edition-lint-paths.rs +// compile-flags:--extern edition_lint_paths +// run-rustfix + +// The "normal case". Ideally we would remove the `extern crate` here, +// but we don't. + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +extern crate edition_lint_paths; + +use edition_lint_paths::foo; + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-referenced-by-self-path.fixed b/tests/ui/rust-2018/extern-crate-referenced-by-self-path.fixed new file mode 100644 index 000000000..11b9a67ed --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-referenced-by-self-path.fixed @@ -0,0 +1,17 @@ +// run-pass +// aux-build:edition-lint-paths.rs +// run-rustfix + +// Oddball: `edition_lint_paths` is accessed via this `self` path +// rather than being accessed directly. Unless we rewrite that path, +// we can't drop the extern crate. + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +extern crate edition_lint_paths; +use self::edition_lint_paths::foo; + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-referenced-by-self-path.rs b/tests/ui/rust-2018/extern-crate-referenced-by-self-path.rs new file mode 100644 index 000000000..11b9a67ed --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-referenced-by-self-path.rs @@ -0,0 +1,17 @@ +// run-pass +// aux-build:edition-lint-paths.rs +// run-rustfix + +// Oddball: `edition_lint_paths` is accessed via this `self` path +// rather than being accessed directly. Unless we rewrite that path, +// we can't drop the extern crate. + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +extern crate edition_lint_paths; +use self::edition_lint_paths::foo; + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-rename.fixed b/tests/ui/rust-2018/extern-crate-rename.fixed new file mode 100644 index 000000000..ea832ef3e --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-rename.fixed @@ -0,0 +1,18 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix + +// Oddball: crate is renamed, making it harder for us to rewrite +// paths. We don't (and we leave the `extern crate` in place). + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +extern crate edition_lint_paths as my_crate; + +use crate::my_crate::foo; +//~^ ERROR absolute paths must start +//~| WARNING this is accepted in the current edition + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-rename.rs b/tests/ui/rust-2018/extern-crate-rename.rs new file mode 100644 index 000000000..b1f617dd8 --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-rename.rs @@ -0,0 +1,18 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix + +// Oddball: crate is renamed, making it harder for us to rewrite +// paths. We don't (and we leave the `extern crate` in place). + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +extern crate edition_lint_paths as my_crate; + +use my_crate::foo; +//~^ ERROR absolute paths must start +//~| WARNING this is accepted in the current edition + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-rename.stderr b/tests/ui/rust-2018/extern-crate-rename.stderr new file mode 100644 index 000000000..eb040f5de --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-rename.stderr @@ -0,0 +1,16 @@ +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/extern-crate-rename.rs:12:5 + | +LL | use my_crate::foo; + | ^^^^^^^^^^^^^ help: use `crate`: `crate::my_crate::foo` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 +note: the lint level is defined here + --> $DIR/extern-crate-rename.rs:8:9 + | +LL | #![deny(absolute_paths_not_starting_with_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rust-2018/extern-crate-submod.fixed b/tests/ui/rust-2018/extern-crate-submod.fixed new file mode 100644 index 000000000..9b0b0dd8e --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-submod.fixed @@ -0,0 +1,25 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix + +// Oddball: extern crate appears in a submodule, making it harder for +// us to rewrite paths. We don't (and we leave the `extern crate` in +// place). + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +mod m { + // Because this extern crate does not appear at the root, we + // ignore it altogether. + pub extern crate edition_lint_paths; +} + +// And we don't being smart about paths like this, even though you +// *could* rewrite it to `use edition_lint_paths::foo` +use crate::m::edition_lint_paths::foo; +//~^ ERROR absolute paths must start +//~| WARNING this is accepted in the current edition + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-submod.rs b/tests/ui/rust-2018/extern-crate-submod.rs new file mode 100644 index 000000000..dfce9128c --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-submod.rs @@ -0,0 +1,25 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix + +// Oddball: extern crate appears in a submodule, making it harder for +// us to rewrite paths. We don't (and we leave the `extern crate` in +// place). + +#![feature(rust_2018_preview)] +#![deny(absolute_paths_not_starting_with_crate)] + +mod m { + // Because this extern crate does not appear at the root, we + // ignore it altogether. + pub extern crate edition_lint_paths; +} + +// And we don't being smart about paths like this, even though you +// *could* rewrite it to `use edition_lint_paths::foo` +use m::edition_lint_paths::foo; +//~^ ERROR absolute paths must start +//~| WARNING this is accepted in the current edition + +fn main() { + foo(); +} diff --git a/tests/ui/rust-2018/extern-crate-submod.stderr b/tests/ui/rust-2018/extern-crate-submod.stderr new file mode 100644 index 000000000..1a9aa7578 --- /dev/null +++ b/tests/ui/rust-2018/extern-crate-submod.stderr @@ -0,0 +1,16 @@ +error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition + --> $DIR/extern-crate-submod.rs:19:5 + | +LL | use m::edition_lint_paths::foo; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::m::edition_lint_paths::foo` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #53130 +note: the lint level is defined here + --> $DIR/extern-crate-submod.rs:9:9 + | +LL | #![deny(absolute_paths_not_starting_with_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rust-2018/future-proofing-locals.rs b/tests/ui/rust-2018/future-proofing-locals.rs new file mode 100644 index 000000000..2c388cf37 --- /dev/null +++ b/tests/ui/rust-2018/future-proofing-locals.rs @@ -0,0 +1,50 @@ +// edition:2018 + +#![allow(non_camel_case_types)] +#![allow(unused_imports)] + +mod T { + pub struct U; +} +mod x { + pub struct y; +} + +fn type_param() { + use T as _; //~ ERROR imports cannot refer to type parameters + use T::U; //~ ERROR imports cannot refer to type parameters + use T::*; //~ ERROR imports cannot refer to type parameters +} + +fn self_import() { + use T; //~ ERROR imports cannot refer to type parameters +} + +fn let_binding() { + let x = 10; + + use x as _; //~ ERROR imports cannot refer to local variables + use x::y; // OK + use x::*; // OK +} + +fn param_binding(x: u8) { + use x; //~ ERROR imports cannot refer to local variables +} + +fn match_binding() { + match 0 { + x => { + use x; //~ ERROR imports cannot refer to local variables + } + } +} + +fn nested() { + let x = 10; + + use {T as _, x}; //~ ERROR imports cannot refer to type parameters + //~| ERROR imports cannot refer to local variables +} + +fn main() {} diff --git a/tests/ui/rust-2018/future-proofing-locals.stderr b/tests/ui/rust-2018/future-proofing-locals.stderr new file mode 100644 index 000000000..7021489a6 --- /dev/null +++ b/tests/ui/rust-2018/future-proofing-locals.stderr @@ -0,0 +1,56 @@ +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:14:9 + | +LL | use T as _; + | ^ + +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:15:9 + | +LL | use T::U; + | ^ + +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:16:9 + | +LL | use T::*; + | ^ + +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:20:9 + | +LL | use T; + | ^ + +error: imports cannot refer to local variables + --> $DIR/future-proofing-locals.rs:26:9 + | +LL | use x as _; + | ^ + +error: imports cannot refer to local variables + --> $DIR/future-proofing-locals.rs:32:9 + | +LL | use x; + | ^ + +error: imports cannot refer to local variables + --> $DIR/future-proofing-locals.rs:38:17 + | +LL | use x; + | ^ + +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:46:10 + | +LL | use {T as _, x}; + | ^ + +error: imports cannot refer to local variables + --> $DIR/future-proofing-locals.rs:46:18 + | +LL | use {T as _, x}; + | ^ + +error: aborting due to 9 previous errors + diff --git a/tests/ui/rust-2018/issue-51008-1.rs b/tests/ui/rust-2018/issue-51008-1.rs new file mode 100644 index 000000000..8ae5e8278 --- /dev/null +++ b/tests/ui/rust-2018/issue-51008-1.rs @@ -0,0 +1,15 @@ +// Regression test for #51008 -- the anonymous lifetime in `&i32` was +// being incorrectly considered part of the "elided lifetimes" from +// the impl. +// +// run-pass + +#![feature(rust_2018_preview)] + +trait A { + +} + +impl A for F where F: PartialEq { } + +fn main() {} diff --git a/tests/ui/rust-2018/issue-51008.rs b/tests/ui/rust-2018/issue-51008.rs new file mode 100644 index 000000000..b62609e32 --- /dev/null +++ b/tests/ui/rust-2018/issue-51008.rs @@ -0,0 +1,15 @@ +// Regression test for #51008 -- the anonymous lifetime in `&i32` was +// being incorrectly considered part of the "elided lifetimes" from +// the impl. +// +// run-pass + +#![feature(rust_2018_preview)] + +trait A { + +} + +impl A for F where F: FnOnce(&i32) {} + +fn main() {} diff --git a/tests/ui/rust-2018/issue-52202-use-suggestions.rs b/tests/ui/rust-2018/issue-52202-use-suggestions.rs new file mode 100644 index 000000000..1c0426808 --- /dev/null +++ b/tests/ui/rust-2018/issue-52202-use-suggestions.rs @@ -0,0 +1,13 @@ +// edition:2018 + +// The local `use` suggestion should start with `crate::` (but the +// standard-library suggestions should not, obviously). + +mod plumbing { + pub struct Drain; +} + +fn main() { + let _d = Drain {}; + //~^ ERROR cannot find struct, variant or union type `Drain` in this scope +} diff --git a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr new file mode 100644 index 000000000..38cd9713d --- /dev/null +++ b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -0,0 +1,21 @@ +error[E0422]: cannot find struct, variant or union type `Drain` in this scope + --> $DIR/issue-52202-use-suggestions.rs:11:14 + | +LL | let _d = Drain {}; + | ^^^^^ not found in this scope + | +help: consider importing one of these items + | +LL | use crate::plumbing::Drain; + | +LL | use std::collections::binary_heap::Drain; + | +LL | use std::collections::hash_map::Drain; + | +LL | use std::collections::hash_set::Drain; + | + and 3 other candidates + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0422`. diff --git a/tests/ui/rust-2018/issue-54006.rs b/tests/ui/rust-2018/issue-54006.rs new file mode 100644 index 000000000..a7a4770fc --- /dev/null +++ b/tests/ui/rust-2018/issue-54006.rs @@ -0,0 +1,13 @@ +// edition:2018 + +#![no_std] +#![crate_type = "lib"] + +use alloc::vec; +//~^ ERROR unresolved import `alloc` + +pub fn foo() { + let mut xs = vec![]; + //~^ ERROR cannot determine resolution for the macro `vec` + xs.push(0); +} diff --git a/tests/ui/rust-2018/issue-54006.stderr b/tests/ui/rust-2018/issue-54006.stderr new file mode 100644 index 000000000..1978138a6 --- /dev/null +++ b/tests/ui/rust-2018/issue-54006.stderr @@ -0,0 +1,17 @@ +error[E0432]: unresolved import `alloc` + --> $DIR/issue-54006.rs:6:5 + | +LL | use alloc::vec; + | ^^^^^ help: a similar path exists: `core::alloc` + +error: cannot determine resolution for the macro `vec` + --> $DIR/issue-54006.rs:10:18 + | +LL | let mut xs = vec![]; + | ^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed new file mode 100644 index 000000000..d59243800 --- /dev/null +++ b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed @@ -0,0 +1,14 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix +// compile-flags:--extern edition_lint_paths --cfg blandiloquence +// edition:2018 + +#![deny(rust_2018_idioms)] +#![allow(dead_code)] + +// The suggestion span should include the attribute. + + +//~^ ERROR unused extern crate + +fn main() {} diff --git a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs new file mode 100644 index 000000000..a948baee5 --- /dev/null +++ b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs @@ -0,0 +1,15 @@ +// aux-build:edition-lint-paths.rs +// run-rustfix +// compile-flags:--extern edition_lint_paths --cfg blandiloquence +// edition:2018 + +#![deny(rust_2018_idioms)] +#![allow(dead_code)] + +// The suggestion span should include the attribute. + +#[cfg(blandiloquence)] //~ HELP remove it +extern crate edition_lint_paths; +//~^ ERROR unused extern crate + +fn main() {} diff --git a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr new file mode 100644 index 000000000..2ef97e7f2 --- /dev/null +++ b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr @@ -0,0 +1,18 @@ +error: unused extern crate + --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:12:1 + | +LL | / #[cfg(blandiloquence)] +LL | | extern crate edition_lint_paths; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | |________________________________| + | help: remove it + | +note: the lint level is defined here + --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:6:9 + | +LL | #![deny(rust_2018_idioms)] + | ^^^^^^^^^^^^^^^^ + = note: `#[deny(unused_extern_crates)]` implied by `#[deny(rust_2018_idioms)]` + +error: aborting due to previous error + diff --git a/tests/ui/rust-2018/local-path-suggestions-2015.rs b/tests/ui/rust-2018/local-path-suggestions-2015.rs new file mode 100644 index 000000000..32e9c0c33 --- /dev/null +++ b/tests/ui/rust-2018/local-path-suggestions-2015.rs @@ -0,0 +1,26 @@ +// aux-build:baz.rs +// compile-flags:--extern baz +// edition:2015 + +// This test exists to demonstrate the behaviour of the import suggestions +// from the `local-path-suggestions-2018.rs` test when not using the 2018 edition. + +extern crate baz as aux_baz; + +mod foo { + pub type Bar = u32; +} + +mod baz { + use foo::Bar; + + fn baz() { + let x: Bar = 22; + } +} + +use foo::Bar; + +use foobar::Baz; //~ ERROR unresolved import `foobar` + +fn main() { } diff --git a/tests/ui/rust-2018/local-path-suggestions-2015.stderr b/tests/ui/rust-2018/local-path-suggestions-2015.stderr new file mode 100644 index 000000000..666864a18 --- /dev/null +++ b/tests/ui/rust-2018/local-path-suggestions-2015.stderr @@ -0,0 +1,12 @@ +error[E0432]: unresolved import `foobar` + --> $DIR/local-path-suggestions-2015.rs:24:5 + | +LL | use foobar::Baz; + | ^^^^^^ + | | + | unresolved import + | help: a similar path exists: `aux_baz::foobar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/rust-2018/local-path-suggestions-2018.rs b/tests/ui/rust-2018/local-path-suggestions-2018.rs new file mode 100644 index 000000000..5eafbb2c2 --- /dev/null +++ b/tests/ui/rust-2018/local-path-suggestions-2018.rs @@ -0,0 +1,21 @@ +// aux-build:baz.rs +// compile-flags:--extern baz +// edition:2018 + +mod foo { + pub type Bar = u32; +} + +mod bazz { + use foo::Bar; //~ ERROR unresolved import `foo` + + fn baz() { + let x: Bar = 22; + } +} + +use foo::Bar; + +use foobar::Baz; //~ ERROR unresolved import `foobar` + +fn main() { } diff --git a/tests/ui/rust-2018/local-path-suggestions-2018.stderr b/tests/ui/rust-2018/local-path-suggestions-2018.stderr new file mode 100644 index 000000000..40f3d6bf1 --- /dev/null +++ b/tests/ui/rust-2018/local-path-suggestions-2018.stderr @@ -0,0 +1,17 @@ +error[E0432]: unresolved import `foo` + --> $DIR/local-path-suggestions-2018.rs:10:9 + | +LL | use foo::Bar; + | ^^^ help: a similar path exists: `crate::foo` + | + = note: `use` statements changed in Rust 2018; read more at + +error[E0432]: unresolved import `foobar` + --> $DIR/local-path-suggestions-2018.rs:19:5 + | +LL | use foobar::Baz; + | ^^^^^^ help: a similar path exists: `baz::foobar` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/rust-2018/macro-use-warned-against.rs b/tests/ui/rust-2018/macro-use-warned-against.rs new file mode 100644 index 000000000..72f2868e0 --- /dev/null +++ b/tests/ui/rust-2018/macro-use-warned-against.rs @@ -0,0 +1,14 @@ +// aux-build:macro-use-warned-against.rs +// aux-build:macro-use-warned-against2.rs +// check-pass + +#![warn(macro_use_extern_crate, unused)] + +#[macro_use] //~ WARN should be replaced at use sites with a `use` item +extern crate macro_use_warned_against; +#[macro_use] //~ WARN unused `#[macro_use]` +extern crate macro_use_warned_against2; + +fn main() { + foo!(); +} diff --git a/tests/ui/rust-2018/macro-use-warned-against.stderr b/tests/ui/rust-2018/macro-use-warned-against.stderr new file mode 100644 index 000000000..6b46f002e --- /dev/null +++ b/tests/ui/rust-2018/macro-use-warned-against.stderr @@ -0,0 +1,27 @@ +warning: deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead + --> $DIR/macro-use-warned-against.rs:7:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/macro-use-warned-against.rs:5:9 + | +LL | #![warn(macro_use_extern_crate, unused)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused `#[macro_use]` import + --> $DIR/macro-use-warned-against.rs:9:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/macro-use-warned-against.rs:5:33 + | +LL | #![warn(macro_use_extern_crate, unused)] + | ^^^^^^ + = note: `#[warn(unused_imports)]` implied by `#[warn(unused)]` + +warning: 2 warnings emitted + diff --git a/tests/ui/rust-2018/proc-macro-crate-in-paths.rs b/tests/ui/rust-2018/proc-macro-crate-in-paths.rs new file mode 100644 index 000000000..2d4cb6514 --- /dev/null +++ b/tests/ui/rust-2018/proc-macro-crate-in-paths.rs @@ -0,0 +1,16 @@ +// build-pass (FIXME(62277): could be check-pass?) +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![deny(rust_2018_compatibility)] +#![feature(rust_2018_preview)] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Template, attributes(template))] +pub fn derive_template(input: TokenStream) -> TokenStream { + input +} diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed new file mode 100644 index 000000000..832632268 --- /dev/null +++ b/tests/ui/rust-2018/remove-extern-crate.fixed @@ -0,0 +1,39 @@ +// run-rustfix +// edition:2018 +// check-pass +// aux-build:remove-extern-crate.rs +// compile-flags:--extern remove_extern_crate + +#![warn(rust_2018_idioms)] + + //~ WARNING unused extern crate +// Shouldn't suggest changing to `use`, as `another_name` +// would no longer be added to the prelude which could cause +// compilation errors for imports that use `another_name` in other +// modules. See #57672. +extern crate core as another_name; +use remove_extern_crate; +#[macro_use] +extern crate remove_extern_crate as something_else; + +// Shouldn't suggest changing to `use`, as the `alloc` +// crate is not in the extern prelude - see #54381. +extern crate alloc; + +fn main() { + another_name::mem::drop(3); + another::foo(); + remove_extern_crate::foo!(); + bar!(); + alloc::vec![5]; +} + +mod another { + use core; //~ WARNING `extern crate` is not idiomatic + use remove_extern_crate; + + 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 new file mode 100644 index 000000000..bbb84cd46 --- /dev/null +++ b/tests/ui/rust-2018/remove-extern-crate.rs @@ -0,0 +1,39 @@ +// run-rustfix +// edition:2018 +// check-pass +// aux-build:remove-extern-crate.rs +// compile-flags:--extern remove_extern_crate + +#![warn(rust_2018_idioms)] + +extern crate core; //~ WARNING unused extern crate +// Shouldn't suggest changing to `use`, as `another_name` +// would no longer be added to the prelude which could cause +// compilation errors for imports that use `another_name` in other +// modules. See #57672. +extern crate core as another_name; +use remove_extern_crate; +#[macro_use] +extern crate remove_extern_crate as something_else; + +// Shouldn't suggest changing to `use`, as the `alloc` +// crate is not in the extern prelude - see #54381. +extern crate alloc; + +fn main() { + another_name::mem::drop(3); + another::foo(); + remove_extern_crate::foo!(); + bar!(); + alloc::vec![5]; +} + +mod another { + extern crate core; //~ WARNING `extern crate` is not idiomatic + use remove_extern_crate; + + 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 new file mode 100644 index 000000000..bde4c1808 --- /dev/null +++ b/tests/ui/rust-2018/remove-extern-crate.stderr @@ -0,0 +1,21 @@ +warning: unused extern crate + --> $DIR/remove-extern-crate.rs:9:1 + | +LL | extern crate core; + | ^^^^^^^^^^^^^^^^^^ help: remove it + | +note: the lint level is defined here + --> $DIR/remove-extern-crate.rs:7:9 + | +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 + | +LL | extern crate core; + | ^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + +warning: 2 warnings emitted + diff --git a/tests/ui/rust-2018/suggestions-not-always-applicable.fixed b/tests/ui/rust-2018/suggestions-not-always-applicable.fixed new file mode 100644 index 000000000..f5afbad9f --- /dev/null +++ b/tests/ui/rust-2018/suggestions-not-always-applicable.fixed @@ -0,0 +1,23 @@ +// aux-build:suggestions-not-always-applicable.rs +// edition:2015 +// run-rustfix +// rustfix-only-machine-applicable +// check-pass + +#![feature(rust_2018_preview)] +#![warn(rust_2018_compatibility)] + +extern crate suggestions_not_always_applicable as foo; + +pub struct Foo; + +mod test { + use crate::foo::foo; + + #[foo] + fn main() {} +} + +fn main() { + test::foo(); +} diff --git a/tests/ui/rust-2018/suggestions-not-always-applicable.rs b/tests/ui/rust-2018/suggestions-not-always-applicable.rs new file mode 100644 index 000000000..f5afbad9f --- /dev/null +++ b/tests/ui/rust-2018/suggestions-not-always-applicable.rs @@ -0,0 +1,23 @@ +// aux-build:suggestions-not-always-applicable.rs +// edition:2015 +// run-rustfix +// rustfix-only-machine-applicable +// check-pass + +#![feature(rust_2018_preview)] +#![warn(rust_2018_compatibility)] + +extern crate suggestions_not_always_applicable as foo; + +pub struct Foo; + +mod test { + use crate::foo::foo; + + #[foo] + fn main() {} +} + +fn main() { + test::foo(); +} diff --git a/tests/ui/rust-2018/trait-import-suggestions.rs b/tests/ui/rust-2018/trait-import-suggestions.rs new file mode 100644 index 000000000..9c67c3f4b --- /dev/null +++ b/tests/ui/rust-2018/trait-import-suggestions.rs @@ -0,0 +1,31 @@ +// edition:2018 +// aux-build:trait-import-suggestions.rs +// compile-flags:--extern trait-import-suggestions + +mod foo { + mod foobar { + pub(crate) trait Foobar { + fn foobar(&self) { } + } + + impl Foobar for u32 { } + } + + pub(crate) trait Bar { + fn bar(&self) { } + } + + impl Bar for u32 { } + + fn in_foo() { + let x: u32 = 22; + x.foobar(); //~ ERROR no method named `foobar` + } +} + +fn main() { + let x: u32 = 22; + x.bar(); //~ ERROR no method named `bar` + x.baz(); //~ ERROR no method named `baz` + let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` +} diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr new file mode 100644 index 000000000..6454b6045 --- /dev/null +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -0,0 +1,55 @@ +error[E0599]: no method named `foobar` found for type `u32` in the current scope + --> $DIR/trait-import-suggestions.rs:22:11 + | +LL | fn foobar(&self) { } + | ------ the method is available for `u32` here +... +LL | x.foobar(); + | ^^^^^^ method not found in `u32` + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use crate::foo::foobar::Foobar; + | + +error[E0599]: no method named `bar` found for type `u32` in the current scope + --> $DIR/trait-import-suggestions.rs:28:7 + | +LL | fn bar(&self) { } + | --- the method is available for `u32` here +... +LL | x.bar(); + | ^^^ method not found in `u32` + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use crate::foo::Bar; + | + +error[E0599]: no method named `baz` found for type `u32` in the current scope + --> $DIR/trait-import-suggestions.rs:29:7 + | +LL | x.baz(); + | ^^^ method not found in `u32` + +error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope + --> $DIR/trait-import-suggestions.rs:30:18 + | +LL | let y = u32::from_str("33"); + | ^^^^^^^^ function or associated item not found in `u32` + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use std::str::FromStr; + | +help: there is an associated function with a similar name + | +LL | let y = u32::from_str_radix("33"); + | ~~~~~~~~~~~~~~ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/rust-2018/try-ident.fixed b/tests/ui/rust-2018/try-ident.fixed new file mode 100644 index 000000000..985348665 --- /dev/null +++ b/tests/ui/rust-2018/try-ident.fixed @@ -0,0 +1,15 @@ +// run-rustfix +// check-pass + +#![warn(rust_2018_compatibility)] + +fn main() { + r#try(); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this is accepted in the current edition +} + +fn r#try() { + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/try-ident.rs b/tests/ui/rust-2018/try-ident.rs new file mode 100644 index 000000000..2c02b7596 --- /dev/null +++ b/tests/ui/rust-2018/try-ident.rs @@ -0,0 +1,15 @@ +// run-rustfix +// check-pass + +#![warn(rust_2018_compatibility)] + +fn main() { + try(); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this is accepted in the current edition +} + +fn try() { + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this is accepted in the current edition +} diff --git a/tests/ui/rust-2018/try-ident.stderr b/tests/ui/rust-2018/try-ident.stderr new file mode 100644 index 000000000..74015ac9d --- /dev/null +++ b/tests/ui/rust-2018/try-ident.stderr @@ -0,0 +1,26 @@ +warning: `try` is a keyword in the 2018 edition + --> $DIR/try-ident.rs:7:5 + | +LL | try(); + | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 +note: the lint level is defined here + --> $DIR/try-ident.rs:4:9 + | +LL | #![warn(rust_2018_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(keyword_idents)]` implied by `#[warn(rust_2018_compatibility)]` + +warning: `try` is a keyword in the 2018 edition + --> $DIR/try-ident.rs:12:4 + | +LL | fn try() { + | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 + +warning: 2 warnings emitted + diff --git a/tests/ui/rust-2018/try-macro.fixed b/tests/ui/rust-2018/try-macro.fixed new file mode 100644 index 000000000..3308870f6 --- /dev/null +++ b/tests/ui/rust-2018/try-macro.fixed @@ -0,0 +1,18 @@ +// Test that `try!` macros are rewritten. + +// run-rustfix +// check-pass + +#![warn(rust_2018_compatibility)] +#![allow(dead_code)] +#![allow(deprecated)] + +fn foo() -> Result { + let x: Result = Ok(22); + r#try!(x); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this is accepted in the current edition + Ok(44) +} + +fn main() {} diff --git a/tests/ui/rust-2018/try-macro.rs b/tests/ui/rust-2018/try-macro.rs new file mode 100644 index 000000000..69e87a1ff --- /dev/null +++ b/tests/ui/rust-2018/try-macro.rs @@ -0,0 +1,18 @@ +// Test that `try!` macros are rewritten. + +// run-rustfix +// check-pass + +#![warn(rust_2018_compatibility)] +#![allow(dead_code)] +#![allow(deprecated)] + +fn foo() -> Result { + let x: Result = Ok(22); + try!(x); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this is accepted in the current edition + Ok(44) +} + +fn main() {} diff --git a/tests/ui/rust-2018/try-macro.stderr b/tests/ui/rust-2018/try-macro.stderr new file mode 100644 index 000000000..760378f09 --- /dev/null +++ b/tests/ui/rust-2018/try-macro.stderr @@ -0,0 +1,17 @@ +warning: `try` is a keyword in the 2018 edition + --> $DIR/try-macro.rs:12:5 + | +LL | try!(x); + | ^^^ help: you can use a raw identifier to stay compatible: `r#try` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! + = note: for more information, see issue #49716 +note: the lint level is defined here + --> $DIR/try-macro.rs:6:9 + | +LL | #![warn(rust_2018_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(keyword_idents)]` implied by `#[warn(rust_2018_compatibility)]` + +warning: 1 warning emitted + diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs new file mode 100644 index 000000000..678b4774d --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs @@ -0,0 +1,21 @@ +// edition:2018 + +// This test is similar to `ambiguity-macros.rs`, but nested in a module. + +#![allow(non_camel_case_types)] + +mod foo { + pub use std::io; + //~^ ERROR `std` is ambiguous + + macro_rules! m { + () => { + mod std { + pub struct io; + } + } + } + m!(); +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr new file mode 100644 index 000000000..7e008d465 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr @@ -0,0 +1,25 @@ +error[E0659]: `std` is ambiguous + --> $DIR/ambiguity-macros-nested.rs:8:13 + | +LL | pub use std::io; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources + = note: `std` could refer to a built-in crate + = help: use `::std` to refer to this crate unambiguously +note: `std` could also refer to the module defined here + --> $DIR/ambiguity-macros-nested.rs:13:13 + | +LL | / mod std { +LL | | pub struct io; +LL | | } + | |_____________^ +... +LL | m!(); + | ---- in this macro invocation + = help: use `self::std` to refer to this module unambiguously + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs new file mode 100644 index 000000000..56ea726d7 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs @@ -0,0 +1,19 @@ +// edition:2018 + +// This test is similar to `ambiguity.rs`, but with macros defining local items. + +#![allow(non_camel_case_types)] + +use std::io; +//~^ ERROR `std` is ambiguous + +macro_rules! m { + () => { + mod std { + pub struct io; + } + } +} +m!(); + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr new file mode 100644 index 000000000..771d2c10c --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr @@ -0,0 +1,25 @@ +error[E0659]: `std` is ambiguous + --> $DIR/ambiguity-macros.rs:7:5 + | +LL | use std::io; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources + = note: `std` could refer to a built-in crate + = help: use `::std` to refer to this crate unambiguously +note: `std` could also refer to the module defined here + --> $DIR/ambiguity-macros.rs:12:9 + | +LL | / mod std { +LL | | pub struct io; +LL | | } + | |_________^ +... +LL | m!(); + | ---- in this macro invocation + = help: use `crate::std` to refer to this module unambiguously + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs new file mode 100644 index 000000000..50c8fc822 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs @@ -0,0 +1,16 @@ +// edition:2018 + +// This test is similar to `ambiguity.rs`, but nested in a module. + +#![allow(non_camel_case_types)] + +mod foo { + pub use std::io; + //~^ ERROR `std` is ambiguous + + mod std { + pub struct io; + } +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr new file mode 100644 index 000000000..defb16f79 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr @@ -0,0 +1,21 @@ +error[E0659]: `std` is ambiguous + --> $DIR/ambiguity-nested.rs:8:13 + | +LL | pub use std::io; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources + = note: `std` could refer to a built-in crate + = help: use `::std` to refer to this crate unambiguously +note: `std` could also refer to the module defined here + --> $DIR/ambiguity-nested.rs:11:5 + | +LL | / mod std { +LL | | pub struct io; +LL | | } + | |_____^ + = help: use `self::std` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity.rs b/tests/ui/rust-2018/uniform-paths/ambiguity.rs new file mode 100644 index 000000000..60f77a1c6 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity.rs @@ -0,0 +1,12 @@ +// edition:2018 + +#![allow(non_camel_case_types)] + +use std::io; +//~^ ERROR `std` is ambiguous + +mod std { + pub struct io; +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity.stderr new file mode 100644 index 000000000..2d735c7e3 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/ambiguity.stderr @@ -0,0 +1,21 @@ +error[E0659]: `std` is ambiguous + --> $DIR/ambiguity.rs:5:5 + | +LL | use std::io; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources + = note: `std` could refer to a built-in crate + = help: use `::std` to refer to this crate unambiguously +note: `std` could also refer to the module defined here + --> $DIR/ambiguity.rs:8:1 + | +LL | / mod std { +LL | | pub struct io; +LL | | } + | |_^ + = help: use `crate::std` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs new file mode 100644 index 000000000..4aa5d1870 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs @@ -0,0 +1,5 @@ +// edition:2018 + +pub use ignore as built_in_attr; +pub use u8 as built_in_type; +pub use rustfmt as tool_mod; diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs new file mode 100644 index 000000000..1ce9841c1 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs @@ -0,0 +1 @@ +pub trait Trait { fn no_op(&self); } diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs new file mode 100644 index 000000000..db723075f --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs @@ -0,0 +1 @@ +pub extern crate core; diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs new file mode 100644 index 000000000..bc010a3dd --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs @@ -0,0 +1 @@ +// Nothing here diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs new file mode 100644 index 000000000..8fd2d77be --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs @@ -0,0 +1,3 @@ +pub trait Deserialize { + fn deserialize(); +} diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs new file mode 100644 index 000000000..3f5897901 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs @@ -0,0 +1,20 @@ +// edition:2018 + +mod my { + pub mod sub { + pub fn bar() {} + } +} + +mod sub { + pub fn bar() {} +} + +fn foo() { + use my::sub; + { + use sub::bar; //~ ERROR `sub` is ambiguous + } +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr new file mode 100644 index 000000000..3d45a8140 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr @@ -0,0 +1,24 @@ +error[E0659]: `sub` is ambiguous + --> $DIR/block-scoped-shadow-nested.rs:16:13 + | +LL | use sub::bar; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources +note: `sub` could refer to the module imported here + --> $DIR/block-scoped-shadow-nested.rs:14:9 + | +LL | use my::sub; + | ^^^^^^^ +note: `sub` could also refer to the module defined here + --> $DIR/block-scoped-shadow-nested.rs:9:1 + | +LL | / mod sub { +LL | | pub fn bar() {} +LL | | } + | |_^ + = help: use `crate::sub` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs new file mode 100644 index 000000000..828ee4fe4 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs @@ -0,0 +1,21 @@ +// edition:2018 + +#![allow(non_camel_case_types)] + +enum Foo {} + +struct std; + +fn main() { + enum Foo { A, B } + use Foo::*; + //~^ ERROR `Foo` is ambiguous + + let _ = (A, B); + + fn std() {} + enum std {} + use std as foo; + //~^ ERROR `std` is ambiguous + //~| ERROR `std` is ambiguous +} diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr new file mode 100644 index 000000000..b068312ce --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr @@ -0,0 +1,60 @@ +error[E0659]: `Foo` is ambiguous + --> $DIR/block-scoped-shadow.rs:11:9 + | +LL | use Foo::*; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources +note: `Foo` could refer to the enum defined here + --> $DIR/block-scoped-shadow.rs:10:5 + | +LL | enum Foo { A, B } + | ^^^^^^^^^^^^^^^^^ +note: `Foo` could also refer to the enum defined here + --> $DIR/block-scoped-shadow.rs:5:1 + | +LL | enum Foo {} + | ^^^^^^^^^^^ + = help: use `crate::Foo` to refer to this enum unambiguously + +error[E0659]: `std` is ambiguous + --> $DIR/block-scoped-shadow.rs:18:9 + | +LL | use std as foo; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources +note: `std` could refer to the enum defined here + --> $DIR/block-scoped-shadow.rs:17:5 + | +LL | enum std {} + | ^^^^^^^^^^^ +note: `std` could also refer to the struct defined here + --> $DIR/block-scoped-shadow.rs:7:1 + | +LL | struct std; + | ^^^^^^^^^^^ + = help: use `crate::std` to refer to this struct unambiguously + +error[E0659]: `std` is ambiguous + --> $DIR/block-scoped-shadow.rs:18:9 + | +LL | use std as foo; + | ^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources +note: `std` could refer to the function defined here + --> $DIR/block-scoped-shadow.rs:16:5 + | +LL | fn std() {} + | ^^^^^^^^^^^ +note: `std` could also refer to the unit struct defined here + --> $DIR/block-scoped-shadow.rs:7:1 + | +LL | struct std; + | ^^^^^^^^^^^ + = help: use `crate::std` to refer to this unit struct unambiguously + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/cross-crate.rs b/tests/ui/rust-2018/uniform-paths/cross-crate.rs new file mode 100644 index 000000000..0ca7fa37a --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/cross-crate.rs @@ -0,0 +1,12 @@ +// edition:2018 +// aux-build:cross-crate.rs + +extern crate cross_crate; +use cross_crate::*; + +#[built_in_attr] //~ ERROR cannot use a built-in attribute through an import +#[tool_mod::skip] //~ ERROR cannot use a tool module through an import + //~| ERROR cannot use a tool module through an import +fn main() { + let _: built_in_type; // OK +} diff --git a/tests/ui/rust-2018/uniform-paths/cross-crate.stderr b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr new file mode 100644 index 000000000..45f77a0c9 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr @@ -0,0 +1,38 @@ +error: cannot use a built-in attribute through an import + --> $DIR/cross-crate.rs:7:3 + | +LL | #[built_in_attr] + | ^^^^^^^^^^^^^ + | +note: the built-in attribute imported here + --> $DIR/cross-crate.rs:5:5 + | +LL | use cross_crate::*; + | ^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/cross-crate.rs:8:3 + | +LL | #[tool_mod::skip] + | ^^^^^^^^ + | +note: the tool module imported here + --> $DIR/cross-crate.rs:5:5 + | +LL | use cross_crate::*; + | ^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/cross-crate.rs:8:3 + | +LL | #[tool_mod::skip] + | ^^^^^^^^ + | +note: the tool module imported here + --> $DIR/cross-crate.rs:5:5 + | +LL | use cross_crate::*; + | ^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/rust-2018/uniform-paths/deadlock.rs b/tests/ui/rust-2018/uniform-paths/deadlock.rs new file mode 100644 index 000000000..2427bde6d --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/deadlock.rs @@ -0,0 +1,8 @@ +// edition:2018 +// compile-flags:--extern foo --extern bar + +use bar::foo; //~ ERROR can't find crate for `bar` +use foo::bar; //~ ERROR can't find crate for `foo` +//~^^ ERROR unresolved imports `bar::foo`, `foo::bar` + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/deadlock.stderr b/tests/ui/rust-2018/uniform-paths/deadlock.stderr new file mode 100644 index 000000000..8b9863948 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/deadlock.stderr @@ -0,0 +1,24 @@ +error[E0463]: can't find crate for `bar` + --> $DIR/deadlock.rs:4:5 + | +LL | use bar::foo; + | ^^^ can't find crate + +error[E0463]: can't find crate for `foo` + --> $DIR/deadlock.rs:5:5 + | +LL | use foo::bar; + | ^^^ can't find crate + +error[E0432]: unresolved imports `bar::foo`, `foo::bar` + --> $DIR/deadlock.rs:4:5 + | +LL | use bar::foo; + | ^^^^^^^^ +LL | use foo::bar; + | ^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0432, E0463. +For more information about an error, try `rustc --explain E0432`. diff --git a/tests/ui/rust-2018/uniform-paths/fn-local-enum.rs b/tests/ui/rust-2018/uniform-paths/fn-local-enum.rs new file mode 100644 index 000000000..c6525869b --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/fn-local-enum.rs @@ -0,0 +1,13 @@ +// build-pass (FIXME(62277): could be check-pass?) +// edition:2018 + +fn main() { + enum E { A, B, C } + + use E::*; + match A { + A => {} + B => {} + C => {} + } +} diff --git a/tests/ui/rust-2018/uniform-paths/from-decl-macro.rs b/tests/ui/rust-2018/uniform-paths/from-decl-macro.rs new file mode 100644 index 000000000..9af520a07 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/from-decl-macro.rs @@ -0,0 +1,12 @@ +// build-pass (FIXME(62277): could be check-pass?) +// edition:2018 + +#![feature(decl_macro)] + +macro check() { + ::std::vec::Vec::::new() +} + +fn main() { + check!(); +} diff --git a/tests/ui/rust-2018/uniform-paths/issue-54253.rs b/tests/ui/rust-2018/uniform-paths/issue-54253.rs new file mode 100644 index 000000000..7db469945 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-54253.rs @@ -0,0 +1,17 @@ +// edition:2018 + +// Dummy import that previously introduced uniform path canaries. +use std; + +// fn version() -> &'static str {""} + +mod foo { + // Error wasn't reported, despite `version` being commented out above. + use crate::version; //~ ERROR unresolved import `crate::version` + + fn bar() { + version(); + } +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/issue-54253.stderr b/tests/ui/rust-2018/uniform-paths/issue-54253.stderr new file mode 100644 index 000000000..adde63590 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-54253.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `crate::version` + --> $DIR/issue-54253.rs:10:9 + | +LL | use crate::version; + | ^^^^^^^^^^^^^^ no `version` in the root + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/rust-2018/uniform-paths/issue-55779.rs b/tests/ui/rust-2018/uniform-paths/issue-55779.rs new file mode 100644 index 000000000..0af17a89b --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-55779.rs @@ -0,0 +1,29 @@ +// run-pass +// edition:2018 +// aux-crate:issue_55779_extern_trait=issue-55779-extern-trait.rs + +use issue_55779_extern_trait::Trait; + +struct Local; +struct Helper; + +impl Trait for Local { + fn no_op(&self) + { + // (Unused) extern crate declaration necessary to reproduce bug + extern crate issue_55779_extern_trait; + + // This one works + // impl Trait for Helper { fn no_op(&self) { } } + + // This one infinite-loops + const _IMPL_SERIALIZE_FOR_HELPER: () = { + // (extern crate can also appear here to reproduce bug, + // as in originating example from serde) + impl Trait for Helper { fn no_op(&self) { } } + }; + + } +} + +fn main() { } diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596-2.rs b/tests/ui/rust-2018/uniform-paths/issue-56596-2.rs new file mode 100644 index 000000000..9ea7e496d --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-56596-2.rs @@ -0,0 +1,11 @@ +// check-pass +// edition:2018 +// compile-flags: --extern issue_56596_2 +// aux-build:issue-56596-2.rs + +mod m { + use core::any; + pub use issue_56596_2::*; +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596.rs b/tests/ui/rust-2018/uniform-paths/issue-56596.rs new file mode 100644 index 000000000..ec5bb656a --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-56596.rs @@ -0,0 +1,12 @@ +// edition:2018 +// compile-flags: --extern issue_56596 +// aux-build:issue-56596.rs + +mod m { + pub mod issue_56596 {} +} + +use m::*; +use issue_56596; //~ ERROR `issue_56596` is ambiguous + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596.stderr b/tests/ui/rust-2018/uniform-paths/issue-56596.stderr new file mode 100644 index 000000000..8b8ab26dc --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-56596.stderr @@ -0,0 +1,19 @@ +error[E0659]: `issue_56596` is ambiguous + --> $DIR/issue-56596.rs:10:5 + | +LL | use issue_56596; + | ^^^^^^^^^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources + = note: `issue_56596` could refer to a crate passed with `--extern` + = help: use `::issue_56596` to refer to this crate unambiguously +note: `issue_56596` could also refer to the module imported here + --> $DIR/issue-56596.rs:9:5 + | +LL | use m::*; + | ^^^^ + = help: use `crate::issue_56596` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.rs b/tests/ui/rust-2018/uniform-paths/issue-87932.rs new file mode 100644 index 000000000..70a641d8a --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.rs @@ -0,0 +1,15 @@ +// edition:2018 +// aux-crate:issue_87932_a=issue-87932-a.rs + +pub struct A {} + +impl issue_87932_a::Deserialize for A { + fn deserialize() { + extern crate issue_87932_a as _a; + } +} + +fn main() { + A::deserialize(); + //~^ ERROR no function or associated item named `deserialize` found for struct `A` +} diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr new file mode 100644 index 000000000..b52720ae3 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr @@ -0,0 +1,18 @@ +error[E0599]: no function or associated item named `deserialize` found for struct `A` in the current scope + --> $DIR/issue-87932.rs:13:8 + | +LL | pub struct A {} + | ------------ function or associated item `deserialize` not found for this struct +... +LL | A::deserialize(); + | ^^^^^^^^^^^ function or associated item not found in `A` + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use ::deserialize::_a::Deserialize; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.rs b/tests/ui/rust-2018/uniform-paths/macro-rules.rs new file mode 100644 index 000000000..2d9a6a9a9 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/macro-rules.rs @@ -0,0 +1,43 @@ +// edition:2018 + +#![feature(decl_macro)] + +mod m1 { + // Non-exported legacy macros are treated as `pub(crate)`. + macro_rules! legacy_macro { () => () } + + use legacy_macro as _; // OK + pub(crate) use legacy_macro as _; // OK + pub use legacy_macro as _; //~ ERROR `legacy_macro` is only public within the crate, and cannot be re-exported outside +} + +mod m2 { + macro_rules! legacy_macro { () => () } + + #[allow(non_camel_case_types)] + type legacy_macro = u8; + + // Legacy macro imports don't prevent names from other namespaces from being imported. + use legacy_macro as _; // OK +} + +mod m3 { + macro legacy_macro() {} + + fn f() { + macro_rules! legacy_macro { () => () } + + // Legacy macro imports create ambiguities with other names in the same namespace. + use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous + } +} + +mod exported { + // Exported legacy macros are treated as `pub`. + #[macro_export] + macro_rules! legacy_macro { () => () } + + pub use legacy_macro as _; // OK +} + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr new file mode 100644 index 000000000..9f8c928c3 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -0,0 +1,35 @@ +error[E0364]: `legacy_macro` is only public within the crate, and cannot be re-exported outside + --> $DIR/macro-rules.rs:11:13 + | +LL | pub use legacy_macro as _; + | ^^^^^^^^^^^^^^^^^ + | +help: consider adding a `#[macro_export]` to the macro in the imported module + --> $DIR/macro-rules.rs:7:5 + | +LL | macro_rules! legacy_macro { () => () } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0659]: `legacy_macro` is ambiguous + --> $DIR/macro-rules.rs:31:13 + | +LL | use legacy_macro as _; + | ^^^^^^^^^^^^ ambiguous name + | + = note: ambiguous because of multiple potential import sources +note: `legacy_macro` could refer to the macro defined here + --> $DIR/macro-rules.rs:28:9 + | +LL | macro_rules! legacy_macro { () => () } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `legacy_macro` could also refer to the macro defined here + --> $DIR/macro-rules.rs:25:5 + | +LL | macro legacy_macro() {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + = help: use `self::legacy_macro` to refer to this macro unambiguously + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0364, E0659. +For more information about an error, try `rustc --explain E0364`. diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs new file mode 100644 index 000000000..44da71de0 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs @@ -0,0 +1,21 @@ +// edition:2018 + +// Built-in attribute +use inline as imported_inline; +mod builtin { + pub use inline as imported_inline; +} + +// Tool module +use rustfmt as imported_rustfmt; +mod tool_mod { + pub use rustfmt as imported_rustfmt; +} + +#[imported_inline] //~ ERROR cannot use a built-in attribute through an import +#[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import +#[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import + //~| ERROR cannot use a tool module through an import +#[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import + //~| ERROR cannot use a tool module through an import +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr new file mode 100644 index 000000000..908bb4985 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr @@ -0,0 +1,68 @@ +error: cannot use a built-in attribute through an import + --> $DIR/prelude-fail-2.rs:15:3 + | +LL | #[imported_inline] + | ^^^^^^^^^^^^^^^ + | +note: the built-in attribute imported here + --> $DIR/prelude-fail-2.rs:4:5 + | +LL | use inline as imported_inline; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a built-in attribute through an import + --> $DIR/prelude-fail-2.rs:16:3 + | +LL | #[builtin::imported_inline] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:17:3 + | +LL | #[imported_rustfmt::skip] + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:10:5 + | +LL | use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:19:13 + | +LL | #[tool_mod::imported_rustfmt::skip] + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:12:13 + | +LL | pub use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:17:3 + | +LL | #[imported_rustfmt::skip] + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:10:5 + | +LL | use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:19:13 + | +LL | #[tool_mod::imported_rustfmt::skip] + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:12:13 + | +LL | pub use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail.rs b/tests/ui/rust-2018/uniform-paths/prelude-fail.rs new file mode 100644 index 000000000..48c33d720 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/prelude-fail.rs @@ -0,0 +1,6 @@ +// edition:2018 + +// Tool attribute +use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt` + +fn main() {} diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail.stderr b/tests/ui/rust-2018/uniform-paths/prelude-fail.stderr new file mode 100644 index 000000000..97d4c7367 --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/prelude-fail.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `rustfmt` + --> $DIR/prelude-fail.rs:4:5 + | +LL | use rustfmt::skip as imported_rustfmt_skip; + | ^^^^^^^ `rustfmt` is a tool module, not a module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/rust-2018/uniform-paths/prelude.rs b/tests/ui/rust-2018/uniform-paths/prelude.rs new file mode 100644 index 000000000..65763614c --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/prelude.rs @@ -0,0 +1,22 @@ +// build-pass (FIXME(62277): could be check-pass?) +// edition:2018 + +// Macro imported with `#[macro_use] extern crate` +use vec as imported_vec; + +// Standard library prelude +use Vec as ImportedVec; + +// Built-in type +use u8 as imported_u8; + +// Built-in macro +use env as env_imported; + +type A = imported_u8; + +fn main() { + imported_vec![0]; + ImportedVec::::new(); + env_imported!("PATH"); +} diff --git a/tests/ui/rust-2018/uniform-paths/redundant.rs b/tests/ui/rust-2018/uniform-paths/redundant.rs new file mode 100644 index 000000000..fd7fc7fbd --- /dev/null +++ b/tests/ui/rust-2018/uniform-paths/redundant.rs @@ -0,0 +1,20 @@ +// run-pass +// edition:2018 + +use std; +use std::io; + +mod foo { + pub use std as my_std; +} + +mod bar { + pub use std::{self}; +} + +fn main() { + let _ = io::stdout(); + let _ = self::std::io::stdout(); + let _ = foo::my_std::io::stdout(); + let _ = bar::std::io::stdout(); +} diff --git a/tests/ui/rust-2018/unresolved-asterisk-imports.rs b/tests/ui/rust-2018/unresolved-asterisk-imports.rs new file mode 100644 index 000000000..ad1064570 --- /dev/null +++ b/tests/ui/rust-2018/unresolved-asterisk-imports.rs @@ -0,0 +1,6 @@ +// edition:2018 + +use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate +use std as foo; + +fn main() {} diff --git a/tests/ui/rust-2018/unresolved-asterisk-imports.stderr b/tests/ui/rust-2018/unresolved-asterisk-imports.stderr new file mode 100644 index 000000000..09e9edc63 --- /dev/null +++ b/tests/ui/rust-2018/unresolved-asterisk-imports.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `not_existing_crate` + --> $DIR/unresolved-asterisk-imports.rs:3:5 + | +LL | use not_existing_crate::*; + | ^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `not_existing_crate` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. -- cgit v1.2.3