Skip to content

Schedule cleanup for &* on fat owned pointers #16915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nrc
Copy link
Member

@nrc nrc commented Sep 1, 2014

For example let _x: &Trait = &*(box Foo as Box<Trait>);. There was a bug where no cleanup would be scheduled by the deref.

No test because cleanup-auto-borrow-obj.rs is a test for this once we remove trait cross-borrowing (done on another branch).

r?

// A fat pointer and an opened DST value have the same
// represenation just different types. Since there is no
// temporary for `*e` here (because it is unsized), we cannot
// emmulate the sized object code path for running drop glue and
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*emulate

For example `let _x: &Trait = &*(box Foo as Box<Trait>);`. There was a bug where no cleanup would be scheduled by the deref.

No test because cleanup-auto-borrow-obj.rs is a test for this once we remove trait cross-borrowing (done on another branch).
@nrc
Copy link
Member Author

nrc commented Sep 2, 2014

This is on the branch for PR #16917

@nrc nrc closed this Sep 2, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 31, 2024
fix: Prevent stack overflow in recursive const types

In the evaluation of const values of recursive types certain declarations could cause an endless call-loop within the interpreter (hir-ty’s create_memory_map), which would lead to a stack overflow.
This commit adds a check that prevents values that contain an address in their value (such as TyKind::Ref) from being allocated at the address they contain.
The commit also adds a test for this edge case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants