Specialize a few tests depending on opt-level.
This commit is contained in:
parent
6bb549f0d1
commit
6a9946143d
10 changed files with 56 additions and 40 deletions
|
@ -1,4 +1,5 @@
|
||||||
// build-pass
|
// build-fail
|
||||||
|
// compile-flags: -Copt-level=0
|
||||||
// normalize-stderr-test: ".nll/" -> "/"
|
// normalize-stderr-test: ".nll/" -> "/"
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -26,5 +27,6 @@ where
|
||||||
T::count(it);
|
T::count(it);
|
||||||
} else {
|
} else {
|
||||||
rec(identity(&mut it))
|
rec(identity(&mut it))
|
||||||
|
//~^ ERROR reached the recursion limit while instantiating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
src/test/ui/issues/issue-67552.stderr
Normal file
17
src/test/ui/issues/issue-67552.stderr
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>`
|
||||||
|
--> $DIR/issue-67552.rs:29:9
|
||||||
|
|
|
||||||
|
LL | rec(identity(&mut it))
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: `rec` defined here
|
||||||
|
--> $DIR/issue-67552.rs:22:1
|
||||||
|
|
|
||||||
|
LL | / fn rec<T>(mut it: T)
|
||||||
|
LL | | where
|
||||||
|
LL | | T: Iterator,
|
||||||
|
| |________________^
|
||||||
|
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552/issue-67552.long-type.txt'
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// run-fail
|
// run-fail
|
||||||
// check-run-results
|
// check-run-results
|
||||||
// compile-flags: -Zlocation-detail=line,column
|
// compile-flags: -Copt-level=0 -Zlocation-detail=line,column
|
||||||
// exec-env:RUST_BACKTRACE=0
|
// exec-env:RUST_BACKTRACE=0
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:8:5
|
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:8:9
|
||||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
// compile-flags:-Zpolymorphize=on
|
// compile-flags: -Copt-level=0 -Zpolymorphize=on
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
// This test checks that `T` is considered used in `foo`, because it is used in a predicate for
|
// This test checks that `T` is considered used in `foo`, because it is used in a predicate for
|
||||||
|
|
|
@ -1,31 +1,17 @@
|
||||||
error: item has unused generic parameters
|
error: item has unused generic parameters
|
||||||
--> $DIR/predicates.rs:58:4
|
--> $DIR/predicates.rs:15:4
|
||||||
|
|
|
||||||
LL | fn quux<A, B, C: Default>() -> usize
|
|
||||||
| ^^^^ - - generic parameter `B` is unused
|
|
||||||
| |
|
|
||||||
| generic parameter `A` is unused
|
|
||||||
|
|
||||||
error: item has unused generic parameters
|
|
||||||
--> $DIR/predicates.rs:75:4
|
|
||||||
|
|
|
||||||
LL | fn foobar<F, G>() -> usize
|
|
||||||
| ^^^^^^ - generic parameter `F` is unused
|
|
||||||
|
|
||||||
error: item has unused generic parameters
|
|
||||||
--> $DIR/predicates.rs:14:4
|
|
||||||
|
|
|
|
||||||
LL | fn foo<I, T>(_: I)
|
LL | fn foo<I, T>(_: I)
|
||||||
| ^^^ - generic parameter `T` is unused
|
| ^^^ - generic parameter `T` is unused
|
||||||
|
|
||||||
error: item has unused generic parameters
|
error: item has unused generic parameters
|
||||||
--> $DIR/predicates.rs:23:4
|
--> $DIR/predicates.rs:24:4
|
||||||
|
|
|
|
||||||
LL | fn baz<I, T>(_: I)
|
LL | fn baz<I, T>(_: I)
|
||||||
| ^^^ - generic parameter `T` is unused
|
| ^^^ - generic parameter `T` is unused
|
||||||
|
|
||||||
error: item has unused generic parameters
|
error: item has unused generic parameters
|
||||||
--> $DIR/predicates.rs:44:19
|
--> $DIR/predicates.rs:45:19
|
||||||
|
|
|
|
||||||
LL | impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E>
|
LL | impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E>
|
||||||
| - - generic parameter `E` is unused
|
| - - generic parameter `E` is unused
|
||||||
|
@ -36,13 +22,27 @@ LL | self.find(|_| true)
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: item has unused generic parameters
|
error: item has unused generic parameters
|
||||||
--> $DIR/predicates.rs:9:4
|
--> $DIR/predicates.rs:59:4
|
||||||
|
|
|
||||||
|
LL | fn quux<A, B, C: Default>() -> usize
|
||||||
|
| ^^^^ - - generic parameter `B` is unused
|
||||||
|
| |
|
||||||
|
| generic parameter `A` is unused
|
||||||
|
|
||||||
|
error: item has unused generic parameters
|
||||||
|
--> $DIR/predicates.rs:76:4
|
||||||
|
|
|
||||||
|
LL | fn foobar<F, G>() -> usize
|
||||||
|
| ^^^^^^ - generic parameter `F` is unused
|
||||||
|
|
||||||
|
error: item has unused generic parameters
|
||||||
|
--> $DIR/predicates.rs:10:4
|
||||||
|
|
|
|
||||||
LL | fn bar<I>() {
|
LL | fn bar<I>() {
|
||||||
| ^^^ - generic parameter `I` is unused
|
| ^^^ - generic parameter `I` is unused
|
||||||
|
|
||||||
note: the above error was encountered while instantiating `fn foo::<std::slice::Iter<u32>, T>`
|
note: the above error was encountered while instantiating `fn foo::<std::slice::Iter<u32>, T>`
|
||||||
--> $DIR/predicates.rs:85:5
|
--> $DIR/predicates.rs:86:5
|
||||||
|
|
|
|
||||||
LL | foo(x.iter());
|
LL | foo(x.iter());
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
|
// compile-flags: -Copt-level=0
|
||||||
|
//~^^ ERROR overflow evaluating the requirement
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut iter = 0u8..1;
|
let mut iter = 0u8..1;
|
||||||
|
@ -7,5 +9,4 @@ fn main() {
|
||||||
|
|
||||||
fn func<T: Iterator<Item = u8>>(iter: &mut T) { //~ WARN function cannot return without recursing
|
fn func<T: Iterator<Item = u8>>(iter: &mut T) { //~ WARN function cannot return without recursing
|
||||||
func(&mut iter.map(|x| x + 1))
|
func(&mut iter.map(|x| x + 1))
|
||||||
//~^ ERROR reached the recursion limit while instantiating
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
warning: function cannot return without recursing
|
warning: function cannot return without recursing
|
||||||
--> $DIR/issue-83150.rs:8:1
|
--> $DIR/issue-83150.rs:10:1
|
||||||
|
|
|
|
||||||
LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) {
|
LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
||||||
|
@ -9,18 +9,11 @@ LL | func(&mut iter.map(|x| x + 1))
|
||||||
= note: `#[warn(unconditional_recursion)]` on by default
|
= note: `#[warn(unconditional_recursion)]` on by default
|
||||||
= help: a `loop` may express intention better if this is on purpose
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
|
||||||
error: reached the recursion limit while instantiating `func::<Map<&mut Map<&mut Map<&mu...ion/issue-83150.rs:9:24: 9:33]>>`
|
error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>: Iterator`
|
||||||
--> $DIR/issue-83150.rs:9:5
|
|
||||||
|
|
|
|
||||||
LL | func(&mut iter.map(|x| x + 1))
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `Iterator` for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>`
|
||||||
|
|
|
||||||
note: `func` defined here
|
|
||||||
--> $DIR/issue-83150.rs:8:1
|
|
||||||
|
|
|
||||||
LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type.txt'
|
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0275`.
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
// error-pattern: reached the type-length limit while instantiating
|
// error-pattern: reached the type-length limit while instantiating
|
||||||
|
// compile-flags: -Copt-level=0
|
||||||
// normalize-stderr-test: ".nll/" -> "/"
|
// normalize-stderr-test: ".nll/" -> "/"
|
||||||
|
|
||||||
// Test that the type length limit can be changed.
|
// Test that the type length limit can be changed.
|
||||||
|
// The exact type depends on optimizations, so disable them.
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![type_length_limit="4"]
|
#![type_length_limit="4"]
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: reached the type-length limit while instantiating `<[closure@std::rt::lang_start<()...e<()>>::call_once - shim(vtable)`
|
error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((...,....., ...), ..., ...), ..., ...)>>`
|
||||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
|
LL | pub fn drop<T>(_x: T) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt'
|
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt'
|
||||||
= help: consider adding a `#![type_length_limit="8"]` attribute to your crate
|
= help: consider adding a `#![type_length_limit="8"]` attribute to your crate
|
||||||
|
|
Loading…
Add table
Reference in a new issue