diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-20 14:36:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-20 14:36:54 +0200 |
| commit | 17f6763a148a408a8016b657718148604a88ab4b (patch) | |
| tree | e28713e1e4dc98c49d4118bd8d8f6d0661d32b2c /compiler/rustc_codegen_ssa/src | |
| parent | ae240e2f192740d8f565ae3b289202beaf8b4ace (diff) | |
| parent | 25b9263b345b36b18ac13305ff89e850170d6a7c (diff) | |
| download | rust-17f6763a148a408a8016b657718148604a88ab4b.tar.gz rust-17f6763a148a408a8016b657718148604a88ab4b.zip | |
Rollup merge of #110545 - WaffleLapkin:generic_arg_as_x, r=cjgillot
Add `GenericArgKind::as_{type,const,region}`
This allows to make code nicer in some cases
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/meth.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/meth.rs b/compiler/rustc_codegen_ssa/src/meth.rs index 2421acab471..81b49afb883 100644 --- a/compiler/rustc_codegen_ssa/src/meth.rs +++ b/compiler/rustc_codegen_ssa/src/meth.rs @@ -67,10 +67,10 @@ impl<'a, 'tcx> VirtualIndex { /// ref of the type. fn expect_dyn_trait_in_self(ty: Ty<'_>) -> ty::PolyExistentialTraitRef<'_> { for arg in ty.peel_refs().walk() { - if let GenericArgKind::Type(ty) = arg.unpack() { - if let ty::Dynamic(data, _, _) = ty.kind() { - return data.principal().expect("expected principal trait object"); - } + if let GenericArgKind::Type(ty) = arg.unpack() + && let ty::Dynamic(data, _, _) = ty.kind() + { + return data.principal().expect("expected principal trait object"); } } |
