RFC: Can we make drop glue for recursive types not stack overflow?
Open
Nobody has claimed this yet.
T-lang
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
Issue by bblum
Thursday Aug 08, 2013 at 20:01 GMT
For earlier discussion, see https://github.com/rust-lang/rust/issues/8399
This issue was labelled with: A-codegen, B-RFC, E-hard, I-wishlist in the Rust repository
Example 2014-02-23
struct Foo { data: int, next: Option<~Foo> }
fn main() {
let mut foo = Some(~Foo { data: 0, next: None });
for i in range(0, 17_000_000) {
if i % 1000000 == 0 {
error!("{}", i);
}
foo = Some(~Foo { data: i, next: foo.take() });
}
}
Original example
use std::cell::Cell;
struct Foo { data: int, next: Option<~Foo> }
fn main() {
let foo = Cell::new(Foo { data: 0, next: None });
let mut i = 0;
do 17_000_000.times {
i += 1;
if i % 1000000 == 0 {
error!("%d", i);
}
foo.put_back(Foo { data: i, next: Some(~foo.take()) });
}
}
Contributor guide
No contributing guide indexed for this repository
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 reading the earlier discussion in Rust issue 8399 and reproducing the recursive Foo example from this issue. Determine how recursive drop glue causes stack overflow at the demonstrated depth, then define and document a viable design for avoiding it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100