Sized hierarchy: PointeeSized bounds aren't fully validated during HIR ty lowering (original) (raw)
The following code compiles successfully:
#![feature(sized_hierarchy)] fn f<T: std:📑:PointeeSized<(), (), (), Undefined = ()>>() {}
but it should definitely not because PointeeSized doesn't have any generic params or assoc types.
This happens because of this check:
rust/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs
Lines 464 to 466 in70e2b4a
| if self.should_skip_sizedness_bound(hir_bound) { |
|---|
| continue; |
| } |
which leads to <dyn HirTyLowering<'_>>::lower_poly_trait_ref getting skipped which would've performed the necessary generic args validation.