eddyb's refactoring of coercions/adjustments

This commit is contained in:
Eduard Burtescu 2015-03-16 18:45:01 +02:00 committed by Nick Cameron
parent a4eb5a66a5
commit 4e8e64140f
25 changed files with 822 additions and 1497 deletions

View file

@ -34,6 +34,8 @@ fn dent<C:BoxCar>(c: C, color: C::Color) {
fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
//~^ ERROR ambiguous associated type
//~| ERROR the associated type `Color` (from the trait `Box`) must be specified
//~| ERROR the associated type `Color` (from the trait `Vehicle`) must be specified
}
fn paint<C:BoxCar>(c: C, d: C::Color) {

View file

@ -20,7 +20,7 @@ impl Foo for X {
type Item = bool;
}
fn print_x(_: &Foo, extra: &str) {
fn print_x(_: &Foo<Item=bool>, extra: &str) {
println!("{}", extra);
}

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// 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.
//
@ -9,7 +9,7 @@
// except according to those terms.
// Test that a partially specified trait object with unspecified associated
// type does not ICE.
// type does not type-check.
// pretty-expanded FIXME #23616
@ -20,7 +20,6 @@ trait Foo {
}
fn bar(x: &Foo) {}
// FIXME(#19482) -- `Foo` should specify `A`, but this is not
// currently enforced except at object creation
//~^ ERROR the associated type `A` (from the trait `Foo`) must be specified
pub fn main() {}

View file

@ -11,7 +11,8 @@
#![feature(rustc_attrs)]
#![allow(warnings)]
pub fn fail(x: Option<& (Iterator+Send)>) -> Option<&Iterator> {
pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
-> Option<&Iterator<Item=()>> {
// This call used to trigger an LLVM assertion because the return
// slot had type "Option<&Iterator>"* instead of
// "Option<&(Iterator+Send)>"* -- but this now yields a
@ -23,7 +24,8 @@ pub fn fail(x: Option<& (Iterator+Send)>) -> Option<&Iterator> {
inner(x) //~ ERROR mismatched types
}
pub fn inner(x: Option<& (Iterator+Send)>) -> Option<&(Iterator+Send)> {
pub fn inner(x: Option<&(Iterator<Item=()>+Send)>)
-> Option<&(Iterator<Item=()>+Send)> {
x
}

View file

@ -11,7 +11,7 @@
// Test that the `Fn` traits require `()` form without a feature gate.
fn bar1(x: &Fn<()>) {
fn bar1(x: &Fn<(), Output=()>) {
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family
}