Skip to content

needs_drop intrinsic #2055

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
nikomatsakis opened this issue Mar 26, 2012 · 2 comments
Closed

needs_drop intrinsic #2055

nikomatsakis opened this issue Mar 26, 2012 · 2 comments
Labels
A-codegen Area: Code generation C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@nikomatsakis
Copy link
Contributor

We should add a needs_drop<T> intrinsic that is true if the type requires drop glue. We could then implement a vec::clear() method that clears out the contents of a vector efficiently, avoiding the execution of drop glue if the vector has a type like [int]. vec::slice() is another example of where this might be useful.

@nikomatsakis
Copy link
Contributor Author

In the case of vec::slice(), the question is the take glue.

@ghost ghost assigned marijnh Apr 5, 2012
@marijnh
Copy link
Contributor

marijnh commented Apr 18, 2012

Things that have drop glue tend to have take glue.

Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants