diff options
| author | bors <bors@rust-lang.org> | 2022-12-27 15:44:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-27 15:44:53 +0000 |
| commit | db7962532610cfbfb9be17e8d6c1b48acf5ed184 (patch) | |
| tree | aed378c750c8a930e823b93e31975135f02abfba /src | |
| parent | b38a6d373cb254697411147c0e49cd2e84864258 (diff) | |
| parent | b7657e9cecaf46128702c5a221c3a84fd6e7cae6 (diff) | |
| download | rust-db7962532610cfbfb9be17e8d6c1b48acf5ed184.tar.gz rust-db7962532610cfbfb9be17e8d6c1b48acf5ed184.zip | |
Auto merge of #106183 - matthiaskrgr:rollup-ww6yzhi, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - #105817 (Remove unreasonable help message for auto trait) - #105994 (Add regression test for #99647) - #106066 (Always suggest as `MachineApplicable` in `recover_intersection_pat`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/attributes/z-crate-attr.rs (renamed from src/test/ui/z-crate-attr.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/const-generics/generic_const_exprs/issue-99647.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/methods/issues/issue-105732.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/methods/issues/issue-105732.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/parser/intersection-patterns-1.fixed | 35 | ||||
| -rw-r--r-- | src/test/ui/parser/intersection-patterns-1.rs (renamed from src/test/ui/parser/intersection-patterns.rs) | 13 | ||||
| -rw-r--r-- | src/test/ui/parser/intersection-patterns-1.stderr (renamed from src/test/ui/parser/intersection-patterns.stderr) | 17 | ||||
| -rw-r--r-- | src/test/ui/parser/intersection-patterns-2.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/parser/intersection-patterns-2.stderr | 13 |
9 files changed, 95 insertions, 37 deletions
diff --git a/src/test/ui/z-crate-attr.rs b/src/test/ui/attributes/z-crate-attr.rs index 1021774fc5f..1021774fc5f 100644 --- a/src/test/ui/z-crate-attr.rs +++ b/src/test/ui/attributes/z-crate-attr.rs diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-99647.rs b/src/test/ui/const-generics/generic_const_exprs/issue-99647.rs new file mode 100644 index 00000000000..f797beda8e6 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-99647.rs @@ -0,0 +1,15 @@ +// edition:2018 +// run-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +#[allow(unused)] +async fn foo<'a>() { + let _data = &mut [0u8; { 1 + 4 }]; + bar().await +} + +async fn bar() {} + +fn main() {} diff --git a/src/test/ui/methods/issues/issue-105732.rs b/src/test/ui/methods/issues/issue-105732.rs index 98b7a8d0d04..d7005065813 100644 --- a/src/test/ui/methods/issues/issue-105732.rs +++ b/src/test/ui/methods/issues/issue-105732.rs @@ -6,7 +6,8 @@ auto trait Foo { trait Bar { fn f(&self) { - self.g(); //~ ERROR the method `g` exists for reference `&Self`, but its trait bounds were not satisfied + // issue #105788 + self.g(); //~ ERROR no method named `g` found for reference `&Self` in the current scope } } diff --git a/src/test/ui/methods/issues/issue-105732.stderr b/src/test/ui/methods/issues/issue-105732.stderr index fb2bdf47de7..7696642548d 100644 --- a/src/test/ui/methods/issues/issue-105732.stderr +++ b/src/test/ui/methods/issues/issue-105732.stderr @@ -6,21 +6,11 @@ LL | auto trait Foo { LL | fn g(&self); | ---^-------- help: remove these associated items -error[E0599]: the method `g` exists for reference `&Self`, but its trait bounds were not satisfied - --> $DIR/issue-105732.rs:9:14 +error[E0599]: no method named `g` found for reference `&Self` in the current scope + --> $DIR/issue-105732.rs:10:14 | LL | self.g(); - | ^ - | - = note: the following trait bounds were not satisfied: - `Self: Foo` - which is required by `&Self: Foo` - `&Self: Foo` - = help: items from traits can only be used if the type parameter is bounded by the trait -help: the following trait defines an item `g`, perhaps you need to add a supertrait for it: - | -LL | trait Bar: Foo { - | +++++ + | ^ help: there is a method with a similar name: `f` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/intersection-patterns-1.fixed b/src/test/ui/parser/intersection-patterns-1.fixed new file mode 100644 index 00000000000..44773095b87 --- /dev/null +++ b/src/test/ui/parser/intersection-patterns-1.fixed @@ -0,0 +1,35 @@ +// This tests the parser recovery in `recover_intersection_pat` +// and serves as a regression test for the diagnostics issue #65400. +// +// The general idea is that for `$pat_lhs @ $pat_rhs` where +// `$pat_lhs` is not generated by `ref? mut? $ident` we want +// to suggest either switching the order or note that intersection +// patterns are not allowed. + +// run-rustfix + +#![allow(unused_variables)] + +fn main() { + let s: Option<u8> = None; + + match s { + y @ Some(x) => {} + //~^ ERROR pattern on wrong side of `@` + //~| pattern on the left, should be on the right + //~| binding on the right, should be on the left + //~| HELP switch the order + //~| SUGGESTION y @ Some(x) + _ => {} + } + + match 2 { + e @ 1..=5 => {} + //~^ ERROR pattern on wrong side of `@` + //~| pattern on the left, should be on the right + //~| binding on the right, should be on the left + //~| HELP switch the order + //~| SUGGESTION e @ 1..=5 + _ => {} + } +} diff --git a/src/test/ui/parser/intersection-patterns.rs b/src/test/ui/parser/intersection-patterns-1.rs index a6d27aab4f6..1036b9daf64 100644 --- a/src/test/ui/parser/intersection-patterns.rs +++ b/src/test/ui/parser/intersection-patterns-1.rs @@ -6,6 +6,10 @@ // to suggest either switching the order or note that intersection // patterns are not allowed. +// run-rustfix + +#![allow(unused_variables)] + fn main() { let s: Option<u8> = None; @@ -19,15 +23,6 @@ fn main() { _ => {} } - match s { - Some(x) @ Some(y) => {} - //~^ ERROR left-hand side of `@` must be a binding - //~| interpreted as a pattern, not a binding - //~| also a pattern - //~| NOTE bindings are `x`, `mut x`, `ref x`, and `ref mut x` - _ => {} - } - match 2 { 1 ..= 5 @ e => {} //~^ ERROR pattern on wrong side of `@` diff --git a/src/test/ui/parser/intersection-patterns.stderr b/src/test/ui/parser/intersection-patterns-1.stderr index 9dc4c469a60..dc968656c91 100644 --- a/src/test/ui/parser/intersection-patterns.stderr +++ b/src/test/ui/parser/intersection-patterns-1.stderr @@ -1,5 +1,5 @@ error: pattern on wrong side of `@` - --> $DIR/intersection-patterns.rs:13:9 + --> $DIR/intersection-patterns-1.rs:17:9 | LL | Some(x) @ y => {} | -------^^^- @@ -8,19 +8,8 @@ LL | Some(x) @ y => {} | pattern on the left, should be on the right | help: switch the order: `y @ Some(x)` -error: left-hand side of `@` must be a binding - --> $DIR/intersection-patterns.rs:23:9 - | -LL | Some(x) @ Some(y) => {} - | -------^^^------- - | | | - | | also a pattern - | interpreted as a pattern, not a binding - | - = note: bindings are `x`, `mut x`, `ref x`, and `ref mut x` - error: pattern on wrong side of `@` - --> $DIR/intersection-patterns.rs:32:9 + --> $DIR/intersection-patterns-1.rs:27:9 | LL | 1 ..= 5 @ e => {} | -------^^^- @@ -29,5 +18,5 @@ LL | 1 ..= 5 @ e => {} | pattern on the left, should be on the right | help: switch the order: `e @ 1..=5` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/intersection-patterns-2.rs b/src/test/ui/parser/intersection-patterns-2.rs new file mode 100644 index 00000000000..408415e87ef --- /dev/null +++ b/src/test/ui/parser/intersection-patterns-2.rs @@ -0,0 +1,20 @@ +// This tests the parser recovery in `recover_intersection_pat` +// and serves as a regression test for the diagnostics issue #65400. +// +// The general idea is that for `$pat_lhs @ $pat_rhs` where +// `$pat_lhs` is not generated by `ref? mut? $ident` we want +// to suggest either switching the order or note that intersection +// patterns are not allowed. + +fn main() { + let s: Option<u8> = None; + + match s { + Some(x) @ Some(y) => {} + //~^ ERROR left-hand side of `@` must be a binding + //~| interpreted as a pattern, not a binding + //~| also a pattern + //~| NOTE bindings are `x`, `mut x`, `ref x`, and `ref mut x` + _ => {} + } +} diff --git a/src/test/ui/parser/intersection-patterns-2.stderr b/src/test/ui/parser/intersection-patterns-2.stderr new file mode 100644 index 00000000000..f7e78814ca5 --- /dev/null +++ b/src/test/ui/parser/intersection-patterns-2.stderr @@ -0,0 +1,13 @@ +error: left-hand side of `@` must be a binding + --> $DIR/intersection-patterns-2.rs:13:9 + | +LL | Some(x) @ Some(y) => {} + | -------^^^------- + | | | + | | also a pattern + | interpreted as a pattern, not a binding + | + = note: bindings are `x`, `mut x`, `ref x`, and `ref mut x` + +error: aborting due to previous error + |
