summaryrefslogtreecommitdiffstats
path: root/src/test/ui/recursion_limit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/recursion_limit
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/recursion_limit')
-rw-r--r--src/test/ui/recursion_limit/empty.rs8
-rw-r--r--src/test/ui/recursion_limit/empty.stderr18
-rw-r--r--src/test/ui/recursion_limit/invalid_digit.rs7
-rw-r--r--src/test/ui/recursion_limit/invalid_digit.stderr18
-rw-r--r--src/test/ui/recursion_limit/invalid_digit_type.rs3
-rw-r--r--src/test/ui/recursion_limit/invalid_digit_type.stderr8
-rw-r--r--src/test/ui/recursion_limit/invalid_macro.rs7
-rw-r--r--src/test/ui/recursion_limit/invalid_macro.stderr8
-rw-r--r--src/test/ui/recursion_limit/no-value.rs6
-rw-r--r--src/test/ui/recursion_limit/no-value.stderr8
-rw-r--r--src/test/ui/recursion_limit/overflow.rs9
-rw-r--r--src/test/ui/recursion_limit/overflow.stderr18
-rw-r--r--src/test/ui/recursion_limit/zero-overflow.rs7
-rw-r--r--src/test/ui/recursion_limit/zero-overflow.stderr7
-rw-r--r--src/test/ui/recursion_limit/zero.rs12
-rw-r--r--src/test/ui/recursion_limit/zero.stderr10
16 files changed, 154 insertions, 0 deletions
diff --git a/src/test/ui/recursion_limit/empty.rs b/src/test/ui/recursion_limit/empty.rs
new file mode 100644
index 000000000..59dae106c
--- /dev/null
+++ b/src/test/ui/recursion_limit/empty.rs
@@ -0,0 +1,8 @@
+// Test the parse error for an empty recursion_limit
+
+#![recursion_limit = ""] //~ ERROR `limit` must be a non-negative integer
+ //~| `limit` must be a non-negative integer
+ //~| ERROR `limit` must be a non-negative integer
+ //~| `limit` must be a non-negative integer
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/empty.stderr b/src/test/ui/recursion_limit/empty.stderr
new file mode 100644
index 000000000..cb5c0c35a
--- /dev/null
+++ b/src/test/ui/recursion_limit/empty.stderr
@@ -0,0 +1,18 @@
+error: `limit` must be a non-negative integer
+ --> $DIR/empty.rs:3:1
+ |
+LL | #![recursion_limit = ""]
+ | ^^^^^^^^^^^^^^^^^^^^^--^
+ | |
+ | `limit` must be a non-negative integer
+
+error: `limit` must be a non-negative integer
+ --> $DIR/empty.rs:3:1
+ |
+LL | #![recursion_limit = ""]
+ | ^^^^^^^^^^^^^^^^^^^^^--^
+ | |
+ | `limit` must be a non-negative integer
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/recursion_limit/invalid_digit.rs b/src/test/ui/recursion_limit/invalid_digit.rs
new file mode 100644
index 000000000..03df3e7a9
--- /dev/null
+++ b/src/test/ui/recursion_limit/invalid_digit.rs
@@ -0,0 +1,7 @@
+// Test the parse error for an invalid digit in recursion_limit
+
+#![recursion_limit = "-100"] //~ ERROR `limit` must be a non-negative integer
+ //~| not a valid integer
+ //~| ERROR `limit` must be a non-negative integer
+ //~| not a valid integer
+fn main() {}
diff --git a/src/test/ui/recursion_limit/invalid_digit.stderr b/src/test/ui/recursion_limit/invalid_digit.stderr
new file mode 100644
index 000000000..4dc93ad5f
--- /dev/null
+++ b/src/test/ui/recursion_limit/invalid_digit.stderr
@@ -0,0 +1,18 @@
+error: `limit` must be a non-negative integer
+ --> $DIR/invalid_digit.rs:3:1
+ |
+LL | #![recursion_limit = "-100"]
+ | ^^^^^^^^^^^^^^^^^^^^^------^
+ | |
+ | not a valid integer
+
+error: `limit` must be a non-negative integer
+ --> $DIR/invalid_digit.rs:3:1
+ |
+LL | #![recursion_limit = "-100"]
+ | ^^^^^^^^^^^^^^^^^^^^^------^
+ | |
+ | not a valid integer
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/recursion_limit/invalid_digit_type.rs b/src/test/ui/recursion_limit/invalid_digit_type.rs
new file mode 100644
index 000000000..e408109b3
--- /dev/null
+++ b/src/test/ui/recursion_limit/invalid_digit_type.rs
@@ -0,0 +1,3 @@
+#![recursion_limit = 123] //~ ERROR malformed `recursion_limit` attribute
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/invalid_digit_type.stderr b/src/test/ui/recursion_limit/invalid_digit_type.stderr
new file mode 100644
index 000000000..6d1409bb3
--- /dev/null
+++ b/src/test/ui/recursion_limit/invalid_digit_type.stderr
@@ -0,0 +1,8 @@
+error: malformed `recursion_limit` attribute input
+ --> $DIR/invalid_digit_type.rs:1:1
+ |
+LL | #![recursion_limit = 123]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/recursion_limit/invalid_macro.rs b/src/test/ui/recursion_limit/invalid_macro.rs
new file mode 100644
index 000000000..7db67a8d1
--- /dev/null
+++ b/src/test/ui/recursion_limit/invalid_macro.rs
@@ -0,0 +1,7 @@
+#![recursion_limit = foo!()] //~ ERROR malformed `recursion_limit` attribute
+
+macro_rules! foo {
+ () => {"128"};
+}
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/invalid_macro.stderr b/src/test/ui/recursion_limit/invalid_macro.stderr
new file mode 100644
index 000000000..0189e99da
--- /dev/null
+++ b/src/test/ui/recursion_limit/invalid_macro.stderr
@@ -0,0 +1,8 @@
+error: malformed `recursion_limit` attribute input
+ --> $DIR/invalid_macro.rs:1:1
+ |
+LL | #![recursion_limit = foo!()]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/recursion_limit/no-value.rs b/src/test/ui/recursion_limit/no-value.rs
new file mode 100644
index 000000000..2202e5b77
--- /dev/null
+++ b/src/test/ui/recursion_limit/no-value.rs
@@ -0,0 +1,6 @@
+// Test the parse error for no value provided to recursion_limit
+
+#![recursion_limit]
+//~^ ERROR malformed `recursion_limit` attribute input
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/no-value.stderr b/src/test/ui/recursion_limit/no-value.stderr
new file mode 100644
index 000000000..35ac2c4cd
--- /dev/null
+++ b/src/test/ui/recursion_limit/no-value.stderr
@@ -0,0 +1,8 @@
+error: malformed `recursion_limit` attribute input
+ --> $DIR/no-value.rs:3:1
+ |
+LL | #![recursion_limit]
+ | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/recursion_limit/overflow.rs b/src/test/ui/recursion_limit/overflow.rs
new file mode 100644
index 000000000..c733ba6b9
--- /dev/null
+++ b/src/test/ui/recursion_limit/overflow.rs
@@ -0,0 +1,9 @@
+// Test the parse error for an overflowing recursion_limit
+
+#![recursion_limit = "999999999999999999999999"]
+//~^ ERROR `limit` must be a non-negative integer
+//~| `limit` is too large
+//~| ERROR `limit` must be a non-negative integer
+//~| `limit` is too large
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/overflow.stderr b/src/test/ui/recursion_limit/overflow.stderr
new file mode 100644
index 000000000..2f622d28b
--- /dev/null
+++ b/src/test/ui/recursion_limit/overflow.stderr
@@ -0,0 +1,18 @@
+error: `limit` must be a non-negative integer
+ --> $DIR/overflow.rs:3:1
+ |
+LL | #![recursion_limit = "999999999999999999999999"]
+ | ^^^^^^^^^^^^^^^^^^^^^--------------------------^
+ | |
+ | `limit` is too large
+
+error: `limit` must be a non-negative integer
+ --> $DIR/overflow.rs:3:1
+ |
+LL | #![recursion_limit = "999999999999999999999999"]
+ | ^^^^^^^^^^^^^^^^^^^^^--------------------------^
+ | |
+ | `limit` is too large
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/recursion_limit/zero-overflow.rs b/src/test/ui/recursion_limit/zero-overflow.rs
new file mode 100644
index 000000000..77bd81856
--- /dev/null
+++ b/src/test/ui/recursion_limit/zero-overflow.rs
@@ -0,0 +1,7 @@
+//~ ERROR overflow evaluating the requirement `&mut Self: DispatchFromDyn<&mut RustaceansAreAwesome>
+//~| HELP consider increasing the recursion limit
+// build-fail
+
+#![recursion_limit = "0"]
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/zero-overflow.stderr b/src/test/ui/recursion_limit/zero-overflow.stderr
new file mode 100644
index 000000000..9007ec0d7
--- /dev/null
+++ b/src/test/ui/recursion_limit/zero-overflow.stderr
@@ -0,0 +1,7 @@
+error[E0275]: overflow evaluating the requirement `&mut Self: DispatchFromDyn<&mut RustaceansAreAwesome>`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`zero_overflow`)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/src/test/ui/recursion_limit/zero.rs b/src/test/ui/recursion_limit/zero.rs
new file mode 100644
index 000000000..3a2d904cb
--- /dev/null
+++ b/src/test/ui/recursion_limit/zero.rs
@@ -0,0 +1,12 @@
+// Test that a `limit` of 0 is valid
+
+#![recursion_limit = "0"]
+
+macro_rules! test {
+ () => {};
+ ($tt:tt) => { test!(); };
+}
+
+test!(test); //~ ERROR recursion limit reached while expanding `test!`
+
+fn main() {}
diff --git a/src/test/ui/recursion_limit/zero.stderr b/src/test/ui/recursion_limit/zero.stderr
new file mode 100644
index 000000000..b43565909
--- /dev/null
+++ b/src/test/ui/recursion_limit/zero.stderr
@@ -0,0 +1,10 @@
+error: recursion limit reached while expanding `test!`
+ --> $DIR/zero.rs:10:1
+ |
+LL | test!(test);
+ | ^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`zero`)
+
+error: aborting due to previous error
+