Skip to content

Commit d6cc62c

Browse files
authored
Merge pull request #2440 from rust-lang/tshepang-patch-1
distracting indirection
2 parents d243d37 + 23285ef commit d6cc62c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/doc/rustc-dev-guide/src/normalization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ Another problem was that it was not possible to normalize `ParamEnv`s correctly
265265

266266
Given a type such as `for<'a> fn(<?x as Trait<'a>::Assoc>)`, it is not possible to correctly handle this with the old solver's approach to normalization.
267267

268-
If we were to normalize it to `for<'a> fn(?y)` and register a goal to normalize `for<'a> <?x as Trait<'a>>::Assoc -> ?y`, this would result in errors in cases where `<?x as Trait<'a>>::Assoc` normalized to `&'a u32`. The inference variable `?y` would be in a lower [universe][universes] than the placeholders made when instantiating the `for<'a>` binder.
268+
If we were to normalize it to `for<'a> fn(?y)` and register a goal to normalize `for<'a> <?x as Trait<'a>>::Assoc -> ?y`, this would result in errors in cases where `<?x as Trait<'a>>::Assoc` normalized to `&'a u32`. The inference variable `?y` would be in a lower [universe] than the placeholders made when instantiating the `for<'a>` binder.
269269

270270
Leaving the alias unnormalized would also be wrong as the old solver expects all aliases to be rigid. This was a soundness bug before the new solver was stabilized in coherence: [relating projection substs is unsound during coherence](https://github.com/rust-lang/rust/issues/102048).
271271

272272
Ultimately this means that it is not always possible to ensure all aliases inside of a value are rigid.
273273

274-
[universes]: borrow_check/region_inference/placeholders_and_universes.md#what-is-a-universe
274+
[universe]: borrow_check/region_inference/placeholders_and_universes.md#what-is-a-universe
275275
[deeply_normalize]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/normalize/trait.NormalizeExt.html#tymethod.deeply_normalize
276276

277277
## Handling uses of diverging aliases

0 commit comments

Comments
 (0)