// if you change this list without updating src/doc/reference.md, @cmr will be sad
static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
- ("globs", Active),
+ ("globs", Accepted),
("macro_rules", Active),
("struct_variant", Accepted),
("asm", Active),
("lang_items", Active),
("simd", Active),
- ("default_type_params", Active),
+ ("default_type_params", Accepted),
("quote", Active),
("link_llvm_intrinsics", Active),
("linkage", Active),
("import_shadowing", Active),
("advanced_slice_patterns", Active),
("tuple_indexing", Accepted),
- ("associated_types", Active),
+ ("associated_types", Accepted),
("visible_private_types", Active),
("slicing_syntax", Active),
// A way to temporarily opt out of the new orphan rules. This will *never* be accepted.
("old_orphan_check", Deprecated),
+ // OIBIT specific features
+ ("optin_builtin_traits", Active),
+
// These are used to test this portion of the compiler, they don't actually
// mean anything
("test_accepted_feature", Accepted),
/// A set of features to be used by later passes.
#[derive(Copy)]
pub struct Features {
- pub default_type_params: bool,
pub unboxed_closures: bool,
pub rustc_diagnostic_macros: bool,
pub import_shadowing: bool,
impl Features {
pub fn new() -> Features {
Features {
- default_type_params: false,
unboxed_closures: false,
rustc_diagnostic_macros: false,
import_shadowing: false,
fn visit_view_item(&mut self, i: &ast::ViewItem) {
match i.node {
- ast::ViewItemUse(ref path) => {
- if let ast::ViewPathGlob(..) = path.node {
- self.gate_feature("globs", path.span,
- "glob import statements are \
- experimental and possibly buggy");
- }
- }
+ ast::ViewItemUse(..) => {}
ast::ViewItemExternCrate(..) => {
for attr in i.attrs.iter() {
if attr.name().get() == "phase"{
}
}
- ast::ItemImpl(_, _, _, _, ref items) => {
+ ast::ItemImpl(_, polarity, _, _, _, ref items) => {
+ match polarity {
+ ast::ImplPolarity::Negative => {
+ self.gate_feature("optin_builtin_traits",
+ i.span,
+ "negative trait bounds are not yet fully implemented; \
+ use marker types for now");
+ },
+ _ => {}
+ }
+
if attr::contains_name(i.attrs[],
"unsafe_destructor") {
self.gate_feature("unsafe_destructor",
visit::walk_item(self, i);
}
- fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) {
- match *trait_item {
- ast::RequiredMethod(_) | ast::ProvidedMethod(_) => {}
- ast::TypeTraitItem(ref ti) => {
- self.gate_feature("associated_types",
- ti.ty_param.span,
- "associated types are experimental")
- }
- }
- }
-
fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
if attr::contains_name(i.attrs[], "linkage") {
self.gate_feature("linkage", i.span,
}
fn visit_ty(&mut self, t: &ast::Ty) {
- if let ast::TyClosure(ref closure) = t.node {
- // this used to be blocked by a feature gate, but it should just
- // be plain impossible right now
- assert!(closure.onceness != ast::Once);
- }
-
visit::walk_ty(self, t);
}
visit::walk_expr(self, e);
}
- fn visit_generics(&mut self, generics: &ast::Generics) {
- for type_parameter in generics.ty_params.iter() {
- match type_parameter.default {
- Some(ref ty) => {
- self.gate_feature("default_type_params", ty.span,
- "default type parameters are \
- experimental and possibly buggy");
- }
- None => {}
- }
- }
- visit::walk_generics(self, generics);
- }
-
fn visit_attribute(&mut self, attr: &ast::Attribute) {
if attr::contains_name(slice::ref_slice(attr), "lang") {
self.gate_feature("lang_items",
check(&mut cx, krate);
(Features {
- default_type_params: cx.has_feature("default_type_params"),
unboxed_closures: cx.has_feature("unboxed_closures"),
rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"),
import_shadowing: cx.has_feature("import_shadowing"),