// cross-crate scenario.
#![crate_type="lib"]
-#![feature(associated_types)]
pub trait Bar {
type T;
// except according to those terms.
#![crate_type = "lib"]
-#![feature(associated_types)]
pub struct TreeBuilder<H>;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
pub trait T {
type C;
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct DerefWithHelper<H, T> {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::cmp::PartialEq;
use std::ops::{Add, Sub, Mul};
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
-#![feature(associated_types, slicing_syntax)]
+#![feature(slicing_syntax)]
use std::cmp::min;
use std::io::{BufferedWriter, File};
// ignore-android see #10393 #13206
-#![feature(associated_types, slicing_syntax)]
+#![feature(slicing_syntax)]
use std::ascii::OwnedAsciiExt;
use std::iter::repeat;
// no-pretty-expanded FIXME #15189
-#![feature(associated_types)]
-
use std::iter::repeat;
use std::sync::Arc;
use std::sync::mpsc::channel;
// ignore-android see #10393 #13206
-#![feature(associated_types, slicing_syntax, unboxed_closures)]
+#![feature(slicing_syntax, unboxed_closures)]
extern crate libc;
// just propagate the error.
#![crate_type = "lib"]
-#![feature(associated_types, default_type_params, lang_items)]
+#![feature(default_type_params, lang_items)]
#![no_std]
#[lang="sized"]
// Test equality constraints on associated types in a where clause.
-#![feature(associated_types)]
-
pub trait ToInt {
fn to_int(&self) -> int;
}
// Test equality constraints on associated types. Check that unsupported syntax
// does not ICE.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> <Self as Foo>::A;
// Test equality constraints on associated types. Check we get an error when an
// equality constraint is used in a qualified path.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> <Self as Foo>::A;
// Test equality constraints on associated types. Check we get type errors
// where we should.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> <Self as Foo>::A;
// Check that an associated type cannot be bound in an expression path.
-#![feature(associated_types)]
-
trait Foo {
type A;
fn bar() -> int;
// Check testing of equality constraints in a higher-ranked context.
-#![feature(associated_types)]
-
pub trait TheTrait<T> {
type A;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> <Self as Get>::Value;
fn main() {
}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> <Self as Get>::Value;
fn main() {
}
-
// Check that the user gets an errror if they omit a binding from an
// object type.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
type B;
// Test that we reliably check the value of the associated type.
#![crate_type = "lib"]
-#![feature(associated_types)]
#![no_implicit_prelude]
use std::option::Option::{self, None, Some};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> <Self as Get>::Value;
fn main() {
}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
// Check that we get an error when you use `<Self as Get>::Value` in
// the trait definition but `Self` does not, in fact, implement `Get`.
// Test that we have one and only one associated type per ref.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
}
pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} //~ERROR ambiguous associated type `A`
pub fn main() {}
-
// Test type checking of uses of associated types via sugary paths.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
}
// Test you can't use a higher-ranked trait bound inside of a qualified
// path (just won't parse).
-#![feature(associated_types)]
-
pub trait Foo<T> {
type A;
// Check projection of an associated type out of a higher-ranked
// trait-bound in the context of a function body.
-#![feature(associated_types)]
-
pub trait Foo<T> {
type A;
// Check projection of an associated type out of a higher-ranked trait-bound
// in the context of a function signature.
-#![feature(associated_types)]
-
pub trait Foo<T> {
type A;
// Check projection of an associated type out of a higher-ranked trait-bound
// in the context of a struct definition.
-#![feature(associated_types)]
-
pub trait Foo<T> {
type A;
// Check projection of an associated type out of a higher-ranked trait-bound
// in the context of a method definition in a trait.
-#![feature(associated_types)]
-
pub trait Foo<T> {
type A;
// Check that an associated type cannot be bound in an expression path.
-#![feature(associated_types)]
-
trait Foo {
type A;
fn bar() -> int;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Sized? Value;
fn get(&self) -> <Self as Get>::Value;
fn main() {
}
-
// Test that binary operators consume their arguments
-#![feature(associated_types, default_type_params)]
+#![feature(default_type_params)]
use std::ops::{Add, Sub, Mul, Div, Rem, BitAnd, BitXor, BitOr, Shl, Shr};
// Test that move restrictions are enforced on overloaded binary operations
-#![feature(associated_types, default_type_params)]
+#![feature(default_type_params)]
use std::ops::Add;
// Test how overloaded deref interacts with borrows when DerefMut
// is implemented.
-#![feature(associated_types)]
-
use std::ops::{Deref, DerefMut};
struct Own<T> {
// Test how overloaded deref interacts with borrows when only
// Deref and not DerefMut is implemented.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct Rc<T> {
// Test how overloaded deref interacts with borrows when DerefMut
// is implemented.
-#![feature(associated_types)]
-
use std::ops::{Deref, DerefMut};
struct Own<T> {
// Test how overloaded deref interacts with borrows when only
// Deref and not DerefMut is implemented.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct Rc<T> {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Add;
#[derive(Clone)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types, default_type_params)]
+#![feature(default_type_params)]
use std::ops::Add;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Index;
struct MyVec<T> {
// Test that we still see borrowck errors of various kinds when using
// indexing and autoderef in combination.
-#![feature(associated_types)]
-
use std::ops::{Index, IndexMut};
struct Foo {
fn main() {
}
-
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::{Index, IndexMut};
struct Foo {
s[2] = 20;
//~^ ERROR cannot assign to immutable dereference (dereference is implicit, due to indexing)
}
-
-
// Test that overloaded index expressions with DST result types
// can't be used as rvalues
-#![feature(associated_types)]
-
use std::ops::Index;
use std::fmt::Show;
// error-pattern: reached the recursion limit while auto-dereferencing
-#![feature(associated_types)]
-
use std::ops::Deref;
struct Foo;
// except according to those terms.
#![feature(unboxed_closures)]
-#![feature(associated_types)]
use std::any::Any;
use std::intrinsics::TypeId;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct MyPtr<'a>(&'a mut uint);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
fn add_state(op: <int as HasState>::State) {
//~^ ERROR the trait `HasState` is not implemented for the type `int`
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Foo {
type Item;
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait From<Src> {
type Output;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait From<Src> {
type Result;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
struct StateMachineIter<'a> {
statefn: &'a StateMachineFunc<'a>
}
println!("{}",it.next());
println!("{}",it.next());
}
-
// (In this case the mul method should take &f64 and not f64)
// See: #11450
-#![feature(associated_types, default_type_params)]
+#![feature(default_type_params)]
use std::ops::Mul;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Foo {
type T;
}
let y: int = 44;
assert_eq!(x * 2, y);
}
-
// Test equality constraints on associated types in a where clause.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> <Self as Foo>::A;
// Test equality constraints on associated types in a where clause.
-#![feature(associated_types)]
-
pub trait ToInt {
fn to_int(&self) -> int;
}
// Test that we are able to reference cross-crate traits that employ
// associated types.
-#![feature(associated_types)]
-
extern crate "associated-types-cc-lib" as bar;
use bar::Bar;
// `Target=[A]`, then the impl marked with `(*)` is seen to conflict
// with all the others.
-#![feature(associated_types, default_type_params)]
+#![feature(default_type_params)]
use std::ops::Deref;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait SignedUnsigned {
type Opposite;
fn convert(self) -> Self::Opposite;
let x = get(22);
assert_eq!(22u, x);
}
-
// Test equality constraints on associated types inside of an object type
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> <Self as Foo>::A;
// ignore-pretty -- FIXME(#17362)
-#![feature(associated_types, lang_items, unboxed_closures)]
+#![feature(lang_items, unboxed_closures)]
#![no_implicit_prelude]
use std::kinds::Sized;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> &<Self as Get>::Value;
};
assert_eq!(*s.grab(), 100);
}
-
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> &<Self as Get>::Value;
};
assert_eq!(*grab(&s), 100);
}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> &<Self as Get>::Value;
};
assert_eq!(*s.grab(), 100);
}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> &<Self as Get>::Value;
};
assert_eq!(*Struct::grab(&s), 100);
}
-
// Test that we are able to have an impl that defines an associated type
// before the actual trait.
-#![feature(associated_types)]
impl X for f64 { type Y = int; }
trait X {type Y; }
fn main() {}
// Test that we normalize associated types that appear in bounds; if
// we didn't, the call to `self.split2()` fails to type check.
-#![feature(associated_types)]
-
struct Splits<'a, T, P>;
struct SplitsN<I>;
// Test that we normalize associated types that appear in bounds; if
// we didn't, the call to `self.split2()` fails to type check.
-#![feature(associated_types)]
-
struct Splits<'a, T, P>;
struct SplitsN<I>;
// this case, the `Result=Self` binding in the supertrait listing of
// `Int` was being ignored.
-#![feature(associated_types)]
-
trait Not {
type Result;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Foo<T> {
type Bar;
fn get_bar() -> <Self as Foo<T>>::Bar;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get<T> {
fn get(&self) -> T;
}
// Test equality constraints on associated types in a where clause.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> <Self as Foo>::A;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Get {
type Value;
fn get(&self) -> &<Self as Get>::Value;
};
assert_eq!(*s.get(), 100);
}
-
// Test paths to associated types using the type-parameter-only sugar.
-#![feature(associated_types)]
-
pub trait Foo {
type A;
fn boo(&self) -> Self::A;
// ignore-pretty -- FIXME(#17362) pretty prints with `<<` which lexes wrong
-#![feature(associated_types, lang_items, unboxed_closures)]
+#![feature(lang_items, unboxed_closures)]
#![no_implicit_prelude]
use std::kinds::Sized;
// Test that a custom deref with a fat pointer return type does not ICE
-#![feature(associated_types)]
-
use std::ops::{Deref, DerefMut};
pub struct Arr {
// Test that a custom deref with a fat pointer return type does not ICE
-#![feature(associated_types)]
-
use std::ops::Deref;
pub struct Arr {
// Test that overloaded index expressions with DST result types
// work and don't ICE.
-#![feature(associated_types)]
-
use std::ops::Index;
use std::fmt::Show;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::{Deref, DerefMut};
// Generic unique/owned smaht pointer.
}
fn main() {}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::slice;
pub struct PhfMapEntries<'a, T: 'a> {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct Root {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Matcher {
fn next_match(&mut self) -> Option<(uint, uint)>;
}
// If `Index` used an associated type for its output, this test would
// work more smoothly.
-#![feature(associated_types, old_orphan_check)]
+#![feature(old_orphan_check)]
use std::ops::Index;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait MatrixRow {}
struct Mat;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types, unboxed_closures)]
+#![feature(unboxed_closures)]
use std::ops::{Deref, DerefMut};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
trait Person {
type string;
}
// ignore-pretty -- FIXME(#17362) pretty prints as `Hash<<Self as Hasher...` which fails to parse
-#![feature(associated_types)]
-
pub trait Hasher {
type State;
// Test that a partially specified trait object with unspecified associated
// type does not ICE.
-#![feature(associated_types)]
-
trait Foo {
type A;
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Trait<Input> {
type Output;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Trait<Input> {
type Output;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
trait Base {}
trait AssocA {
type X: Base;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait PoolManager {
type C;
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait PoolManager {
type C;
}
// Test that `<Type as Trait>::Output` and `Self::Output` are accepted as type annotations in let
// bindings
-#![feature(associated_types)]
-
trait Int {
fn one() -> Self;
fn leading_zeros(self) -> uint;
// Check that associated types are `Sized`
-#![feature(associated_types)]
-
trait Trait {
type Output;
// aux-build:issue_20389.rs
-#![feature(associated_types)]
extern crate issue_20389;
struct Foo;
// If `Mul` used an associated type for its output, this test would
// work more smoothly.
-#![feature(associated_types, default_type_params, old_orphan_check)]
+#![feature(default_type_params, old_orphan_check)]
use std::ops::Mul;
// Test that we can overload the `+` operator for points so that two
// points can be added, and a point can be added to an integer.
-#![feature(associated_types, default_type_params)]
+#![feature(default_type_params)]
use std::ops;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::cmp;
use std::ops;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::cell::Cell;
use std::ops::{Deref, DerefMut};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct DerefArray<'a, T:'a> {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::rc::Rc;
use std::ops::Deref;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::Deref;
struct DerefWithHelper<H, T> {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::cell::Cell;
use std::ops::{Deref, DerefMut};
use std::vec::Vec;
// Test overloading of the `[]` operator. In particular test that it
// takes its argument *by reference*.
-#![feature(associated_types)]
-
use std::ops::Index;
struct AssociationList<K,V> {
// Test overloaded indexing combined with autoderef.
-#![feature(associated_types)]
-
use std::ops::{Index, IndexMut};
struct Foo {
assert_eq!(f[1].get(), 5);
assert_eq!(f[1].get_from_ref(), 5);
}
-
// Test using overloaded indexing when the "map" is stored in a
// field. This caused problems at some point.
-#![feature(associated_types)]
-
use std::ops::Index;
struct Foo {
} };
assert_eq!(f.foo[1].get(), 2);
}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::ops::{Index, IndexMut};
struct Foo {
assert_eq!(f[1].get(), 5);
assert_eq!(f[1].get_from_ref(), 5);
}
-
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
trait Foo {
type T;
fn foo() -> Box<<Self as Foo>::T>;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types, unsafe_destructor)]
+#![feature(unsafe_destructor)]
pub struct Foo<T>;
// except according to those terms.
-#![feature(associated_types, simd)]
+#![feature(simd)]
use std::ops;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(associated_types)]
-
use std::cmp::PartialEq;
use std::ops::{Add, Sub, Mul};