Open
Description
#![feature(const_trait_impl)]
#![feature(auto_traits, negative_impls)]
auto trait NotPartialOrd {}
impl<T: ~const PartialOrd> const !NotPartialOrd for T {}
const fn foo<T: ~const PartialOrd>(_t: &T) { }
const fn bar<T: ~const NotPartialOrd>(_t: &T) { }
const b1: () = foo(&4_u32);
const b2: () = bar(&4_u32);
This fails compilation on both consts; the first because the trait ~const PartialOrd is not implemented for u32 (note: the trait PartialOrd is implemented for u32, but that implementation is not const)
, and the second because the trait bound u32: ~const NotPartialOrd is not satisfied
.
I tried with_negative_coherence
too, but it did not impact this test case.
Meta
$ rustc --version --verbose`:
rustc 1.64.0-nightly (c80c4b8fd 2022-06-26)
binary: rustc
commit-hash: c80c4b8fdcf3da69cd483e2fec172c9b1f95842c
commit-date: 2022-06-26
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.5