Fix TyKind lint, make consts no longer fn, etc

This commit is contained in:
Michael Goulet 2022-05-26 20:22:28 -07:00
parent a056a953f0
commit 34e05812e0
17 changed files with 868 additions and 538 deletions

View file

@ -98,8 +98,10 @@ struct Upvar<'tcx> {
by_ref: bool,
}
const fn deref_projection<'tcx>() -> &'tcx [PlaceElem<'tcx>; 1] {
&[ProjectionElem::Deref]
/// Associate some local constants with the `'tcx` lifetime
struct TyCtxtConsts<'tcx>(TyCtxt<'tcx>);
impl<'tcx> TyCtxtConsts<'tcx> {
const DEREF_PROJECTION: &'tcx [PlaceElem<'tcx>; 1] = &[ProjectionElem::Deref];
}
pub fn provide(providers: &mut Providers) {
@ -1445,7 +1447,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// Thread-locals might be dropped after the function exits
// We have to dereference the outer reference because
// borrows don't conflict behind shared references.
root_place.projection = deref_projection();
root_place.projection = TyCtxtConsts::DEREF_PROJECTION;
(true, true)
} else {
(false, self.locals_are_invalidated_at_exit)