rust-lang.github.io
...E) -> Box<Error> {
box err as Box<Error>
}
}
macro_rules! try (
($expr:expr) => ({
use error;
match $expr {
Ok(val) => val,
Err(err) => return Err(error::FromError::from_err(err))
}
})
)
This code depends on multidispatch, because the conversion depends on both the source and target error types. (In today's Rust...
RFC 201
RFC
2014-07-17
~8 min read
rust-lang.github.io
...if we require exact matches, then all CUs must agree because all CUs depend on core. The missed detection requires that we don't consider AB or BC incompatible. This could be an argument in favor of not allowing any mismatches with the shadow call stack sanitizer (which you never...
RFC 3716
RFC
2024-10-24
~18 min read
rust-lang.github.io
...The compiler then checks if the attribute matches any of the declared or built- in attributes. If this fails, then it reports a macro not found error. The compiler may suggest mis-typed attributes (declared or built-in).
A similar opt-in mechanism will exist for lints.
Proposed for immediate...
RFC 2103
RFC
2016-09-22
~8 min read
rust-lang.github.io
...Fn(T) -> T
{
let mut cursor = list.cursor_front_mut();
// move to the first element, if it exists
loop {
let should_replace = match cursor.peek_next() {
Some(element) => p(element),
None => break,
};
if should_replace {
let old_element = cursor.remove_current().unwrap();
cursor.insert_after(f(old_element));
}
cursor.move...
RFC 2570
RFC
2018-10-14
~9 min read
rust-lang.github.io
...let mut future = IntoFuture::into_future($expression);
let mut pin = unsafe { Pin::new_unchecked(&mut future) };
loop {
match Future::poll(Pin::borrow(&mut pin), &mut ctx) {
Poll::Ready(item) => break item,
Poll::Pending => yield,
}
}
This is not a literal expansion, because the yield concept cannot be expressed in the surface...
RFC 2394
RFC
2018-03-30
~20 min read
rust-lang.github.io
...let this = unsafe { Pin::get_unchecked_mut(self) };
match this.state {
0 => {
// The first time, set up the pointer.
this.ptr_to_data = ptr::addr_of_mut!(this.data);
// Now yield.
this.state += 1;
Poll::Pending
}
1 => {
// After coming back from the yield, write to the pointer.
unsafe { this.ptr...
RFC 3467
RFC
2024-06-17
~20 min read
rust-lang.github.io
...The RFC author argues the chosen syntax is the most suitable, because it matches the existing syntax for named arguments.
Alternative Solution - Interpolation
Some may argue that if it becomes possible to write identifiers into format strings and have them passed as implicit named arguments to the macro, why not...
RFC 2795
RFC
2019-10-27
~20 min read
github.com
...Fn(T) -> T
{
let mut cursor = list.cursor_front_mut();
// move to the first element, if it exists
loop {
let should_replace = match cursor.peek_next() {
Some(element) => p(element),
None => break,
};
if should_replace {
let old_element = cursor.remove_current().unwrap();
cursor.insert_after(f(old_element));
}
cursor.move...
RFC 2570
RFC
2018-10-14
~9 min read
rust-lang.github.io
...For a final product (outputs that aren't rlibs) the -C panic mode of the panic runtime must match the final product itself. If the panic mode is abort, then no other validation is performed, but otherwise all crates in the DAG must have the same value of -C panic...
RFC 1513
RFC
2016-02-25
~9 min read
rust-lang.github.io
...This avoids ambiguity for the span overlapping actual bytes in any existing files on disk, and matches precedent in other toolchains, e.g., see clang's output for --include on the command line:
$ touch t.h
$ clang t.h --include foo.h
<built-in>:1:10: fatal error: 'foo.h...
RFC 3791
RFC
2025-03-16
~9 min read
rust-lang.github.io
...A driving motivation for a f16b type is to close that interop gap, in a similar spirit to RFC 3892, which proposes core::num::Complex to match C99 _Complex at the FFI boundary.
Beyond raw hardware support, f16b is already supported in the surrounding ecosystem. A f16b type is provided...
RFC 3983
RFC
2026-05-27
~20 min read
rust-lang.github.io
...failed to select a version for the requirement `clap_builder = "=4.4.8"`
candidate versions found which didn't match: 4.3.24
location searched: crates.io index
required by package `clap v4.4.8`
... which satisfies dependency `clap = "^4.4.8"` (locked to 4.4.8) of package `msrv...
RFC 3537
RFC
2023-11-14
~51 min read
rust-lang.github.io
...We can certainly emulate any model we want; the original doc argues that the process described here matches what the team has already informally employed.
However, there is value in setting down formal expectations. It is healthy for us to tell our teammates: We want each of you to have...
RFC 3262
RFC
2022-05-09
~10 min read
rust-lang.github.io
...This complication is unfortunate, but to a large extent already exists with where-clauses and trait matching (see e.g. #21974). (Moreover, it seems to be inherent to the concept of associated types, since they take several inputs (the parameters to the trait) which may or may not be related...
RFC 1214
RFC
2015-07-17
~33 min read
rust-lang.github.io
...the check recursively traverses the type of the constant and ensures that the data matches that type.
Operations that might fail include:
• //%
• panic! (including the assertion that follows Checked* arithmetic to ensure that no overflow happened)
• array/slice indexing
• any unsafe operation
• const fn calls (as they might do any...
RFC 3027
RFC
2020-11-08
~10 min read
rust-lang.github.io
...However, if changes are later made, the compiler will naturally have to be adjusted to match.
It is expected that the lang team will be highly involved in this discussion.
Detailed rules
Once we've settled on a high-level path -- and, no doubt, while in the process of doing...
RFC 1643
RFC
2016-06-07
~10 min read
rust-lang.github.io
...This RFC aims to provide clarity by providing new distinct terminology that matches the intent behind "Team Working Groups", as well as codify some of the processes that these groups have been using to help facilitate creating new groups.
Guide-level explanation
To address this confusion this RFC proposes switching...
RFC 2856
RFC
2015-05-21
~11 min read
rust-lang.github.io
...trait IntoSendIterator {
type Item;
fn into_iter(self) -> impl Iterator<Item = Self::Item> + Send;
}
// OK (signatures match exactly):
impl IntoSendIterator for Vec<u32> {
type Item = u32;
fn into_iter(self) -> impl Iterator<Item = u32> + Send {
self.into_iter()
}
}
// OK (auto traits leak, so adding `+ Send` here is NOT required):
impl...
RFC 3425
RFC
2023-04-27
~24 min read
rust-lang.github.io
...References could be in multiple crates, so we would need to reload incremental compilation data (which must include the serialised MIR, or something equivalent) for all crates, then search this data for matching identifiers. Assuming the serialisation format is not too complex, this should be possible in a reasonable amount...
RFC 1317
RFC
2015-10-13
~11 min read
rust-lang.github.io
...try_reserve's only serious drawback is that it isn't a complete solution, and it may not idiomatically match future "complete" solutions to the problem.
Rationale and Alternatives
Always panic on OOM
We probably shouldn't mandate this in the actual Alloc trait, but certainly we could change how...
RFC 2116
RFC
2017-08-18
~24 min read