about summary refs log tree commit diff
path: root/tests/ui/sized-hierarchy/pointee-validation.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-18 19:14:43 +0200
committerGitHub <noreply@github.com>2025-07-18 19:14:43 +0200
commitf38891e697e9b9efe3c232d25c20feb80bc248bc (patch)
tree2c2bfa43a21adc2e4133055952a621b9c1626fdd /tests/ui/sized-hierarchy/pointee-validation.rs
parentb3827e4f3728b77bd3e60587487ebfc3cc8d901b (diff)
parent82a02aefe07092c737c852daccebf49ca25507e3 (diff)
downloadrust-f38891e697e9b9efe3c232d25c20feb80bc248bc.tar.gz
rust-f38891e697e9b9efe3c232d25c20feb80bc248bc.zip
Rollup merge of #142693 - fmease:unbound-bettering, r=compiler-errors
More robustly deal with relaxed bounds and improve their diagnostics

Scaffolding for https://github.com/rust-lang/rust/issues/135229 (CC https://github.com/rust-lang/rust/pull/135331)

Fixes https://github.com/rust-lang/rust/issues/136944 (6th commit).
Fixes https://github.com/rust-lang/rust/issues/142718 (8th commit).
Diffstat (limited to 'tests/ui/sized-hierarchy/pointee-validation.rs')
-rw-r--r--tests/ui/sized-hierarchy/pointee-validation.rs20
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() {}