Closed
Description
#![forbid(coherence_leak_check)]
#![feature(negative_impls, with_negative_coherence)]
pub trait Marker {}
impl<'a, T: ?Sized> !Marker for &'a T {}
trait FnMarker {}
impl<T: ?Sized + Marker> FnMarker for fn(T) {}
impl<T: ?Sized> FnMarker for fn(&T) {}
I expected to see this happen: Compiles successfully
Instead, this happened:
error: conflicting implementations of trait `FnMarker` for type `fn(&_)`
--> src/lib.rs:11:1
|
10 | impl<T: ?Sized + Marker> FnMarker for fn(T) {}
| ------------------------------------------- first implementation here
11 | impl<T: ?Sized> FnMarker for fn(&T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&_)`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
note: the lint level is defined here
--> src/lib.rs:1:11
|
1 | #![forbid(coherence_leak_check)]
| ^^^^^^^^^^^^^^^^^^^^
Meta
rustc --version
:
1.76.0-nightly (2023-11-15 6b771f6b5a6c8b03b632)
@rustbot label A-coherence F-negative_impls requires-nightly T-compiler