about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
diff options
context:
space:
mode:
authorDavid Wood <david.wood2@arm.com>2025-02-27 21:19:51 +0000
committerDavid Wood <david.wood2@arm.com>2025-06-16 23:04:33 +0000
commit86ab2b60cd22f6190eb586c889f8a2504f0d926b (patch)
treec379a930de63e5cb21b83110dccd82c1c3874a25 /compiler/rustc_ty_utils/src
parentf0b84b8dcfc15c3936256ccb438b1d050620ff3c (diff)
downloadrust-86ab2b60cd22f6190eb586c889f8a2504f0d926b.tar.gz
rust-86ab2b60cd22f6190eb586c889f8a2504f0d926b.zip
hir_analysis: add `{Meta,Pointee}Sized` bounds
Opting-out of `Sized` with `?Sized` is now equivalent to adding a
`MetaSized` bound, and adding a `MetaSized` or `PointeeSized` bound
is equivalent to removing the default `Sized` bound - this commit
implements this change in `rustc_hir_analysis::hir_ty_lowering`.

`MetaSized` is also added as a supertrait of all traits, as this is
necessary to preserve backwards compatibility.

Unfortunately, non-global where clauses being preferred over item bounds
(where `PointeeSized` bounds would be proven) - which can result in
errors when a `PointeeSized` supertrait/bound/predicate is added to some
items. Rather than `PointeeSized` being a bound on everything, it can
be the absence of a bound on everything, as `?Sized` was.
Diffstat (limited to 'compiler/rustc_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/ty.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs
index 923c9242ff8..d996ee2b60a 100644
--- a/compiler/rustc_ty_utils/src/ty.rs
+++ b/compiler/rustc_ty_utils/src/ty.rs
@@ -95,7 +95,7 @@ fn defaultness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Defaultness {
 /// `def_id` is assumed to be the `AdtDef` of a struct and will panic otherwise.
 ///
 /// For `Sized`, there are only a few options for the types in the constraint:
-///     - an metasized type (str, slices, trait objects, etc)
+///     - an meta-sized type (str, slices, trait objects, etc)
 ///     - an pointee-sized type (extern types)
 ///     - a type parameter or projection whose sizedness can't be known
 ///