Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 592f2c9

Browse files
committedJan 8, 2025
modify test to side-step platform-dependent stderr output
1 parent d44f021 commit 592f2c9

2 files changed

+27
-18
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// Regression test for #135209.
22
// We ensure that we don't try to access fields on a non-struct pattern type.
33
fn main() {
4-
if let Iterator::Item { .. } = 1 { //~ ERROR E0223
4+
if let <Vec<()> as Iterator>::Item { .. } = 1 {
5+
//~^ ERROR E0658
6+
//~| ERROR E0071
7+
//~| ERROR E0277
58
x //~ ERROR E0425
69
}
710
}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
error[E0425]: cannot find value `x` in this scope
2-
--> $DIR/struct-pattern-on-non-struct-resolve-error.rs:5:9
2+
--> $DIR/struct-pattern-on-non-struct-resolve-error.rs:8:9
33
|
44
LL | x
55
| ^ not found in this scope
66

7-
error[E0223]: ambiguous associated type
7+
error[E0658]: usage of qualified paths in this context is experimental
88
--> $DIR/struct-pattern-on-non-struct-resolve-error.rs:4:12
99
|
10-
LL | if let Iterator::Item { .. } = 1 {
11-
| ^^^^^^^^^^^^^^
10+
LL | if let <Vec<()> as Iterator>::Item { .. } = 1 {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
|
13-
help: use fully-qualified syntax
13+
= note: see issue #86935 <https://github.com/rust-lang/rust/issues/86935> for more information
14+
= help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable
15+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
16+
17+
error[E0071]: expected struct, variant or union type, found inferred type
18+
--> $DIR/struct-pattern-on-non-struct-resolve-error.rs:4:12
19+
|
20+
LL | if let <Vec<()> as Iterator>::Item { .. } = 1 {
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a struct
22+
23+
error[E0277]: `Vec<()>` is not an iterator
24+
--> $DIR/struct-pattern-on-non-struct-resolve-error.rs:4:12
25+
|
26+
LL | if let <Vec<()> as Iterator>::Item { .. } = 1 {
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Vec<()>` is not an iterator
1428
|
15-
LL | if let <Ancestors<'_> as Iterator>::Item { .. } = 1 {
16-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17-
LL | if let <Args as Iterator>::Item { .. } = 1 {
18-
| ~~~~~~~~~~~~~~~~~~~~~~~~
19-
LL | if let <ArgsOs as Iterator>::Item { .. } = 1 {
20-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
21-
LL | if let <CharIndices<'_> as Iterator>::Item { .. } = 1 {
22-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23-
and 71 other candidates
29+
= help: the trait `Iterator` is not implemented for `Vec<()>`
2430

25-
error: aborting due to 2 previous errors
31+
error: aborting due to 4 previous errors
2632

27-
Some errors have detailed explanations: E0223, E0425.
28-
For more information about an error, try `rustc --explain E0223`.
33+
Some errors have detailed explanations: E0071, E0277, E0425, E0658.
34+
For more information about an error, try `rustc --explain E0071`.

0 commit comments

Comments
 (0)
Failed to load comments.