Skip to content

Commit c49895d

Browse files
committed
Auto merge of rust-lang#84623 - jackh726:gats-incomplete, r=nikomatsakis
Make GATs no longer an incomplete feature Blocked on ~rust-lang#84622~, ~rust-lang#82272~, ~rust-lang#76826~ r? `@nikomatsakis`
2 parents 2119976 + f1ab6f9 commit c49895d

File tree

138 files changed

+197
-587
lines changed

Some content is hidden

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

138 files changed

+197
-587
lines changed

compiler/rustc_feature/src/active.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ declare_features! (
405405
(active, in_band_lifetimes, "1.23.0", Some(44524), None),
406406

407407
/// Allows associated types to be generic, e.g., `type Foo<T>;` (RFC 1598).
408-
(incomplete, generic_associated_types, "1.23.0", Some(44265), None),
408+
(active, generic_associated_types, "1.23.0", Some(44265), None),
409409

410410
/// Allows defining `trait X = A + B;` alias items.
411411
(active, trait_alias, "1.24.0", Some(41517), None),

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ declare_lint! {
23152315
/// ### Example
23162316
///
23172317
/// ```rust
2318-
/// #![feature(generic_associated_types)]
2318+
/// #![feature(const_generics)]
23192319
/// ```
23202320
///
23212321
/// {{produces}}

src/test/ui/generic-associated-types/collections-project-default.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(incomplete_features)]
21
#![feature(generic_associated_types)]
32
#![feature(associated_type_defaults)]
43

src/test/ui/generic-associated-types/collections-project-default.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/collections-project-default.rs:60:5
2+
--> $DIR/collections-project-default.rs:59:5
33
|
44
LL | fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32>
55
| ------------------------------------ expected `<C as Collection<i32>>::Sibling<f32>` because of return type

src/test/ui/generic-associated-types/collections.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(incomplete_features)]
21
#![feature(generic_associated_types)]
32
#![feature(associated_type_defaults)]
43

src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![feature(generic_associated_types)]
3-
#![allow(incomplete_features)]
43

54
// This test unsures that with_opt_const_param returns the
65
// def_id of the N param in the Foo::Assoc GAT.

src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![feature(generic_associated_types)]
3-
#![allow(incomplete_features)]
43

54
// This test unsures that with_opt_const_param returns the
65
// def_id of the N param in the Foo::Assoc GAT.

src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-3.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![feature(generic_associated_types)]
3-
#![allow(incomplete_features)]
43

54
// This test unsures that with_opt_const_param returns the
65
// def_id of the N param in the Bar::Assoc GAT.

src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Test that correct syntax is used in suggestion to constrain associated type
22

33
#![feature(generic_associated_types)]
4-
//~^ WARNING the feature `generic_associated_types` is incomplete
54

65
trait X {
76
type Y<T>;
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/constraint-assoc-type-suggestion.rs:3:12
3-
|
4-
LL | #![feature(generic_associated_types)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: `#[warn(incomplete_features)]` on by default
8-
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
9-
101
error[E0308]: mismatched types
11-
--> $DIR/constraint-assoc-type-suggestion.rs:13:23
2+
--> $DIR/constraint-assoc-type-suggestion.rs:12:23
123
|
134
LL | let b: Vec<i32> = a;
145
| -------- ^ expected struct `Vec`, found associated type
@@ -22,6 +13,6 @@ help: consider constraining the associated type `<T as X>::Y<i32>` to `Vec<i32>`
2213
LL | fn f<T: X<Y<i32> = Vec<i32>>>(a: T::Y<i32>) {
2314
| ^^^^^^^^^^^^^^^^^^^
2415

25-
error: aborting due to previous error; 1 warning emitted
16+
error: aborting due to previous error
2617

2718
For more information about this error, try `rustc --explain E0308`.

src/test/ui/generic-associated-types/construct_with_other_type.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(incomplete_features)]
21
#![feature(generic_associated_types)]
32

43
// check-pass

src/test/ui/generic-associated-types/empty_generics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(incomplete_features)]
21
#![feature(generic_associated_types)]
32

43
trait Foo {

src/test/ui/generic-associated-types/empty_generics.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
2-
--> $DIR/empty_generics.rs:5:14
2+
--> $DIR/empty_generics.rs:4:14
33
|
44
LL | trait Foo {
55
| - while parsing this item list starting here

src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(generic_associated_types)]
2-
//~^ WARNING: the feature `generic_associated_types` is incomplete
32

43
trait X {
54
type Y<'x>;
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:1:12
3-
|
4-
LL | #![feature(generic_associated_types)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: `#[warn(incomplete_features)]` on by default
8-
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
9-
101
error[E0261]: use of undeclared lifetime name `'x`
11-
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:9:35
2+
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:35
123
|
134
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
145
| - ^^ undeclared lifetime
@@ -18,12 +9,12 @@ LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
189
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
1910

2011
error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types
21-
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:9:33
12+
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:33
2213
|
2314
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
2415
| ^^^^^^^^^^^^^^^^^
2516

26-
error: aborting due to 2 previous errors; 1 warning emitted
17+
error: aborting due to 2 previous errors
2718

2819
Some errors have detailed explanations: E0261, E0582.
2920
For more information about an error, try `rustc --explain E0261`.

src/test/ui/generic-associated-types/gat-in-trait-path.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(generic_associated_types)]
2-
//~^ WARNING: the feature `generic_associated_types` is incomplete
32
#![feature(associated_type_defaults)]
43

54
trait Foo {
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
1-
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/gat-in-trait-path.rs:1:12
3-
|
4-
LL | #![feature(generic_associated_types)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: `#[warn(incomplete_features)]` on by default
8-
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
9-
101
error[E0038]: the trait `Foo` cannot be made into an object
11-
--> $DIR/gat-in-trait-path.rs:22:13
2+
--> $DIR/gat-in-trait-path.rs:21:13
123
|
134
LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {}
145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
156
|
167
= help: consider moving `A` to another trait
178
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
18-
--> $DIR/gat-in-trait-path.rs:6:10
9+
--> $DIR/gat-in-trait-path.rs:5:10
1910
|
2011
LL | trait Foo {
2112
| --- this trait cannot be made into an object...
2213
LL | type A<'a> where Self: 'a;
2314
| ^ ...because it contains the generic associated type `A`
2415

25-
error: aborting due to previous error; 1 warning emitted
16+
error: aborting due to previous error
2617

2718
For more information about this error, try `rustc --explain E0038`.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

33
#![feature(generic_associated_types)]
4-
//~^ WARNING the feature `generic_associated_types` is incomplete
54

65
fn main() {}

src/test/ui/generic-associated-types/gat-incomplete-warning.stderr

-11
This file was deleted.

src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(generic_associated_types)]
2-
//~^ WARNING: the feature `generic_associated_types` is incomplete
32

43
trait Foo {
54
type F<'a>;
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
error[E0403]: the name `T1` is already used for a generic parameter in this item's generic parameters
2-
--> $DIR/gat-trait-path-generic-type-arg.rs:11:12
2+
--> $DIR/gat-trait-path-generic-type-arg.rs:10:12
33
|
44
LL | impl <T, T1> Foo for T {
55
| -- first use of `T1`
66
LL | type F<T1> = &[u8];
77
| ^^ already used
88

9-
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
10-
--> $DIR/gat-trait-path-generic-type-arg.rs:1:12
11-
|
12-
LL | #![feature(generic_associated_types)]
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^
14-
|
15-
= note: `#[warn(incomplete_features)]` on by default
16-
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
17-
189
error[E0106]: missing lifetime specifier
19-
--> $DIR/gat-trait-path-generic-type-arg.rs:11:18
10+
--> $DIR/gat-trait-path-generic-type-arg.rs:10:18
2011
|
2112
LL | type F<T1> = &[u8];
2213
| ^ expected named lifetime parameter
@@ -26,7 +17,7 @@ help: consider introducing a named lifetime parameter
2617
LL | type F<'a, T1> = &'a [u8];
2718
| ^^^ ^^^
2819

29-
error: aborting due to 2 previous errors; 1 warning emitted
20+
error: aborting due to 2 previous errors
3021

3122
Some errors have detailed explanations: E0106, E0403.
3223
For more information about an error, try `rustc --explain E0106`.

src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(generic_associated_types)]
2-
//~^ WARNING: the feature `generic_associated_types` is incomplete
32

43
trait X {
54
type Y<'a>;
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/gat-trait-path-missing-lifetime.rs:1:12
3-
|
4-
LL | #![feature(generic_associated_types)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: `#[warn(incomplete_features)]` on by default
8-
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
9-
101
error[E0107]: missing generics for associated type `X::Y`
11-
--> $DIR/gat-trait-path-missing-lifetime.rs:11:20
2+
--> $DIR/gat-trait-path-missing-lifetime.rs:10:20
123
|
134
LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
145
| ^ expected 1 lifetime argument
156
|
167
note: associated type defined here, with 1 lifetime parameter: `'a`
17-
--> $DIR/gat-trait-path-missing-lifetime.rs:5:8
8+
--> $DIR/gat-trait-path-missing-lifetime.rs:4:8
189
|
1910
LL | type Y<'a>;
2011
| ^ --
@@ -24,13 +15,13 @@ LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
2415
| ^^^^^
2516

2617
error[E0107]: missing generics for associated type `X::Y`
27-
--> $DIR/gat-trait-path-missing-lifetime.rs:11:20
18+
--> $DIR/gat-trait-path-missing-lifetime.rs:10:20
2819
|
2920
LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
3021
| ^ expected 1 lifetime argument
3122
|
3223
note: associated type defined here, with 1 lifetime parameter: `'a`
33-
--> $DIR/gat-trait-path-missing-lifetime.rs:5:8
24+
--> $DIR/gat-trait-path-missing-lifetime.rs:4:8
3425
|
3526
LL | type Y<'a>;
3627
| ^ --
@@ -39,6 +30,6 @@ help: add missing lifetime argument
3930
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
4031
| ^^^^^
4132

42-
error: aborting due to 2 previous errors; 1 warning emitted
33+
error: aborting due to 2 previous errors
4334

4435
For more information about this error, try `rustc --explain E0107`.

src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(generic_associated_types)]
2-
//~^ WARNING: the feature `generic_associated_types` is incomplete
32

43
trait X {
54
type Y<'a>;
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
error: lifetime in trait object type must be followed by `+`
2-
--> $DIR/gat-trait-path-parenthesised-args.rs:8:29
2+
--> $DIR/gat-trait-path-parenthesised-args.rs:7:29
33
|
44
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
55
| ^^
66

77
error: parenthesized generic arguments cannot be used in associated type constraints
8-
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
8+
--> $DIR/gat-trait-path-parenthesised-args.rs:7:27
99
|
1010
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
1111
| ^^^^^
1212

13-
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
14-
--> $DIR/gat-trait-path-parenthesised-args.rs:1:12
15-
|
16-
LL | #![feature(generic_associated_types)]
17-
| ^^^^^^^^^^^^^^^^^^^^^^^^
18-
|
19-
= note: `#[warn(incomplete_features)]` on by default
20-
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
21-
2213
warning: trait objects without an explicit `dyn` are deprecated
23-
--> $DIR/gat-trait-path-parenthesised-args.rs:8:29
14+
--> $DIR/gat-trait-path-parenthesised-args.rs:7:29
2415
|
2516
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
2617
| ^^ help: use `dyn`: `dyn 'a`
@@ -30,13 +21,13 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
3021
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
3122

3223
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
33-
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
24+
--> $DIR/gat-trait-path-parenthesised-args.rs:7:27
3425
|
3526
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
3627
| ^ expected 1 lifetime argument
3728
|
3829
note: associated type defined here, with 1 lifetime parameter: `'a`
39-
--> $DIR/gat-trait-path-parenthesised-args.rs:5:8
30+
--> $DIR/gat-trait-path-parenthesised-args.rs:4:8
4031
|
4132
LL | type Y<'a>;
4233
| ^ --
@@ -46,19 +37,19 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a, 'a) = &'a ()>>) {}
4637
| ^^^
4738

4839
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
49-
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
40+
--> $DIR/gat-trait-path-parenthesised-args.rs:7:27
5041
|
5142
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
5243
| ^---- help: remove these generics
5344
| |
5445
| expected 0 generic arguments
5546
|
5647
note: associated type defined here, with 0 generic parameters
57-
--> $DIR/gat-trait-path-parenthesised-args.rs:5:8
48+
--> $DIR/gat-trait-path-parenthesised-args.rs:4:8
5849
|
5950
LL | type Y<'a>;
6051
| ^
6152

62-
error: aborting due to 4 previous errors; 2 warnings emitted
53+
error: aborting due to 4 previous errors; 1 warning emitted
6354

6455
For more information about this error, try `rustc --explain E0107`.

src/test/ui/generic-associated-types/generic-associated-type-bounds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![allow(incomplete_features)]
43
#![feature(generic_associated_types)]
54

65
pub trait X {

src/test/ui/generic-associated-types/generic-associated-types-where.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(incomplete_features)]
21
#![feature(generic_associated_types)]
32

43
// Checking the interaction with this other feature

src/test/ui/generic-associated-types/generic-associated-types-where.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: `T` doesn't implement `std::fmt::Display`
2-
--> $DIR/generic-associated-types-where.rs:21:5
2+
--> $DIR/generic-associated-types-where.rs:20:5
33
|
44
LL | type Assoc2<T> = Vec<T>;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
@@ -11,7 +11,7 @@ LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
1111
| ^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0276]: impl has stricter requirements than trait
14-
--> $DIR/generic-associated-types-where.rs:23:5
14+
--> $DIR/generic-associated-types-where.rs:22:5
1515
|
1616
LL | type Assoc3<T>;
1717
| --------------- definition of `Assoc3` from trait

src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(incomplete_features)]
21
#![feature(generic_associated_types)]
32

43
use std::ops::Deref;

0 commit comments

Comments
 (0)