Skip to content
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

vec needs clear #2814

Closed
catamorphism opened this issue Jul 5, 2012 · 3 comments
Closed

vec needs clear #2814

catamorphism opened this issue Jul 5, 2012 · 3 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@catamorphism
Copy link
Contributor

Similarly to #2775 -- FIXME in typeck::transaction_methods::commit says "could use a vec::clear() that ran destructors but kept the vec at its currently allocated length"

@kud1ing
Copy link

kud1ing commented Jul 6, 2012

I think clear would be counterintuitive to the use in other languages (returning an empty vector/list/array). Maybe blank instead?

@jld
Copy link
Contributor

jld commented Sep 8, 2012

If I understand the issue correctly, vec::clear(v) can be expressed as vec::truncate(v, 0) as of ec9c68c.

@catamorphism
Copy link
Contributor Author

Closing since it's easy enough to use truncate.

saethlin pushed a commit to saethlin/rust that referenced this issue Apr 11, 2023
Emit a warning when Miri is used with optimizations

This may address rust-lang/miri#2797, by clarifying to the user what is going on and what the consequences of their choices are.

Fixes rust-lang/miri#2797
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Source changes required by the following upstream commits:

* rust-lang/rust@e8a2673159 Add VariantIdx back
* rust-lang/rust@f14b7c9443 Move FieldIdx and Layout to rustc_target
* rust-lang/rust@b47ad3b744 Bring back generic FieldIdx

Resolves: rust-lang#2813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants