2015-01-07 17:41:50 -06: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.
|
|
|
|
|
2015-01-13 13:21:19 -06:00
|
|
|
// The dummy functions are used to avoid adding new cfail files.
|
|
|
|
// What happens is that the compiler attempts to squash duplicates and some
|
|
|
|
// errors are not reported. This way, we make sure that, for each function, different
|
|
|
|
// typeck phases are involved and all errors are reported.
|
|
|
|
|
2015-01-07 17:41:50 -06:00
|
|
|
#![feature(optin_builtin_traits)]
|
|
|
|
|
|
|
|
use std::marker::Send;
|
|
|
|
|
|
|
|
struct Outer<T: Send>(T);
|
|
|
|
|
|
|
|
struct Outer2<T>(T);
|
|
|
|
|
|
|
|
unsafe impl<T: Send> Sync for Outer2<T> {}
|
|
|
|
|
|
|
|
fn is_send<T: Send>(_: T) {}
|
|
|
|
fn is_sync<T: Sync>(_: T) {}
|
|
|
|
|
2015-01-13 13:21:19 -06:00
|
|
|
fn dummy() {
|
2015-06-15 16:30:34 -05:00
|
|
|
struct TestType;
|
|
|
|
impl !Send for TestType {}
|
|
|
|
|
2015-01-07 17:41:50 -06:00
|
|
|
Outer(TestType);
|
2016-03-20 06:24:08 -05:00
|
|
|
//~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy::TestType`
|
|
|
|
//~| ERROR the trait `std::marker::Send` is not implemented for the type `dummy::TestType`
|
2015-08-07 12:23:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn dummy1b() {
|
|
|
|
struct TestType;
|
|
|
|
impl !Send for TestType {}
|
2015-01-07 17:41:50 -06:00
|
|
|
|
|
|
|
is_send(TestType);
|
2016-03-20 06:24:08 -05:00
|
|
|
//~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy1b::TestType`
|
2015-08-07 12:23:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn dummy1c() {
|
|
|
|
struct TestType;
|
|
|
|
impl !Send for TestType {}
|
2015-01-07 17:41:50 -06:00
|
|
|
|
2015-01-13 13:21:19 -06:00
|
|
|
is_send((8, TestType));
|
2016-03-20 06:24:08 -05:00
|
|
|
//~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy1c::TestType`
|
2015-01-13 13:21:19 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn dummy2() {
|
2015-06-15 16:30:34 -05:00
|
|
|
struct TestType;
|
|
|
|
impl !Send for TestType {}
|
|
|
|
|
2015-01-13 13:21:19 -06:00
|
|
|
is_send(Box::new(TestType));
|
2016-03-20 06:24:08 -05:00
|
|
|
//~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy2::TestType`
|
2015-01-13 13:21:19 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn dummy3() {
|
2015-06-15 16:30:34 -05:00
|
|
|
struct TestType;
|
|
|
|
impl !Send for TestType {}
|
|
|
|
|
2015-01-13 13:21:19 -06:00
|
|
|
is_send(Box::new(Outer2(TestType)));
|
2016-03-20 06:24:08 -05:00
|
|
|
//~^ ERROR the trait `std::marker::Send` is not implemented for the type `dummy3::TestType`
|
2015-01-13 13:21:19 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-06-15 16:30:34 -05:00
|
|
|
struct TestType;
|
|
|
|
impl !Send for TestType {}
|
|
|
|
|
2015-01-07 17:41:50 -06:00
|
|
|
// This will complain about a missing Send impl because `Sync` is implement *just*
|
|
|
|
// for T that are `Send`. Look at #20366 and #19950
|
|
|
|
is_sync(Outer2(TestType));
|
2016-03-20 06:24:08 -05:00
|
|
|
//~^ ERROR the trait `std::marker::Send` is not implemented for the type `main::TestType`
|
2015-01-07 17:41:50 -06:00
|
|
|
}
|