Skip to content

Commit 3cf0e98

Browse files
committed
Stabilize GATs
1 parent 02654a0 commit 3cf0e98

File tree

280 files changed

+313
-808
lines changed

Some content is hidden

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

280 files changed

+313
-808
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -342,25 +342,6 @@ impl<'a> PostExpansionVisitor<'a> {
342342
}
343343
}
344344

345-
fn check_gat(&self, generics: &ast::Generics, span: Span) {
346-
if !generics.params.is_empty() {
347-
gate_feature_post!(
348-
&self,
349-
generic_associated_types,
350-
span,
351-
"generic associated types are unstable"
352-
);
353-
}
354-
if !generics.where_clause.predicates.is_empty() {
355-
gate_feature_post!(
356-
&self,
357-
generic_associated_types,
358-
span,
359-
"where clauses on associated types are unstable"
360-
);
361-
}
362-
}
363-
364345
/// Feature gate `impl Trait` inside `type Alias = $type_expr;`.
365346
fn check_impl_trait(&self, ty: &ast::Ty) {
366347
struct ImplTraitVisitor<'a> {
@@ -719,7 +700,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
719700
fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) {
720701
let is_fn = match i.kind {
721702
ast::AssocItemKind::Fn(_) => true,
722-
ast::AssocItemKind::TyAlias(box ast::TyAlias { ref generics, ref ty, .. }) => {
703+
ast::AssocItemKind::TyAlias(box ast::TyAlias { ref ty, .. }) => {
723704
if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
724705
gate_feature_post!(
725706
&self,
@@ -731,7 +712,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
731712
if let Some(ty) = ty {
732713
self.check_impl_trait(ty);
733714
}
734-
self.check_gat(generics, i.span);
735715
false
736716
}
737717
_ => false,

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ declare_features! (
161161
(accepted, fn_must_use, "1.27.0", Some(43302), None),
162162
/// Allows capturing variables in scope using format_args!
163163
(accepted, format_args_capture, "1.58.0", Some(67984), None),
164+
/// Allows associated types to be generic, e.g., `type Foo<T>;` (RFC 1598).
165+
(accepted, generic_associated_types, "CURRENT_RUSTC_VERSION", Some(44265), None),
164166
/// Allows attributes on lifetime/type formal parameters in generics (RFC 1327).
165167
(accepted, generic_param_attrs, "1.27.0", Some(48848), None),
166168
/// Allows the `#[global_allocator]` attribute.

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,6 @@ declare_features! (
398398
(active, generators, "1.21.0", Some(43122), None),
399399
/// Infer generic args for both consts and types.
400400
(active, generic_arg_infer, "1.55.0", Some(85077), None),
401-
/// Allows associated types to be generic, e.g., `type Foo<T>;` (RFC 1598).
402-
(active, generic_associated_types, "1.23.0", Some(44265), None),
403401
/// An extension to the `generic_associated_types` feature, allowing incomplete features.
404402
(incomplete, generic_associated_types_extended, "1.61.0", Some(95451), None),
405403
/// Allows non-trivial generic constants which have to have wfness manually propagated to callers

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3989,8 +3989,6 @@ declare_lint! {
39893989
/// ### Example
39903990
///
39913991
/// ```rust
3992-
/// #![feature(generic_associated_types)]
3993-
///
39943992
/// trait Trait {
39953993
/// type Assoc<'a> where Self: 'a;
39963994
/// }

compiler/rustc_metadata/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![feature(decl_macro)]
33
#![feature(drain_filter)]
44
#![feature(generators)]
5-
#![feature(generic_associated_types)]
5+
#![cfg_attr(bootstrap, feature(generic_associated_types))]
66
#![feature(iter_from_generator)]
77
#![feature(let_chains)]
88
#![feature(let_else)]

compiler/rustc_middle/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#![feature(discriminant_kind)]
3232
#![feature(exhaustive_patterns)]
3333
#![feature(get_mut_unchecked)]
34-
#![feature(generic_associated_types)]
34+
#![cfg_attr(bootstrap, feature(generic_associated_types))]
3535
#![feature(if_let_guard)]
3636
#![feature(map_first_last)]
3737
#![feature(negative_impls)]

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,8 +2064,6 @@ fn confirm_impl_candidate<'cx, 'tcx>(
20642064

20652065
// Get obligations corresponding to the predicates from the where-clause of the
20662066
// associated type itself.
2067-
// Note: `feature(generic_associated_types)` is required to write such
2068-
// predicates, even for non-generic associated types.
20692067
fn assoc_ty_own_obligations<'cx, 'tcx>(
20702068
selcx: &mut SelectionContext<'cx, 'tcx>,
20712069
obligation: &ProjectionTyObligation<'tcx>,

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#![feature(type_ascription)]
1717
#![feature(iter_intersperse)]
1818
#![feature(type_alias_impl_trait)]
19-
#![feature(generic_associated_types)]
19+
#![cfg_attr(bootstrap, feature(generic_associated_types))]
2020
#![recursion_limit = "256"]
2121
#![warn(rustc::internal)]
2222
#![allow(clippy::collapsible_if, clippy::collapsible_else_if)]

src/test/pretty/gat-bounds.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
// pretty-compare-only
55

6-
#![feature(generic_associated_types)]
7-
86
trait X {
97
type Y<T>: Trait where Self: Sized;
108
}

src/test/rustdoc-json/generic-associated-types/gats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ignore-tidy-linelength
22

33
#![no_core]
4-
#![feature(generic_associated_types, lang_items, no_core)]
4+
#![feature(lang_items, no_core)]
55

66
#[lang = "sized"]
77
pub trait Sized {}

0 commit comments

Comments
 (0)