Skip to content

Commit c7a419d

Browse files
Fix up tests
1 parent 9bc484f commit c7a419d

20 files changed

+148
-22
lines changed

src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: fatal error triggered by #[rustc_error]
2-
--> $DIR/bound-lifetime-in-binding-only.rs:71:1
2+
--> $DIR/bound-lifetime-in-binding-only.rs:75:1
33
|
44
LL | fn main() { }
55
| ^^^^^^^^^

src/test/ui/associated-types/bound-lifetime-in-binding-only.rs

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ fn elision<T: Fn() -> &i32>() {
5555

5656
struct Parameterized<'a> { x: &'a str }
5757

58+
impl<'a> Foo for Parameterized<'a> {
59+
type Item = &'a i32;
60+
}
61+
5862
#[cfg(ok)]
5963
fn ok1<T: for<'a> Fn(&Parameterized<'a>) -> &'a i32>() {
6064
}

src/test/ui/associated-types/issue-69398.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub trait Broken {
1212
impl<T> Broken for T {
1313
type Assoc = ();
1414
fn broken(&self) where Self::Assoc: Foo {
15+
//~^ WARN where-clause bound is impossible to satisfy
1516
let _x: <Self::Assoc as Foo>::Bar;
1617
}
1718
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-69398.rs:14:28
3+
|
4+
LL | fn broken(&self) where Self::Assoc: Foo {
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: the bound `<T as Broken>::Assoc: Foo` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
10+
warning: 1 warning emitted
11+

src/test/ui/consts/issue-67696-const-prop-ice.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ trait A {
1010
}
1111

1212
impl A for [fn(&())] {
13-
fn foo(&self) -> Self where Self: Copy { *(&[] as &[_]) }
13+
fn foo(&self) -> Self where Self: Copy {
14+
//~^ WARN where-clause bound is impossible to satisfy
15+
//~| WARN where-clause bound is impossible to satisfy
16+
//~| WARN where-clause bound is impossible to satisfy
17+
*(&[] as &[_])
18+
}
1419
}
1520

1621
impl A for i32 {
17-
fn foo(&self) -> Self { 3 }
22+
fn foo(&self) -> Self {
23+
3
24+
}
1825
}
1926

2027
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-67696-const-prop-ice.rs:13:33
3+
|
4+
LL | fn foo(&self) -> Self where Self: Copy {
5+
| ^^^^^^^^^^
6+
|
7+
= note: the bound `[for<'r> fn(&'r ())]: Copy` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
10+
warning: where-clause bound is impossible to satisfy
11+
--> $DIR/issue-67696-const-prop-ice.rs:13:33
12+
|
13+
LL | fn foo(&self) -> Self where Self: Copy {
14+
| ^^^^^^^^^^
15+
|
16+
= note: the bound `[for<'r> fn(&'r ())]: Clone` was previously accepted, but it may become a hard error in a future release
17+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
18+
19+
warning: where-clause bound is impossible to satisfy
20+
--> $DIR/issue-67696-const-prop-ice.rs:13:33
21+
|
22+
LL | fn foo(&self) -> Self where Self: Copy {
23+
| ^^^^^^^^^^
24+
|
25+
= note: the bound `[for<'r> fn(&'r ())]: Sized` was previously accepted, but it may become a hard error in a future release
26+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
27+
28+
warning: 3 warnings emitted
29+

src/test/ui/feature-gates/feature-gate-trivial_bounds.rs

+2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ fn return_str() -> str where str: Sized { //~ ERROR
6262

6363
// This is currently accepted because the function pointer isn't
6464
// considered global.
65+
// FIXME(compiler-errors): Not for long..
6566
fn global_hr(x: fn(&())) where fn(&()): Foo { // OK
67+
//~^ WARN where-clause bound is impossible to satisfy
6668
x.test();
6769
}
6870

src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ LL | fn return_str() -> str where str: Sized {
113113
= help: see issue #48214
114114
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
115115

116-
error: aborting due to 11 previous errors
116+
warning: where-clause bound is impossible to satisfy
117+
--> $DIR/feature-gate-trivial_bounds.rs:66:32
118+
|
119+
LL | fn global_hr(x: fn(&())) where fn(&()): Foo { // OK
120+
| ^^^^^^^^^^^^
121+
|
122+
= note: the bound `for<'r> fn(&'r ()): Foo` was previously accepted, but it may become a hard error in a future release
123+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
124+
125+
error: aborting due to 11 previous errors; 1 warning emitted
117126

118127
For more information about this error, try `rustc --explain E0277`.

src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
77
trait StackContext
88
where
99
Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
10+
//~^ WARN where-clause bound is impossible to satisfy
1011
{
1112
type Dispatcher;
1213
}
@@ -26,6 +27,8 @@ where
2627
struct EthernetWorker<C>(C)
2728
where
2829
Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
30+
//~^ WARN where-clause bound is impossible to satisfy
31+
2932
impl<C> EthernetWorker<C> {}
3033
//~^ ERROR: is not satisfied [E0277]
3134

src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-89118.rs:9:5
3+
|
4+
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: the bound `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
110
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
2-
--> $DIR/issue-89118.rs:19:8
11+
--> $DIR/issue-89118.rs:20:8
312
|
413
LL | C: StackContext,
514
| ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
@@ -19,7 +28,7 @@ LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
1928
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
2029

2130
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
22-
--> $DIR/issue-89118.rs:22:20
31+
--> $DIR/issue-89118.rs:23:20
2332
|
2433
LL | type Handler = Ctx<C::Dispatcher>;
2534
| ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
@@ -38,8 +47,17 @@ LL | where
3847
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
3948
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
4049

50+
warning: where-clause bound is impossible to satisfy
51+
--> $DIR/issue-89118.rs:29:5
52+
|
53+
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
54+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55+
|
56+
= note: the bound `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` was previously accepted, but it may become a hard error in a future release
57+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
58+
4159
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
42-
--> $DIR/issue-89118.rs:29:9
60+
--> $DIR/issue-89118.rs:32:9
4361
|
4462
LL | impl<C> EthernetWorker<C> {}
4563
| ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
@@ -50,14 +68,14 @@ note: required because of the requirements on the impl of `for<'a> BufferUdpStat
5068
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
5169
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
5270
note: required by a bound in `EthernetWorker`
53-
--> $DIR/issue-89118.rs:28:14
71+
--> $DIR/issue-89118.rs:29:14
5472
|
5573
LL | struct EthernetWorker<C>(C)
5674
| -------------- required by a bound in this
5775
LL | where
5876
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
5977
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
6078

61-
error: aborting due to 3 previous errors
79+
error: aborting due to 3 previous errors; 2 warnings emitted
6280

6381
For more information about this error, try `rustc --explain E0277`.

src/test/ui/issues/issue-36839.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub trait Broken {
1212
impl<T> Broken for T {
1313
type Assoc = ();
1414
fn broken(&self) where Self::Assoc: Foo {
15+
//~^ WARN where-clause bound is impossible to satisfy
1516
let _x: <Self::Assoc as Foo>::Bar;
1617
}
1718
}

src/test/ui/issues/issue-36839.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-36839.rs:14:28
3+
|
4+
LL | fn broken(&self) where Self::Assoc: Foo {
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: the bound `<T as Broken>::Assoc: Foo` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
10+
warning: 1 warning emitted
11+

src/test/ui/issues/issue-39970.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ impl<'a> Array<'a> for () {
1313
impl Visit for () where
1414
//(): for<'a> Array<'a, Element=&'a ()>, // No ICE
1515
(): for<'a> Array<'a, Element=()>, // ICE
16+
//~^ WARN where-clause bound is impossible to satisfy
1617
{}
1718

1819
fn main() {

src/test/ui/issues/issue-39970.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-39970.rs:15:5
3+
|
4+
LL | (): for<'a> Array<'a, Element=()>, // ICE
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: the bound `for<'a> <() as Array<'a>>::Element == ()` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
110
error[E0271]: type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()`
2-
--> $DIR/issue-39970.rs:19:5
11+
--> $DIR/issue-39970.rs:20:5
312
|
413
LL | <() as Visit>::visit();
514
| ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()`
@@ -15,6 +24,6 @@ note: required because of the requirements on the impl of `Visit` for `()`
1524
LL | impl Visit for () where
1625
| ^^^^^ ^^
1726

18-
error: aborting due to previous error
27+
error: aborting due to previous error; 1 warning emitted
1928

2029
For more information about this error, try `rustc --explain E0271`.

src/test/ui/issues/issue-42796.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ impl<T, Smoke> Mirror<Smoke> for T {
77
}
88

99
pub fn poison<S>(victim: String) where <String as Mirror<S>>::Image: Copy {
10+
//~^ WARN where-clause bound is impossible to satisfy
1011
loop { drop(victim); }
1112
}
1213

src/test/ui/issues/issue-42796.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-42796.rs:9:40
3+
|
4+
LL | pub fn poison<S>(victim: String) where <String as Mirror<S>>::Image: Copy {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: the bound `<String as Mirror<S>>::Image: Copy` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
110
error[E0382]: borrow of moved value: `s`
2-
--> $DIR/issue-42796.rs:18:20
11+
--> $DIR/issue-42796.rs:19:20
312
|
413
LL | let s = "Hello!".to_owned();
514
| - move occurs because `s` has type `String`, which does not implement the `Copy` trait
@@ -11,6 +20,6 @@ LL | println!("{}", s);
1120
|
1221
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
1322

14-
error: aborting due to previous error
23+
error: aborting due to previous error; 1 warning emitted
1524

1625
For more information about this error, try `rustc --explain E0382`.

src/test/ui/mir/issue-91745.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub trait Broken {
1212
impl<T> Broken for T {
1313
type Assoc = ();
1414
fn broken(&self) where Self::Assoc: Foo {
15+
//~^ WARN where-clause bound is impossible to satisfy
1516
let _x: <Self::Assoc as Foo>::Bar;
1617
}
1718
}

src/test/ui/mir/issue-91745.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: where-clause bound is impossible to satisfy
2+
--> $DIR/issue-91745.rs:14:28
3+
|
4+
LL | fn broken(&self) where Self::Assoc: Foo {
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: the bound `<T as Broken>::Assoc: Foo` was previously accepted, but it may become a hard error in a future release
8+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to allow it
9+
10+
warning: 1 warning emitted
11+

src/test/ui/regions/regions-normalize-in-where-clause-list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ where
2323
// Here we get an error: we need `'a: 'b`.
2424
fn bar<'a, 'b>()
2525
//~^ ERROR cannot infer
26-
//~| ERROR cannot infer
2726
where
2827
<() as Project<'a, 'b>>::Item: Eq,
28+
//~^ ERROR cannot infer
2929
{
3030
}
3131

src/test/ui/regions/regions-normalize-in-where-clause-list.stderr

+6-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d
33
|
44
LL | / fn bar<'a, 'b>()
55
LL | |
6-
LL | |
76
LL | | where
87
LL | | <() as Project<'a, 'b>>::Item: Eq,
98
| |______________________________________^
@@ -23,18 +22,17 @@ note: ...so that the types are compatible
2322
|
2423
LL | / fn bar<'a, 'b>()
2524
LL | |
26-
LL | |
2725
LL | | where
2826
LL | | <() as Project<'a, 'b>>::Item: Eq,
2927
| |______________________________________^
3028
= note: expected `Project<'a, 'b>`
3129
found `Project<'_, '_>`
3230

3331
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
34-
--> $DIR/regions-normalize-in-where-clause-list.rs:24:4
32+
--> $DIR/regions-normalize-in-where-clause-list.rs:27:5
3533
|
36-
LL | fn bar<'a, 'b>()
37-
| ^^^
34+
LL | <() as Project<'a, 'b>>::Item: Eq,
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3836
|
3937
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
4038
--> $DIR/regions-normalize-in-where-clause-list.rs:24:8
@@ -47,10 +45,10 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined he
4745
LL | fn bar<'a, 'b>()
4846
| ^^
4947
note: ...so that the types are compatible
50-
--> $DIR/regions-normalize-in-where-clause-list.rs:24:4
48+
--> $DIR/regions-normalize-in-where-clause-list.rs:27:5
5149
|
52-
LL | fn bar<'a, 'b>()
53-
| ^^^
50+
LL | <() as Project<'a, 'b>>::Item: Eq,
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5452
= note: expected `Project<'a, 'b>`
5553
found `Project<'_, '_>`
5654

0 commit comments

Comments
 (0)