Skip to content

Commit 2198fae

Browse files
committed
Make NonUseContext::AscribeUserTy carry ty::Variance
1 parent a0111af commit 2198fae

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

compiler/rustc_borrowck/src/def_use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> {
5555
// `PlaceMention` and `AscribeUserType` both evaluate the place, which must not
5656
// contain dangling references.
5757
PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention) |
58-
PlaceContext::NonUse(NonUseContext::AscribeUserTy) |
58+
PlaceContext::NonUse(NonUseContext::AscribeUserTy(_)) |
5959

6060
PlaceContext::MutatingUse(MutatingUseContext::AddressOf) |
6161
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) |

compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
777777
Inspect | Copy | Move | PlaceMention | SharedBorrow | ShallowBorrow | UniqueBorrow
778778
| AddressOf | Projection,
779779
) => ty::Covariant,
780-
PlaceContext::NonUse(AscribeUserTy) => ty::Covariant,
780+
PlaceContext::NonUse(AscribeUserTy(variance)) => variance,
781781
}
782782
}
783783

compiler/rustc_middle/src/mir/visit.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
6565
use crate::mir::*;
6666
use crate::ty::subst::SubstsRef;
67-
use crate::ty::{CanonicalUserTypeAnnotation, Ty};
67+
use crate::ty::{self, CanonicalUserTypeAnnotation, Ty};
6868
use rustc_span::Span;
6969

7070
macro_rules! make_mir_visitor {
@@ -782,12 +782,12 @@ macro_rules! make_mir_visitor {
782782

783783
fn super_ascribe_user_ty(&mut self,
784784
place: & $($mutability)? Place<'tcx>,
785-
_variance: $(& $mutability)? ty::Variance,
785+
variance: $(& $mutability)? ty::Variance,
786786
user_ty: & $($mutability)? UserTypeProjection,
787787
location: Location) {
788788
self.visit_place(
789789
place,
790-
PlaceContext::NonUse(NonUseContext::AscribeUserTy),
790+
PlaceContext::NonUse(NonUseContext::AscribeUserTy($(* &$mutability *)? variance)),
791791
location
792792
);
793793
self.visit_user_type_projection(user_ty);
@@ -1320,7 +1320,7 @@ pub enum NonUseContext {
13201320
/// Ending a storage live range.
13211321
StorageDead,
13221322
/// User type annotation assertions for NLL.
1323-
AscribeUserTy,
1323+
AscribeUserTy(ty::Variance),
13241324
/// The data of a user variable, for debug info.
13251325
VarDebugInfo,
13261326
}

compiler/rustc_type_ir/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ impl UnifyKey for FloatVid {
640640
}
641641
}
642642

643-
#[derive(Copy, Clone, PartialEq, Decodable, Encodable, Hash, HashStable_Generic)]
643+
#[derive(Copy, Clone, PartialEq, Eq, Decodable, Encodable, Hash, HashStable_Generic)]
644644
#[rustc_pass_by_value]
645645
pub enum Variance {
646646
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type

0 commit comments

Comments
 (0)