Skip to content

Commit 3b83466

Browse files
authored
Merge pull request #634 from RalfJung/trophy-case
List some bugs that we found
2 parents 526b8ae + a4c852d commit 3b83466

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ for example:
1515
or an invalid enum discriminant)
1616
* WIP: Violations of the rules governing aliasing for reference types
1717

18+
Miri has already discovered some [real-world bugs](#bugs-found-by-miri).
19+
1820
[rust]: https://www.rust-lang.org/
1921
[mir]: https://github.com/rust-lang/rfcs/blob/master/text/1211-mir.md
2022
[`unreachable_unchecked`]: https://doc.rust-lang.org/stable/std/hint/fn.unreachable_unchecked.html
@@ -252,6 +254,18 @@ used according to their aliasing restrictions.
252254
[slides]: https://solson.me/miri-slides.pdf
253255
[report]: https://solson.me/miri-report.pdf
254256

257+
## Bugs found by Miri
258+
259+
Miri has already found a number of bugs in the Rust standard library, which we collect here.
260+
261+
* [`Debug for vec_deque::Iter` accessing uninitialized memory](https://github.com/rust-lang/rust/issues/53566)
262+
* [`From<&[T]> for Rc` creating a not sufficiently aligned reference](https://github.com/rust-lang/rust/issues/54908)
263+
* [`BTreeMap` creating a shared reference pointing to a too small allocation](https://github.com/rust-lang/rust/issues/54957)
264+
* [`VecDeque` creating overlapping mutable references](https://github.com/rust-lang/rust/pull/56161)
265+
* [Futures turning a shared reference into a mutable one](https://github.com/rust-lang/rust/pull/56319)
266+
* [`str` turning a shared reference into a mutable one](https://github.com/rust-lang/rust/pull/58200)
267+
* [`BTreeMap` creating mutable references that overlap with shared references](https://github.com/rust-lang/rust/pull/58431)
268+
255269
## License
256270

257271
Licensed under either of

tests/run-pass/vecdeque.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ fn main() {
99
let mut src = VecDeque::new();
1010
src.push_front(Box::new(2));
1111
dst.append(&mut src);
12+
for a in dst.iter() {
13+
assert_eq!(**a, 2);
14+
}
15+
16+
// Regression test for Debug and Diaplay impl's
17+
println!("{:?} {:?}", dst, dst.iter());
18+
println!("{:?}", VecDeque::<u32>::new().iter());
19+
1220
for a in dst {
1321
assert_eq!(*a, 2);
1422
}

tests/run-pass/vecdeque.stdout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[2, 2] Iter([2, 2], [])
2+
Iter([], [])

0 commit comments

Comments
 (0)