exhaustive matching in get_ambient_variance
This commit is contained in:
parent
6e1d228285
commit
758cc95763
1 changed files with 9 additions and 1 deletions
|
@ -767,9 +767,17 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_ambient_variance(&self, context: PlaceContext) -> ty::Variance {
|
fn get_ambient_variance(&self, context: PlaceContext) -> ty::Variance {
|
||||||
|
use rustc_middle::mir::visit::NonMutatingUseContext::*;
|
||||||
|
use rustc_middle::mir::visit::NonUseContext::*;
|
||||||
|
|
||||||
match context {
|
match context {
|
||||||
PlaceContext::MutatingUse(_) => ty::Invariant,
|
PlaceContext::MutatingUse(_) => ty::Invariant,
|
||||||
PlaceContext::NonMutatingUse(_) | PlaceContext::NonUse(_) => ty::Covariant,
|
PlaceContext::NonUse(StorageDead | StorageLive | VarDebugInfo) => ty::Invariant,
|
||||||
|
PlaceContext::NonMutatingUse(
|
||||||
|
Inspect | Copy | Move | SharedBorrow | ShallowBorrow | UniqueBorrow | AddressOf
|
||||||
|
| Projection,
|
||||||
|
) => ty::Covariant,
|
||||||
|
PlaceContext::NonUse(AscribeUserTy) => ty::Covariant,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue