Skip to content

Commit 464b4dc

Browse files
committed
Unify tests
Implement compile tests as variants of existing tests
1 parent 2888d56 commit 464b4dc

File tree

164 files changed

+400
-2723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+400
-2723
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// aux-build:coherence_lib.rs
2+
// revisions: old re
3+
4+
#![cfg_attr(re, feature(re_rebalance_coherence))]
25

36
extern crate coherence_lib as lib;
47
use lib::Remote1;
58

69
impl<T> Remote1<T> for isize { }
7-
//~^ ERROR E0210
10+
//[old]~^ ERROR E0210
11+
//[re]~^^ ERROR E0210
812

913
fn main() { }
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// aux-build:coherence_lib.rs
2+
// revisions: old re
3+
4+
#![cfg_attr(re, feature(re_rebalance_coherence))]
25

36
extern crate coherence_lib as lib;
47
use lib::Remote1;
58

69
pub struct BigInt;
710

811
impl<T> Remote1<BigInt> for T { }
9-
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
12+
//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type
13+
//[re]~^^ ERROR E0210
1014

1115
fn main() { }

src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: old re
2+
3+
#![cfg_attr(re, feature(re_rebalance_coherence))]
4+
15
use std::fmt::Debug;
26
use std::default::Default;
37

@@ -21,7 +25,10 @@ impl<T:Even> MyTrait for T {
2125
fn get(&self) -> usize { 0 }
2226
}
2327

24-
impl<T:Odd> MyTrait for T { //~ ERROR E0119
28+
impl<T:Odd> MyTrait for T {
29+
//[old]~^ ERROR E0119
30+
//[re]~^^ ERROR E0119
31+
2532
fn get(&self) -> usize { 0 }
2633
}
2734

src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: old re
2+
3+
#![cfg_attr(re, feature(re_rebalance_coherence))]
4+
15
use std::fmt::Debug;
26
use std::default::Default;
37

@@ -17,7 +21,9 @@ impl<T:Even> MyTrait for T {
1721
fn get(&self) -> usize { 0 }
1822
}
1923

20-
impl<T:Odd> MyTrait for T { //~ ERROR E0119
24+
impl<T:Odd> MyTrait for T {
25+
//[old]~^ ERROR E0119
26+
//[re]~^^ ERROR E0119
2127
fn get(&self) -> usize { 0 }
2228
}
2329

src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// aux-build:go_trait.rs
2+
// revisions: old re
3+
4+
#![cfg_attr(re, feature(re_rebalance_coherence))]
25

36
extern crate go_trait;
47

@@ -12,7 +15,9 @@ impl Go for MyThingy {
1215
fn go(&self, arg: isize) { }
1316
}
1417

15-
impl GoMut for MyThingy { //~ ERROR conflicting implementations
18+
impl GoMut for MyThingy {
19+
//[old]~^ ERROR conflicting implementations
20+
//[re]~^^ ERROR E0119
1621
fn go_mut(&mut self, arg: isize) { }
1722
}
1823

src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: old re
2+
3+
#![cfg_attr(re, feature(re_rebalance_coherence))]
4+
15
use std::fmt::Debug;
26
use std::default::Default;
37

@@ -19,7 +23,9 @@ struct MyType {
1923
dummy: usize
2024
}
2125

22-
impl MyTrait<MyType> for MyType { //~ ERROR E0119
26+
impl MyTrait<MyType> for MyType {
27+
//[old]~^ ERROR E0119
28+
//[re]~^^ ERROR E0119
2329
fn get(&self) -> usize { (*self).clone() }
2430
}
2531

src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Test that a blank impl for all T:PartialEq conflicts with an impl for some
22
// specific T when T:PartialEq.
33

4+
// revisions: old re
5+
6+
#![cfg_attr(re, feature(re_rebalance_coherence))]
7+
48
trait OtherTrait {
59
fn noop(&self);
610
}
@@ -17,7 +21,9 @@ struct MyType {
1721
dummy: usize
1822
}
1923

20-
impl MyTrait for MyType { //~ ERROR E0119
24+
impl MyTrait for MyType {
25+
//[old]~^ ERROR E0119
26+
//[re]~^^ ERROR E0119
2127
fn get(&self) -> usize { self.dummy }
2228
}
2329

src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: old re
2+
3+
#![cfg_attr(re, feature(re_rebalance_coherence))]
4+
15
use std::fmt::Debug;
26
use std::default::Default;
37

@@ -16,7 +20,9 @@ struct MyType {
1620
dummy: usize
1721
}
1822

19-
impl MyTrait for MyType { //~ ERROR E0119
23+
impl MyTrait for MyType {
24+
//[old]~^ ERROR E0119
25+
//[re]~^^ ERROR E0119
2026
fn get(&self) -> usize { self.dummy }
2127
}
2228

src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// revisions: old re
2+
3+
#![cfg_attr(re, feature(re_rebalance_coherence))]
14
#![feature(optin_builtin_traits)]
25
#![feature(overlapping_marker_traits)]
36

@@ -8,11 +11,13 @@ struct TestType<T>(::std::marker::PhantomData<T>);
811
unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
912

1013
impl<T: MyTrait> !Send for TestType<T> {}
11-
//~^ ERROR conflicting implementations of trait `std::marker::Send`
14+
//[old]~^ ERROR conflicting implementations of trait `std::marker::Send`
15+
//[re]~^^ ERROR E0119
1216

1317
unsafe impl<T:'static> Send for TestType<T> {}
1418

1519
impl !Send for TestType<i32> {}
16-
//~^ ERROR conflicting implementations of trait `std::marker::Send`
20+
//[old]~^ ERROR conflicting implementations of trait `std::marker::Send`
21+
//[re]~^^ ERROR E0119
1722

1823
fn main() {}

src/test/ui/coherence/coherence-cow.a.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
2-
--> $DIR/coherence-cow.rs:16:1
2+
--> $DIR/coherence-cow.rs:28:1
33
|
4-
LL | impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0210
4+
LL | impl<T> Remote for Pair<T,Cover<T>> { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
66
|
77
= note: only traits defined in the current crate can be implemented for a type parameter

src/test/ui/coherence/coherence-cow.b.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
2-
--> $DIR/coherence-cow.rs:19:1
2+
--> $DIR/coherence-cow.rs:33:1
33
|
4-
LL | impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0210
4+
LL | impl<T> Remote for Pair<Cover<T>,T> { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
66
|
77
= note: only traits defined in the current crate can be implemented for a type parameter

src/test/ui/coherence/coherence-cow.c.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
2-
--> $DIR/coherence-cow.rs:22:1
2+
--> $DIR/coherence-cow.rs:38:1
33
|
44
LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// revisions: a b c
1+
// revisions: a b c re_a re_b re_c
2+
3+
#![cfg_attr(any(re_a, re_b, re_c), feature(re_rebalance_coherence))]
24

35
// aux-build:coherence_lib.rs
46

@@ -12,14 +14,19 @@ use lib::{Remote,Pair};
1214

1315
pub struct Cover<T>(T);
1416

15-
#[cfg(a)]
16-
impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0210
17+
#[cfg(any(a, re_a))]
18+
impl<T> Remote for Pair<T,Cover<T>> { }
19+
//[a]~^ ERROR E0210
20+
//[re_a]~^^ ERROR E0117
1721

18-
#[cfg(b)]
19-
impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0210
22+
#[cfg(any(b, re_b))]
23+
impl<T> Remote for Pair<Cover<T>,T> { }
24+
//[b]~^ ERROR E0210
25+
//[re_b]~^^ ERROR E0117
2026

21-
#[cfg(c)]
27+
#[cfg(any(c, re_c))]
2228
impl<T,U> Remote for Pair<Cover<T>,U> { }
2329
//[c]~^ ERROR type parameter `T` must be used as the type parameter for some local type
30+
//[re_c]~^^ ERROR E0117
2431

2532
fn main() { }

src/test/ui/coherence/coherence-cross-crate-conflict.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
// generalizes the one upstream
33

44
// aux-build:trait_impl_conflict.rs
5+
// revisions: old re
6+
7+
#![cfg_attr(re, feature(re_rebalance_coherence))]
8+
59
extern crate trait_impl_conflict;
610
use trait_impl_conflict::Foo;
711

812
impl<A> Foo for A {
9-
//~^ ERROR type parameter `A` must be used as the type parameter for some local type
10-
//~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`
13+
//[old]~^ ERROR type parameter `A` must be used as the type parameter for some local type
14+
//[old]~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`
15+
//[re]~^^^ ERROR E0119
16+
//[re]~| ERROR E0210
1117
}
1218

1319
fn main() {
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
// revisions: old re
2+
3+
#![cfg_attr(re, feature(re_rebalance_coherence))]
14
#![feature(optin_builtin_traits)]
25

36
auto trait MySafeTrait {}
47

58
struct Foo;
69

710
unsafe impl MySafeTrait for Foo {}
8-
//~^ ERROR implementing the trait `MySafeTrait` is not unsafe
11+
//[old]~^ ERROR implementing the trait `MySafeTrait` is not unsafe
12+
//[re]~^^ ERROR E0199
913

1014
unsafe auto trait MyUnsafeTrait {}
1115

1216
impl MyUnsafeTrait for Foo {}
13-
//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
17+
//[old]~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
18+
//[re]~^^ ERROR E0200
1419

1520
fn main() {}

src/test/ui/coherence/coherence-error-suppression.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
// check that error types in coherence do not cause error cascades.
22

3+
// revisions: old re
4+
5+
#![cfg_attr(re, feature(re_rebalance_coherence))]
6+
37
trait Foo {}
48

59
impl Foo for i8 {}
610
impl Foo for i16 {}
711
impl Foo for i32 {}
812
impl Foo for i64 {}
9-
impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope
13+
impl Foo for DoesNotExist {}
14+
//[old]~^ ERROR cannot find type `DoesNotExist` in this scope
15+
//[re]~^^ ERROR E0412
1016
impl Foo for u8 {}
1117
impl Foo for u16 {}
1218
impl Foo for u32 {}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// Test that we give suitable error messages when the user attempts to
22
// impl a trait `Trait` for its own object type.
33

4+
// revisions: old re
5+
6+
#![cfg_attr(re, feature(re_rebalance_coherence))]
7+
48
// If the trait is not object-safe, we give a more tailored message
59
// because we're such schnuckels:
610
trait NotObjectSafe { fn eq(&self, other: Self); }
7-
impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038
11+
impl NotObjectSafe for NotObjectSafe { }
12+
//[old]~^ ERROR E0038
13+
//[re]~^^ ERROR E0038
814

915
fn main() { }

src/test/ui/coherence/coherence-impl-trait-for-trait.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
// Test that we give suitable error messages when the user attempts to
22
// impl a trait `Trait` for its own object type.
33

4+
// revisions: old re
5+
6+
#![cfg_attr(re, feature(re_rebalance_coherence))]
7+
48
trait Foo { fn dummy(&self) { } }
59
trait Bar: Foo { }
610
trait Baz: Bar { }
711

812
// Supertraits of Baz are not legal:
9-
impl Foo for Baz { } //~ ERROR E0371
10-
impl Bar for Baz { } //~ ERROR E0371
11-
impl Baz for Baz { } //~ ERROR E0371
13+
impl Foo for Baz { }
14+
//[old]~^ ERROR E0371
15+
//[re]~^^ ERROR E0371
16+
impl Bar for Baz { }
17+
//[old]~^ ERROR E0371
18+
//[re]~^^ ERROR E0371
19+
impl Baz for Baz { }
20+
//[old]~^ ERROR E0371
21+
//[re]~^^ ERROR E0371
1222

1323
// But other random traits are:
1424
trait Other { }

0 commit comments

Comments
 (0)