Closed as not planned
Description
I tried this code (playground):
#![feature(auto_traits, negative_impls)]
auto trait Blob {}
trait NotBlob {}
impl<B: NotBlob> !Blob for B {}
fn assert_blob(_: impl Blob) {}
fn main() {
assert_blob(())
}
I expected the code to compile, because Blob
is auto-implemented for all types except those for which NotBlob
has been implemented (there aren't any); instead, the compiler complains that Blob
is not implemented for the unit type ()
:
error[E0277]: the trait bound `(): Blob` is not satisfied --> src/main.rs:10:17 | 10 | assert_blob(()) | ----------- ^^ the trait `Blob` is not implemented for `()` | | | required by a bound introduced by this call | note: required by a bound in `assert_blob` --> src/main.rs:8:24 | 8 | fn assert_blob(_: impl Blob) {} | ^^^^ required by this bound in `assert_blob` For more information about this error, try `rustc --explain E0277`.
Meta
rustc --version --verbose
:
rustc 1.69.0 (5243ea5c2 2023-02-20)
binary: rustc
commit-hash: 5243ea5c29b136137c36bd773e5baa663790e097
commit-date: 2023-02-20
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.7
@rustbot label +F-auto_traits +F-negative_impls