2013-10-29 15:08:49 -05:00
|
|
|
// Tests that an `&` pointer to something inherently mutable is itself
|
|
|
|
// to be considered mutable.
|
|
|
|
|
2020-01-09 04:56:38 -06:00
|
|
|
#![feature(negative_impls)]
|
2014-01-22 13:03:02 -06:00
|
|
|
|
2015-01-11 06:14:39 -06:00
|
|
|
use std::marker::Sync;
|
|
|
|
|
|
|
|
struct NoSync;
|
|
|
|
impl !Sync for NoSync {}
|
|
|
|
|
|
|
|
enum Foo { A(NoSync) }
|
2013-10-29 15:08:49 -05:00
|
|
|
|
2014-08-05 18:40:04 -05:00
|
|
|
fn bar<T: Sync>(_: T) {}
|
2013-10-29 15:08:49 -05:00
|
|
|
|
|
|
|
fn main() {
|
2015-01-11 06:14:39 -06:00
|
|
|
let x = Foo::A(NoSync);
|
2018-02-10 23:01:49 -06:00
|
|
|
bar(&x);
|
|
|
|
//~^ ERROR `NoSync` cannot be shared between threads safely [E0277]
|
2013-10-29 15:08:49 -05:00
|
|
|
}
|