mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Auto merge of #27382 - brson:gate-assoc-type, r=alexcrichton
There are still problems in both the design and implementation of this, so we don't want it landing in 1.2. cc @arielb1 @nikomatsakis cc #27364 r? @alexcrichton
This commit is contained in:
commit
8d2eb5971a
@ -65,6 +65,7 @@
|
||||
#![allow(raw_pointer_derive)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
#![feature(intrinsics)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(on_unimplemented)]
|
||||
|
@ -163,8 +163,12 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
|
||||
|
||||
// Allows the definition recursive static items.
|
||||
("static_recursion", "1.3.0", Active),
|
||||
// Allows default type parameters to influence type inference.
|
||||
("default_type_parameter_fallback", "1.3.0", Active)
|
||||
|
||||
// Allows default type parameters to influence type inference.
|
||||
("default_type_parameter_fallback", "1.3.0", Active),
|
||||
|
||||
// Allows associated type defaults
|
||||
("associated_type_defaults", "1.2.0", Active),
|
||||
];
|
||||
// (changing above list without updating src/doc/reference.md makes @cmr sad)
|
||||
|
||||
@ -762,6 +766,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
|
||||
self.gate_feature("const_fn", ti.span, "const fn is unstable");
|
||||
}
|
||||
}
|
||||
ast::TypeTraitItem(_, Some(_)) => {
|
||||
self.gate_feature("associated_type_defaults", ti.span,
|
||||
"associated type defaults are unstable");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_trait_item(self, ti);
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
pub trait Foo {
|
||||
type Input = usize;
|
||||
fn bar(&self, _: Self::Input) {}
|
||||
|
@ -9,6 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_consts)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
pub trait Tr {
|
||||
type Assoc = u8;
|
||||
|
15
src/test/compile-fail/feature-gate-assoc-type-defaults.rs
Normal file
15
src/test/compile-fail/feature-gate-assoc-type-defaults.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2015 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.
|
||||
|
||||
trait Foo {
|
||||
type Bar = u8; //~ ERROR associated type defaults are unstable
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
trait Foo { type T; }
|
||||
trait Bar {
|
||||
type Foo: Foo;
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
use std::ops::{Index};
|
||||
|
||||
trait Hierarchy {
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
pub struct C<AType: A> {a:AType}
|
||||
|
||||
pub trait A {
|
||||
|
@ -12,6 +12,7 @@
|
||||
// injected intrinsics by the compiler.
|
||||
#![deny(missing_docs)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
//! Some garbage docs for the crate here
|
||||
#![doc="More garbage"]
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
trait Foo<T> {
|
||||
type Out = T;
|
||||
fn foo(&self) -> Self::Out;
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub trait Routing<I> {
|
||||
|
Loading…
Reference in New Issue
Block a user