diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-06-20 23:13:11 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2025-07-18 12:25:24 +0200 |
| commit | 82a02aefe07092c737c852daccebf49ca25507e3 (patch) | |
| tree | 4a601b3cc7bd1318f720740fc77b339b862c9103 /tests/ui/sized-hierarchy/pointee-validation.rs | |
| parent | cdc3d701cb4ff37e9d0c96c1c68b2e8789c19441 (diff) | |
| download | rust-82a02aefe07092c737c852daccebf49ca25507e3.tar.gz rust-82a02aefe07092c737c852daccebf49ca25507e3.zip | |
HIR ty lowering: Validate `PointeeSized` bounds
Diffstat (limited to 'tests/ui/sized-hierarchy/pointee-validation.rs')
| -rw-r--r-- | tests/ui/sized-hierarchy/pointee-validation.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/sized-hierarchy/pointee-validation.rs b/tests/ui/sized-hierarchy/pointee-validation.rs new file mode 100644 index 00000000000..dfc28829e08 --- /dev/null +++ b/tests/ui/sized-hierarchy/pointee-validation.rs @@ -0,0 +1,20 @@ +// Test that despite us dropping `PointeeSized` bounds during HIR ty lowering +// we still validate it first. +// issue: <https://github.com/rust-lang/rust/issues/142718> +#![feature(sized_hierarchy)] + +use std::marker::PointeeSized; + +struct T where (): PointeeSized<(), Undefined = ()>; +//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied +//~| ERROR associated type `Undefined` not found for `PointeeSized` + +const fn test<T, U>() where T: const PointeeSized, U: [const] PointeeSized {} +//~^ ERROR `const` can only be applied to `const` traits +//~| ERROR `const` can only be applied to `const` traits +//~| ERROR const trait impls are experimental +//~| ERROR `[const]` can only be applied to `const` traits +//~| ERROR `[const]` can only be applied to `const` traits +//~| ERROR const trait impls are experimental + +fn main() {} |
