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