diff options
| author | bors <bors@rust-lang.org> | 2022-12-29 16:46:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-29 16:46:08 +0000 |
| commit | e37ff7e71a087fcd799d3e59bcd63e3732d351d3 (patch) | |
| tree | 07ea573e09bd231f4de878cfbf137f7164b31bc7 /src/test | |
| parent | 29d76cc6f5064e393440019198328b4424302633 (diff) | |
| parent | 031a2143f0ef78e9b080b20481507ec0268e7bab (diff) | |
| download | rust-e37ff7e71a087fcd799d3e59bcd63e3732d351d3.tar.gz rust-e37ff7e71a087fcd799d3e59bcd63e3732d351d3.zip | |
Auto merge of #106256 - matthiaskrgr:rollup-g1ovcqq, r=matthiaskrgr
Rollup of 9 pull requests
Successful merges:
- #106208 (Make trait/impl `where` clause mismatch on region error a bit more actionable)
- #106216 (Powershell: Use `WaitForExit` instead of `-Wait`)
- #106217 (rustdoc: remove unnecessary `.tooltip::after { text-align: center }`)
- #106218 (Migrate css var scraped examples)
- #106221 (Rename `Rptr` to `Ref` in AST and HIR)
- #106223 (On unsized locals with explicit types suggest `&`)
- #106225 (Remove CraftSpider from review rotation)
- #106229 (update Miri)
- #106242 (Detect diff markers in the parser)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
40 files changed, 510 insertions, 11 deletions
diff --git a/src/test/rustdoc-gui/codeblock-tooltip.goml b/src/test/rustdoc-gui/codeblock-tooltip.goml index aab27394eb1..d4443f821d2 100644 --- a/src/test/rustdoc-gui/codeblock-tooltip.goml +++ b/src/test/rustdoc-gui/codeblock-tooltip.goml @@ -34,7 +34,6 @@ define-function: ( ".docblock .example-wrap.compile_fail .tooltip::after", { "content": '"This example deliberately fails to compile"', - "text-align": "center", "padding": "5px 3px 3px", "background-color": |background|, "color": |color|, @@ -74,7 +73,6 @@ define-function: ( ".docblock .example-wrap.should_panic .tooltip::after", { "content": '"This example panics"', - "text-align": "center", "padding": "5px 3px 3px", "background-color": |background|, "color": |color|, @@ -114,7 +112,6 @@ define-function: ( ".docblock .example-wrap.ignore .tooltip::after", { "content": '"This example is not tested"', - "text-align": "center", "padding": "5px 3px 3px", "background-color": |background|, "color": |color|, diff --git a/src/test/rustdoc-gui/scrape-examples-color.goml b/src/test/rustdoc-gui/scrape-examples-color.goml new file mode 100644 index 00000000000..5175891e7ba --- /dev/null +++ b/src/test/rustdoc-gui/scrape-examples-color.goml @@ -0,0 +1,34 @@ +// Check that scrape example code blocks have the expected colors. +goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" + +define-function: ( + "check-colors", + (theme, highlight, highlight_focus), + [ + ("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }), + ("reload"), + ("wait-for", ".more-examples-toggle"), + ("assert-css", (".scraped-example .example-wrap .rust span.highlight:not(.focus)", { + "background-color": |highlight|, + }, ALL)), + ("assert-css", (".scraped-example .example-wrap .rust span.highlight.focus", { + "background-color": |highlight_focus|, + }, ALL)), + ] +) + +call-function: ("check-colors", { + "theme": "ayu", + "highlight": "rgb(91, 59, 1)", + "highlight_focus": "rgb(124, 75, 15)", +}) +call-function: ("check-colors", { + "theme": "dark", + "highlight": "rgb(91, 59, 1)", + "highlight_focus": "rgb(124, 75, 15)", +}) +call-function: ("check-colors", { + "theme": "light", + "highlight": "rgb(252, 255, 214)", + "highlight_focus": "rgb(246, 253, 176)", +}) diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index 0277501de09..af765c51ace 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -59,7 +59,7 @@ pub async fn const_generics<const N: usize>(_: impl Trait<N>) {} // @has - '//pre[@class="rust fn"]' 'pub async fn elided(foo: &str) -> &str' pub async fn elided(foo: &str) -> &str {} // This should really be shown as written, but for implementation reasons it's difficult. -// See `impl Clean for TyKind::Rptr`. +// See `impl Clean for TyKind::Ref`. // @has async_fn/fn.user_elided.html // @has - '//pre[@class="rust fn"]' 'pub async fn user_elided(foo: &str) -> &str' pub async fn user_elided(foo: &'_ str) -> &str {} diff --git a/src/test/ui/compare-method/region-extra-2.stderr b/src/test/ui/compare-method/region-extra-2.stderr index f01d7f4710c..eb19d57ab05 100644 --- a/src/test/ui/compare-method/region-extra-2.stderr +++ b/src/test/ui/compare-method/region-extra-2.stderr @@ -6,6 +6,11 @@ LL | fn renew<'b: 'a>(self) -> &'b mut [T]; ... LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { | ^^ impl has extra requirement `'a: 'b` + | +help: copy the `where` clause predicates from the trait + | +LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a { + | ~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr index 4a3af65e904..1a471e18d9d 100644 --- a/src/test/ui/compare-method/region-extra.stderr +++ b/src/test/ui/compare-method/region-extra.stderr @@ -6,6 +6,12 @@ LL | fn foo(); ... LL | fn foo() where 'a: 'b { } | ^^ impl has extra requirement `'a: 'b` + | +help: remove the `where` clause + | +LL - fn foo() where 'a: 'b { } +LL + fn foo() { } + | error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index 3acd85c8ac6..3456b345cc2 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -15,6 +15,11 @@ LL | type B<'a, 'b> where 'a: 'b; ... LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | ^^ impl has extra requirement `'b: 'a` + | +help: copy the `where` clause predicates from the trait + | +LL | type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b; + | ~~~~~~~~~~~~ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/impl_bounds.rs:18:33 diff --git a/src/test/ui/generic-associated-types/issue-90014.stderr b/src/test/ui/generic-associated-types/issue-90014.stderr index 2d3f4a6af7e..b4b1bc7da7f 100644 --- a/src/test/ui/generic-associated-types/issue-90014.stderr +++ b/src/test/ui/generic-associated-types/issue-90014.stderr @@ -5,13 +5,17 @@ LL | type Fut<'a> where Self: 'a; | ------------ definition of `Fut` from trait ... LL | type Fut<'a> = impl Future<Output = ()>; - | ^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` + | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must outlive the lifetime `'a` as defined here --> $DIR/issue-90014.rs:13:14 | LL | type Fut<'a> = impl Future<Output = ()>; | ^^ +help: copy the `where` clause predicates from the trait + | +LL | type Fut<'a> = impl Future<Output = ()> where Self: 'a; + | ++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-91883.stderr b/src/test/ui/generic-associated-types/issue-91883.stderr index 1cfc2aaf161..d5db962094c 100644 --- a/src/test/ui/generic-associated-types/issue-91883.stderr +++ b/src/test/ui/generic-associated-types/issue-91883.stderr @@ -5,7 +5,7 @@ LL | type Cursor<'tx>: Cursor<'tx> | ----------------------------- definition of `Cursor` from trait ... LL | type Cursor<'tx> = CursorImpl<'tx>; - | ^^^^^^^^^^^^^^^- help: try copying these clauses from the trait: `where 'db: 'tx, Self: 'tx` + | ^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'db` as defined here --> $DIR/issue-91883.rs:29:6 @@ -17,6 +17,10 @@ note: but lifetime parameter must outlive the lifetime `'tx` as defined here | LL | type Cursor<'tx> = CursorImpl<'tx>; | ^^^ +help: copy the `where` clause predicates from the trait + | +LL | type Cursor<'tx> = CursorImpl<'tx> where 'db: 'tx, Self: 'tx; + | +++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-92033.stderr b/src/test/ui/generic-associated-types/issue-92033.stderr index cd7eed25421..ddc420a7b4e 100644 --- a/src/test/ui/generic-associated-types/issue-92033.stderr +++ b/src/test/ui/generic-associated-types/issue-92033.stderr @@ -5,13 +5,17 @@ LL | type TextureIter<'a>: Iterator<Item = &'a Texture> | -------------------------------------------------- definition of `TextureIter` from trait ... LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must outlive the lifetime `'a` as defined here --> $DIR/issue-92033.rs:20:22 | LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; | ^^ +help: copy the `where` clause predicates from the trait + | +LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture> where Self: 'a; + | ++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/mismatched-where-clause-regions.rs b/src/test/ui/generic-associated-types/mismatched-where-clause-regions.rs new file mode 100644 index 00000000000..8caf5317693 --- /dev/null +++ b/src/test/ui/generic-associated-types/mismatched-where-clause-regions.rs @@ -0,0 +1,12 @@ +trait Foo { + type T<'a1, 'b1> + where + 'a1: 'b1; +} + +impl Foo for () { + type T<'a2, 'b2> = () where 'b2: 'a2; + //~^ ERROR impl has stricter requirements than trait +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/mismatched-where-clause-regions.stderr b/src/test/ui/generic-associated-types/mismatched-where-clause-regions.stderr new file mode 100644 index 00000000000..91a03007640 --- /dev/null +++ b/src/test/ui/generic-associated-types/mismatched-where-clause-regions.stderr @@ -0,0 +1,17 @@ +error[E0276]: impl has stricter requirements than trait + --> $DIR/mismatched-where-clause-regions.rs:8:38 + | +LL | type T<'a1, 'b1> + | ---------------- definition of `T` from trait +... +LL | type T<'a2, 'b2> = () where 'b2: 'a2; + | ^^^ impl has extra requirement `'b2: 'a2` + | +help: copy the `where` clause predicates from the trait + | +LL | type T<'a2, 'b2> = () where 'a2: 'b2; + | ~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0276`. diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr index ffdba6676bf..8a71fc73a9d 100644 --- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr +++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr @@ -6,6 +6,12 @@ LL | type Assoc<'a, 'b>; ... LL | type Assoc<'a, 'b> = () where 'a: 'b; | ^^ impl has extra requirement `'a: 'b` + | +help: remove the `where` clause + | +LL - type Assoc<'a, 'b> = () where 'a: 'b; +LL + type Assoc<'a, 'b> = () ; + | error: aborting due to previous error diff --git a/src/test/ui/macros/stringify.rs b/src/test/ui/macros/stringify.rs index bc0d4488162..5cd217df6fc 100644 --- a/src/test/ui/macros/stringify.rs +++ b/src/test/ui/macros/stringify.rs @@ -801,7 +801,7 @@ fn test_ty() { assert_eq!(stringify_ty!(*const T), "*const T"); assert_eq!(stringify_ty!(*mut T), "*mut T"); - // TyKind::Rptr + // TyKind::Ref assert_eq!(stringify_ty!(&T), "&T"); assert_eq!(stringify_ty!(&mut T), "&mut T"); assert_eq!(stringify_ty!(&'a T), "&'a T"); diff --git a/src/test/ui/parser/diff-markers/enum-2.rs b/src/test/ui/parser/diff-markers/enum-2.rs new file mode 100644 index 00000000000..76ea980fc62 --- /dev/null +++ b/src/test/ui/parser/diff-markers/enum-2.rs @@ -0,0 +1,11 @@ +enum E { + Foo { +<<<<<<< HEAD //~ ERROR encountered diff marker + x: u8, +||||||| + z: (), +======= + y: i8, +>>>>>>> branch + } +} diff --git a/src/test/ui/parser/diff-markers/enum-2.stderr b/src/test/ui/parser/diff-markers/enum-2.stderr new file mode 100644 index 00000000000..63da5c2a6e1 --- /dev/null +++ b/src/test/ui/parser/diff-markers/enum-2.stderr @@ -0,0 +1,21 @@ +error: encountered diff marker + --> $DIR/enum-2.rs:3:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | x: u8, +LL | ||||||| + | ------- +LL | z: (), +LL | ======= + | ------- +LL | y: i8, +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/enum.rs b/src/test/ui/parser/diff-markers/enum.rs new file mode 100644 index 00000000000..45df6e3251d --- /dev/null +++ b/src/test/ui/parser/diff-markers/enum.rs @@ -0,0 +1,7 @@ +enum E { +<<<<<<< HEAD //~ ERROR encountered diff marker + Foo(u8), +======= + Bar(i8), +>>>>>>> branch +} diff --git a/src/test/ui/parser/diff-markers/enum.stderr b/src/test/ui/parser/diff-markers/enum.stderr new file mode 100644 index 00000000000..abbf3fb41e7 --- /dev/null +++ b/src/test/ui/parser/diff-markers/enum.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/enum.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | Foo(u8), +LL | ======= + | ------- +LL | Bar(i8), +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/fn-arg.rs b/src/test/ui/parser/diff-markers/fn-arg.rs new file mode 100644 index 00000000000..86c355628ab --- /dev/null +++ b/src/test/ui/parser/diff-markers/fn-arg.rs @@ -0,0 +1,16 @@ +trait T { + fn foo( +<<<<<<< HEAD //~ ERROR encountered diff marker + x: u8, +======= + x: i8, +>>>>>>> branch + ) {} +} + +struct S; +impl T for S {} + +fn main() { + S::foo(42); +} diff --git a/src/test/ui/parser/diff-markers/fn-arg.stderr b/src/test/ui/parser/diff-markers/fn-arg.stderr new file mode 100644 index 00000000000..933a206410e --- /dev/null +++ b/src/test/ui/parser/diff-markers/fn-arg.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/fn-arg.rs:3:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | x: u8, +LL | ======= + | ------- +LL | x: i8, +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/item-with-attr.rs b/src/test/ui/parser/diff-markers/item-with-attr.rs new file mode 100644 index 00000000000..985907c08b2 --- /dev/null +++ b/src/test/ui/parser/diff-markers/item-with-attr.rs @@ -0,0 +1,10 @@ +#[attribute] +<<<<<<< HEAD //~ ERROR encountered diff marker +fn foo() {} +======= +fn bar() {} +>>>>>>> branch + +fn main() { + foo(); +} diff --git a/src/test/ui/parser/diff-markers/item-with-attr.stderr b/src/test/ui/parser/diff-markers/item-with-attr.stderr new file mode 100644 index 00000000000..850e2368e55 --- /dev/null +++ b/src/test/ui/parser/diff-markers/item-with-attr.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/item-with-attr.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | fn foo() {} +LL | ======= + | ------- +LL | fn bar() {} +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/item.rs b/src/test/ui/parser/diff-markers/item.rs new file mode 100644 index 00000000000..4ed36b7b42b --- /dev/null +++ b/src/test/ui/parser/diff-markers/item.rs @@ -0,0 +1,9 @@ +<<<<<<< HEAD //~ ERROR encountered diff marker +fn foo() {} +======= +fn bar() {} +>>>>>>> branch + +fn main() { + foo(); +} diff --git a/src/test/ui/parser/diff-markers/item.stderr b/src/test/ui/parser/diff-markers/item.stderr new file mode 100644 index 00000000000..9ab3631a60e --- /dev/null +++ b/src/test/ui/parser/diff-markers/item.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/item.rs:1:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | fn foo() {} +LL | ======= + | ------- +LL | fn bar() {} +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/statement.rs b/src/test/ui/parser/diff-markers/statement.rs new file mode 100644 index 00000000000..e55d16d3bbb --- /dev/null +++ b/src/test/ui/parser/diff-markers/statement.rs @@ -0,0 +1,15 @@ +trait T { + fn foo() {} + fn bar() {} +} + +struct S; +impl T for S {} + +fn main() { +<<<<<<< HEAD //~ ERROR encountered diff marker + S::foo(); +======= + S::bar(); +>>>>>>> branch +} diff --git a/src/test/ui/parser/diff-markers/statement.stderr b/src/test/ui/parser/diff-markers/statement.stderr new file mode 100644 index 00000000000..7ca2495b829 --- /dev/null +++ b/src/test/ui/parser/diff-markers/statement.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/statement.rs:10:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | S::foo(); +LL | ======= + | ------- +LL | S::bar(); +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/struct-expr.rs b/src/test/ui/parser/diff-markers/struct-expr.rs new file mode 100644 index 00000000000..99d2fd662c6 --- /dev/null +++ b/src/test/ui/parser/diff-markers/struct-expr.rs @@ -0,0 +1,12 @@ +struct S { + x: u8, +} +fn main() { + let _ = S { +<<<<<<< HEAD //~ ERROR encountered diff marker + x: 42, +======= + x: 0, +>>>>>>> branch + } +} diff --git a/src/test/ui/parser/diff-markers/struct-expr.stderr b/src/test/ui/parser/diff-markers/struct-expr.stderr new file mode 100644 index 00000000000..d70476a9833 --- /dev/null +++ b/src/test/ui/parser/diff-markers/struct-expr.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/struct-expr.rs:6:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | x: 42, +LL | ======= + | ------- +LL | x: 0, +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/struct.rs b/src/test/ui/parser/diff-markers/struct.rs new file mode 100644 index 00000000000..d26464d47bc --- /dev/null +++ b/src/test/ui/parser/diff-markers/struct.rs @@ -0,0 +1,7 @@ +struct S { +<<<<<<< HEAD //~ ERROR encountered diff marker + x: u8, +======= + x: i8, +>>>>>>> branch +} diff --git a/src/test/ui/parser/diff-markers/struct.stderr b/src/test/ui/parser/diff-markers/struct.stderr new file mode 100644 index 00000000000..cc0b3da664e --- /dev/null +++ b/src/test/ui/parser/diff-markers/struct.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/struct.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | x: u8, +LL | ======= + | ------- +LL | x: i8, +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/trait-item.rs b/src/test/ui/parser/diff-markers/trait-item.rs new file mode 100644 index 00000000000..3227c8212c9 --- /dev/null +++ b/src/test/ui/parser/diff-markers/trait-item.rs @@ -0,0 +1,14 @@ +trait T { +<<<<<<< HEAD //~ ERROR encountered diff marker + fn foo() {} +======= + fn bar() {} +>>>>>>> branch +} + +struct S; +impl T for S {} + +fn main() { + S::foo(); +} diff --git a/src/test/ui/parser/diff-markers/trait-item.stderr b/src/test/ui/parser/diff-markers/trait-item.stderr new file mode 100644 index 00000000000..cdc19f8e076 --- /dev/null +++ b/src/test/ui/parser/diff-markers/trait-item.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/trait-item.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | fn foo() {} +LL | ======= + | ------- +LL | fn bar() {} +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/tuple-struct.rs b/src/test/ui/parser/diff-markers/tuple-struct.rs new file mode 100644 index 00000000000..7eec35c968d --- /dev/null +++ b/src/test/ui/parser/diff-markers/tuple-struct.rs @@ -0,0 +1,7 @@ +struct S( +<<<<<<< HEAD //~ ERROR encountered diff marker + u8, +======= + i8, +>>>>>>> branch +); diff --git a/src/test/ui/parser/diff-markers/tuple-struct.stderr b/src/test/ui/parser/diff-markers/tuple-struct.stderr new file mode 100644 index 00000000000..d673db89837 --- /dev/null +++ b/src/test/ui/parser/diff-markers/tuple-struct.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/tuple-struct.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | u8, +LL | ======= + | ------- +LL | i8, +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/parser/diff-markers/use-statement.rs b/src/test/ui/parser/diff-markers/use-statement.rs new file mode 100644 index 00000000000..6306243a514 --- /dev/null +++ b/src/test/ui/parser/diff-markers/use-statement.rs @@ -0,0 +1,9 @@ +use foo::{ +<<<<<<< HEAD //~ ERROR encountered diff marker + bar, +======= + baz, +>>>>>>> branch +}; + +fn main() {} diff --git a/src/test/ui/parser/diff-markers/use-statement.stderr b/src/test/ui/parser/diff-markers/use-statement.stderr new file mode 100644 index 00000000000..12e6f57dd50 --- /dev/null +++ b/src/test/ui/parser/diff-markers/use-statement.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/use-statement.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +LL | bar, +LL | ======= + | ------- +LL | baz, +LL | >>>>>>> branch + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to previous error + diff --git a/src/test/ui/stats/hir-stats.stderr b/src/test/ui/stats/hir-stats.stderr index 15900bef7f6..7d9ff2dfb4d 100644 --- a/src/test/ui/stats/hir-stats.stderr +++ b/src/test/ui/stats/hir-stats.stderr @@ -41,8 +41,8 @@ ast-stats-1 - Wild 88 ( 1.2%) 1 ast-stats-1 - Ident 440 ( 5.9%) 5 ast-stats-1 PathSegment 720 ( 9.7%) 30 24 ast-stats-1 Ty 896 (12.1%) 14 64 -ast-stats-1 - Rptr 64 ( 0.9%) 1 ast-stats-1 - Ptr 64 ( 0.9%) 1 +ast-stats-1 - Ref 64 ( 0.9%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.7%) 2 ast-stats-1 - Path 640 ( 8.6%) 10 ast-stats-1 Item 1_656 (22.3%) 9 184 @@ -100,8 +100,8 @@ ast-stats-2 - Lit 144 ( 1.8%) 2 ast-stats-2 - Block 216 ( 2.7%) 3 ast-stats-2 PathSegment 792 ( 9.8%) 33 24 ast-stats-2 Ty 896 (11.0%) 14 64 -ast-stats-2 - Rptr 64 ( 0.8%) 1 ast-stats-2 - Ptr 64 ( 0.8%) 1 +ast-stats-2 - Ref 64 ( 0.8%) 1 ast-stats-2 - ImplicitSelf 128 ( 1.6%) 2 ast-stats-2 - Path 640 ( 7.9%) 10 ast-stats-2 Item 2_024 (25.0%) 11 184 @@ -154,7 +154,7 @@ hir-stats GenericParam 400 ( 4.4%) 5 80 hir-stats Generics 560 ( 6.2%) 10 56 hir-stats Ty 720 ( 8.0%) 15 48 hir-stats - Ptr 48 ( 0.5%) 1 -hir-stats - Rptr 48 ( 0.5%) 1 +hir-stats - Ref 48 ( 0.5%) 1 hir-stats - Path 624 ( 6.9%) 13 hir-stats Expr 768 ( 8.5%) 12 64 hir-stats - Path 64 ( 0.7%) 1 diff --git a/src/test/ui/unsized-locals/suggest-borrow.rs b/src/test/ui/unsized-locals/suggest-borrow.rs new file mode 100644 index 00000000000..08694857993 --- /dev/null +++ b/src/test/ui/unsized-locals/suggest-borrow.rs @@ -0,0 +1,7 @@ +fn main() { + let x: [u8] = vec!(1, 2, 3)[..]; //~ ERROR E0277 + let x: &[u8] = vec!(1, 2, 3)[..]; //~ ERROR E0308 + let x: [u8] = &vec!(1, 2, 3)[..]; //~ ERROR E0308 + //~^ ERROR E0277 + let x: &[u8] = &vec!(1, 2, 3)[..]; +} diff --git a/src/test/ui/unsized-locals/suggest-borrow.stderr b/src/test/ui/unsized-locals/suggest-borrow.stderr new file mode 100644 index 00000000000..08745eab28d --- /dev/null +++ b/src/test/ui/unsized-locals/suggest-borrow.stderr @@ -0,0 +1,60 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/suggest-borrow.rs:2:9 + | +LL | let x: [u8] = vec!(1, 2, 3)[..]; + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: all local variables must have a statically known size + = help: unsized locals are gated as an unstable feature +help: consider borrowing here + | +LL | let x: &[u8] = vec!(1, 2, 3)[..]; + | + + +error[E0308]: mismatched types + --> $DIR/suggest-borrow.rs:3:20 + | +LL | let x: &[u8] = vec!(1, 2, 3)[..]; + | ----- ^^^^^^^^^^^^^^^^^ + | | | + | | expected `&[u8]`, found slice `[{integer}]` + | | help: consider borrowing here: `&vec!(1, 2, 3)[..]` + | expected due to this + +error[E0308]: mismatched types + --> $DIR/suggest-borrow.rs:4:19 + | +LL | let x: [u8] = &vec!(1, 2, 3)[..]; + | ---- ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]` + | | + | expected due to this + | +help: consider removing the borrow + | +LL - let x: [u8] = &vec!(1, 2, 3)[..]; +LL + let x: [u8] = vec!(1, 2, 3)[..]; + | +help: alternatively, consider changing the type annotation + | +LL | let x: &[u8] = &vec!(1, 2, 3)[..]; + | + + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/suggest-borrow.rs:4:9 + | +LL | let x: [u8] = &vec!(1, 2, 3)[..]; + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: all local variables must have a statically known size + = help: unsized locals are gated as an unstable feature +help: consider borrowing here + | +LL | let x: &[u8] = &vec!(1, 2, 3)[..]; + | + + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr b/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr index da77026673d..ace5a87187b 100644 --- a/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr +++ b/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr @@ -27,6 +27,10 @@ LL | let _foo: [u8] = *foo; = help: the trait `Sized` is not implemented for `[u8]` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: consider borrowing here + | +LL | let _foo: &[u8] = *foo; + | + error: aborting due to 3 previous errors diff --git a/src/test/ui/unsized/unsized6.stderr b/src/test/ui/unsized/unsized6.stderr index 011f2b426c7..18ac1ea1875 100644 --- a/src/test/ui/unsized/unsized6.stderr +++ b/src/test/ui/unsized/unsized6.stderr @@ -14,6 +14,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) { LL + fn f1<W: ?Sized, X: ?Sized, Y, Z: ?Sized>(x: &X) { | +help: consider borrowing here + | +LL | let y: &Y; + | + error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:7:12 @@ -62,6 +66,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) { LL + fn f2<X, Y: ?Sized>(x: &X) { | +help: consider borrowing here + | +LL | let y: &X; + | + error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized6.rs:17:12 @@ -94,6 +102,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { | +help: consider borrowing here + | +LL | let y: &X = *x1; + | + error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:24:9 @@ -144,6 +156,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { | +help: consider borrowing here + | +LL | let y: &X = *x1; + | + error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:32:9 |
