Skip to content

Commit 56d7bb2

Browse files
committed
Revert "pre-expansion gate associated_type_bounds"
This reverts commit c17a1fd.
1 parent b05d362 commit 56d7bb2

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/libsyntax/feature_gate/check.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ use super::accepted::ACCEPTED_FEATURES;
33
use super::removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
44
use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
55

6-
use crate::ast::{self, NodeId, GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
6+
use crate::ast::{
7+
self, AssocTyConstraint, AssocTyConstraintKind, NodeId, GenericParam, GenericParamKind,
8+
PatKind, RangeEnd, VariantData,
9+
};
710
use crate::attr::{self, check_builtin_attribute};
811
use crate::source_map::Spanned;
912
use crate::edition::{ALL_EDITIONS, Edition};
@@ -604,6 +607,16 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
604607
visit::walk_generic_param(self, param)
605608
}
606609

610+
fn visit_assoc_ty_constraint(&mut self, constraint: &'a AssocTyConstraint) {
611+
match constraint.kind {
612+
AssocTyConstraintKind::Bound { .. } =>
613+
gate_feature_post!(&self, associated_type_bounds, constraint.span,
614+
"associated type bounds are unstable"),
615+
_ => {}
616+
}
617+
visit::walk_assoc_ty_constraint(self, constraint)
618+
}
619+
607620
fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
608621
match ti.kind {
609622
ast::TraitItemKind::Method(ref sig, ref block) => {

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

-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,3 @@ fn main() {
7070
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
7171
// let _: &dyn Tr1<As1: Copy> = &S1;
7272
}
73-
74-
macro_rules! accept_path { ($p:path) => {} }
75-
accept_path!(Iterator<Item: Ord>);
76-
//~^ ERROR associated type bounds are unstable

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

+1-10
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,6 @@ LL | let _: impl Tr1<As1: Copy> = S1;
115115
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
116116
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
117117

118-
error[E0658]: associated type bounds are unstable
119-
--> $DIR/feature-gate-associated_type_bounds.rs:75:23
120-
|
121-
LL | accept_path!(Iterator<Item: Ord>);
122-
| ^^^^^^^^^
123-
|
124-
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
125-
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
126-
127118
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
128119
--> $DIR/feature-gate-associated_type_bounds.rs:54:14
129120
|
@@ -148,7 +139,7 @@ LL | let _: impl Tr1<As1: Copy> = S1;
148139
|
149140
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
150141

151-
error: aborting due to 17 previous errors
142+
error: aborting due to 16 previous errors
152143

153144
Some errors have detailed explanations: E0562, E0658.
154145
For more information about an error, try `rustc --explain E0562`.

0 commit comments

Comments
 (0)