`Self` of negative impl is not required to be well-formed
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
feature(negative_impls) tracking issue: https://github.com/rust-lang/rust/issues/68318
I'm not sure if this is intended behavior or not.
I tried this code:
#![feature(negative_impls)]
struct Foo<T: Sized>(T);
trait MyTrait {}
impl !MyTrait for Foo<str> {} // Foo requires T: Sized, but str: !Sized
I expected to see this happen: error[E0277]: the size for values of type `str` cannot be known at compilation time
Instead, this happened: successful compilation (playground)
Meta
rustc --version --verbose:
rustc 1.95.0-nightly (a423f68a0 2026-02-13)
binary: rustc
commit-hash: a423f68a0d75656eabab4982a06bed9f316f7109
commit-date: 2026-02-13
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
no backtrace
@rustbot label F-negative_impls requires-nightly
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the provided negative_impls reproducer on the reported nightly and compare its behavior with the linked negative_impls tracking issue. Trace how the compiler checks the Self type in impl !MyTrait for Foo<str>; done means the invalid str argument is rejected with the expected well-formedness error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100