-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #101454 - cjgillot:concat-binders, r=estebank
Do not overwrite lifetime binders for another HirId. This PR makes higher-ranked bounds in where clauses a bit more principled. We used to conflate `for<'a> T: Trait` with `(for<'a> T): Trait`. This PR separates both binders. This caused issued with fn types, which have their own binder, causing us to overwrite the predicates's binders with `fn`'s binders, ICEing. Fixes #98594
- Loading branch information
Showing
9 changed files
with
118 additions
and
31 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
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
18 changes: 18 additions & 0 deletions
18
src/test/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
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 @@ | ||
error[E0277]: the trait bound `for<'b> for<'b> fn(&'b ()): Foo` is not satisfied | ||
--> $DIR/higher-ranked-fn-type.rs:20:5 | ||
| | ||
LL | called() | ||
| ^^^^^^ the trait `for<'b> Foo` is not implemented for `for<'b> fn(&'b ())` | ||
| | ||
note: required by a bound in `called` | ||
--> $DIR/higher-ranked-fn-type.rs:12:25 | ||
| | ||
LL | fn called() | ||
| ------ required by a bound in this | ||
LL | where | ||
LL | for<'b> fn(&'b ()): Foo, | ||
| ^^^ required by this bound in `called` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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,25 @@ | ||
// revisions: quiet verbose | ||
// [verbose]compile-flags: -Zverbose | ||
|
||
#![allow(unused_parens)] | ||
|
||
trait Foo { | ||
type Assoc; | ||
} | ||
|
||
fn called() | ||
where | ||
for<'b> fn(&'b ()): Foo, | ||
{ | ||
} | ||
|
||
fn caller() | ||
where | ||
(for<'a> fn(&'a ())): Foo, | ||
{ | ||
called() | ||
//[quiet]~^ ERROR the trait bound `for<'b> for<'b> fn(&'b ()): Foo` is not satisfied | ||
//[verbose]~^^ ERROR the trait bound `for<'b> fn(&ReLateBound( | ||
} | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
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 @@ | ||
error[E0277]: the trait bound `for<'b> fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[1209]::called::'b), 'b) }) ()): Foo` is not satisfied | ||
--> $DIR/higher-ranked-fn-type.rs:20:5 | ||
| | ||
LL | called() | ||
| ^^^^^^ the trait `for<'b> Foo` is not implemented for `fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[1209]::called::'b), 'b) }) ())` | ||
| | ||
note: required by a bound in `called` | ||
--> $DIR/higher-ranked-fn-type.rs:12:25 | ||
| | ||
LL | fn called() | ||
| ------ required by a bound in this | ||
LL | where | ||
LL | for<'b> fn(&'b ()): Foo, | ||
| ^^^ required by this bound in `called` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |