Adding feature gate
This commit is contained in:
parent
6bd8ea1a6b
commit
f29613437f
@ -431,6 +431,9 @@ declare_features! (
|
||||
|
||||
// Nested groups in `use` (RFC 2128)
|
||||
(active, use_nested_groups, "1.23.0", Some(44494)),
|
||||
|
||||
// generic associated types (RFC 1598)
|
||||
(active, generic_associated_types, "1.23.0", Some(44265)),
|
||||
);
|
||||
|
||||
declare_features! (
|
||||
@ -1618,6 +1621,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
gate_feature_post!(&self, associated_type_defaults, ti.span,
|
||||
"associated type defaults are unstable");
|
||||
}
|
||||
_ if ti.generics.is_parameterized() => {
|
||||
gate_feature_post!(&self, generic_associated_types, ti.span, "generic associated types are unstable");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_trait_item(self, ti);
|
||||
@ -1636,6 +1642,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
gate_feature_post!(&self, const_fn, ii.span, "const fn is unstable");
|
||||
}
|
||||
}
|
||||
_ if ii.generics.is_parameterized() => {
|
||||
gate_feature_post!(&self, generic_associated_types, ii.span, "generic associated types are unstable");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_impl_item(self, ii);
|
||||
|
17
src/test/compile-fail/generic-associated-types.rs
Normal file
17
src/test/compile-fail/generic-associated-types.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
trait PointerFamily {
|
||||
type Pointer<T>: Deref<Target = T>;
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
trait Foo {
|
||||
type Bar<'a, 'b>;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
trait Iterable {
|
||||
type Item<'a>;
|
||||
type Iter<'a>: Iterator<Item = Self::Item<'a>>;
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::ops::Deref;
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
trait StreamingIterator {
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
// Checking the interaction with this other feature
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user