forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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#122881 - Bryanskiy:delegation-fixes-2, r=petrochenkov Delegation: fix ICE on `bound_vars` divergence Fixes rust-lang#122550. Bug was caused by divergence between lowered type and corresponding `bound_vars` in `late_bound_vars_map`. In this patch `bound_vars` calculation for delegation item is moved from `lower_fn_ty` to `resolve_bound_vars` query. r? `@petrochenkov`
- Loading branch information
Showing
4 changed files
with
59 additions
and
8 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
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,18 @@ | ||
#![feature(fn_delegation)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Trait { | ||
fn description(&self) -> &str {} | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
struct F; | ||
struct S(F); | ||
|
||
impl S { | ||
reuse <S as Trait>::description { &self.0 } | ||
//~^ ERROR mismatched types | ||
//~| ERROR the trait bound `S: Trait` is not satisfied | ||
} | ||
|
||
fn main() {} |
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,31 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/ice-issue-122550.rs:5:35 | ||
| | ||
LL | fn description(&self) -> &str {} | ||
| ^^ expected `&str`, found `()` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/ice-issue-122550.rs:13:39 | ||
| | ||
LL | reuse <S as Trait>::description { &self.0 } | ||
| ^^^^^^^ expected `&S`, found `&F` | ||
| | ||
= note: expected reference `&S` | ||
found reference `&F` | ||
|
||
error[E0277]: the trait bound `S: Trait` is not satisfied | ||
--> $DIR/ice-issue-122550.rs:13:12 | ||
| | ||
LL | reuse <S as Trait>::description { &self.0 } | ||
| ^ the trait `Trait` is not implemented for `S` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/ice-issue-122550.rs:4:1 | ||
| | ||
LL | trait Trait { | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. |