methods.
This paves the way to associated items by introducing an extra level of
abstraction ("impl-or-trait item") between traits/implementations and
methods. This new abstraction is encoded in the metadata and used
throughout the compiler where appropriate.
There are no functional changes; this is purely a refactoring.
r? @nick29581
methods.
This paves the way to associated items by introducing an extra level of
abstraction ("impl-or-trait item") between traits/implementations and
methods. This new abstraction is encoded in the metadata and used
throughout the compiler where appropriate.
There are no functional changes; this is purely a refactoring.
This patch primarily does two things: (1) it prevents lifetimes from
leaking out of unboxed closures; (2) it allows unboxed closure type
notation, call notation, and construction notation to construct closures
matching any of the three traits.
This breaks code that looked like:
let mut f;
{
let x = &5i;
f = |&mut:| *x + 10;
}
Change this code to avoid having a reference escape. For example:
{
let x = &5i;
let mut f; // <-- move here to avoid dangling reference
f = |&mut:| *x + 10;
}
I believe this is enough to consider unboxed closures essentially
implemented. Further issues (for example, higher-rank lifetimes) should
be filed as followups.
Closes#14449.
[breaking-change]
r? @pnkfelix
This patch primarily does two things: (1) it prevents lifetimes from
leaking out of unboxed closures; (2) it allows unboxed closure type
notation, call notation, and construction notation to construct closures
matching any of the three traits.
This breaks code that looked like:
let mut f;
{
let x = &5i;
f = |&mut:| *x + 10;
}
Change this code to avoid having a reference escape. For example:
{
let x = &5i;
let mut f; // <-- move here to avoid dangling reference
f = |&mut:| *x + 10;
}
I believe this is enough to consider unboxed closures essentially
implemented. Further issues (for example, higher-rank lifetimes) should
be filed as followups.
Closes#14449.
[breaking-change]
* `rust.md`: changes for consistency
* `guide-ffi.md`: wrapped inline code
NOTE: This is a duplicate of #16375. I completely messed up that fork, so I made a new fork.
by-reference upvars.
This partially implements RFC 38. A snapshot will be needed to turn this
on, because stage0 cannot yet parse the keyword.
Part of #12831.
r? @alexcrichton
by-reference upvars.
This partially implements RFC 38. A snapshot will be needed to turn this
on, because stage0 cannot yet parse the keyword.
Part of #12381.
We shouldn't be setting conceallevel in the syntax file. Besides not
being able to undo this if we switch to another syntax later, it also
interferes with embedding rust in other filetypes (such as markdown).
Instead, set it in the ftplugin, where it belongs.
Currently, the Timer methods take an integer number of ms. This is considered a bug because a) types, b) some timers have ns precision.
This plucks the `Duration` type from [rust-chrono](https://github.com/lifthrasiir/rust-chrono), plops it into `std::time`, and replaces the arguments to `sleep`, `oneshot`, and `periodic` timers with it. It leaves the old methods intact as `sleep_ms`, `oneshot_ms`, and `periodic_ms`, for convenience.
Closes https://github.com/rust-lang/rust/issues/11189.
cc @lifthrasiir @aturon @kballard @alexcrichton
Put `Duration` in `time::duration`, where the two constants can
be called just `MAX` and `MIN`. Reexport from `time`.
This provides more room for the time module to expand.