Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 17 pull requests #60100

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6225b31
Make clear that format padding doesn't work for Debug
sourcefrog Apr 13, 2019
cc2689a
implement nth_back for Bytes
koalatux Apr 16, 2019
fae2a68
implement nth_back for Fuse
koalatux Apr 16, 2019
2605537
implement nth_back for Enumerate
koalatux Apr 16, 2019
4fed94b
Remove unwanted z-index change
GuillaumeGomez Apr 17, 2019
98f38b2
Correct E0392 diagnostic
varkor Apr 17, 2019
ca19ffe
Update rustfmt to 1.2.1
topecongiro Apr 17, 2019
365a48a
whitelist rtm x86 cpu feature
mtak- Apr 17, 2019
007b40b
Point at try `?` on errors affecting the err match arm of the desugar…
estebank Apr 18, 2019
1e99b2e
Give custom error for E0277 on `?` error case
estebank Apr 18, 2019
379c541
Simplify the returning of a Result a bit
janhohenheim Apr 17, 2019
be69785
Use more realistic example for thread builder
matklad Apr 18, 2019
553ec5d
Update run-make PGO test to new commandline syntax.
michaelwoerister Apr 17, 2019
4269be3
Prefix PROFILER_SUPPORT and SANITIZER_SUPPORT test env vars with RUST…
michaelwoerister Apr 18, 2019
227be65
compiletest: Allow for tests requiring profiler-rt or sanitizer-rt su…
michaelwoerister Apr 18, 2019
e2acaee
Add codegen test that makes sure PGO instrumentation is emitted as ex…
michaelwoerister Apr 16, 2019
d98afc5
Fix small errors in docs for `rchunks_exact` and `rchunks_exact_mut`.
nathankleyn Apr 18, 2019
cc77087
Use new `needs-(profiler|sanitizer)-support` compiletest directive to…
michaelwoerister Apr 18, 2019
08efbac
Implement event filtering for self-profiler.
michaelwoerister Apr 12, 2019
ae1f2b5
Update miri
TimDiekmann Apr 18, 2019
048ba28
Update tests
varkor Apr 17, 2019
faaab52
Add a `header` method to `FnKind`
varkor Apr 18, 2019
b13562a
Refactor some existing methods
varkor Apr 18, 2019
db13fe6
Feature gate async fn methods
varkor Apr 18, 2019
b6888db
Add test for async fn methods feature gating
varkor Apr 18, 2019
edce367
Fix typo in variadic C function warning
varkor Apr 18, 2019
04cf770
Change suggestion of field when not in self context
estebank Apr 18, 2019
9daeaa8
review comments: change wording
estebank Apr 18, 2019
3dbe05f
Fix additional variadic typos
varkor Apr 18, 2019
94e5ec1
Suggest appropriate path when calling associated item on bare types
estebank Apr 17, 2019
bf0965c
Check async in trait methods
varkor Apr 18, 2019
eed3619
Use -mergefunc-use-aliases for any LLVM >= 8
cuviper Apr 18, 2019
a1099ae
Remove the unused LLVMRustIsRustLLVM
cuviper Apr 18, 2019
3625b19
Rollup merge of #59915 - michaelwoerister:sp-event-filters-1, r=wesle…
Centril Apr 19, 2019
250c154
Rollup merge of #59933 - sourcefrog:doc-fmt, r=shepmaster
Centril Apr 19, 2019
b388682
Rollup merge of #60023 - koalatux:nth-back, r=scottmcm
Centril Apr 19, 2019
2cf0d52
Rollup merge of #60032 - rust-lang:remove-unwanted-z-index, r=QuietMi…
Centril Apr 19, 2019
6e6bb7d
Rollup merge of #60038 - michaelwoerister:pgo-updates-2, r=alexcrichton
Centril Apr 19, 2019
729886d
Rollup merge of #60041 - jnferner:patch-1, r=shepmaster
Centril Apr 19, 2019
2a9d97c
Rollup merge of #60045 - estebank:suggest-std, r=petrochenkov
Centril Apr 19, 2019
ad87862
Rollup merge of #60052 - varkor:unused-parameter-diagnostic, r=estebank
Centril Apr 19, 2019
67f5e69
Rollup merge of #60056 - topecongiro:rustfmt-1.2.1, r=alexcrichton
Centril Apr 19, 2019
f5c3e64
Rollup merge of #60060 - mtak-:rtm-x86-feature, r=petrochenkov
Centril Apr 19, 2019
31a4e9c
Rollup merge of #60061 - estebank:field-sugg, r=davidtwco
Centril Apr 19, 2019
3f329f6
Rollup merge of #60064 - estebank:issue-59980, r=varkor
Centril Apr 19, 2019
87e399a
Rollup merge of #60078 - matklad:patch-1, r=shepmaster
Centril Apr 19, 2019
b2dea94
Rollup merge of #60080 - nathankleyn:fix-issue-60068, r=Centril
Centril Apr 19, 2019
0ee9034
Rollup merge of #60082 - TimDiekmann:master, r=RalfJung
Centril Apr 19, 2019
8ba6c29
Rollup merge of #60088 - varkor:async_await-method-feature-gate, r=cr…
Centril Apr 19, 2019
a37446a
Rollup merge of #60097 - cuviper:llvm8-mergefunc-use-aliases, r=rkruppe
Centril Apr 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change suggestion of field when not in self context
  • Loading branch information
estebank committed Apr 18, 2019
commit 04cf7701f12bb14a0e35aa1499bff62937b912bf
22 changes: 12 additions & 10 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,18 @@ impl<'a> Resolver<'a> {
let self_is_available = self.self_value_is_available(path[0].ident.span, span);
match candidate {
AssocSuggestion::Field => {
err.span_suggestion(
span,
"try",
format!("self.{}", path_str),
Applicability::MachineApplicable,
);
if !self_is_available {
err.span_label(span, format!("`self` value is a keyword \
only available in \
methods with `self` parameter"));
if self_is_available {
err.span_suggestion(
span,
"you might have meant to use the available field",
format!("self.{}", path_str),
Applicability::MachineApplicable,
);
} else {
err.span_label(
span,
format!("a field by this name exists in `Self::{}`", path_str),
);
}
}
AssocSuggestion::MethodWithSelf if self_is_available => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/class-missing-self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/issues/issue-60057.rs
Original file line number Diff line number Diff line change
@@ -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
}
}
}
20 changes: 20 additions & 0 deletions src/test/ui/issues/issue-60057.stderr
Original file line number Diff line number Diff line change
@@ -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`.
8 changes: 4 additions & 4 deletions src/test/ui/resolve/issue-14254.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions src/test/ui/resolve/issue-2356.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/resolve/resolve-assoc-suggestions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/resolve/resolve-speculative-adjustment.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/test/ui/resolve/unresolved_static_type_field.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down