Feature gate
This commit is contained in:
parent
f50c1e1f05
commit
fb9ca9223d
6 changed files with 73 additions and 6 deletions
|
|
@ -174,6 +174,10 @@ impl GenericArgs {
|
|||
matches!(self, AngleBracketed(..))
|
||||
}
|
||||
|
||||
pub fn is_parenthesized(&self) -> bool {
|
||||
matches!(self, Parenthesized(..))
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
match self {
|
||||
AngleBracketed(data) => data.span,
|
||||
|
|
|
|||
|
|
@ -482,12 +482,21 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||
|
||||
fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) {
|
||||
if let AssocConstraintKind::Bound { .. } = constraint.kind {
|
||||
gate_feature_post!(
|
||||
&self,
|
||||
associated_type_bounds,
|
||||
constraint.span,
|
||||
"associated type bounds are unstable"
|
||||
)
|
||||
if constraint.gen_args.as_ref().map_or(false, |args| args.is_parenthesized()) {
|
||||
gate_feature_post!(
|
||||
&self,
|
||||
return_type_notation,
|
||||
constraint.span,
|
||||
"return type notation is unstable"
|
||||
)
|
||||
} else {
|
||||
gate_feature_post!(
|
||||
&self,
|
||||
associated_type_bounds,
|
||||
constraint.span,
|
||||
"associated type bounds are unstable"
|
||||
)
|
||||
}
|
||||
}
|
||||
visit::walk_assoc_constraint(self, constraint)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -495,6 +495,8 @@ declare_features! (
|
|||
(active, repr_simd, "1.4.0", Some(27731), None),
|
||||
/// Allows return-position `impl Trait` in traits.
|
||||
(incomplete, return_position_impl_trait_in_trait, "1.65.0", Some(91611), None),
|
||||
/// Allows bounding the return type of AFIT/RPITIT.
|
||||
(incomplete, return_type_notation, "CURRENT_RUSTC_VERSION", Some(109417), None),
|
||||
/// Allows `extern "rust-cold"`.
|
||||
(active, rust_cold_cc, "1.63.0", Some(97544), None),
|
||||
/// Allows the use of SIMD types in functions declared in `extern` blocks.
|
||||
|
|
|
|||
|
|
@ -1193,6 +1193,7 @@ symbols! {
|
|||
residual,
|
||||
result,
|
||||
return_position_impl_trait_in_trait,
|
||||
return_type_notation,
|
||||
rhs,
|
||||
rintf32,
|
||||
rintf64,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue