Contract attributes gives its output all the same span
Open
@celinval is already working on this.
Since Oct 18, 2025.
C-bug
F-contracts
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
It was reported in https://github.com/rust-lang/rust/issues/146808 that the following code ICEs:
#![core::contracts::requires]
#[allow{}]
fn main() {}
(compiler version for future reference)
rustc 1.92.0-nightly (f46475914 2025-10-17)
binary: rustc
commit-hash: f46475914de626785090a05ae037578aaa119fc8
commit-date: 2025-10-17
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
The reason it ICEs has little to do with contract attributes, and more to do with the fact that if two spans of a suggestion overlap, rust ICEs. This can be triggered in other ways.
However, contract attributes trigger this precisely because they cause their output to all have the same span. This I think is a bug on its own.
Assigning @celinval for now since she's doing contract attributes as far as I'm aware?
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.
Assessment
This issue has not been assessed yet.