about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-12 07:11:14 +0200
committerGitHub <noreply@github.com>2023-05-12 07:11:14 +0200
commit4c12f5d25202bbf957d5807dfef26daa70f2f593 (patch)
treea2edecf899392158d122947e4d1975ace3594cf0 /compiler/rustc_middle
parent1d4689cb99f21c0f04c544b52073133cd50f2ad5 (diff)
parent3009cb3f6bded69d83b1d5fe22b26612496e87fc (diff)
downloadrust-4c12f5d25202bbf957d5807dfef26daa70f2f593.tar.gz
rust-4c12f5d25202bbf957d5807dfef26daa70f2f593.zip
Rollup merge of #111490 - compiler-errors:layout-placeholder, r=aliemjay
Don't ICE in layout computation for placeholder types

We use `layout_of` for the built-in `PointerLike` trait to check if a type can be coerced to a `dyn*`.

Since the new solver canonicalizes parameter types to placeholders, that code needs to be able to treat placeholders like params, and for the most part it does, **except** for a call to `is_trivially_sized`. This PR fixes that.
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 8d0737e1eee..488d83b5f67 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -2366,13 +2366,11 @@ impl<'tcx> Ty<'tcx> {
 
             ty::Adt(def, _substs) => def.sized_constraint(tcx).0.is_empty(),
 
-            ty::Alias(..) | ty::Param(_) => false,
+            ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => false,
 
             ty::Infer(ty::TyVar(_)) => false,
 
-            ty::Bound(..)
-            | ty::Placeholder(..)
-            | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
+            ty::Bound(..) | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
                 bug!("`is_trivially_sized` applied to unexpected type: {:?}", self)
             }
         }