From 56d7bb2133c82ec73fa17d9b02872feb4bf09c63 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 31 Oct 2019 18:49:22 +0200 Subject: [PATCH] Revert "pre-expansion gate associated_type_bounds" This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7. --- src/libsyntax/feature_gate/check.rs | 15 ++++++++++++++- .../feature-gate-associated_type_bounds.rs | 4 ---- .../feature-gate-associated_type_bounds.stderr | 11 +---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 184a38dfaed7..a4fc6114b985 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -3,7 +3,10 @@ use super::accepted::ACCEPTED_FEATURES; use super::removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES}; use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP}; -use crate::ast::{self, NodeId, GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; +use crate::ast::{ + self, AssocTyConstraint, AssocTyConstraintKind, NodeId, GenericParam, GenericParamKind, + PatKind, RangeEnd, VariantData, +}; use crate::attr::{self, check_builtin_attribute}; use crate::source_map::Spanned; use crate::edition::{ALL_EDITIONS, Edition}; @@ -604,6 +607,16 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_generic_param(self, param) } + fn visit_assoc_ty_constraint(&mut self, constraint: &'a AssocTyConstraint) { + match constraint.kind { + AssocTyConstraintKind::Bound { .. } => + gate_feature_post!(&self, associated_type_bounds, constraint.span, + "associated type bounds are unstable"), + _ => {} + } + visit::walk_assoc_ty_constraint(self, constraint) + } + fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) { match ti.kind { ast::TraitItemKind::Method(ref sig, ref block) => { diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs index 00737d8428b3..0faa9090f4eb 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs @@ -70,7 +70,3 @@ fn main() { // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. // let _: &dyn Tr1 = &S1; } - -macro_rules! accept_path { ($p:path) => {} } -accept_path!(Iterator); -//~^ ERROR associated type bounds are unstable diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr index a7ab7614d7b7..84af2a0163ae 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -115,15 +115,6 @@ LL | let _: impl Tr1 = S1; = note: for more information, see https://github.com/rust-lang/rust/issues/52662 = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable -error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:75:23 - | -LL | accept_path!(Iterator); - | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/52662 - = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable - error[E0562]: `impl Trait` not allowed outside of function and inherent method return types --> $DIR/feature-gate-associated_type_bounds.rs:54:14 | @@ -148,7 +139,7 @@ LL | let _: impl Tr1 = S1; | = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable -error: aborting due to 17 previous errors +error: aborting due to 16 previous errors Some errors have detailed explanations: E0562, E0658. For more information about an error, try `rustc --explain E0562`.