diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-04-17 17:22:16 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-04-18 18:39:56 -0700 |
| commit | 248fe949afbebb0df59d84d17b0e45762965238f (patch) | |
| tree | a99114854a3f5446ff3f15cf340d1cb96c212dc1 /src/test | |
| parent | e928e9441157f63a776ba1f8773818838e0912ea (diff) | |
| download | rust-248fe949afbebb0df59d84d17b0e45762965238f.tar.gz rust-248fe949afbebb0df59d84d17b0e45762965238f.zip | |
Change suggestion of field when not in self context
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/class-missing-self.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-60057.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-60057.stderr | 20 | ||||
| -rw-r--r-- | src/test/ui/resolve/issue-14254.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/resolve/issue-2356.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/resolve/resolve-assoc-suggestions.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/resolve/resolve-speculative-adjustment.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/resolve/unresolved_static_type_field.stderr | 5 |
8 files changed, 48 insertions, 20 deletions
diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr index ec11f125399..25cb85dadb9 100644 --- a/src/test/ui/class-missing-self.stderr +++ b/src/test/ui/class-missing-self.stderr @@ -2,7 +2,7 @@ error[E0425]: cannot find value `meows` in this scope --> $DIR/class-missing-self.rs:9:7 | LL | meows += 1; - | ^^^^^ help: try: `self.meows` + | ^^^^^ help: you might have meant to use the available field: `self.meows` error[E0425]: cannot find function `sleep` in this scope --> $DIR/class-missing-self.rs:10:7 diff --git a/src/test/ui/issues/issue-60057.rs b/src/test/ui/issues/issue-60057.rs new file mode 100644 index 00000000000..3027d01c532 --- /dev/null +++ b/src/test/ui/issues/issue-60057.rs @@ -0,0 +1,17 @@ +struct A { + banana: u8, +} + +impl A { + fn new(peach: u8) -> A { + A { + banana: banana //~ ERROR cannot find value `banana` in this scope + } + } + + fn foo(&self, peach: u8) -> A { + A { + banana: banana //~ ERROR cannot find value `banana` in this scope + } + } +} diff --git a/src/test/ui/issues/issue-60057.stderr b/src/test/ui/issues/issue-60057.stderr new file mode 100644 index 00000000000..0bee87a4372 --- /dev/null +++ b/src/test/ui/issues/issue-60057.stderr @@ -0,0 +1,20 @@ +error[E0425]: cannot find value `banana` in this scope + --> $DIR/issue-60057.rs:8:21 + | +LL | banana: banana + | ^^^^^^ a field by this name exists in `Self::banana` + +error[E0425]: cannot find value `banana` in this scope + --> $DIR/issue-60057.rs:14:21 + | +LL | banana: banana + | ^^^^^^ help: you might have meant to use the available field: `self.banana` + +error[E0601]: `main` function not found in crate `issue_60057` + | + = note: consider adding a `main` function to `$DIR/issue-60057.rs` + +error: aborting due to 3 previous errors + +Some errors occurred: E0425, E0601. +For more information about an error, try `rustc --explain E0425`. diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr index 783b3addfc2..97d42aa8ef4 100644 --- a/src/test/ui/resolve/issue-14254.stderr +++ b/src/test/ui/resolve/issue-14254.stderr @@ -20,13 +20,13 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/issue-14254.rs:30:9 | LL | x; - | ^ help: try: `self.x` + | ^ help: you might have meant to use the available field: `self.x` error[E0425]: cannot find value `y` in this scope --> $DIR/issue-14254.rs:32:9 | LL | y; - | ^ help: try: `self.y` + | ^ help: you might have meant to use the available field: `self.y` error[E0425]: cannot find value `a` in this scope --> $DIR/issue-14254.rs:34:9 @@ -56,13 +56,13 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/issue-14254.rs:47:9 | LL | x; - | ^ help: try: `self.x` + | ^ help: you might have meant to use the available field: `self.x` error[E0425]: cannot find value `y` in this scope --> $DIR/issue-14254.rs:49:9 | LL | y; - | ^ help: try: `self.y` + | ^ help: you might have meant to use the available field: `self.y` error[E0425]: cannot find value `a` in this scope --> $DIR/issue-14254.rs:51:9 diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr index 01dff5dd82f..10fcbfc74f2 100644 --- a/src/test/ui/resolve/issue-2356.stderr +++ b/src/test/ui/resolve/issue-2356.stderr @@ -20,10 +20,7 @@ error[E0425]: cannot find value `whiskers` in this scope --> $DIR/issue-2356.rs:39:5 | LL | whiskers -= other; - | ^^^^^^^^ - | | - | `self` value is a keyword only available in methods with `self` parameter - | help: try: `self.whiskers` + | ^^^^^^^^ a field by this name exists in `Self::whiskers` error[E0425]: cannot find function `shave` in this scope --> $DIR/issue-2356.rs:41:5 @@ -83,16 +80,13 @@ error[E0425]: cannot find value `whiskers` in this scope --> $DIR/issue-2356.rs:79:5 | LL | whiskers = 0; - | ^^^^^^^^ help: try: `self.whiskers` + | ^^^^^^^^ help: you might have meant to use the available field: `self.whiskers` error[E0425]: cannot find value `whiskers` in this scope --> $DIR/issue-2356.rs:84:5 | LL | whiskers = 4; - | ^^^^^^^^ - | | - | `self` value is a keyword only available in methods with `self` parameter - | help: try: `self.whiskers` + | ^^^^^^^^ a field by this name exists in `Self::whiskers` error[E0425]: cannot find function `purr_louder` in this scope --> $DIR/issue-2356.rs:86:5 diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr index fd97ce09d4a..87040015b8d 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr +++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr @@ -14,7 +14,7 @@ error[E0425]: cannot find value `field` in this scope --> $DIR/resolve-assoc-suggestions.rs:20:9 | LL | field; - | ^^^^^ help: try: `self.field` + | ^^^^^ help: you might have meant to use the available field: `self.field` error[E0412]: cannot find type `Type` in this scope --> $DIR/resolve-assoc-suggestions.rs:23:16 diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.stderr b/src/test/ui/resolve/resolve-speculative-adjustment.stderr index c4a6ced1ca4..892b50309a9 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.stderr +++ b/src/test/ui/resolve/resolve-speculative-adjustment.stderr @@ -14,7 +14,7 @@ error[E0425]: cannot find value `field` in this scope --> $DIR/resolve-speculative-adjustment.rs:23:9 | LL | field; - | ^^^^^ help: try: `self.field` + | ^^^^^ help: you might have meant to use the available field: `self.field` error[E0425]: cannot find function `method` in this scope --> $DIR/resolve-speculative-adjustment.rs:25:9 diff --git a/src/test/ui/resolve/unresolved_static_type_field.stderr b/src/test/ui/resolve/unresolved_static_type_field.stderr index a5173243787..7008fadad81 100644 --- a/src/test/ui/resolve/unresolved_static_type_field.stderr +++ b/src/test/ui/resolve/unresolved_static_type_field.stderr @@ -2,10 +2,7 @@ error[E0425]: cannot find value `cx` in this scope --> $DIR/unresolved_static_type_field.rs:9:11 | LL | f(cx); - | ^^ - | | - | `self` value is a keyword only available in methods with `self` parameter - | help: try: `self.cx` + | ^^ a field by this name exists in `Self::cx` error: aborting due to previous error |
