-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #113471 - compiler-errors:new-solver-norm-escaping, r=lcnr
Allow escaping bound vars during `normalize_erasing_regions` in new solver Add `AllowEscapingBoundVars` to `deeply_normalize`, and use it in the new solver in the `query_normalize` routine. Ideally, we'd make all `query_normalize` calls handle pass in `AllowEscapingBoundVars` individually, because really the only `query_normalize` call that needs `AllowEscapingBoundVars::Yes` is the one in `try_normalize_generic_arg_after_erasing_regions`, but I think that's kind of overkill. I am happy to be convinced otherwise, though. r? `@lcnr`
- Loading branch information
Showing
4 changed files
with
55 additions
and
22 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
18 changes: 18 additions & 0 deletions
18
tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs
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 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// check-pass | ||
|
||
trait Trivial { | ||
type Assoc; | ||
} | ||
|
||
impl<T: ?Sized> Trivial for T { | ||
type Assoc = (); | ||
} | ||
|
||
fn main() { | ||
// During writeback, we call `normalize_erasing_regions`, which will walk past | ||
// the `for<'a>` binder and try to normalize `<&'a () as Trivial>::Assoc` directly. | ||
// We need to handle this case in the new deep normalizer similarly to how it | ||
// is handled in the old solver. | ||
let x: Option<for<'a> fn(<&'a () as Trivial>::Assoc)> = None; | ||
} |