-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Repro:
#![feature(inclusive_range_syntax)]
#![feature(trusted_len)]
use std::iter::TrustedLen;
fn check_size_correctness<T:TrustedLen+ExactSizeIterator>(x: T) {
let len = x.len();
assert_eq!(x.count(), len);
}
fn main() {
check_size_correctness(100...0u8);
}
#42134 will fix this, but I wanted to record it because I think TrustedLen
being an unsafe trait
means this could be leading to unsoundness.
Metadata
Metadata
Assignees
Labels
I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.