Apply reviewed suggestions
This commit is contained in:
parent
fc53c59388
commit
d034ab0f92
@ -278,7 +278,7 @@ impl InferenceTable<'_> {
|
|||||||
|
|
||||||
// If we are coercing into an ATPIT, coerce into its proxy inference var, instead.
|
// If we are coercing into an ATPIT, coerce into its proxy inference var, instead.
|
||||||
let mut to_ty = to_ty;
|
let mut to_ty = to_ty;
|
||||||
let mut _to = None;
|
let _to;
|
||||||
if let Some(atpit_table) = &self.atpit_coercion_table {
|
if let Some(atpit_table) = &self.atpit_coercion_table {
|
||||||
if let TyKind::OpaqueType(opaque_ty_id, _) = to_ty.kind(Interner) {
|
if let TyKind::OpaqueType(opaque_ty_id, _) = to_ty.kind(Interner) {
|
||||||
if !matches!(
|
if !matches!(
|
||||||
@ -286,8 +286,8 @@ impl InferenceTable<'_> {
|
|||||||
TyKind::InferenceVar(..) | TyKind::OpaqueType(..)
|
TyKind::InferenceVar(..) | TyKind::OpaqueType(..)
|
||||||
) {
|
) {
|
||||||
if let Some(ty) = atpit_table.get(opaque_ty_id) {
|
if let Some(ty) = atpit_table.get(opaque_ty_id) {
|
||||||
_to = Some(ty.clone());
|
_to = ty.clone();
|
||||||
to_ty = _to.as_ref().unwrap();
|
to_ty = &_to;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,13 +301,9 @@ impl<'a> TyLoweringContext<'a> {
|
|||||||
TypeRef::ImplTrait(bounds) => {
|
TypeRef::ImplTrait(bounds) => {
|
||||||
match &self.impl_trait_mode {
|
match &self.impl_trait_mode {
|
||||||
ImplTraitLoweringState::Opaque(opaque_type_data) => {
|
ImplTraitLoweringState::Opaque(opaque_type_data) => {
|
||||||
let (origin, krate) = match self.resolver.generic_def() {
|
let origin = match self.resolver.generic_def() {
|
||||||
Some(GenericDefId::FunctionId(f)) => {
|
Some(GenericDefId::FunctionId(it)) => Either::Left(it),
|
||||||
(Either::Left(f), f.krate(self.db.upcast()))
|
Some(GenericDefId::TypeAliasId(it)) => Either::Right(it),
|
||||||
}
|
|
||||||
Some(GenericDefId::TypeAliasId(a)) => {
|
|
||||||
(Either::Right(a), a.krate(self.db.upcast()))
|
|
||||||
}
|
|
||||||
_ => panic!(
|
_ => panic!(
|
||||||
"opaque impl trait lowering must be in function or type alias"
|
"opaque impl trait lowering must be in function or type alias"
|
||||||
),
|
),
|
||||||
@ -330,7 +326,7 @@ impl<'a> TyLoweringContext<'a> {
|
|||||||
// away instead of two.
|
// away instead of two.
|
||||||
let actual_opaque_type_data = self
|
let actual_opaque_type_data = self
|
||||||
.with_debruijn(DebruijnIndex::INNERMOST, |ctx| {
|
.with_debruijn(DebruijnIndex::INNERMOST, |ctx| {
|
||||||
ctx.lower_impl_trait(bounds, krate)
|
ctx.lower_impl_trait(bounds, self.resolver.krate())
|
||||||
});
|
});
|
||||||
opaque_type_data.borrow_mut()[idx] = actual_opaque_type_data;
|
opaque_type_data.borrow_mut()[idx] = actual_opaque_type_data;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user