diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2020-01-08 06:39:38 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2020-03-26 06:27:45 -0400 |
| commit | e8a05e201ee6cea12fe05e4271e91fd40c2fb235 (patch) | |
| tree | bdceb99e8a844cd9582b46c0cd10c3da8865bc60 /src/libcore | |
| parent | a17dd3608477a47741f97b907a61b6d81524ba4e (diff) | |
| download | rust-e8a05e201ee6cea12fe05e4271e91fd40c2fb235.tar.gz rust-e8a05e201ee6cea12fe05e4271e91fd40c2fb235.zip | |
permit negative impls for non-auto traits
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/clone.rs | 5 | ||||
| -rw-r--r-- | src/libcore/ops/deref.rs | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 9a412e57294..629c197e376 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -227,4 +227,9 @@ mod impls { *self } } + + // Shared references can be cloned, but mutable references *cannot*! + #[stable(feature = "rust1", since = "1.0.0")] + #[cfg(not(bootstrap))] + impl<T: ?Sized> !Clone for &mut T {} } diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs index 68244fdb381..e2deeb55661 100644 --- a/src/libcore/ops/deref.rs +++ b/src/libcore/ops/deref.rs @@ -81,6 +81,10 @@ impl<T: ?Sized> Deref for &T { } } +#[cfg(not(bootstrap))] +#[stable(feature = "rust1", since = "1.0.0")] +impl<T: ?Sized> !DerefMut for &T {} + #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> Deref for &mut T { type Target = T; |
