From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/recursion_limit/empty.rs | 8 ++++++++ tests/ui/recursion_limit/empty.stderr | 18 ++++++++++++++++++ tests/ui/recursion_limit/invalid_digit.rs | 7 +++++++ tests/ui/recursion_limit/invalid_digit.stderr | 18 ++++++++++++++++++ tests/ui/recursion_limit/invalid_digit_type.rs | 3 +++ tests/ui/recursion_limit/invalid_digit_type.stderr | 8 ++++++++ tests/ui/recursion_limit/invalid_macro.rs | 7 +++++++ tests/ui/recursion_limit/invalid_macro.stderr | 8 ++++++++ tests/ui/recursion_limit/no-value.rs | 6 ++++++ tests/ui/recursion_limit/no-value.stderr | 8 ++++++++ tests/ui/recursion_limit/overflow.rs | 9 +++++++++ tests/ui/recursion_limit/overflow.stderr | 18 ++++++++++++++++++ tests/ui/recursion_limit/zero-overflow.rs | 7 +++++++ tests/ui/recursion_limit/zero-overflow.stderr | 7 +++++++ tests/ui/recursion_limit/zero.rs | 12 ++++++++++++ tests/ui/recursion_limit/zero.stderr | 10 ++++++++++ 16 files changed, 154 insertions(+) create mode 100644 tests/ui/recursion_limit/empty.rs create mode 100644 tests/ui/recursion_limit/empty.stderr create mode 100644 tests/ui/recursion_limit/invalid_digit.rs create mode 100644 tests/ui/recursion_limit/invalid_digit.stderr create mode 100644 tests/ui/recursion_limit/invalid_digit_type.rs create mode 100644 tests/ui/recursion_limit/invalid_digit_type.stderr create mode 100644 tests/ui/recursion_limit/invalid_macro.rs create mode 100644 tests/ui/recursion_limit/invalid_macro.stderr create mode 100644 tests/ui/recursion_limit/no-value.rs create mode 100644 tests/ui/recursion_limit/no-value.stderr create mode 100644 tests/ui/recursion_limit/overflow.rs create mode 100644 tests/ui/recursion_limit/overflow.stderr create mode 100644 tests/ui/recursion_limit/zero-overflow.rs create mode 100644 tests/ui/recursion_limit/zero-overflow.stderr create mode 100644 tests/ui/recursion_limit/zero.rs create mode 100644 tests/ui/recursion_limit/zero.stderr (limited to 'tests/ui/recursion_limit') diff --git a/tests/ui/recursion_limit/empty.rs b/tests/ui/recursion_limit/empty.rs new file mode 100644 index 000000000..59dae106c --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/empty.stderr b/tests/ui/recursion_limit/empty.stderr new file mode 100644 index 000000000..cb5c0c35a --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/invalid_digit.rs b/tests/ui/recursion_limit/invalid_digit.rs new file mode 100644 index 000000000..03df3e7a9 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/invalid_digit.stderr b/tests/ui/recursion_limit/invalid_digit.stderr new file mode 100644 index 000000000..4dc93ad5f --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/invalid_digit_type.rs b/tests/ui/recursion_limit/invalid_digit_type.rs new file mode 100644 index 000000000..e408109b3 --- /dev/null +++ b/tests/ui/recursion_limit/invalid_digit_type.rs @@ -0,0 +1,3 @@ +#![recursion_limit = 123] //~ ERROR malformed `recursion_limit` attribute + +fn main() {} diff --git a/tests/ui/recursion_limit/invalid_digit_type.stderr b/tests/ui/recursion_limit/invalid_digit_type.stderr new file mode 100644 index 000000000..6d1409bb3 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/invalid_macro.rs b/tests/ui/recursion_limit/invalid_macro.rs new file mode 100644 index 000000000..7db67a8d1 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/invalid_macro.stderr b/tests/ui/recursion_limit/invalid_macro.stderr new file mode 100644 index 000000000..0189e99da --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/no-value.rs b/tests/ui/recursion_limit/no-value.rs new file mode 100644 index 000000000..2202e5b77 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/no-value.stderr b/tests/ui/recursion_limit/no-value.stderr new file mode 100644 index 000000000..35ac2c4cd --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/overflow.rs b/tests/ui/recursion_limit/overflow.rs new file mode 100644 index 000000000..c733ba6b9 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/overflow.stderr b/tests/ui/recursion_limit/overflow.stderr new file mode 100644 index 000000000..2f622d28b --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/zero-overflow.rs b/tests/ui/recursion_limit/zero-overflow.rs new file mode 100644 index 000000000..77bd81856 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/zero-overflow.stderr b/tests/ui/recursion_limit/zero-overflow.stderr new file mode 100644 index 000000000..9007ec0d7 --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/zero.rs b/tests/ui/recursion_limit/zero.rs new file mode 100644 index 000000000..3a2d904cb --- /dev/null +++ b/tests/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/tests/ui/recursion_limit/zero.stderr b/tests/ui/recursion_limit/zero.stderr new file mode 100644 index 000000000..b43565909 --- /dev/null +++ b/tests/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 + -- cgit v1.2.3