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

Add MaybeUninit::new #55252

Merged
merged 1 commit into from
Oct 28, 2018
Merged

Add MaybeUninit::new #55252

merged 1 commit into from
Oct 28, 2018

Conversation

SimonSapin
Copy link
Contributor

Sometimes it is initialized!

Sometimes it *is* initialized!
@SimonSapin SimonSapin added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. B-unstable Blocker: Implemented in the nightly compiler and unstable. labels Oct 21, 2018
@rust-highfive
Copy link
Collaborator

r? @bluss

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2018
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
#[unstable(feature = "maybe_uninit", issue = "53491")]
pub const fn new(val: T) -> MaybeUninit<T> {
MaybeUninit { value: ManuallyDrop::new(val) }
Copy link
Member

@scottmcm scottmcm Oct 22, 2018

Choose a reason for hiding this comment

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

Should this be spelled From::from? (Additionally/instead/never, I don't know.)

Edit: Sorry for spam during the GitHub outage.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do this as From now, then it cannot be const fn for the time being (but hopefully in the future...).

@Centril
Copy link
Contributor

Centril commented Oct 22, 2018

@bluss
Copy link
Member

bluss commented Oct 27, 2018

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 27, 2018

📌 Commit ac18635 has been approved by bluss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 27, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Oct 27, 2018
Add MaybeUninit::new

Sometimes it *is* initialized!
kennytm added a commit to kennytm/rust that referenced this pull request Oct 28, 2018
Add MaybeUninit::new

Sometimes it *is* initialized!
bors added a commit that referenced this pull request Oct 28, 2018
Rollup of 11 pull requests

Successful merges:

 - #55148 (Implement FromStr for PathBuf)
 - #55185 (path suggestions in Rust 2018 should point out the change in semantics)
 - #55191 (Fix sub-variant doc display)
 - #55199 (Impl items have generics)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55252 (Add MaybeUninit::new)
 - #55257 (Allow extern statics with an extern type)
 - #55389 (Remove unnecessary mut in iterator.find_map documentation example, R…)
 - #55406 (Update string.rs)
 - #55412 (Fix an ICE in the min_const_fn analysis)
 - #55421 (Add ManuallyDrop::take)
@bors bors merged commit ac18635 into rust-lang:master Oct 28, 2018
@SimonSapin SimonSapin deleted the maybeuninit-new branch October 29, 2018 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants