about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-15 10:45:37 -0400
committerMichael Goulet <michael@errs.io>2024-05-21 15:56:10 -0400
commit994b58fee7e66c25d4b13a8a95feaff650088301 (patch)
treea9ad15524a5cdba84485e410f37425cfcd7b507b /tests
parent506512391b1a75ae450d36c9420978402a91abcc (diff)
downloadrust-994b58fee7e66c25d4b13a8a95feaff650088301.tar.gz
rust-994b58fee7e66c25d4b13a8a95feaff650088301.zip
Okay actually check only alias TYPES
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/higher-ranked/well-formed-aliases.rs8
-rw-r--r--tests/ui/higher-ranked/well-formed-aliases.stderr12
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/higher-ranked/well-formed-aliases.rs b/tests/ui/higher-ranked/well-formed-aliases.rs
new file mode 100644
index 00000000000..60e013a54bc
--- /dev/null
+++ b/tests/ui/higher-ranked/well-formed-aliases.rs
@@ -0,0 +1,8 @@
+trait Trait {
+    type Gat<U: ?Sized>;
+}
+
+fn test<T>(f: for<'a> fn(<&'a T as Trait>::Gat<&'a [str]>)) where for<'a> &'a T: Trait {}
+//~^ ERROR the size for values of type `str` cannot be known at compilation time
+
+fn main() {}
diff --git a/tests/ui/higher-ranked/well-formed-aliases.stderr b/tests/ui/higher-ranked/well-formed-aliases.stderr
new file mode 100644
index 00000000000..4a6f4e961d9
--- /dev/null
+++ b/tests/ui/higher-ranked/well-formed-aliases.stderr
@@ -0,0 +1,12 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+  --> $DIR/well-formed-aliases.rs:5:52
+   |
+LL | fn test<T>(f: for<'a> fn(<&'a T as Trait>::Gat<&'a [str]>)) where for<'a> &'a T: Trait {}
+   |                                                    ^^^^^ doesn't have a size known at compile-time
+   |
+   = help: the trait `Sized` is not implemented for `str`
+   = note: slice and array elements must have `Sized` type
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.