rust/src/test/compile-fail/default_ty_param_conflict_cross_crate.rs

35 lines
1.2 KiB
Rust
Raw Normal View History

2015-07-20 14:49:03 -05:00
// 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.
//
//aux-build:default_ty_param_cross_crate_crate.rs
2015-07-24 15:39:11 -05:00
#![feature(default_type_parameter_fallback)]
extern crate default_param_test;
2015-07-20 14:49:03 -05:00
use default_param_test::{Foo, bleh};
2015-07-20 14:49:03 -05:00
fn meh<X, B=bool>(x: Foo<X, B>) {}
//~^ NOTE: a default was defined here...
2015-07-20 14:49:03 -05:00
fn main() {
let foo = bleh();
//~^ NOTE: ...that also applies to the same type variable here
meh(foo);
//~^ ERROR: mismatched types
//~| NOTE: conflicting type parameter defaults `bool` and `char`
//~| NOTE: conflicting type parameter defaults `bool` and `char`
//~| a second default is defined on `default_param_test::bleh`
//~| NOTE: ...that was applied to an unconstrained type variable here
//~| expected type `bool`
//~| found type `char`
2015-07-20 14:49:03 -05:00
}