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

Use structured suggestion for disambiguating method calls #67127

Merged
merged 2 commits into from Dec 20, 2019

Conversation

@estebank
Copy link
Contributor

estebank commented Dec 7, 2019

Fix #65635.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 7, 2019

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@estebank estebank force-pushed the estebank:disambiguate-suggestion branch from 8083dde to d1dc69e Dec 12, 2019
@estebank estebank force-pushed the estebank:disambiguate-suggestion branch from d1dc69e to 8c4f1d5 Dec 12, 2019
| --^^^--
| | |
| | multiple `foo` found
| help: disambiguate the method call for candidate #2: `T::foo(&x)`

This comment has been minimized.

Copy link
@varkor

varkor Dec 13, 2019

Member

Why is there only one disambiguation suggestion here?

This comment has been minimized.

Copy link
@estebank

estebank Dec 13, 2019

Author Contributor

The code for this is


trait T {
    fn foo(&self);
}

impl<'a> dyn T + 'a {
    fn foo(&self) {}
}

impl T for i32 {
    fn foo(&self) {}
}

fn main() {
    let x: &dyn T = &0i32;
    x.foo(); //~ ERROR multiple applicable items in scope [E0034]
}

I'm not sure what the appropriate syntax would be to call (&dyn T)::foo. Also note that we were already not suggesting it.

This comment has been minimized.

Copy link
@varkor

varkor Dec 17, 2019

Member

Also note that we were already not suggesting it.

I did notice this. I think we ought to open a new issue — if the user can't specify (&dyn T)::foo, we should at least explain this in the diagnostic. But this PR looks good as it is.

@varkor

This comment has been minimized.

Copy link
Member

varkor commented Dec 17, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 17, 2019

📌 Commit 8c4f1d5 has been approved by varkor

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 17, 2019

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Dec 18, 2019
…=varkor

Use structured suggestion for disambiguating method calls

Fix rust-lang#65635.
bors added a commit that referenced this pull request Dec 18, 2019
Rollup of 7 pull requests

Successful merges:

 - #64588 (Add a raw "address of" operator)
 - #66716 (Implement `DebugStruct::non_exhaustive`.)
 - #67127 (Use structured suggestion for disambiguating method calls)
 - #67286 (Fix the configure.py TOML field for a couple LLVM options)
 - #67321 (make htons const fn)
 - #67351 (Set release channel on non-dist builders)
 - #67379 (Revert enabling parallelism by default)

Failed merges:

r? @ghost
tmandry added a commit to tmandry/rust that referenced this pull request Dec 18, 2019
…=varkor

Use structured suggestion for disambiguating method calls

Fix rust-lang#65635.
bors added a commit that referenced this pull request Dec 18, 2019
Rollup of 6 pull requests

Successful merges:

 - #66716 (Implement `DebugStruct::non_exhaustive`.)
 - #67127 (Use structured suggestion for disambiguating method calls)
 - #67286 (Fix the configure.py TOML field for a couple LLVM options)
 - #67321 (make htons const fn)
 - #67351 (Set release channel on non-dist builders)
 - #67379 (Revert enabling parallelism by default)

Failed merges:

r? @ghost
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Dec 19, 2019
…=varkor

Use structured suggestion for disambiguating method calls

Fix rust-lang#65635.
bors added a commit that referenced this pull request Dec 19, 2019
Rollup of 3 pull requests

Successful merges:

 - #66716 (Implement `DebugStruct::non_exhaustive`.)
 - #67020 (save LTO import info and check it when trying to reuse build products)
 - #67127 (Use structured suggestion for disambiguating method calls)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 19, 2019
…=varkor

Use structured suggestion for disambiguating method calls

Fix rust-lang#65635.
bors added a commit that referenced this pull request Dec 19, 2019
Rollup of 7 pull requests

Successful merges:

 - #66670 (Normalize ident)
 - #66755 (Remove a const-if-hack in RawVec)
 - #67127 (Use structured suggestion for disambiguating method calls)
 - #67281 (add string.insert benchmarks)
 - #67328 (Remove now-redundant range check on u128 -> f32 casts)
 - #67392 (Fix unresolved type span inside async object)
 - #67421 (Fix internal documentation typo)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 19, 2019
Rollup of 7 pull requests

Successful merges:

 - rust-lang#66670 (Normalize ident)
 - rust-lang#66755 (Remove a const-if-hack in RawVec)
 - rust-lang#67127 (Use structured suggestion for disambiguating method calls)
 - rust-lang#67281 (add string.insert benchmarks)
 - rust-lang#67328 (Remove now-redundant range check on u128 -> f32 casts)
 - rust-lang#67392 (Fix unresolved type span inside async object)
 - rust-lang#67421 (Fix internal documentation typo)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 19, 2019
Rollup of 7 pull requests

Successful merges:

 - rust-lang#66670 (Normalize ident)
 - rust-lang#66755 (Remove a const-if-hack in RawVec)
 - rust-lang#67127 (Use structured suggestion for disambiguating method calls)
 - rust-lang#67281 (add string.insert benchmarks)
 - rust-lang#67328 (Remove now-redundant range check on u128 -> f32 casts)
 - rust-lang#67392 (Fix unresolved type span inside async object)
 - rust-lang#67421 (Fix internal documentation typo)

Failed merges:

r? @ghost
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Dec 19, 2019
Rollup of 7 pull requests

Successful merges:

 - rust-lang#66670 (Normalize ident)
 - rust-lang#66755 (Remove a const-if-hack in RawVec)
 - rust-lang#67127 (Use structured suggestion for disambiguating method calls)
 - rust-lang#67281 (add string.insert benchmarks)
 - rust-lang#67328 (Remove now-redundant range check on u128 -> f32 casts)
 - rust-lang#67392 (Fix unresolved type span inside async object)
 - rust-lang#67421 (Fix internal documentation typo)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 20, 2019
…=varkor

Use structured suggestion for disambiguating method calls

Fix rust-lang#65635.
bors added a commit that referenced this pull request Dec 20, 2019
Rollup of 8 pull requests

Successful merges:

 - #66755 (Remove a const-if-hack in RawVec)
 - #67127 (Use structured suggestion for disambiguating method calls)
 - #67219 (Fix up Command Debug output when arg0 is specified.)
 - #67285 (Indicate origin of where type parameter for uninferred types )
 - #67328 (Remove now-redundant range check on u128 -> f32 casts)
 - #67333 ([mir-opt] Fix `Inline` pass to handle inlining into `box` expressions)
 - #67367 (Move command line option definitions into a dedicated file)
 - #67442 (Remove `SOCK_CLOEXEC` dummy variable on platforms that don't use it.)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 20, 2019
…=varkor

Use structured suggestion for disambiguating method calls

Fix rust-lang#65635.
bors added a commit that referenced this pull request Dec 20, 2019
Rollup of 7 pull requests

Successful merges:

 - #66755 (Remove a const-if-hack in RawVec)
 - #67127 (Use structured suggestion for disambiguating method calls)
 - #67219 (Fix up Command Debug output when arg0 is specified.)
 - #67285 (Indicate origin of where type parameter for uninferred types )
 - #67328 (Remove now-redundant range check on u128 -> f32 casts)
 - #67367 (Move command line option definitions into a dedicated file)
 - #67442 (Remove `SOCK_CLOEXEC` dummy variable on platforms that don't use it.)

Failed merges:

r? @ghost
@bors bors merged commit 8c4f1d5 into rust-lang:master Dec 20, 2019
4 checks passed
4 checks passed
pr #20191212.5 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.