mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 04:18:20 +00:00
Normalize projections in evaluated const display and layout calculation
This commit is contained in:
parent
bd0289e0e9
commit
1cd9e683e8
3 changed files with 39 additions and 0 deletions
|
|
@ -435,6 +435,9 @@ pub fn layout_of_ty_query(
|
|||
TyKind::Error => return Err(LayoutError::HasErrorType),
|
||||
TyKind::AssociatedType(id, subst) => {
|
||||
// Try again with `TyKind::Alias` to normalize the associated type.
|
||||
// Usually we should not try to normalize `TyKind::AssociatedType`, but layout calculation is used
|
||||
// in monomorphized MIR where this is okay. If outside monomorphization, this will lead to cycle,
|
||||
// which we will recover from with an error.
|
||||
let ty = TyKind::Alias(chalk_ir::AliasTy::Projection(ProjectionTy {
|
||||
associated_ty_id: *id,
|
||||
substitution: subst.clone(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue