forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#125080 - bvanjoi:fix-124946, r=nnethercote only find segs chain for missing methods when no available candidates Fixes rust-lang#124946 This PR includes two changes: - Extracting the lookup for the missing method in chains into a single function. - Calling this function only when there are no candidates available.
- Loading branch information
Showing
3 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// https://github.com/rust-lang/rust/issues/124946 | ||
|
||
struct Builder<const A: bool, const B: bool>; | ||
|
||
impl<const A: bool> Builder<A, false> { | ||
fn cast(self) -> Builder<A, true> { | ||
Builder | ||
} | ||
} | ||
|
||
impl Builder<true, true> { | ||
fn build(self) {} | ||
} | ||
|
||
fn main() { | ||
let b = Builder::<false, false>; | ||
b.cast().build(); | ||
//~^ ERROR: no method named `build` found for struct `Builder<false, true>` in the current scope | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0599]: no method named `build` found for struct `Builder<false, true>` in the current scope | ||
--> $DIR/lookup-method.rs:17:14 | ||
| | ||
LL | struct Builder<const A: bool, const B: bool>; | ||
| -------------------------------------------- method `build` not found for this struct | ||
... | ||
LL | b.cast().build(); | ||
| ^^^^^ method not found in `Builder<false, true>` | ||
| | ||
= note: the method was found for | ||
- `Builder<true, true>` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |