Skip to content

Commit fdf6c65

Browse files
committed
Moved all of the tests over to ui and annotated why they are failing with appropriate fixme comments
1 parent db4408a commit fdf6c65

12 files changed

+97
-35
lines changed

src/test/compile-fail/feature-gate-generic_associated_types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ use std::ops::Deref;
1212

1313
trait PointerFamily<U> {
1414
type Pointer<T>: Deref<Target = T>;
15+
//~^ ERROR generic associated types are unstable
1516
type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone;
17+
//~^ ERROR generic associated types are unstable
1618
}
1719

1820
struct Foo;
1921
impl PointerFamily<u32> for Foo {
2022
type Pointer<usize> = Box<usize>;
23+
//~^ ERROR generic associated types are unstable
2124
type Pointer2<u32> = Box<u32>;
25+
//~^ ERROR generic associated types are unstable
2226
}
2327

2428
fn main() {}

src/test/run-pass/rfc1598-generic-associated-types/whitespace-before-generics.rs

-35
This file was deleted.

src/test/run-pass/rfc1598-generic-associated-types/construct_with_other_type.rs renamed to src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#![feature(generic_associated_types)]
1212

13+
//FIXME(#44265): "undeclared lifetime" errors will be addressed in a follow-up PR
14+
1315
trait Foo {
1416
type Bar<'a, 'b>;
1517
}
@@ -20,6 +22,7 @@ trait Baz {
2022

2123
impl<T> Baz for T where T: Foo {
2224
type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
25+
//~^ ERROR undeclared lifetime
2326
}
2427

2528
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0261]: use of undeclared lifetime name `'a`
2+
--> $DIR/construct_with_other_type.rs:24:37
3+
|
4+
24 | type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
5+
| ^^ undeclared lifetime
6+
7+
error: aborting due to previous error
8+

src/test/run-pass/rfc1598-generic-associated-types/generic-associated-types-where.rs renamed to src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs

+5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
// Checking the interaction with this other feature
1414
#![feature(associated_type_defaults)]
1515

16+
//FIXME(#44265): "undeclared lifetime" errors will be addressed in a follow-up PR
17+
1618
use std::fmt::{Display, Debug};
1719

1820
trait Foo {
1921
type Assoc where Self: Sized;
2022
type Assoc2<T> where T: Display;
2123
type WithDefault<T> where T: Debug = Iterator<Item=T>;
24+
type NoGenerics;
2225
}
2326

2427
struct Bar;
@@ -27,6 +30,8 @@ impl Foo for Bar {
2730
type Assoc = usize;
2831
type Assoc2<T> = Vec<T>;
2932
type WithDefault<'a, T> = &'a Iterator<T>;
33+
//~^ ERROR undeclared lifetime
34+
type NoGenerics = ::std::cell::Cell<i32>;
3035
}
3136

3237
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0261]: use of undeclared lifetime name `'a`
2+
--> $DIR/generic-associated-types-where.rs:32:32
3+
|
4+
32 | type WithDefault<'a, T> = &'a Iterator<T>;
5+
| ^^ undeclared lifetime
6+
7+
error: aborting due to previous error
8+

src/test/run-pass/rfc1598-generic-associated-types/iterable.rs renamed to src/test/ui/rfc1598-generic-associated-types/iterable.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010

1111
#![feature(generic_associated_types)]
1212

13+
//FIXME(#44265): "undeclared lifetime" errors will be addressed in a follow-up PR
14+
1315
trait Iterable {
1416
type Item<'a>;
1517
type Iter<'a>: Iterator<Item = Self::Item<'a>>;
18+
//~^ ERROR undeclared lifetime
1619

1720
fn iter<'a>(&'a self) -> Self::Iter<'a>;
1821
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0261]: use of undeclared lifetime name `'a`
2+
--> $DIR/iterable.rs:17:47
3+
|
4+
17 | type Iter<'a>: Iterator<Item = Self::Item<'a>>;
5+
| ^^ undeclared lifetime
6+
7+
error: aborting due to previous error
8+

src/test/run-pass/rfc1598-generic-associated-types/pointer_family.rs renamed to src/test/ui/rfc1598-generic-associated-types/pointer_family.rs

+6
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@
1010

1111
#![feature(generic_associated_types)]
1212

