diff options
Diffstat (limited to 'src/test')
25 files changed, 1170 insertions, 69 deletions
diff --git a/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir b/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir index 9f235248ca5..8423128123a 100644 --- a/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir +++ b/src/test/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir @@ -25,14 +25,14 @@ | '_#2r live at {bb0[0..=1]} | '_#3r live at {bb0[0..=1]} | '_#4r live at {bb0[0..=1]} -| '_#1r: '_#6r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27) -| '_#1r: '_#8r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55) -| '_#2r: '_#7r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43) -| '_#3r: '_#9r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67) -| '_#6r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27) -| '_#7r: '_#2r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43) -| '_#8r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55) -| '_#9r: '_#3r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67) +| '_#1r: '_#6r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27) ($DIR/named-lifetimes-basic.rs:12:26: 12:27 (#0) +| '_#1r: '_#8r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55) ($DIR/named-lifetimes-basic.rs:12:54: 12:55 (#0) +| '_#2r: '_#7r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43) ($DIR/named-lifetimes-basic.rs:12:42: 12:43 (#0) +| '_#3r: '_#9r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67) ($DIR/named-lifetimes-basic.rs:12:66: 12:67 (#0) +| '_#6r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:26: 12:27) ($DIR/named-lifetimes-basic.rs:12:26: 12:27 (#0) +| '_#7r: '_#2r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:42: 12:43) ($DIR/named-lifetimes-basic.rs:12:42: 12:43 (#0) +| '_#8r: '_#1r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:54: 12:55) ($DIR/named-lifetimes-basic.rs:12:54: 12:55 (#0) +| '_#9r: '_#3r due to BoringNoLocation at All($DIR/named-lifetimes-basic.rs:12:66: 12:67) ($DIR/named-lifetimes-basic.rs:12:66: 12:67 (#0) | fn use_x(_1: &'_#6r mut i32, _2: &'_#7r u32, _3: &'_#8r u32, _4: &'_#9r u32) -> bool { debug w => _1; // in scope 0 at $DIR/named-lifetimes-basic.rs:12:26: 12:27 diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index ed94a1ecf00..f79e2705ad2 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -18,8 +18,8 @@ | '_#3r live at {bb1[0]} | '_#4r live at {bb1[1..=3]} | '_#5r live at {bb1[4..=7], bb2[0..=2]} -| '_#3r: '_#4r due to Assignment at Single(bb1[0]) -| '_#4r: '_#5r due to Assignment at Single(bb1[3]) +| '_#3r: '_#4r due to Assignment at Single(bb1[0]) ($DIR/region-subtyping-basic.rs:18:13: 18:18 (#0) +| '_#4r: '_#5r due to Assignment at Single(bb1[3]) ($DIR/region-subtyping-basic.rs:19:13: 19:14 (#0) | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:16:11: 16:11 diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 95997b20701..162cacef8a5 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -18,8 +18,8 @@ | '_#3r live at {bb1[0]} | '_#4r live at {bb1[1..=3]} | '_#5r live at {bb1[4..=7], bb2[0..=2]} -| '_#3r: '_#4r due to Assignment at Single(bb1[0]) -| '_#4r: '_#5r due to Assignment at Single(bb1[3]) +| '_#3r: '_#4r due to Assignment at Single(bb1[0]) ($DIR/region-subtyping-basic.rs:18:13: 18:18 (#0) +| '_#4r: '_#5r due to Assignment at Single(bb1[3]) ($DIR/region-subtyping-basic.rs:19:13: 19:14 (#0) | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:16:11: 16:11 diff --git a/src/test/mir-opt/storage_ranges.main.nll.0.mir b/src/test/mir-opt/storage_ranges.main.nll.0.mir index e02580135af..b383c5ec9dc 100644 --- a/src/test/mir-opt/storage_ranges.main.nll.0.mir +++ b/src/test/mir-opt/storage_ranges.main.nll.0.mir @@ -16,7 +16,7 @@ | '_#1r live at {bb0[0..=22]} | '_#3r live at {bb0[10]} | '_#4r live at {bb0[11]} -| '_#3r: '_#4r due to Assignment at Single(bb0[10]) +| '_#3r: '_#4r due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0) | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/storage_ranges.rs:3:11: 3:11 diff --git a/src/test/rustdoc-js-std/filter-crate.js b/src/test/rustdoc-js-std/filter-crate.js index 2e0330c4497..b47a1fefa41 100644 --- a/src/test/rustdoc-js-std/filter-crate.js +++ b/src/test/rustdoc-js-std/filter-crate.js @@ -1,6 +1,6 @@ // exact-check -const QUERY = 'hashmap'; +const QUERY = '"hashmap"'; const FILTER_CRATE = 'core'; const EXPECTED = { diff --git a/src/test/rustdoc-js-std/parser-errors.js b/src/test/rustdoc-js-std/parser-errors.js new file mode 100644 index 00000000000..779ab867c12 --- /dev/null +++ b/src/test/rustdoc-js-std/parser-errors.js @@ -0,0 +1,365 @@ +const QUERY = [ + '<P>', + '-> <P>', + 'a<"P">', + '"P" "P"', + 'P "P"', + '"p" p', + '"const": p', + "a<:a>", + "a<::a>", + "((a))", + "(p -> p", + "::a::b", + "a::::b", + "a::b::", + ":a", + "a b:", + "a (b:", + "_:", + "a-bb", + "a>bb", + "ab'", + "a->", + '"p" <a>', + '"p" a<a>', + "a,<", + "aaaaa<>b", + "fn:aaaaa<>b", + "->a<>b", + "a<->", + "a:: a", + "a ::a", + "a<a>:", + "a<>:", + "a,:", + " a<> :", + "mod : :", +]; + +const PARSED = [ + { + elems: [], + foundElems: 0, + original: "<P>", + returned: [], + typeFilter: -1, + userQuery: "<p>", + error: "Found generics without a path", + }, + { + elems: [], + foundElems: 0, + original: "-> <P>", + returned: [], + typeFilter: -1, + userQuery: "-> <p>", + error: "Found generics without a path", + }, + { + elems: [], + foundElems: 0, + original: "a<\"P\">", + returned: [], + typeFilter: -1, + userQuery: "a<\"p\">", + error: "`\"` cannot be used in generics", + }, + { + elems: [], + foundElems: 0, + original: "\"P\" \"P\"", + returned: [], + typeFilter: -1, + userQuery: "\"p\" \"p\"", + error: "Cannot have more than one literal search element", + }, + { + elems: [], + foundElems: 0, + original: "P \"P\"", + returned: [], + typeFilter: -1, + userQuery: "p \"p\"", + error: "Cannot use literal search when there is more than one element", + }, + { + elems: [], + foundElems: 0, + original: "\"p\" p", + returned: [], + typeFilter: -1, + userQuery: "\"p\" p", + error: "You cannot have more than one element if you use quotes", + }, + { + elems: [], + foundElems: 0, + original: "\"const\": p", + returned: [], + typeFilter: -1, + userQuery: "\"const\": p", + error: "You cannot use quotes on type filter", + }, + { + elems: [], + foundElems: 0, + original: "a<:a>", + returned: [], + typeFilter: -1, + userQuery: "a<:a>", + error: "Unexpected `:` after `<`", + }, + { + elems: [], + foundElems: 0, + original: "a<::a>", + returned: [], + typeFilter: -1, + userQuery: "a<::a>", + error: "Unexpected `::`: paths cannot start with `::`", + }, + { + elems: [], + foundElems: 0, + original: "((a))", + returned: [], + typeFilter: -1, + userQuery: "((a))", + error: "Unexpected `(`", + }, + { + elems: [], + foundElems: 0, + original: "(p -> p", + returned: [], + typeFilter: -1, + userQuery: "(p -> p", + error: "Unexpected `(`", + }, + { + elems: [], + foundElems: 0, + original: "::a::b", + returned: [], + typeFilter: -1, + userQuery: "::a::b", + error: "Paths cannot start with `::`", + }, + { + elems: [], + foundElems: 0, + original: "a::::b", + returned: [], + typeFilter: -1, + userQuery: "a::::b", + error: "Unexpected `::::`", + }, + { + elems: [], + foundElems: 0, + original: "a::b::", + returned: [], + typeFilter: -1, + userQuery: "a::b::", + error: "Paths cannot end with `::`", + }, + { + elems: [], + foundElems: 0, + original: ":a", + returned: [], + typeFilter: -1, + userQuery: ":a", + error: "Expected type filter before `:`", + }, + { + elems: [], + foundElems: 0, + original: "a b:", + returned: [], + typeFilter: -1, + userQuery: "a b:", + error: "Unexpected `:`", + }, + { + elems: [], + foundElems: 0, + original: "a (b:", + returned: [], + typeFilter: -1, + userQuery: "a (b:", + error: "Unexpected `(`", + }, + { + elems: [], + foundElems: 0, + original: "_:", + returned: [], + typeFilter: -1, + userQuery: "_:", + error: "Unknown type filter `_`", + }, + { + elems: [], + foundElems: 0, + original: "a-bb", + returned: [], + typeFilter: -1, + userQuery: "a-bb", + error: "Unexpected `-` (did you mean `->`?)", + }, + { + elems: [], + foundElems: 0, + original: "a>bb", + returned: [], + typeFilter: -1, + userQuery: "a>bb", + error: "Unexpected `>` (did you mean `->`?)", + }, + { + elems: [], + foundElems: 0, + original: "ab'", + returned: [], + typeFilter: -1, + userQuery: "ab'", + error: "Unexpected `'`", + }, + { + elems: [], + foundElems: 0, + original: "a->", + returned: [], + typeFilter: -1, + userQuery: "a->", + error: "Expected at least one item after `->`", + }, + { + elems: [], + foundElems: 0, + original: '"p" <a>', + returned: [], + typeFilter: -1, + userQuery: '"p" <a>', + error: "Found generics without a path", + }, + { + elems: [], + foundElems: 0, + original: '"p" a<a>', + returned: [], + typeFilter: -1, + userQuery: '"p" a<a>', + error: "You cannot have more than one element if you use quotes", + }, + { + elems: [], + foundElems: 0, + original: 'a,<', + returned: [], + typeFilter: -1, + userQuery: 'a,<', + error: 'Found generics without a path', + }, + { + elems: [], + foundElems: 0, + original: 'aaaaa<>b', + returned: [], + typeFilter: -1, + userQuery: 'aaaaa<>b', + error: 'Expected `,`, ` `, `:` or `->`, found `b`', + }, + { + elems: [], + foundElems: 0, + original: 'fn:aaaaa<>b', + returned: [], + typeFilter: -1, + userQuery: 'fn:aaaaa<>b', + error: 'Expected `,`, ` ` or `->`, found `b`', + }, + { + elems: [], + foundElems: 0, + original: '->a<>b', + returned: [], + typeFilter: -1, + userQuery: '->a<>b', + error: 'Expected `,` or ` `, found `b`', + }, + { + elems: [], + foundElems: 0, + original: 'a<->', + returned: [], + typeFilter: -1, + userQuery: 'a<->', + error: 'Unexpected `-` after `<`', + }, + { + elems: [], + foundElems: 0, + original: 'a:: a', + returned: [], + typeFilter: -1, + userQuery: 'a:: a', + error: 'Paths cannot end with `::`', + }, + { + elems: [], + foundElems: 0, + original: 'a ::a', + returned: [], + typeFilter: -1, + userQuery: 'a ::a', + error: 'Paths cannot start with `::`', + }, + { + elems: [], + foundElems: 0, + original: "a<a>:", + returned: [], + typeFilter: -1, + userQuery: "a<a>:", + error: 'Unexpected `:`', + }, + { + elems: [], + foundElems: 0, + original: "a<>:", + returned: [], + typeFilter: -1, + userQuery: "a<>:", + error: 'Unexpected `<` in type filter', + }, + { + elems: [], + foundElems: 0, + original: "a,:", + returned: [], + typeFilter: -1, + userQuery: "a,:", + error: 'Unexpected `,` in type filter', + }, + { + elems: [], + foundElems: 0, + original: "a<> :", + returned: [], + typeFilter: -1, + userQuery: "a<> :", + error: 'Unexpected `<` in type filter', + }, + { + elems: [], + foundElems: 0, + original: "mod : :", + returned: [], + typeFilter: -1, + userQuery: "mod : :", + error: 'Unexpected `:`', + }, +]; diff --git a/src/test/rustdoc-js-std/parser-filter.js b/src/test/rustdoc-js-std/parser-filter.js new file mode 100644 index 00000000000..e5a87a415ac --- /dev/null +++ b/src/test/rustdoc-js-std/parser-filter.js @@ -0,0 +1,43 @@ +const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo']; + +const PARSED = [ + { + elems: [{ + name: "foo", + fullPath: ["foo"], + pathWithoutLast: [], + pathLast: "foo", + generics: [], + }], + foundElems: 1, + original: "fn:foo", + returned: [], + typeFilter: 5, + userQuery: "fn:foo", + error: null, + }, + { + elems: [{ + name: "foo", + fullPath: ["foo"], + pathWithoutLast: [], + pathLast: "foo", + generics: [], + }], + foundElems: 1, + original: "enum : foo", + returned: [], + typeFilter: 4, + userQuery: "enum : foo", + error: null, + }, + { + elems: [], + foundElems: 0, + original: "macro<f>:foo", + returned: [], + typeFilter: -1, + userQuery: "macro<f>:foo", + error: "Unexpected `:`", + }, +]; diff --git a/src/test/rustdoc-js-std/parser-generics.js b/src/test/rustdoc-js-std/parser-generics.js new file mode 100644 index 00000000000..0cf7f5019aa --- /dev/null +++ b/src/test/rustdoc-js-std/parser-generics.js @@ -0,0 +1,62 @@ +const QUERY = ['A<B<C<D>, E>', 'p<> u8', '"p"<a>']; + +const PARSED = [ + { + elems: [], + foundElems: 0, + original: 'A<B<C<D>, E>', + returned: [], + typeFilter: -1, + userQuery: 'a<b<c<d>, e>', + error: 'Unexpected `<` after `<`', + }, + { + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + }, + ], + foundElems: 2, + original: "p<> u8", + returned: [], + typeFilter: -1, + userQuery: "p<> u8", + error: null, + }, + { + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [ + { + name: "a", + fullPath: ["a"], + pathWithoutLast: [], + pathLast: "a", + generics: [], + }, + ], + }, + ], + foundElems: 1, + original: '"p"<a>', + returned: [], + typeFilter: -1, + userQuery: '"p"<a>', + error: null, + }, +]; diff --git a/src/test/rustdoc-js-std/parser-literal.js b/src/test/rustdoc-js-std/parser-literal.js new file mode 100644 index 00000000000..87b3baff1e2 --- /dev/null +++ b/src/test/rustdoc-js-std/parser-literal.js @@ -0,0 +1,27 @@ +const QUERY = ['R<P>']; + +const PARSED = [ + { + elems: [{ + name: "r", + fullPath: ["r"], + pathWithoutLast: [], + pathLast: "r", + generics: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + }, + ], + }], + foundElems: 1, + original: "R<P>", + returned: [], + typeFilter: -1, + userQuery: "r<p>", + error: null, + } +]; diff --git a/src/test/rustdoc-js-std/parser-paths.js b/src/test/rustdoc-js-std/parser-paths.js new file mode 100644 index 00000000000..9f823f9336a --- /dev/null +++ b/src/test/rustdoc-js-std/parser-paths.js @@ -0,0 +1,90 @@ +const QUERY = ['A::B', 'A::B,C', 'A::B<f>,C', 'mod::a']; + +const PARSED = [ + { + elems: [{ + name: "a::b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], + pathLast: "b", + generics: [], + }], + foundElems: 1, + original: "A::B", + returned: [], + typeFilter: -1, + userQuery: "a::b", + error: null, + }, + { + elems: [ + { + name: "a::b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], + pathLast: "b", + generics: [], + }, + { + name: "c", + fullPath: ["c"], + pathWithoutLast: [], + pathLast: "c", + generics: [], + }, + ], + foundElems: 2, + original: 'A::B,C', + returned: [], + typeFilter: -1, + userQuery: 'a::b,c', + error: null, + }, + { + elems: [ + { + name: "a::b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], + pathLast: "b", + generics: [ + { + name: "f", + fullPath: ["f"], + pathWithoutLast: [], + pathLast: "f", + generics: [], + }, + ], + }, + { + name: "c", + fullPath: ["c"], + pathWithoutLast: [], + pathLast: "c", + generics: [], + }, + ], + foundElems: 2, + original: 'A::B<f>,C', + returned: [], + typeFilter: -1, + userQuery: 'a::b<f>,c', + error: null, + }, + { + elems: [{ + name: "mod::a", + fullPath: ["mod", "a"], + pathWithoutLast: ["mod"], + pathLast: "a", + generics: [], + }], + foundElems: 1, + original: "mod::a", + returned: [], + typeFilter: -1, + userQuery: "mod::a", + error: null, + }, +]; diff --git a/src/test/rustdoc-js-std/parser-quote.js b/src/test/rustdoc-js-std/parser-quote.js new file mode 100644 index 00000000000..1e16c90de5e --- /dev/null +++ b/src/test/rustdoc-js-std/parser-quote.js @@ -0,0 +1,87 @@ +const QUERY = [ + '-> "p"', + '"p",', + '"p" -> a', + '"a" -> "p"', + '->"-"', + '"a', + '""', +]; + +const PARSED = [ + { + elems: [], + foundElems: 1, + original: '-> "p"', + returned: [{ + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + }], + typeFilter: -1, + userQuery: '-> "p"', + error: null, + }, + { + elems: [{ + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + }], + foundElems: 1, + original: '"p",', + returned: [], + typeFilter: -1, + userQuery: '"p",', + error: null, + }, + { + elems: [], + foundElems: 0, + original: '"p" -> a', + returned: [], + typeFilter: -1, + userQuery: '"p" -> a', + error: "You cannot have more than one element if you use quotes", + }, + { + elems: [], + foundElems: 0, + original: '"a" -> "p"', + returned: [], + typeFilter: -1, + userQuery: '"a" -> "p"', + error: "Cannot have more than one literal search element", + }, + { + elems: [], + foundElems: 0, + original: '->"-"', + returned: [], + typeFilter: -1, + userQuery: '->"-"', + error: 'Unexpected `-` in a string element', + }, + { + elems: [], + foundElems: 0, + original: '"a', + returned: [], + typeFilter: -1, + userQuery: '"a', + error: 'Unclosed `"`', + }, + { + elems: [], + foundElems: 0, + original: '""', + returned: [], + typeFilter: -1, + userQuery: '""', + error: 'Cannot have empty string element', + }, +]; diff --git a/src/test/rustdoc-js-std/parser-returned.js b/src/test/rustdoc-js-std/parser-returned.js new file mode 100644 index 00000000000..b45466aa940 --- /dev/null +++ b/src/test/rustdoc-js-std/parser-returned.js @@ -0,0 +1,78 @@ +const QUERY = ['-> F<P>', '-> P', '->,a', 'aaaaa->a']; + +const PARSED = [ + { + elems: [], + foundElems: 1, + original: "-> F<P>", + returned: [{ + name: "f", + fullPath: ["f"], + pathWithoutLast: [], + pathLast: "f", + generics: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + }, + ], + }], + typeFilter: -1, + userQuery: "-> f<p>", + error: null, + }, + { + elems: [], + foundElems: 1, + original: "-> P", + returned: [{ + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + }], + typeFilter: -1, + userQuery: "-> p", + error: null, + }, + { + elems: [], + foundElems: 1, + original: "->,a", + returned: [{ + name: "a", + fullPath: ["a"], + pathWithoutLast: [], + pathLast: "a", + generics: [], + }], + typeFilter: -1, + userQuery: "->,a", + error: null, + }, + { + elems: [{ + name: "aaaaa", + fullPath: ["aaaaa"], + pathWithoutLast: [], + pathLast: "aaaaa", + generics: [], + }], + foundElems: 2, + original: "aaaaa->a", + returned: [{ + name: "a", + fullPath: ["a"], + pathWithoutLast: [], + pathLast: "a", + generics: [], + }], + typeFilter: -1, + userQuery: "aaaaa->a", + error: null, + }, +]; diff --git a/src/test/rustdoc-js-std/parser-separators.js b/src/test/rustdoc-js-std/parser-separators.js new file mode 100644 index 00000000000..5b7abdfa8d6 --- /dev/null +++ b/src/test/rustdoc-js-std/parser-separators.js @@ -0,0 +1,206 @@ +// ignore-tidy-tab + +const QUERY = [ + 'aaaaaa b', + 'a b', + 'a,b', + 'a\tb', + 'a<b c>', + 'a<b,c>', + 'a<b\tc>', +]; + +const PARSED = [ + { + elems: [ + { + name: 'aaaaaa', + fullPath: ['aaaaaa'], + pathWithoutLast: [], + pathLast: 'aaaaaa', + generics: [], + }, + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + ], + foundElems: 2, + original: "aaaaaa b", + returned: [], + typeFilter: -1, + userQuery: "aaaaaa b", + error: null, + }, + { + elems: [ + { + name: 'a', + fullPath: ['a'], + pathWithoutLast: [], + pathLast: 'a', + generics: [], + }, + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + ], + foundElems: 2, + original: "a b", + returned: [], + typeFilter: -1, + userQuery: "a b", + error: null, + }, + { + elems: [ + { + name: 'a', + fullPath: ['a'], + pathWithoutLast: [], + pathLast: 'a', + generics: [], + }, + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + ], + foundElems: 2, + original: "a,b", + returned: [], + typeFilter: -1, + userQuery: "a,b", + error: null, + }, + { + elems: [ + { + name: 'a', + fullPath: ['a'], + pathWithoutLast: [], + pathLast: 'a', + generics: [], + }, + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + ], + foundElems: 2, + original: "a\tb", + returned: [], + typeFilter: -1, + userQuery: "a\tb", + error: null, + }, + { + elems: [ + { + name: 'a', + fullPath: ['a'], + pathWithoutLast: [], + pathLast: 'a', + generics: [ + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + { + name: 'c', + fullPath: ['c'], + pathWithoutLast: [], + pathLast: 'c', + generics: [], + }, + ], + }, + ], + foundElems: 1, + original: "a<b c>", + returned: [], + typeFilter: -1, + userQuery: "a<b c>", + error: null, + }, + { + elems: [ + { + name: 'a', + fullPath: ['a'], + pathWithoutLast: [], + pathLast: 'a', + generics: [ + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + { + name: 'c', + fullPath: ['c'], + pathWithoutLast: [], + pathLast: 'c', + generics: [], + }, + ], + }, + ], + foundElems: 1, + original: "a<b,c>", + returned: [], + typeFilter: -1, + userQuery: "a<b,c>", + error: null, + }, + { + elems: [ + { + name: 'a', + fullPath: ['a'], + pathWithoutLast: [], + pathLast: 'a', + generics: [ + { + name: 'b', + fullPath: ['b'], + pathWithoutLast: [], + pathLast: 'b', + generics: [], + }, + { + name: 'c', + fullPath: ['c'], + pathWithoutLast: [], + pathLast: 'c', + generics: [], + }, + ], + }, + ], + foundElems: 1, + original: "a<b\tc>", + returned: [], + typeFilter: -1, + userQuery: "a<b\tc>", + error: null, + }, +]; diff --git a/src/test/rustdoc-js-std/parser-weird-queries.js b/src/test/rustdoc-js-std/parser-weird-queries.js new file mode 100644 index 00000000000..a3d85aeca5e --- /dev/null +++ b/src/test/rustdoc-js-std/parser-weird-queries.js @@ -0,0 +1,123 @@ +// This test is mostly to check that the parser still kinda outputs something +// (and doesn't enter an infinite loop!) even though the query is completely +// invalid. +const QUERY = [ + 'a b', + 'a b', + 'a,b(c)', + 'aaa,a', + ',,,,', + 'mod :', + 'mod\t:', +]; + +const PARSED = [ + { + elems: [ + { + name: "a", + fullPath: ["a"], + pathWithoutLast: [], + pathLast: "a", + generics: [], + }, + { + name: "b", + fullPath: ["b"], + pathWithoutLast: [], + pathLast: "b", + generics: [], + }, + ], + foundElems: 2, + original: "a b", + returned: [], + typeFilter: -1, + userQuery: "a b", + error: null, + }, + { + elems: [ + { + name: "a", + fullPath: ["a"], + pathWithoutLast: [], + pathLast: "a", + generics: [], + }, + { + name: "b", + fullPath: ["b"], + pathWithoutLast: [], + pathLast: "b", + generics: [], + }, + ], + foundElems: 2, + original: "a b", + returned: [], + typeFilter: -1, + userQuery: "a b", + error: null, + }, + { + elems: [], + foundElems: 0, + original: "a,b(c)", + returned: [], + typeFilter: -1, + userQuery: "a,b(c)", + error: "Unexpected `(`", + }, + { + elems: [ + { + name: "aaa", + fullPath: ["aaa"], + pathWithoutLast: [], + pathLast: "aaa", + generics: [], + }, + { + name: "a", + fullPath: ["a"], + pathWithoutLast: [], + pathLast: "a", + generics: [], + }, + ], + foundElems: 2, + original: "aaa,a", + returned: [], + typeFilter: -1, + userQuery: "aaa,a", + error: null, + }, + { + elems: [], + foundElems: 0, + original: ",,,,", + returned: [], + typeFilter: -1, + userQuery: ",,,,", + error: null, + }, + { + elems: [], + foundElems: 0, + original: 'mod :', + returned: [], + typeFilter: 0, + userQuery: 'mod :', + error: null, + }, + { + elems: [], + foundElems: 0, + original: 'mod\t:', + returned: [], + typeFilter: 0, + userQuery: 'mod\t:', + error: null, + }, +]; diff --git a/src/test/rustdoc-js-std/quoted.js b/src/test/rustdoc-js-std/quoted.js index 924129f86c8..aec8484a41f 100644 --- a/src/test/rustdoc-js-std/quoted.js +++ b/src/test/rustdoc-js-std/quoted.js @@ -1,4 +1,7 @@ +// ignore-order + const QUERY = '"error"'; +const FILTER_CRATE = 'std'; const EXPECTED = { 'others': [ @@ -6,7 +9,12 @@ const EXPECTED = { { 'path': 'std::fmt', 'name': 'Error' }, { 'path': 'std::io', 'name': 'Error' }, ], - 'in_args': [], + 'in_args': [ + { 'path': 'std::fmt::Error', 'name': 'eq' }, + { 'path': 'std::fmt::Error', 'name': 'cmp' }, + { 'path': 'std::fmt::Error', 'name': 'partial_cmp' }, + + ], 'returned': [ { 'path': 'std::fmt::LowerExp', 'name': 'fmt' }, ], diff --git a/src/test/rustdoc-js-std/struct-vec.js b/src/test/rustdoc-js-std/struct-vec.js index 2c808143bae..29609904b19 100644 --- a/src/test/rustdoc-js-std/struct-vec.js +++ b/src/test/rustdoc-js-std/struct-vec.js @@ -1,8 +1,8 @@ -const QUERY = 'struct:Vec'; +const QUERY = 'struct:VecD'; const EXPECTED = { 'others': [ - { 'path': 'std::vec', 'name': 'Vec' }, { 'path': 'std::collections', 'name': 'VecDeque' }, + { 'path': 'std::vec', 'name': 'Vec' }, ], }; diff --git a/src/test/rustdoc-js-std/typed-query.js b/src/test/rustdoc-js-std/typed-query.js index 3915ee7dc5d..25efbad2695 100644 --- a/src/test/rustdoc-js-std/typed-query.js +++ b/src/test/rustdoc-js-std/typed-query.js @@ -1,6 +1,7 @@ // exact-check const QUERY = 'macro:print'; +const FILTER_CRATE = 'std'; const EXPECTED = { 'others': [ @@ -9,6 +10,8 @@ const EXPECTED = { { 'path': 'std', 'name': 'println' }, { 'path': 'std', 'name': 'eprintln' }, { 'path': 'std::pin', 'name': 'pin' }, - { 'path': 'core::pin', 'name': 'pin' }, + { 'path': 'std::future', 'name': 'join' }, + { 'path': 'std', 'name': 'line' }, + { 'path': 'std', 'name': 'write' }, ], }; diff --git a/src/test/rustdoc-js-std/vec-new.js b/src/test/rustdoc-js-std/vec-new.js index e1a3256876b..cd0e8e7b4a9 100644 --- a/src/test/rustdoc-js-std/vec-new.js +++ b/src/test/rustdoc-js-std/vec-new.js @@ -4,6 +4,6 @@ const EXPECTED = { 'others': [ { 'path': 'std::vec::Vec', 'name': 'new' }, { 'path': 'std::vec::Vec', 'name': 'ne' }, - { 'path': 'std::rc::Rc', 'name': 'ne' }, + { 'path': 'alloc::vec::Vec', 'name': 'ne' }, ], }; diff --git a/src/test/rustdoc-js/doc-alias-filter.js b/src/test/rustdoc-js/doc-alias-filter.js index 4b1e2e29704..e06047ba760 100644 --- a/src/test/rustdoc-js/doc-alias-filter.js +++ b/src/test/rustdoc-js/doc-alias-filter.js @@ -1,6 +1,6 @@ // exact-check -const QUERY = 'true'; +const QUERY = '"true"'; const FILTER_CRATE = 'doc_alias_filter'; diff --git a/src/test/rustdoc-js/doc-alias.js b/src/test/rustdoc-js/doc-alias.js index ff188d51458..7bb0cbe388f 100644 --- a/src/test/rustdoc-js/doc-alias.js +++ b/src/test/rustdoc-js/doc-alias.js @@ -27,6 +27,7 @@ const QUERY = [ const EXPECTED = [ { + // StructItem 'others': [ { 'path': 'doc_alias', @@ -38,6 +39,7 @@ const EXPECTED = [ ], }, { + // StructFieldItem 'others': [ { 'path': 'doc_alias::Struct', @@ -49,6 +51,7 @@ const EXPECTED = [ ], }, { + // StructMethodItem 'others': [ { 'path': 'doc_alias::Struct', @@ -76,6 +79,7 @@ const EXPECTED = [ ], }, { + // ImplTraitFunction 'others': [ { 'path': 'doc_alias::Struct', @@ -87,6 +91,7 @@ const EXPECTED = [ ], }, { + // EnumItem 'others': [ { 'path': 'doc_alias', @@ -98,6 +103,7 @@ const EXPECTED = [ ], }, { + // VariantItem 'others': [ { 'path': 'doc_alias::Enum', @@ -109,6 +115,7 @@ const EXPECTED = [ ], }, { + // EnumMethodItem 'others': [ { 'path': 'doc_alias::Enum', @@ -120,6 +127,7 @@ const EXPECTED = [ ], }, { + // TypedefItem 'others': [ { 'path': 'doc_alias', @@ -131,6 +139,7 @@ const EXPECTED = [ ], }, { + // TraitItem 'others': [ { 'path': 'doc_alias', @@ -142,6 +151,7 @@ const EXPECTED = [ ], }, { + // TraitTypeItem 'others': [ { 'path': 'doc_alias::Trait', @@ -153,6 +163,7 @@ const EXPECTED = [ ], }, { + // AssociatedConstItem 'others': [ { 'path': 'doc_alias::Trait', @@ -164,6 +175,7 @@ const EXPECTED = [ ], }, { + // TraitFunctionItem 'others': [ { 'path': 'doc_alias::Trait', @@ -175,6 +187,7 @@ const EXPECTED = [ ], }, { + // FunctionItem 'others': [ { 'path': 'doc_alias', @@ -186,6 +199,7 @@ const EXPECTED = [ ], }, { + // ModuleItem 'others': [ { 'path': 'doc_alias', @@ -197,6 +211,7 @@ const EXPECTED = [ ], }, { + // ConstItem 'others': [ { 'path': 'doc_alias', @@ -212,6 +227,7 @@ const EXPECTED = [ ], }, { + // StaticItem 'others': [ { 'path': 'doc_alias', @@ -223,6 +239,7 @@ const EXPECTED = [ ], }, { + // UnionItem 'others': [ { 'path': 'doc_alias', @@ -240,6 +257,7 @@ const EXPECTED = [ ], }, { + // UnionFieldItem 'others': [ { 'path': 'doc_alias::Union', @@ -251,6 +269,7 @@ const EXPECTED = [ ], }, { + // UnionMethodItem 'others': [ { 'path': 'doc_alias::Union', @@ -262,6 +281,7 @@ const EXPECTED = [ ], }, { + // MacroItem 'others': [ { 'path': 'doc_alias', diff --git a/src/test/rustdoc-js/generics.js b/src/test/rustdoc-js/generics.js index 63a9ad53812..5e5ba7cd9ac 100644 --- a/src/test/rustdoc-js/generics.js +++ b/src/test/rustdoc-js/generics.js @@ -1,16 +1,18 @@ // exact-check const QUERY = [ - '"R<P>"', + 'R<P>', '"P"', 'P', - '"ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>"', + 'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>', 'TraitCat', 'TraitDog', + 'Result<String>', ]; const EXPECTED = [ { + // R<P> 'returned': [ { 'path': 'generics', 'name': 'alef' }, ], @@ -19,6 +21,7 @@ const EXPECTED = [ ], }, { + // "P" 'others': [ { 'path': 'generics', 'name': 'P' }, ], @@ -30,29 +33,41 @@ const EXPECTED = [ ], }, { + // P 'returned': [ { 'path': 'generics', 'name': 'alef' }, - { 'path': 'generics', 'name': 'bet' }, ], 'in_args': [ { 'path': 'generics', 'name': 'alpha' }, - { 'path': 'generics', 'name': 'beta' }, ], }, { + // "ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti> 'in_args': [ { 'path': 'generics', 'name': 'extracreditlabhomework' }, ], 'returned': [], }, { + // TraitCat 'in_args': [ { 'path': 'generics', 'name': 'gamma' }, ], }, { + // TraitDog 'in_args': [ { 'path': 'generics', 'name': 'gamma' }, ], }, + { + // Result<String> + 'others': [], + 'returned': [ + { 'path': 'generics', 'name': 'super_soup' }, + ], + 'in_args': [ + { 'path': 'generics', 'name': 'super_soup' }, + ], + }, ]; diff --git a/src/test/rustdoc-js/generics.rs b/src/test/rustdoc-js/generics.rs index 5e11a6d6018..055c51c7ec5 100644 --- a/src/test/rustdoc-js/generics.rs +++ b/src/test/rustdoc-js/generics.rs @@ -24,3 +24,5 @@ pub trait TraitCat {} pub trait TraitDog {} pub fn gamma<T: TraitCat + TraitDog>(t: T) {} + +pub fn super_soup(s: Result<String, i32>) -> Result<String, i32> { s } diff --git a/src/test/ui/rfc1623.base.stderr b/src/test/ui/rfc1623.base.stderr index 6d389a1317a..364c8c8f706 100644 --- a/src/test/ui/rfc1623.base.stderr +++ b/src/test/ui/rfc1623.base.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623.rs:36:8 + --> $DIR/rfc1623.rs:32:8 | LL | f: &id, | ^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/rfc1623.nll.stderr b/src/test/ui/rfc1623.nll.stderr index f85b6ff8ff7..2eff4708547 100644 --- a/src/test/ui/rfc1623.nll.stderr +++ b/src/test/ui/rfc1623.nll.stderr @@ -1,63 +1,35 @@ error[E0308]: mismatched types - --> $DIR/rfc1623.rs:29:35 + --> $DIR/rfc1623.rs:32:8 | -LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { - | ___________________________________^ -LL | | -LL | | -LL | | -... | -LL | | -LL | | }; - | |_^ one type is more general than the other +LL | f: &id, + | ^^^ one type is more general than the other | = note: expected type `for<'a, 'b> Fn<(&'a Foo<'b>,)>` found type `Fn<(&Foo<'_>,)>` error[E0308]: mismatched types - --> $DIR/rfc1623.rs:29:35 + --> $DIR/rfc1623.rs:32:8 | -LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { - | ___________________________________^ -LL | | -LL | | -LL | | -... | -LL | | -LL | | }; - | |_^ one type is more general than the other +LL | f: &id, + | ^^^ one type is more general than the other | = note: expected type `for<'a, 'b> Fn<(&'a Foo<'b>,)>` found type `Fn<(&Foo<'_>,)>` error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623.rs:29:35 + --> $DIR/rfc1623.rs:32:8 | -LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { - | ___________________________________^ -LL | | -LL | | -LL | | -... | -LL | | -LL | | }; - | |_^ implementation of `FnOnce` is not general enough +LL | f: &id, + | ^^^ implementation of `FnOnce` is not general enough | = note: `fn(&'2 Foo<'_>) -> &'2 Foo<'_> {id::<&'2 Foo<'_>>}` must implement `FnOnce<(&'1 Foo<'b>,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623.rs:29:35 + --> $DIR/rfc1623.rs:32:8 | -LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { - | ___________________________________^ -LL | | -LL | | -LL | | -... | -LL | | -LL | | }; - | |_^ implementation of `FnOnce` is not general enough +LL | f: &id, + | ^^^ implementation of `FnOnce` is not general enough | = note: `fn(&Foo<'2>) -> &Foo<'2> {id::<&Foo<'2>>}` must implement `FnOnce<(&'a Foo<'1>,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&Foo<'2>,)>`, for some specific lifetime `'2` diff --git a/src/test/ui/rfc1623.rs b/src/test/ui/rfc1623.rs index 0e9d2140324..443da0aa955 100644 --- a/src/test/ui/rfc1623.rs +++ b/src/test/ui/rfc1623.rs @@ -27,14 +27,14 @@ fn id<T>(t: T) -> T { } static SOME_STRUCT: &SomeStruct = &SomeStruct { - //[nll]~^ ERROR mismatched types - //[nll]~| ERROR mismatched types - //[nll]~| ERROR implementation of `FnOnce` is not general enough - //[nll]~| ERROR implementation of `FnOnce` is not general enough foo: &Foo { bools: &[false, true] }, bar: &Bar { bools: &[true, true] }, f: &id, //[base]~^ ERROR implementation of `FnOnce` is not general enough + //[nll]~^^ ERROR mismatched types + //[nll]~| ERROR mismatched types + //[nll]~| ERROR implementation of `FnOnce` is not general enough + //[nll]~| ERROR implementation of `FnOnce` is not general enough }; // very simple test for a 'static static with default lifetime |
