rust-lang.github.io
...This matches conventions elsewhere (like split on strings) and is usually what you want when working with iterators.
The BufReader, BufWriter and BufStream types stay essentially as they are today, except that for streams and writers the into_inner method yields the structure back in the case of a write...
RFC 517
RFC
2014-12-07
~51 min read
rust-lang.github.io
...Cannot infer an appropriate lifetime
...
}
fn main() { }
The reason for this is that because Option is invariant with respect to its argument type, it means that the lifetimes of field1 and field2 must match exactly. It is not good enough for them to have a common subset. This is not...
RFC 738
RFC
2014-12-19
~16 min read
rust-lang.github.io
...This causes problems in practice if that dependency B is also used by the user's code itself, crate B resolves to different versions for each usage, and the values of types from the two crate B instances need to be used together but don't match. In this case...
RFC 1977
RFC
2017-04-03
~15 min read
rust-lang.github.io
...Code that needs to have a cfg expression for a dependency of this kind should use a cfg that matches the condition (like cfg(windows)) or use cfg(accessible(dep_name)) when that syntax is stabilized.
This is somewhat intertwined with the upcoming namespaced features. For an optional dependency, the...
RFC 2957
RFC
2020-05-09
~16 min read
rust-lang.github.io
...unwrap();
if scope != "none" && scope != "false" {
// Runtime working directory of the build script
let cwd = env::var("CARGO_MANIFEST_DIR").unwrap();
let gcc_scope = match scope.as_str() {
"macro" => "-fmacro-prefix-map",
_ => "-ffile-prefix-map",
};
gcc.args([&format!("{gcc_scope}={cwd}=redacted"), &format!("{gcc_scope}={out_dir}=redacted")]);
}
gcc.args...
RFC 3127
RFC
2021-05-24
~15 min read
rust-lang.github.io
...error:
• Couldn't match expected type ‘Int’ with actual type ‘Bar x’
• In the expression: barX
In an equation for ‘baz’: baz _ barX = barX
• Relevant bindings include
barX :: Bar x (bound at main.hs:11:9)
baz :: x -> Bar x -> Int (bound at main.hs:11:3)
<interactive>:3:1...
RFC 2532
RFC
2018-08-27
~37 min read
rust-lang.github.io
...First, if the struct contains a where-clause C matching the above forms, then we add the constraint that C in A[S]. So, for example, in the following struct:
struct Foo<'a, T> where T: 'a { .. }
we would add the constraint that (T: 'a) in A[S].
Next, for...
RFC 2093
RFC
2017-08-02
~17 min read
rust-lang.github.io
...Attendance of these meetings also does not necessarily follow either the distinction between the teams or the separation between libs/libs-api and libs-contributors, with the FCP rights of the top-level teams not matching either those involved in conversations or those doing work on various aspects of libraries...
RFC 3984
RFC
2026-07-15
~17 min read
github.com
...unwrap();
if scope != "none" && scope != "false" {
// Runtime working directory of the build script
let cwd = env::var("CARGO_MANIFEST_DIR").unwrap();
let gcc_scope = match scope.as_str() {
"macro" => "-fmacro-prefix-map",
_ => "-ffile-prefix-map",
};
gcc.args([&format!("{gcc_scope}={cwd}=redacted"), &format!("{gcc_scope}={out_dir}=redacted")]);
}
gcc.args...
RFC 3127
RFC
2021-05-24
~16 min read
rust-lang.github.io
...ToOwned
{
match cow {
Cow::Borrowed(b) => b,
Cow::Owned(_) => panic!(),
}
}
// ^ the trait `std::borrow::ToOwned` is not implemented for `B`
However what we know is that if Cow<'a, B> is well-formed, then B has to implement ToOwned. We would say that such a bound is implied by the...
RFC 2089
RFC
2017-07-28
~18 min read
github.com
...error:
• Couldn't match expected type ‘Int’ with actual type ‘Bar x’
• In the expression: barX
In an equation for ‘baz’: baz _ barX = barX
• Relevant bindings include
barX :: Bar x (bound at main.hs:11:9)
baz :: x -> Bar x -> Int (bound at main.hs:11:3)
<interactive>:3:1...
RFC 2532
RFC
2018-08-27
~39 min read
rust-lang.github.io
...BoxPlace<T>;
fn make_place(self) -> BoxPlace<T> { make_place() }
}
impl<T> proto::Place<T> for BoxPlace<T> {
fn pointer(&mut self) -> *mut T {
match self.fake_box {
Some(ref mut b) => &mut **b as *mut T,
None => panic!("impossible"),
}
}
}
impl<T> proto::BoxPlace<T> for BoxPlace<T> {
fn make...
RFC 809
RFC
2015-02-04
~20 min read
rust-lang.github.io
...Such crates already exist
In particular, the API proposed in this RFC is "stringly-typed" (to make it uniform with the other features being proposed), but arguably a third party crate might want to use an enum to allow pattern-matching on features. These APIs have not been sufficiently explored...
RFC 2045
RFC
2017-06-26
~20 min read
rust-lang.github.io
...The configuration will only be queried if the target triple being built matches what's in the configuration.
Rust build scripts
First pioneered by @tomaka in https://github.com/rust-lang/cargo/issues/610, the build command will no longer be an actual command, but rather a build script itself...
RFC 403
RFC
2014-10-30
~20 min read
rust-lang.github.io
...The error type is one of the biggest pain points when working with futures combinators today, both in trying to get different types to match up, and in inference failures that result when a piece of code cannot produce an error. To be clear, many of these problems will become...
RFC 2592
RFC
2018-11-09
~22 min read
rust-lang.github.io
...In terms of the compiler implementation, what this means is that Edition can change the way that concrete Rust syntax is desugared into MIR (the compiler's internal representation for Rust code), but doesn't change the semantics of MIR itself (or trait matching, etc).
Some examples of changes the...
RFC 3085
RFC
2021-02-19
~23 min read
rust-lang.github.io
...This means that all atomic operations should be implemented with an asm! block or similar that matches what kernel C does, rather than an LLVM intrinsic like we do today.
The Linux Kernel also needs another custom smart pointer called ListArc, which is needed to provide a safe API for...
RFC 3621
RFC
2024-05-01
~23 min read
rust-lang.github.io
...If we did start suggesting bug report templates, then Cargo might also be able to search for issues with descriptions that match the template on that crate's repostory, and advise the user to inspect that bug report to see its current status, rather than file a new bug with...
RFC 2834
RFC
2019-12-10
~24 min read
rust-lang.github.io
...Having to use a .def file has a few extra downsides compared to a version script:
• Having to support both formats
• Lack of support for wildcards means that it is impossible to hide all symbols matching a pattern like *cxxbridge* used by cxx in auto-generated FFI thunks.
• Using a...
RFC 3834
RFC
2025-06-12
~24 min read
rust-lang.github.io
...That works particularly well with teaching Iterator as one of the first real traits you see, since impl Trait is a strong match for working with iterators. As mentioned above, this approach also provides a more intuitive stepping stone for those coming from OO-ish languages. Later, bounded generics can...
RFC 1951
RFC
2017-03-12
~30 min read