]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #89250 - Aaron1011:keep-bound-region-names, r=estebank
authorbors <bors@rust-lang.org>
Thu, 30 Sep 2021 07:33:59 +0000 (07:33 +0000)
committerbors <bors@rust-lang.org>
Thu, 30 Sep 2021 07:33:59 +0000 (07:33 +0000)
commit69c1c6a173dcae20c245348f6c7d19074b6109b7
tree65a96f64fa157e3f1a4dafaf22d4086e473d816e
parent30acf6def32a340b4bfce6e1e2638f1b05ac2cd9
parent78013f296acd79af84dede7dae1580fd36480c7c
Auto merge of #89250 - Aaron1011:keep-bound-region-names, r=estebank

Don't anonymize bound region names during typeck

Once this anonymization has performed, we have no
way of recovering the original names during NLL
borrow checking. Keeping the original names allows
error messages in full NLL mode to contain the original
bound region names.

As a result, the typeck results may contain types that
differ only in the names used for their bound regions. However,
anonimization of bound regions does not guarantee that
all distinct types are unqual (e.g. not subtypes of each other).
For example, `for<'a> fn(&'a u32, &'a u32)` and
`for<'b, 'c> fn(&'b u32, &'c u32)` are subtypes of each other,
as explained here:

https://github.com/rust-lang/rust/blob/63cc2bb3d07d6c726dfcdc5f95cbe5ed4760641a/compiler/rustc_infer/src/infer/nll_relate/mod.rs#L682-L690

Therefore, any code handling types with higher-ranked regions already
needs to handle the case where two distinct `Ty`s are 'actually'
equal.
compiler/rustc_typeck/src/check/writeback.rs