Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue: Rvalue static promotion #38865
Comments
nrc
added
B-RFC-approved
B-unstable
T-lang
labels
Jan 6, 2017
This comment has been minimized.
This comment has been minimized.
|
If anyone is interested, all you have to do is remove this |
eddyb
added
the
E-easy
label
Jan 6, 2017
This comment has been minimized.
This comment has been minimized.
meetmangukiya
commented
Jan 6, 2017
|
I'd like to take a shot at this |
This comment has been minimized.
This comment has been minimized.
|
Just removing the match statement mentioned by @eddyb results in errors in core, all (at least until abort) related to Is there something going on with I'll start getting familiar with the code.
|
This comment has been minimized.
This comment has been minimized.
|
It's special-cased still in the RFC, it's the only mutable borrow that is promoted, and handling it at the same time as everything else didn't work out, so what you're seeing is entirely expected. |
nagisa
referenced this issue
Jan 28, 2017
Open
Extremely slow optimizer performance when including large array of strings #39352
This comment has been minimized.
This comment has been minimized.
|
Is anybody working on this? Seems like any easy thing to push through. Seems like 1.19 is the earliest this could stablize if it makes it to 1.17 beta. |
This comment has been minimized.
This comment has been minimized.
|
My assessment is still correct AFAIK, not sure what happened to @theduke. |
This comment has been minimized.
This comment has been minimized.
badtuple
commented
Feb 19, 2017
|
Seems like a couple people started and then dropped this...but if no one is working on it still then I'll do it tonight when I get home. |
This comment has been minimized.
This comment has been minimized.
|
FWIW, if you do want to feature-gate this, you'll have to put a condition in the place of |
This comment has been minimized.
This comment has been minimized.
|
Go for it @badtuple ! |
This comment has been minimized.
This comment has been minimized.
|
Hello. Is @badtuple still working on this? If not, I would like to take a shot at this. |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Mar 18, 2017
arielb1
pushed a commit
to arielb1/rust
that referenced
this issue
Mar 18, 2017
arielb1
pushed a commit
to arielb1/rust
that referenced
this issue
Mar 19, 2017
arielb1
pushed a commit
to arielb1/rust
that referenced
this issue
Mar 19, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Mar 19, 2017
brson
referenced this issue
Mar 23, 2017
Closed
Lifetime of fn() converted to &Fn() isn't long enough #28546
This comment has been minimized.
This comment has been minimized.
|
To make it in 1.19 as per the milestone predictions this needs to be stabilized in the cycle that starts tomorrow. This has been implemented and I see no outstanding issues, this just needs someone to start the FCP. |
This comment has been minimized.
This comment has been minimized.
|
#28546 was closed in favour of this, but that issue was in some ways more general because an arbitrary Note that doing this more general solution is likely to be faster, since it doesn't involve double-indirection. |
This comment has been minimized.
This comment has been minimized.
|
@Veedrac This proposal gives you |
This comment has been minimized.
This comment has been minimized.
|
@eddyb Unless I'm misunderstanding, though, it doesn't allow for
|
This comment has been minimized.
This comment has been minimized.
|
@Veedrac According to #28546 (comment) that issue wasn't about And the example you gave is The problem then is the size and alignment information in the vtable - the only way I can think of to avoid abstractions accidentally "copying" 0 bytes of data behind the data pointer (and using the same vtable pointer), without introducing more special traits (e.g |
This comment has been minimized.
This comment has been minimized.
|
@eddyb I think you understand the suggestion correctly. I'm not following what you're saying the problem with copies is, though. Surely " |
This comment has been minimized.
This comment has been minimized.
|
@Veedrac I meant "copy" as in "the I'd comment on #1037 and/or open a new issue/RFC about it if I were you - personally I don't see any problem with a coercion from |
This comment has been minimized.
This comment has been minimized.
rfcbot
added
the
proposed-final-comment-period
label
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jul 22, 2017
•
|
Team member @eddyb has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Mark-Simulacrum
added
the
C-tracking-issue
label
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
|
@eddyb and I discussed a bit this statement of theirs:
and I just wanted to elaborate on what it means for future reference. In short, today, you get an error for something like this: let x = Some(&0);which yields:
As the error says, this is because the temporary for const FOO: Option<&'static i32> = Some(&0);
fn main() { }If we were to adopt the changes described in #40036, however, then this code would be in error again -- the max lifetime of Rvalue promotion resolves by accepting both variants: since |
This was referenced Jul 23, 2017
This comment has been minimized.
This comment has been minimized.
|
(Checking the box for @pnkfelix, who is away) |
rfcbot
added
final-comment-period
and removed
proposed-final-comment-period
labels
Aug 2, 2017
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Aug 2, 2017
|
|
eddyb
referenced this issue
Aug 10, 2017
Open
Access to thread locals isn't inlined across crates #25088
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Aug 12, 2017
|
The final comment period is now complete. |
nrc commentedJan 6, 2017
•
edited by nikomatsakis
RFC: https://github.com/rust-lang/rfcs/blob/master/text/1414-rvalue_static_promotion.md
RFC PR: rust-lang/rfcs#1414
Promote constexpr rvalues to values in static memory instead of stack slots, and expose those in the language by being able to directly create
'staticreferences to them. This would allow code likelet x: &'static u32 = &42to work.Related issues (closed in favor of this one):