about summary refs log tree commit diff
path: root/tests/ui/unsized
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-06-18 22:10:53 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2025-07-18 03:13:21 +0200
commit1df99f22d3a1776b36fc00fc35626fd841f7242f (patch)
treeee1b70a04b8964d3fa16f7bac12265e4f317026b /tests/ui/unsized
parent9788f59bbf893965db98dc633e64e4405414b698 (diff)
downloadrust-1df99f22d3a1776b36fc00fc35626fd841f7242f.tar.gz
rust-1df99f22d3a1776b36fc00fc35626fd841f7242f.zip
AST lowering: More robustly deal with relaxed bounds
Diffstat (limited to 'tests/ui/unsized')
-rw-r--r--tests/ui/unsized/relaxed-bounds-invalid-places.rs (renamed from tests/ui/unsized/maybe-bounds-where.rs)3
-rw-r--r--tests/ui/unsized/relaxed-bounds-invalid-places.stderr (renamed from tests/ui/unsized/maybe-bounds-where.stderr)16
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/ui/unsized/maybe-bounds-where.rs b/tests/ui/unsized/relaxed-bounds-invalid-places.rs
index 4c4141631a7..ce3f35608be 100644
--- a/tests/ui/unsized/maybe-bounds-where.rs
+++ b/tests/ui/unsized/relaxed-bounds-invalid-places.rs
@@ -1,3 +1,6 @@
+// Test that relaxed bounds can only be placed on type parameters defined by the closest item
+// (ignoring relaxed bounds inside `impl Trait` and in associated type defs here).
+
 struct S1<T>(T) where (T): ?Sized;
 //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
 
diff --git a/tests/ui/unsized/maybe-bounds-where.stderr b/tests/ui/unsized/relaxed-bounds-invalid-places.stderr
index fb6d37c2966..3287eb8d1e9 100644
--- a/tests/ui/unsized/maybe-bounds-where.stderr
+++ b/tests/ui/unsized/relaxed-bounds-invalid-places.stderr
@@ -1,5 +1,5 @@
 error[E0658]: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:1:28
+  --> $DIR/relaxed-bounds-invalid-places.rs:4:28
    |
 LL | struct S1<T>(T) where (T): ?Sized;
    |                            ^^^^^^
@@ -8,7 +8,7 @@ LL | struct S1<T>(T) where (T): ?Sized;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:4:27
+  --> $DIR/relaxed-bounds-invalid-places.rs:7:27
    |
 LL | struct S2<T>(T) where u8: ?Sized;
    |                           ^^^^^^
@@ -17,7 +17,7 @@ LL | struct S2<T>(T) where u8: ?Sized;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:7:35
+  --> $DIR/relaxed-bounds-invalid-places.rs:10:35
    |
 LL | struct S3<T>(T) where &'static T: ?Sized;
    |                                   ^^^^^^
@@ -26,7 +26,7 @@ LL | struct S3<T>(T) where &'static T: ?Sized;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:12:34
+  --> $DIR/relaxed-bounds-invalid-places.rs:15:34
    |
 LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
    |                                  ^^^^^^^^^^
@@ -35,7 +35,7 @@ LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:21:21
+  --> $DIR/relaxed-bounds-invalid-places.rs:24:21
    |
 LL |     fn f() where T: ?Sized {}
    |                     ^^^^^^
@@ -44,13 +44,13 @@ LL |     fn f() where T: ?Sized {}
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
-  --> $DIR/maybe-bounds-where.rs:12:34
+  --> $DIR/relaxed-bounds-invalid-places.rs:15:34
    |
 LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
    |                                  ^^^^^^^^^^
 
 error[E0203]: type parameter has more than one relaxed default bound, only one is supported
-  --> $DIR/maybe-bounds-where.rs:16:33
+  --> $DIR/relaxed-bounds-invalid-places.rs:19:33
    |
 LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
    |                                 ^^^^^^^^^^^^^^^   ^^^^^^
@@ -59,7 +59,7 @@ LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
-  --> $DIR/maybe-bounds-where.rs:16:33
+  --> $DIR/relaxed-bounds-invalid-places.rs:19:33
    |
 LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
    |                                 ^^^^^^^^^^^^^^^