13+
//FIXME(#44265): "type parameter not allowed" errors will be addressed in a follow-up PR
14+
1315
use std::rc::Rc;
1416
use std::sync::Arc;
1517
use std::ops::Deref;
1618

1719
trait PointerFamily {
1820
type Pointer<T>: Deref<Target = T>;
1921
fn new<T>(value: T) -> Self::Pointer<T>;
22+
//~^ ERROR type parameters are not allowed on this type [E0109]
2023
}
2124

2225
struct ArcFamily;
2326

2427
impl PointerFamily for ArcFamily {
2528
type Pointer<T> = Arc<T>;
2629
fn new<T>(value: T) -> Self::Pointer<T> {
30+
//~^ ERROR type parameters are not allowed on this type [E0109]
2731
Arc::new(value)
2832
}
2933
}
@@ -33,12 +37,14 @@ struct RcFamily;
3337
impl PointerFamily for RcFamily {
3438
type Pointer<T> = Rc<T>;
3539
fn new<T>(value: T) -> Self::Pointer<T> {
40+
//~^ ERROR type parameters are not allowed on this type [E0109]
3641
Rc::new(value)
3742
}
3843
}
3944

4045
struct Foo<P: PointerFamily> {
4146
bar: P::Pointer<String>,
47+
//~^ ERROR type parameters are not allowed on this type [E0109]
4248
}
4349

4450
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error[E0109]: type parameters are not allowed on this type
2+
--> $DIR/pointer_family.rs:46:21
3+
|
4+
46 | bar: P::Pointer<String>,
5+
| ^^^^^^ type parameter not allowed
6+
7+
error[E0109]: type parameters are not allowed on this type
8+
--> $DIR/pointer_family.rs:21:42
9+
|
10+
21 | fn new<T>(value: T) -> Self::Pointer<T>;
11+
| ^ type parameter not allowed
12+
13+
error[E0109]: type parameters are not allowed on this type
14+
--> $DIR/pointer_family.rs:29:42
15+
|
16+
29 | fn new<T>(value: T) -> Self::Pointer<T> {
17+
| ^ type parameter not allowed
18+
19+
error[E0109]: type parameters are not allowed on this type
20+
--> $DIR/pointer_family.rs:39:42
21+
|
22+
39 | fn new<T>(value: T) -> Self::Pointer<T> {
23+
| ^ type parameter not allowed
24+
25+
error: aborting due to 4 previous errors
26+

src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs renamed to src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs

+6
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@
1010

1111
#![feature(generic_associated_types)]
1212

13+
//FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a
14+
// follow-up PR
15+
1316
use std::fmt::Display;
1417

1518
trait StreamingIterator {
1619
type Item<'a>;
1720
// Applying the lifetime parameter `'a` to `Self::Item` inside the trait.
1821
fn next<'a>(&'a self) -> Option<Self::Item<'a>>;
22+
//~^ ERROR lifetime parameters are not allowed on this type [E0110]
1923
}
2024

2125
struct Foo<T: StreamingIterator> {
2226
// Applying a concrete lifetime to the constructor outside the trait.
2327
bar: <T as StreamingIterator>::Item<'static>,
28+
//~^ ERROR lifetime parameters are not allowed on this type [E0110]
2429
}
2530

2631
// Users can bound parameters by the type constructed by that trait's associated type constructor
2732
// of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid:
2833
//FIXME(sunjay): This next line should parse and be valid
2934
//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ }
3035
fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
36+
//~^ ERROR lifetime parameters are not allowed on this type [E0110]
3137

3238
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0110]: lifetime parameters are not allowed on this type
2+
--> $DIR/streaming_iterator.rs:27:41
3+
|
4+
27 | bar: <T as StreamingIterator>::Item<'static>,
5+
| ^^^^^^^ lifetime parameter not allowed on this type
6+
7+
error[E0110]: lifetime parameters are not allowed on this type
8+
--> $DIR/streaming_iterator.rs:35:64
9+
|
10+
35 | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
11+
| ^^ lifetime parameter not allowed on this type
12+
13+
error[E0110]: lifetime parameters are not allowed on this type
14+
--> $DIR/streaming_iterator.rs:21:48
15+
|
16+
21 | fn next<'a>(&'a self) -> Option<Self::Item<'a>>;
17+
| ^^ lifetime parameter not allowed on this type
18+
19+
error: aborting due to 3 previous errors
20+

0 commit comments

Comments
 (0)