diff options
Diffstat (limited to 'tests')
38 files changed, 670 insertions, 73 deletions
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff index 54875cadec5..b461869be31 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff @@ -8,20 +8,20 @@ let mut _3: u8; bb0: { -- StorageLive(_2); -+ nop; - StorageLive(_3); - _3 = _1; + StorageLive(_2); +- StorageLive(_3); +- _3 = _1; - _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; -+ _1 = dummy(move _3) -> [return: bb1, unwind unreachable]; ++ nop; ++ nop; ++ _2 = dummy(move _1) -> [return: bb1, unwind unreachable]; } bb1: { - StorageDead(_3); -- _1 = move _2; -- StorageDead(_2); -+ nop; +- StorageDead(_3); + nop; + _1 = move _2; + StorageDead(_2); _0 = const (); return; } diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff index b4c8a89278b..d5c2e07c6c2 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff @@ -8,20 +8,20 @@ let mut _3: u8; bb0: { -- StorageLive(_2); -+ nop; - StorageLive(_3); - _3 = _1; + StorageLive(_2); +- StorageLive(_3); +- _3 = _1; - _2 = dummy(move _3) -> [return: bb1, unwind continue]; -+ _1 = dummy(move _3) -> [return: bb1, unwind continue]; ++ nop; ++ nop; ++ _2 = dummy(move _1) -> [return: bb1, unwind continue]; } bb1: { - StorageDead(_3); -- _1 = move _2; -- StorageDead(_2); -+ nop; +- StorageDead(_3); + nop; + _1 = move _2; + StorageDead(_2); _0 = const (); return; } diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index f9f9c4f4de8..16d171260da 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -24,7 +24,7 @@ const PARSED = [ original: "-> *", returned: [], userQuery: "-> *", - error: "Unexpected `*`", + error: "Unexpected `*` after ` `", }, { query: 'a<"P">', @@ -108,22 +108,13 @@ const PARSED = [ error: "Unexpected `::`: paths cannot start with `::`", }, { - query: "((a))", - elems: [], - foundElems: 0, - original: "((a))", - returned: [], - userQuery: "((a))", - error: "Unexpected `(`", - }, - { query: "(p -> p", elems: [], foundElems: 0, original: "(p -> p", returned: [], userQuery: "(p -> p", - error: "Unexpected `(`", + error: "Unexpected `-` after `(`", }, { query: "::a::b", @@ -204,7 +195,7 @@ const PARSED = [ original: "a (b:", returned: [], userQuery: "a (b:", - error: "Unexpected `(`", + error: "Expected `,`, `:` or `->`, found `(`", }, { query: "_:", @@ -249,7 +240,7 @@ const PARSED = [ original: "ab'", returned: [], userQuery: "ab'", - error: "Unexpected `'`", + error: "Unexpected `'` after `b`", }, { query: "a->", diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js index 239391bed42..1de52af94e6 100644 --- a/tests/rustdoc-js-std/parser-slice-array.js +++ b/tests/rustdoc-js-std/parser-slice-array.js @@ -267,6 +267,24 @@ const PARSED = [ error: "Unexpected `]`", }, { + query: '[a<b>', + elems: [], + foundElems: 0, + original: "[a<b>", + returned: [], + userQuery: "[a<b>", + error: "Unclosed `[`", + }, + { + query: 'a<b>]', + elems: [], + foundElems: 0, + original: "a<b>]", + returned: [], + userQuery: "a<b>]", + error: "Unexpected `]` after `>`", + }, + { query: 'primitive:[u8]', elems: [ { diff --git a/tests/rustdoc-js-std/parser-tuple.js b/tests/rustdoc-js-std/parser-tuple.js new file mode 100644 index 00000000000..eb16289d3c0 --- /dev/null +++ b/tests/rustdoc-js-std/parser-tuple.js @@ -0,0 +1,365 @@ +const PARSED = [ + { + query: '(((D, ()))', + elems: [], + foundElems: 0, + original: '(((D, ()))', + returned: [], + userQuery: '(((d, ()))', + error: 'Unclosed `(`', + }, + { + query: '(((D, ())))', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [ + { + name: "d", + fullPath: ["d"], + pathWithoutLast: [], + pathLast: "d", + generics: [], + typeFilter: -1, + }, + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [], + typeFilter: 1, + }, + ], + typeFilter: 1, + } + ], + foundElems: 1, + original: '(((D, ())))', + returned: [], + userQuery: '(((d, ())))', + error: null, + }, + { + query: '(),u8', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [], + typeFilter: 1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 2, + original: "(),u8", + returned: [], + userQuery: "(),u8", + error: null, + }, + // Parens act as grouping operators when: + // - there's no commas directly nested within + // - there's at least two child types (zero means unit) + // - it's not tagged with a type filter + // Otherwise, they represent unit and/or tuple. To search for + // unit or tuple specifically, use `primitive:unit` or `primitive:tuple<...>`. + { + query: '(u8)', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "(u8)", + returned: [], + userQuery: "(u8)", + error: null, + }, + { + query: '(u8,)', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "(u8,)", + returned: [], + userQuery: "(u8,)", + error: null, + }, + { + query: '(,u8)', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "(,u8)", + returned: [], + userQuery: "(,u8)", + error: null, + }, + { + query: 'primitive:(u8)', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "primitive:(u8)", + returned: [], + userQuery: "primitive:(u8)", + error: null, + }, + { + query: '(primitive:u8)', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "(primitive:u8)", + returned: [], + userQuery: "(primitive:u8)", + error: null, + }, + { + query: '(u8,u8)', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "(u8,u8)", + returned: [], + userQuery: "(u8,u8)", + error: null, + }, + { + query: '(u8<u8>)', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "(u8<u8>)", + returned: [], + userQuery: "(u8<u8>)", + error: null, + }, + { + query: '()', + elems: [ + { + name: "()", + fullPath: ["()"], + pathWithoutLast: [], + pathLast: "()", + generics: [], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "()", + returned: [], + userQuery: "()", + error: null, + }, + { + query: '(>', + elems: [], + foundElems: 0, + original: "(>", + returned: [], + userQuery: "(>", + error: "Unexpected `>` after `(`", + }, + { + query: '(<', + elems: [], + foundElems: 0, + original: "(<", + returned: [], + userQuery: "(<", + error: "Found generics without a path", + }, + { + query: '(a>', + elems: [], + foundElems: 0, + original: "(a>", + returned: [], + userQuery: "(a>", + error: "Unexpected `>` after `(`", + }, + { + query: '(a<', + elems: [], + foundElems: 0, + original: "(a<", + returned: [], + userQuery: "(a<", + error: "Unclosed `<`", + }, + { + query: '(a', + elems: [], + foundElems: 0, + original: "(a", + returned: [], + userQuery: "(a", + error: "Unclosed `(`", + }, + { + query: '(', + elems: [], + foundElems: 0, + original: "(", + returned: [], + userQuery: "(", + error: "Unclosed `(`", + }, + { + query: ')', + elems: [], + foundElems: 0, + original: ")", + returned: [], + userQuery: ")", + error: "Unexpected `)`", + }, + { + query: '(a<b>', + elems: [], + foundElems: 0, + original: "(a<b>", + returned: [], + userQuery: "(a<b>", + error: "Unclosed `(`", + }, + { + query: 'a<b>)', + elems: [], + foundElems: 0, + original: "a<b>)", + returned: [], + userQuery: "a<b>)", + error: "Unexpected `)` after `>`", + }, + { + query: 'macro:(u8)', + elems: [], + foundElems: 0, + original: "macro:(u8)", + returned: [], + userQuery: "macro:(u8)", + error: "Invalid search type: primitive `()` and `macro` both specified", + }, +]; diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js index ba68c9717c5..26b8c32d680 100644 --- a/tests/rustdoc-js-std/parser-weird-queries.js +++ b/tests/rustdoc-js-std/parser-weird-queries.js @@ -44,7 +44,7 @@ const PARSED = [ original: "a,b(c)", returned: [], userQuery: "a,b(c)", - error: "Unexpected `(`", + error: "Expected `,`, `:` or `->`, found `(`", }, { query: 'aaa,a', diff --git a/tests/rustdoc-js/tuple-unit.js b/tests/rustdoc-js/tuple-unit.js new file mode 100644 index 00000000000..d24a3da328c --- /dev/null +++ b/tests/rustdoc-js/tuple-unit.js @@ -0,0 +1,80 @@ +// exact-check + +const EXPECTED = [ + { + 'query': '()', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'side_effect' }, + { 'path': 'tuple_unit', 'name': 'one' }, + { 'path': 'tuple_unit', 'name': 'two' }, + { 'path': 'tuple_unit', 'name': 'nest' }, + ], + 'in_args': [], + }, + { + 'query': 'primitive:unit', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'side_effect' }, + ], + 'in_args': [], + }, + { + 'query': 'primitive:tuple', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'one' }, + { 'path': 'tuple_unit', 'name': 'two' }, + { 'path': 'tuple_unit', 'name': 'nest' }, + ], + 'in_args': [], + }, + { + 'query': '(P)', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'not_tuple' }, + { 'path': 'tuple_unit', 'name': 'one' }, + { 'path': 'tuple_unit', 'name': 'two' }, + ], + 'in_args': [], + }, + { + 'query': '(P,)', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'one' }, + { 'path': 'tuple_unit', 'name': 'two' }, + ], + 'in_args': [], + }, + { + 'query': '(P, P)', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'two' }, + ], + 'in_args': [], + }, + { + 'query': '(P, ())', + 'returned': [], + 'in_args': [], + }, + { + 'query': '(Q, ())', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'nest' }, + ], + 'in_args': [], + }, + { + 'query': '(R)', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'nest' }, + ], + 'in_args': [], + }, + { + 'query': '(u32)', + 'returned': [ + { 'path': 'tuple_unit', 'name': 'nest' }, + ], + 'in_args': [], + }, +]; diff --git a/tests/rustdoc-js/tuple-unit.rs b/tests/rustdoc-js/tuple-unit.rs new file mode 100644 index 00000000000..93f9a671cbc --- /dev/null +++ b/tests/rustdoc-js/tuple-unit.rs @@ -0,0 +1,18 @@ +pub struct P; +pub struct Q; +pub struct R<T>(T); + +// Checks that tuple and unit both work +pub fn side_effect() { } + +// Check a non-tuple +pub fn not_tuple() -> P { loop {} } + +// Check a 1-tuple +pub fn one() -> (P,) { loop {} } + +// Check a 2-tuple +pub fn two() -> (P,P) { loop {} } + +// Check a nested tuple +pub fn nest() -> (Q, R<(u32,)>) { loop {} } diff --git a/tests/ui-fulldeps/dropck-tarena-cycle-checked.rs b/tests/ui-fulldeps/dropck-tarena-cycle-checked.rs index 188da67295a..cc97971a0dd 100644 --- a/tests/ui-fulldeps/dropck-tarena-cycle-checked.rs +++ b/tests/ui-fulldeps/dropck-tarena-cycle-checked.rs @@ -1,5 +1,3 @@ -// ignore-stage1 - // Reject mixing cyclic structure and Drop when using TypedArena. // // (Compare against dropck-vec-cycle-checked.rs) diff --git a/tests/ui-fulldeps/dropck-tarena-cycle-checked.stderr b/tests/ui-fulldeps/dropck-tarena-cycle-checked.stderr index 2f5be3f7f55..f9ac36be60e 100644 --- a/tests/ui-fulldeps/dropck-tarena-cycle-checked.stderr +++ b/tests/ui-fulldeps/dropck-tarena-cycle-checked.stderr @@ -1,5 +1,5 @@ error[E0597]: `arena` does not live long enough - --> $DIR/dropck-tarena-cycle-checked.rs:118:7 + --> $DIR/dropck-tarena-cycle-checked.rs:116:7 | LL | let arena = TypedArena::default(); | ----- binding `arena` declared here diff --git a/tests/ui-fulldeps/dropck-tarena-unsound-drop.rs b/tests/ui-fulldeps/dropck-tarena-unsound-drop.rs index 5f9a5fb76eb..86485a9887f 100644 --- a/tests/ui-fulldeps/dropck-tarena-unsound-drop.rs +++ b/tests/ui-fulldeps/dropck-tarena-unsound-drop.rs @@ -1,5 +1,3 @@ -// ignore-stage1 - // Check that an arena (TypedArena) cannot carry elements whose drop // methods might access borrowed data of lifetime that does not // strictly outlive the arena itself. diff --git a/tests/ui-fulldeps/dropck-tarena-unsound-drop.stderr b/tests/ui-fulldeps/dropck-tarena-unsound-drop.stderr index 8bb3911241d..82aa339a83b 100644 --- a/tests/ui-fulldeps/dropck-tarena-unsound-drop.stderr +++ b/tests/ui-fulldeps/dropck-tarena-unsound-drop.stderr @@ -1,5 +1,5 @@ error[E0597]: `arena` does not live long enough - --> $DIR/dropck-tarena-unsound-drop.rs:43:7 + --> $DIR/dropck-tarena-unsound-drop.rs:41:7 | LL | let arena: TypedArena<C> = TypedArena::default(); | ----- binding `arena` declared here diff --git a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs index 39219986665..39980ee7c67 100644 --- a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs +++ b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs @@ -1,6 +1,5 @@ // Test the `rustc::span_use_eq_ctxt` internal lint // compile-flags: -Z unstable-options -// ignore-stage1 #![feature(rustc_private)] #![deny(rustc::span_use_eq_ctxt)] diff --git a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr index fcf2565c8ab..b52df0368b1 100644 --- a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr +++ b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr @@ -1,11 +1,11 @@ error: use `.eq_ctxt()` instead of `.ctxt() == .ctxt()` - --> $DIR/span_use_eq_ctxt.rs:13:5 + --> $DIR/span_use_eq_ctxt.rs:12:5 | LL | s.ctxt() == t.ctxt() | ^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/span_use_eq_ctxt.rs:6:9 + --> $DIR/span_use_eq_ctxt.rs:5:9 | LL | #![deny(rustc::span_use_eq_ctxt)] | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui-fulldeps/pathless-extern-unstable.rs b/tests/ui-fulldeps/pathless-extern-unstable.rs index 50d157c5795..7fba8343bc0 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.rs +++ b/tests/ui-fulldeps/pathless-extern-unstable.rs @@ -1,6 +1,5 @@ // edition:2018 // compile-flags:--extern rustc_middle -// ignore-stage1 // Test that `--extern rustc_middle` fails with `rustc_private`. diff --git a/tests/ui-fulldeps/pathless-extern-unstable.stderr b/tests/ui-fulldeps/pathless-extern-unstable.stderr index 840b95d755c..cfd8669c45f 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.stderr +++ b/tests/ui-fulldeps/pathless-extern-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/pathless-extern-unstable.rs:7:9 + --> $DIR/pathless-extern-unstable.rs:6:9 | LL | pub use rustc_middle; | ^^^^^^^^^^^^ diff --git a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs index 33148311261..a0a8114e0c5 100644 --- a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs +++ b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs @@ -1,5 +1,4 @@ // rustc-env:CARGO_CRATE_NAME=rustc_dummy -// ignore-stage1 #![feature(rustc_private)] #![crate_type = "lib"] diff --git a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr index c752a5ee057..4cdc24e6a6b 100644 --- a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr +++ b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr @@ -1,5 +1,5 @@ error: diagnostic slug and crate name do not match - --> $DIR/enforce_slug_naming.rs:23:8 + --> $DIR/enforce_slug_naming.rs:22:8 | LL | #[diag(compiletest_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/anon-params/anon-params-edition-hygiene.rs b/tests/ui/anon-params/anon-params-edition-hygiene.rs index 6936205f8b9..0b69081d4ed 100644 --- a/tests/ui/anon-params/anon-params-edition-hygiene.rs +++ b/tests/ui/anon-params/anon-params-edition-hygiene.rs @@ -1,4 +1,3 @@ -// check-pass // edition:2018 // aux-build:anon-params-edition-hygiene.rs @@ -8,6 +7,8 @@ #[macro_use] extern crate anon_params_edition_hygiene; -generate_trait_2015!(u8); +generate_trait_2015_ident!(u8); +// FIXME: Edition hygiene doesn't work correctly with `tt`s in this case. +generate_trait_2015_tt!(u8); //~ ERROR expected one of `:`, `@`, or `|`, found `)` fn main() {} diff --git a/tests/ui/anon-params/anon-params-edition-hygiene.stderr b/tests/ui/anon-params/anon-params-edition-hygiene.stderr new file mode 100644 index 00000000000..373d7c6aebb --- /dev/null +++ b/tests/ui/anon-params/anon-params-edition-hygiene.stderr @@ -0,0 +1,23 @@ +error: expected one of `:`, `@`, or `|`, found `)` + --> $DIR/anon-params-edition-hygiene.rs:12:1 + | +LL | generate_trait_2015_tt!(u8); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `:`, `@`, or `|` + | + = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) + = note: this error originates in the macro `generate_trait_2015_tt` (in Nightly builds, run with -Z macro-backtrace for more info) +help: if this is a `self` type, give it a parameter name + | +LL | generate_trait_2015_tt!(self: u8); + | +++++ +help: if this is a parameter name, give it a type + | +LL | generate_trait_2015_tt!(u8: TypeName); + | ++++++++++ +help: if this is a type, explicitly ignore the parameter name + | +LL | generate_trait_2015_tt!(_: u8); + | ++ + +error: aborting due to 1 previous error + diff --git a/tests/ui/anon-params/auxiliary/anon-params-edition-hygiene.rs b/tests/ui/anon-params/auxiliary/anon-params-edition-hygiene.rs index aa4221becc2..28365655293 100644 --- a/tests/ui/anon-params/auxiliary/anon-params-edition-hygiene.rs +++ b/tests/ui/anon-params/auxiliary/anon-params-edition-hygiene.rs @@ -1,9 +1,18 @@ // edition:2015 #[macro_export] -macro_rules! generate_trait_2015 { +macro_rules! generate_trait_2015_ident { ($Type: ident) => { - trait Trait { + trait Trait1 { + fn method($Type) {} + } + }; +} + +#[macro_export] +macro_rules! generate_trait_2015_tt { + ($Type: tt) => { + trait Trait2 { fn method($Type) {} } }; diff --git a/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs b/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs index 7cfd128f2bf..a4a2b156e13 100644 --- a/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs +++ b/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs @@ -26,3 +26,8 @@ macro_rules! consumes_async_raw { macro_rules! passes_ident { ($i: ident) => ($i) } + +#[macro_export] +macro_rules! passes_tt { + ($i: tt) => ($i) +} diff --git a/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs b/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs index d07c0218db3..02db38103d2 100644 --- a/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs +++ b/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs @@ -26,3 +26,8 @@ macro_rules! consumes_async_raw { macro_rules! passes_ident { ($i: ident) => ($i) } + +#[macro_export] +macro_rules! passes_tt { + ($i: tt) => ($i) +} diff --git a/tests/ui/editions/edition-keywords-2015-2015-parsing.rs b/tests/ui/editions/edition-keywords-2015-2015-parsing.rs index d1752a7ec71..3574bc81515 100644 --- a/tests/ui/editions/edition-keywords-2015-2015-parsing.rs +++ b/tests/ui/editions/edition-keywords-2015-2015-parsing.rs @@ -19,6 +19,8 @@ pub fn check_async() { if passes_ident!(async) == 1 {} // OK if passes_ident!(r#async) == 1 {} // OK + if passes_tt!(async) == 1 {} // OK + if passes_tt!(r#async) == 1 {} // OK module::async(); // OK module::r#async(); // OK } diff --git a/tests/ui/editions/edition-keywords-2015-2015.rs b/tests/ui/editions/edition-keywords-2015-2015.rs index 943d203b806..77a2cb2e6de 100644 --- a/tests/ui/editions/edition-keywords-2015-2015.rs +++ b/tests/ui/editions/edition-keywords-2015-2015.rs @@ -20,6 +20,8 @@ pub fn check_async() { if passes_ident!(async) == 1 {} // OK if passes_ident!(r#async) == 1 {} // OK + if passes_tt!(async) == 1 {} // OK + if passes_tt!(r#async) == 1 {} // OK one_async::async(); // OK one_async::r#async(); // OK two_async::async(); // OK diff --git a/tests/ui/editions/edition-keywords-2015-2018-parsing.rs b/tests/ui/editions/edition-keywords-2015-2018-parsing.rs index 44455f43856..49f8562a6b1 100644 --- a/tests/ui/editions/edition-keywords-2015-2018-parsing.rs +++ b/tests/ui/editions/edition-keywords-2015-2018-parsing.rs @@ -19,6 +19,8 @@ pub fn check_async() { if passes_ident!(async) == 1 {} // OK if passes_ident!(r#async) == 1 {} // OK + if passes_tt!(async) == 1 {} // OK + if passes_tt!(r#async) == 1 {} // OK module::async(); // OK module::r#async(); // OK } diff --git a/tests/ui/editions/edition-keywords-2015-2018.rs b/tests/ui/editions/edition-keywords-2015-2018.rs index 8c3397c951d..a431a06bd10 100644 --- a/tests/ui/editions/edition-keywords-2015-2018.rs +++ b/tests/ui/editions/edition-keywords-2015-2018.rs @@ -20,6 +20,8 @@ pub fn check_async() { if passes_ident!(async) == 1 {} // OK if passes_ident!(r#async) == 1 {} // OK + if passes_tt!(async) == 1 {} // OK + if passes_tt!(r#async) == 1 {} // OK // one_async::async(); // ERROR, unresolved name // one_async::r#async(); // ERROR, unresolved name two_async::async(); // OK diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs index d5ed9fb9a28..8472430361f 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs @@ -21,8 +21,10 @@ pub fn check_async() { r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` r#async = consumes_async_raw!(r#async); // OK - if passes_ident!(async) == 1 {} + if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved if passes_ident!(r#async) == 1 {} // OK + if passes_tt!(async) == 1 {} //~ ERROR macro expansion ends with an incomplete expression + if passes_tt!(r#async) == 1 {} // OK module::async(); //~ ERROR expected identifier, found keyword `async` module::r#async(); // OK diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr index 1a4a94e9733..42db75f6659 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -10,7 +10,7 @@ LL | let mut r#async = 1; | ++ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:26:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:28:13 | LL | module::async(); | ^^^^^ expected identifier, found keyword @@ -52,17 +52,23 @@ LL | ($i: ident) => ($i) | ::: $DIR/edition-keywords-2018-2015-parsing.rs:24:8 | -LL | if passes_ident!(async) == 1 {} +LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` + --> $DIR/edition-keywords-2018-2015-parsing.rs:26:24 + | +LL | if passes_tt!(async) == 1 {} + | ^ expected one of `move`, `|`, or `||` + error[E0308]: mismatched types - --> $DIR/edition-keywords-2018-2015-parsing.rs:29:33 + --> $DIR/edition-keywords-2018-2015-parsing.rs:31:33 | LL | let _recovery_witness: () = 0; | -- ^ expected `()`, found integer | | | expected due to this -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/editions/edition-keywords-2018-2015.rs b/tests/ui/editions/edition-keywords-2018-2015.rs index 2cb2dfb18a0..4a02f867172 100644 --- a/tests/ui/editions/edition-keywords-2018-2015.rs +++ b/tests/ui/editions/edition-keywords-2018-2015.rs @@ -18,6 +18,8 @@ pub fn check_async() { // if passes_ident!(async) == 1 {} // ERROR, reserved if passes_ident!(r#async) == 1 {} // OK + // if passes_tt!(async) == 1 {} // ERROR, reserved + if passes_tt!(r#async) == 1 {} // OK // one_async::async(); // ERROR, reserved one_async::r#async(); // OK // two_async::async(); // ERROR, reserved diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs index 044ab249f2c..c0d8927d059 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs @@ -12,6 +12,13 @@ mod module { pub fn r#async() {} } +macro_rules! local_passes_ident { + ($i: ident) => ($i) //~ ERROR macro expansion ends with an incomplete expression +} +macro_rules! local_passes_tt { + ($i: tt) => ($i) //~ ERROR macro expansion ends with an incomplete expression +} + pub fn check_async() { let mut async = 1; //~ ERROR expected identifier, found keyword `async` let mut r#async = 1; // OK @@ -21,8 +28,14 @@ pub fn check_async() { r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` r#async = consumes_async_raw!(r#async); // OK - if passes_ident!(async) == 1 {} + if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved if passes_ident!(r#async) == 1 {} // OK + if passes_tt!(async) == 1 {} //~ ERROR macro expansion ends with an incomplete expression + if passes_tt!(r#async) == 1 {} // OK + if local_passes_ident!(async) == 1 {} // Error reported above in the macro + if local_passes_ident!(r#async) == 1 {} // OK + if local_passes_tt!(async) == 1 {} // Error reported above in the macro + if local_passes_tt!(r#async) == 1 {} // OK module::async(); //~ ERROR expected identifier, found keyword `async` module::r#async(); // OK diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr index 19eb7ac9823..6f08cff433b 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:16:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:23:13 | LL | let mut async = 1; | ^^^^^ expected identifier, found keyword @@ -10,7 +10,7 @@ LL | let mut r#async = 1; | ++ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:26:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:39:13 | LL | module::async(); | ^^^^^ expected identifier, found keyword @@ -21,7 +21,7 @@ LL | module::r#async(); | ++ error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:20:31 + --> $DIR/edition-keywords-2018-2018-parsing.rs:27:31 | LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call @@ -33,7 +33,7 @@ LL | (async) => (1) | ^^^^^ error: no rules expected the token `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:21:35 + --> $DIR/edition-keywords-2018-2018-parsing.rs:28:35 | LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call @@ -50,19 +50,37 @@ error: macro expansion ends with an incomplete expression: expected one of `move LL | ($i: ident) => ($i) | ^ expected one of `move`, `|`, or `||` | - ::: $DIR/edition-keywords-2018-2018-parsing.rs:24:8 + ::: $DIR/edition-keywords-2018-2018-parsing.rs:31:8 | -LL | if passes_ident!(async) == 1 {} +LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` + --> $DIR/edition-keywords-2018-2018-parsing.rs:33:24 + | +LL | if passes_tt!(async) == 1 {} + | ^ expected one of `move`, `|`, or `||` + +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` + --> $DIR/edition-keywords-2018-2018-parsing.rs:16:23 + | +LL | ($i: ident) => ($i) + | ^ expected one of `move`, `|`, or `||` + +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` + --> $DIR/edition-keywords-2018-2018-parsing.rs:19:20 + | +LL | ($i: tt) => ($i) + | ^ expected one of `move`, `|`, or `||` + error[E0308]: mismatched types - --> $DIR/edition-keywords-2018-2018-parsing.rs:29:33 + --> $DIR/edition-keywords-2018-2018-parsing.rs:42:33 | LL | let _recovery_witness: () = 0; | -- ^ expected `()`, found integer | | | expected due to this -error: aborting due to 6 previous errors +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/editions/edition-keywords-2018-2018.rs b/tests/ui/editions/edition-keywords-2018-2018.rs index 5043440aa16..e7294326137 100644 --- a/tests/ui/editions/edition-keywords-2018-2018.rs +++ b/tests/ui/editions/edition-keywords-2018-2018.rs @@ -18,6 +18,8 @@ pub fn check_async() { // if passes_ident!(async) == 1 {} // ERROR, reserved if passes_ident!(r#async) == 1 {} // OK + // if passes_tt!(async) == 1 {} // ERROR, reserved + if passes_tt!(r#async) == 1 {} // OK // one_async::async(); // ERROR, reserved // one_async::r#async(); // ERROR, unresolved name // two_async::async(); // ERROR, reserved diff --git a/tests/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs b/tests/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs index 233120c92f3..24fc512dfbf 100644 --- a/tests/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs +++ b/tests/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs @@ -22,7 +22,7 @@ //[thin]compile-flags: -C lto=thin //[fat]compile-flags: -C lto=fat -#![feature(core_panic)] +#![feature(panic_internals)] // (For some reason, reproducing the LTO issue requires pulling in std // explicitly this way.) diff --git a/tests/ui/lint/wide_pointer_comparisons.rs b/tests/ui/lint/wide_pointer_comparisons.rs index 8334575cf52..961b998c956 100644 --- a/tests/ui/lint/wide_pointer_comparisons.rs +++ b/tests/ui/lint/wide_pointer_comparisons.rs @@ -109,6 +109,15 @@ fn main() { { macro_rules! cmp { + ($a:tt, $b:tt) => { $a == $b } + //~^ WARN ambiguous wide pointer comparison + } + + cmp!(a, b); + } + + { + macro_rules! cmp { ($a:ident, $b:ident) => { $a == $b } //~^ WARN ambiguous wide pointer comparison } diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index 926b8775902..349ff467d0f 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -421,7 +421,18 @@ LL | std::ptr::eq(*a, *b) | ~~~~~~~~~~~~~ ~ + warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected - --> $DIR/wide_pointer_comparisons.rs:112:39 + --> $DIR/wide_pointer_comparisons.rs:112:33 + | +LL | ($a:tt, $b:tt) => { $a == $b } + | ^^^^^^^^ + | +help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses + | +LL | ($a:tt, $b:tt) => { std::ptr::addr_eq($a, $b) } + | ++++++++++++++++++ ~ + + +warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected + --> $DIR/wide_pointer_comparisons.rs:121:39 | LL | ($a:ident, $b:ident) => { $a == $b } | ^^^^^^^^ @@ -436,7 +447,7 @@ LL | ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } | ++++++++++++++++++ ~ + warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected - --> $DIR/wide_pointer_comparisons.rs:122:37 + --> $DIR/wide_pointer_comparisons.rs:131:37 | LL | ($a:expr, $b:expr) => { $a == $b } | ^^ @@ -448,5 +459,5 @@ LL | cmp!(&a, &b); = help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) -warning: 37 warnings emitted +warning: 38 warnings emitted diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.rs b/tests/ui/methods/method-on-ambiguous-numeric-type.rs index 82f47438d50..f42b72e9f9c 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.rs +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.rs @@ -5,6 +5,9 @@ macro_rules! local_mac { ($ident:ident) => { let $ident = 42; } } +macro_rules! local_mac_tt { + ($tt:tt) => { let $tt = 42; } +} fn main() { let x = 2.0.neg(); @@ -23,6 +26,10 @@ fn main() { local_mac!(local_bar); local_bar.pow(2); //~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}` + + local_mac_tt!(local_bar_tt); + local_bar_tt.pow(2); + //~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}` } fn qux() { diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index 91733411637..060595e1d40 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -1,5 +1,5 @@ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` - --> $DIR/method-on-ambiguous-numeric-type.rs:10:17 + --> $DIR/method-on-ambiguous-numeric-type.rs:13:17 | LL | let x = 2.0.neg(); | ^^^ @@ -10,7 +10,7 @@ LL | let x = 2.0_f32.neg(); | ~~~~~~~ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` - --> $DIR/method-on-ambiguous-numeric-type.rs:14:15 + --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 | LL | let x = y.neg(); | ^^^ @@ -21,7 +21,7 @@ LL | let y: f32 = 2.0; | +++++ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` - --> $DIR/method-on-ambiguous-numeric-type.rs:19:26 + --> $DIR/method-on-ambiguous-numeric-type.rs:22:26 | LL | for i in 0..100 { | - you must specify a type for this binding, like `i32` @@ -29,7 +29,7 @@ LL | println!("{}", i.pow(2)); | ^^^ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` - --> $DIR/method-on-ambiguous-numeric-type.rs:24:15 + --> $DIR/method-on-ambiguous-numeric-type.rs:27:15 | LL | local_bar.pow(2); | ^^^ @@ -40,7 +40,18 @@ LL | ($ident:ident) => { let $ident: i32 = 42; } | +++++ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` - --> $DIR/method-on-ambiguous-numeric-type.rs:30:9 + --> $DIR/method-on-ambiguous-numeric-type.rs:31:18 + | +LL | local_bar_tt.pow(2); + | ^^^ + | +help: you must specify a type for this binding, like `i32` + | +LL | ($tt:tt) => { let $tt: i32 = 42; } + | +++++ + +error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` + --> $DIR/method-on-ambiguous-numeric-type.rs:37:9 | LL | bar.pow(2); | ^^^ @@ -51,6 +62,6 @@ help: you must specify a type for this binding, like `i32` LL | ($ident:ident) => { let $ident: i32 = 42; } | +++++ -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0689`. |
