summaryrefslogtreecommitdiffstats
path: root/tests/ui/query-system
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/query-system
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/query-system')
-rw-r--r--tests/ui/query-system/fn-sig-cycle-arity.rs8
-rw-r--r--tests/ui/query-system/fn-sig-cycle-arity.stderr9
-rw-r--r--tests/ui/query-system/issue-83479.rs16
-rw-r--r--tests/ui/query-system/issue-83479.stderr44
-rw-r--r--tests/ui/query-system/query_depth.rs31
-rw-r--r--tests/ui/query-system/query_depth.stderr11
6 files changed, 119 insertions, 0 deletions
diff --git a/tests/ui/query-system/fn-sig-cycle-arity.rs b/tests/ui/query-system/fn-sig-cycle-arity.rs
new file mode 100644
index 000000000..7a9b8469c
--- /dev/null
+++ b/tests/ui/query-system/fn-sig-cycle-arity.rs
@@ -0,0 +1,8 @@
+trait Dancer {
+ fn dance(&self) -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ self.dance()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/query-system/fn-sig-cycle-arity.stderr b/tests/ui/query-system/fn-sig-cycle-arity.stderr
new file mode 100644
index 000000000..67e0c2545
--- /dev/null
+++ b/tests/ui/query-system/fn-sig-cycle-arity.stderr
@@ -0,0 +1,9 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/fn-sig-cycle-arity.rs:2:24
+ |
+LL | fn dance(&self) -> _ {
+ | ^ not allowed in type signatures
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/tests/ui/query-system/issue-83479.rs b/tests/ui/query-system/issue-83479.rs
new file mode 100644
index 000000000..32676dfe9
--- /dev/null
+++ b/tests/ui/query-system/issue-83479.rs
@@ -0,0 +1,16 @@
+#![feature(type_alias_impl_trait)]
+
+type PairCoupledTypes: Trait<
+ //~^ ERROR: bounds on `type`s in this context have no effect
+ //~| ERROR: cannot find trait `Trait` in this scope
+ [u32; {
+ static FOO: usize; //~ ERROR: free static item without body
+ }],
+> = impl Trait<
+ //~^ ERROR: cannot find trait `Trait` in this scope
+ [u32; {
+ static FOO: usize; //~ ERROR: free static item without body
+ }],
+>;
+
+fn main() {}
diff --git a/tests/ui/query-system/issue-83479.stderr b/tests/ui/query-system/issue-83479.stderr
new file mode 100644
index 000000000..7cb41f5cb
--- /dev/null
+++ b/tests/ui/query-system/issue-83479.stderr
@@ -0,0 +1,44 @@
+error: bounds on `type`s in this context have no effect
+ --> $DIR/issue-83479.rs:3:24
+ |
+LL | type PairCoupledTypes: Trait<
+ | ________________________^
+LL | |
+LL | |
+LL | | [u32; {
+LL | | static FOO: usize;
+LL | | }],
+LL | | > = impl Trait<
+ | |_^
+
+error: free static item without body
+ --> $DIR/issue-83479.rs:7:9
+ |
+LL | static FOO: usize;
+ | ^^^^^^^^^^^^^^^^^-
+ | |
+ | help: provide a definition for the static: `= <expr>;`
+
+error: free static item without body
+ --> $DIR/issue-83479.rs:12:9
+ |
+LL | static FOO: usize;
+ | ^^^^^^^^^^^^^^^^^-
+ | |
+ | help: provide a definition for the static: `= <expr>;`
+
+error[E0405]: cannot find trait `Trait` in this scope
+ --> $DIR/issue-83479.rs:3:24
+ |
+LL | type PairCoupledTypes: Trait<
+ | ^^^^^ not found in this scope
+
+error[E0405]: cannot find trait `Trait` in this scope
+ --> $DIR/issue-83479.rs:9:10
+ |
+LL | > = impl Trait<
+ | ^^^^^ not found in this scope
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0405`.
diff --git a/tests/ui/query-system/query_depth.rs b/tests/ui/query-system/query_depth.rs
new file mode 100644
index 000000000..e600c1c08
--- /dev/null
+++ b/tests/ui/query-system/query_depth.rs
@@ -0,0 +1,31 @@
+// build-fail
+
+#![recursion_limit = "64"]
+type Byte = Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Option<Option<Option<Option< Option<Option<Option<Option<
+ Box<String>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+ >>>> >>>>
+>>>> >>>>;
+
+fn main() {
+//~^ ERROR: queries overflow the depth limit!
+ println!("{}", std::mem::size_of::<Byte>());
+}
diff --git a/tests/ui/query-system/query_depth.stderr b/tests/ui/query-system/query_depth.stderr
new file mode 100644
index 000000000..43a18b4e0
--- /dev/null
+++ b/tests/ui/query-system/query_depth.stderr
@@ -0,0 +1,11 @@
+error: queries overflow the depth limit!
+ --> $DIR/query_depth.rs:28:1
+ |
+LL | fn main() {
+ | ^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "128"]` attribute to your crate (`query_depth`)
+ = note: query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+
+error: aborting due to previous error
+