Skip to content

Commit 6a99461

Browse files
committed
Specialize a few tests depending on opt-level.
1 parent 6bb549f commit 6a99461

10 files changed

+56
-40
lines changed

Diff for: src/test/ui/issues/issue-67552.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// build-pass
1+
// build-fail
2+
// compile-flags: -Copt-level=0
23
// normalize-stderr-test: ".nll/" -> "/"
34

45
fn main() {
@@ -26,5 +27,6 @@ where
2627
T::count(it);
2728
} else {
2829
rec(identity(&mut it))
30+
//~^ ERROR reached the recursion limit while instantiating
2931
}
3032
}

Diff for: src/test/ui/issues/issue-67552.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>`
2+
--> $DIR/issue-67552.rs:29:9
3+
|
4+
LL | rec(identity(&mut it))
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: `rec` defined here
8+
--> $DIR/issue-67552.rs:22:1
9+
|
10+
LL | / fn rec<T>(mut it: T)
11+
LL | | where
12+
LL | | T: Iterator,
13+
| |________________^
14+
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552/issue-67552.long-type.txt'
15+
16+
error: aborting due to previous error
17+

Diff for: src/test/ui/panics/location-detail-unwrap-no-file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-fail
22
// check-run-results
3-
// compile-flags: -Zlocation-detail=line,column
3+
// compile-flags: -Copt-level=0 -Zlocation-detail=line,column
44
// exec-env:RUST_BACKTRACE=0
55

66
fn main() {
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:8:5
1+
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:8:9
22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Diff for: src/test/ui/polymorphization/predicates.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// build-fail
2-
// compile-flags:-Zpolymorphize=on
2+
// compile-flags: -Copt-level=0 -Zpolymorphize=on
3+
34
#![feature(rustc_attrs)]
45

56
// This test checks that `T` is considered used in `foo`, because it is used in a predicate for

Diff for: src/test/ui/polymorphization/predicates.stderr

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
error: item has unused generic parameters
2-
--> $DIR/predicates.rs:58:4
3-
|
4-
LL | fn quux<A, B, C: Default>() -> usize
5-
| ^^^^ - - generic parameter `B` is unused
6-
| |
7-
| generic parameter `A` is unused
8-
9-
error: item has unused generic parameters
10-
--> $DIR/predicates.rs:75:4
11-
|
12-
LL | fn foobar<F, G>() -> usize
13-
| ^^^^^^ - generic parameter `F` is unused
14-
15-
error: item has unused generic parameters
16-
--> $DIR/predicates.rs:14:4
2+
--> $DIR/predicates.rs:15:4
173
|
184
LL | fn foo<I, T>(_: I)
195
| ^^^ - generic parameter `T` is unused
206

217
error: item has unused generic parameters
22-
--> $DIR/predicates.rs:23:4
8+
--> $DIR/predicates.rs:24:4
239
|
2410
LL | fn baz<I, T>(_: I)
2511
| ^^^ - generic parameter `T` is unused
2612

2713
error: item has unused generic parameters
28-
--> $DIR/predicates.rs:44:19
14+
--> $DIR/predicates.rs:45:19
2915
|
3016
LL | impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E>
3117
| - - generic parameter `E` is unused
@@ -36,13 +22,27 @@ LL | self.find(|_| true)
3622
| ^^^^^^^^
3723

3824
error: item has unused generic parameters
39-
--> $DIR/predicates.rs:9:4
25+
--> $DIR/predicates.rs:59:4
26+
|
27+
LL | fn quux<A, B, C: Default>() -> usize
28+
| ^^^^ - - generic parameter `B` is unused
29+
| |
30+
| generic parameter `A` is unused
31+
32+
error: item has unused generic parameters
33+
--> $DIR/predicates.rs:76:4
34+
|
35+
LL | fn foobar<F, G>() -> usize
36+
| ^^^^^^ - generic parameter `F` is unused
37+
38+
error: item has unused generic parameters
39+
--> $DIR/predicates.rs:10:4
4040
|
4141
LL | fn bar<I>() {
4242
| ^^^ - generic parameter `I` is unused
4343

4444
note: the above error was encountered while instantiating `fn foo::<std::slice::Iter<u32>, T>`
45-
--> $DIR/predicates.rs:85:5
45+
--> $DIR/predicates.rs:86:5
4646
|
4747
LL | foo(x.iter());
4848
| ^^^^^^^^^^^^^

Diff for: src/test/ui/recursion/issue-83150.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// build-fail
2+
// compile-flags: -Copt-level=0
3+
//~^^ ERROR overflow evaluating the requirement
24

35
fn main() {
46
let mut iter = 0u8..1;
@@ -7,5 +9,4 @@ fn main() {
79

810
fn func<T: Iterator<Item = u8>>(iter: &mut T) { //~ WARN function cannot return without recursing
911
func(&mut iter.map(|x| x + 1))
10-
//~^ ERROR reached the recursion limit while instantiating
1112
}

Diff for: src/test/ui/recursion/issue-83150.stderr

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: function cannot return without recursing
2-
--> $DIR/issue-83150.rs:8:1
2+
--> $DIR/issue-83150.rs:10:1
33
|
44
LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
@@ -9,18 +9,11 @@ LL | func(&mut iter.map(|x| x + 1))
99
= note: `#[warn(unconditional_recursion)]` on by default
1010
= help: a `loop` may express intention better if this is on purpose
1111

12-
error: reached the recursion limit while instantiating `func::<Map<&mut Map<&mut Map<&mu...ion/issue-83150.rs:9:24: 9:33]>>`
13-
--> $DIR/issue-83150.rs:9:5
12+
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`
1413
|
15-
LL | func(&mut iter.map(|x| x + 1))
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17-
|
18-
note: `func` defined here
19-
--> $DIR/issue-83150.rs:8:1
20-
|
21-
LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) {
22-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23-
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type.txt'
14+
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
15+
= 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]>`
2416

2517
error: aborting due to previous error; 1 warning emitted
2618

19+
For more information about this error, try `rustc --explain E0275`.

Diff for: src/test/ui/type_length_limit.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// build-fail
22
// error-pattern: reached the type-length limit while instantiating
3+
// compile-flags: -Copt-level=0
34
// normalize-stderr-test: ".nll/" -> "/"
45

56
// Test that the type length limit can be changed.
7+
// The exact type depends on optimizations, so disable them.
68

79
#![allow(dead_code)]
810
#![type_length_limit="4"]

Diff for: src/test/ui/type_length_limit.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: reached the type-length limit while instantiating `<[closure@std::rt::lang_start<()...e<()>>::call_once - shim(vtable)`
2-
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
1+
error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((...,....., ...), ..., ...), ..., ...)>>`
2+
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
33
|
4-
LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | pub fn drop<T>(_x: T) {}
5+
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt'
88
= help: consider adding a `#![type_length_limit="8"]` attribute to your crate

0 commit comments

Comments
 (0)