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

Tracking issue: Add back Vec::from_elem (RFC 832) #22414

Closed
aturon opened this issue Feb 16, 2015 · 8 comments · Fixed by #22455
Closed

Tracking issue: Add back Vec::from_elem (RFC 832) #22414

aturon opened this issue Feb 16, 2015 · 8 comments · Fixed by #22455
Assignees
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@aturon
Copy link
Member

aturon commented Feb 16, 2015

rust-lang/rfcs#832

@aturon aturon added A-libs B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. labels Feb 16, 2015
@Gankra Gankra added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Feb 17, 2015
@Gankra
Copy link
Contributor

Gankra commented Feb 17, 2015

Super easy to implement for anyone interested. The implementation in the RFC is sound, although the new code should be abstracted out into a function that the macro calls for inline and macro-sanity reasons. The function needs to be marked as public/stable, but should otherwise be marked as #[doc(hidden)], as it is not intended to be called directly -- only by the macro.

@Gankra Gankra added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Feb 17, 2015
@Gankra
Copy link
Contributor

Gankra commented Feb 17, 2015

Willing to mentor on details.

@msiemens
Copy link
Contributor

I'd like to give it a shot :)

@msiemens
Copy link
Contributor

By the way: The documentation for vec! seems very sparse. If it's okay, I'd expand that a bit while I'm on it, or should that go into a seperate PR?

@Gankra
Copy link
Contributor

Gankra commented Feb 17, 2015

Yeah, that's totally reasonable to do at the same time!

@msiemens
Copy link
Contributor

Great! What would be the preferred place where to put the new function? I've added it to libcollections/vec.rs as pub fn from_elem<T: Clone>(elem: T, n: usize) -> Vec<T> for now (currently compiling it)

@Gankra
Copy link
Contributor

Gankra commented Feb 17, 2015

Since it's supposed to only be used by the vec! macro (and will be doc(hidden)), it makes sense to me to put it in macros.rs. Putting it in vec.rs makes sense, too, though.

@msiemens
Copy link
Contributor

vec.rs has a section labeled "Internal methods and functions" that seemed to fit well.

msiemens added a commit to msiemens/rust that referenced this issue Feb 17, 2015
Implement `Vec::from_elem` by making the `vec![element; len]` macro
more powerful (see RFC 832).

Closes rust-lang#22414
alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 18, 2015
Implement `Vec::from_elem` by making the `vec![element; len]` macro more powerful (see rust-lang/rfcs#832).

Closes rust-lang#22414

r? @gankro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants