diff options
| author | Caio <c410.f3r@gmail.com> | 2024-04-21 15:43:43 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2024-04-21 15:43:43 -0300 |
| commit | 3aaa3941fd62fb4aeea559eafe8a6aa6472eb87d (patch) | |
| tree | 370d74ef8239f923cae41848afd9e71648850de3 /tests/ui/expr | |
| parent | fecb7b43093e4fa59e2d366e88bf0085ce350f29 (diff) | |
| download | rust-3aaa3941fd62fb4aeea559eafe8a6aa6472eb87d.tar.gz rust-3aaa3941fd62fb4aeea559eafe8a6aa6472eb87d.zip | |
Move some tests
Diffstat (limited to 'tests/ui/expr')
| -rw-r--r-- | tests/ui/expr/issue-22933-1.rs | 23 | ||||
| -rw-r--r-- | tests/ui/expr/issue-22933-2.rs | 8 | ||||
| -rw-r--r-- | tests/ui/expr/issue-22933-2.stderr | 15 |
3 files changed, 46 insertions, 0 deletions
diff --git a/tests/ui/expr/issue-22933-1.rs b/tests/ui/expr/issue-22933-1.rs new file mode 100644 index 00000000000..8f1f5a5048a --- /dev/null +++ b/tests/ui/expr/issue-22933-1.rs @@ -0,0 +1,23 @@ +//@ check-pass + +struct CNFParser { + token: char, +} + +impl CNFParser { + fn is_whitespace(c: char) -> bool { + c == ' ' || c == '\n' + } + + fn consume_whitespace(&mut self) { + self.consume_while(&(CNFParser::is_whitespace)) + } + + fn consume_while(&mut self, p: &dyn Fn(char) -> bool) { + while p(self.token) { + return + } + } +} + +fn main() {} diff --git a/tests/ui/expr/issue-22933-2.rs b/tests/ui/expr/issue-22933-2.rs new file mode 100644 index 00000000000..dfd84b9a79d --- /dev/null +++ b/tests/ui/expr/issue-22933-2.rs @@ -0,0 +1,8 @@ +enum Delicious { + Pie = 0x1, + Apple = 0x2, + ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, + //~^ ERROR no variant or associated item named `PIE` found +} + +fn main() {} diff --git a/tests/ui/expr/issue-22933-2.stderr b/tests/ui/expr/issue-22933-2.stderr new file mode 100644 index 00000000000..8cda8598f3c --- /dev/null +++ b/tests/ui/expr/issue-22933-2.stderr @@ -0,0 +1,15 @@ +error[E0599]: no variant or associated item named `PIE` found for enum `Delicious` in the current scope + --> $DIR/issue-22933-2.rs:4:55 + | +LL | enum Delicious { + | -------------- variant or associated item `PIE` not found for this enum +... +LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, + | ^^^ + | | + | variant or associated item not found in `Delicious` + | help: there is a variant with a similar name: `Pie` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. |
