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