Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rust-lang.github.io
nll
...The innermost expression that encloses both of these expressions is the match itself (as depicted above), and hence the borrow is considered to extend until the end of the match. Unfortunately, the match encloses not only the Some branch, but also the None branch, and hence when we go to...
RFC 2094 RFC 2017-08-02 ~66 min read
rust-lang.github.io
...when a target modifier changes), and that match the user's profile. These proposals are drafts and are intended only to signpost future direction for this feature, and ensure compatibility with the current proposal: • build-std.when = "compatible" • build-std.when = "match-profile" ↩ Why does "always" rebuild in release profile...
RFC 3874 RFC 2025-06-05 ~48 min read
rust-lang.github.io
...Note that this can only be done with a compiler that already supports i128/u128 to match the calling convention that LLVM is expecting. Here is the list of functions that need to be implemented: fn __ashlti3(a: i128, b: i32) -> i128; fn __ashrti3(a: i128, b: i32) -> i128; fn...
RFC 1504 RFC 2016-02-21 ~4 min read
rust-lang.github.io
...The app code looks something like: // search for "#define FOO nnn" fn find_c_defines(input: &str) { let rx = Regex::new(r#"^#define\s+(\w+)\s+([0-9]+)\s*(//(.*))?"#).unwrap(); for captures in rx.captures_iter(input) { let my_match: Match = captures.get(1).unwrap(); do_some_work(my_match...
RFC 3191 RFC 2021-11-01 ~21 min read
rust-lang.github.io
...fn deserialize_from(dest: &mut MyBigEnum) -> Result<(), Error> { let tag = deserialize_tag()?; match tag { A => { let payload = deserialize_a()? *dest = A(payload); } .. } Ok(()) } We must construct the entire payload out-of-place, and then move it into place at the end, even though our API is specifically designed to let...
RFC 2195 RFC 2017-10-30 ~13 min read
rust-lang.github.io
...Gc<Monster>, room: &mut Room) { match room.find_random_exit() { None => { } Some(exit) => { victim.move_to_room(exit); } } } As before, we'll start out with a type of Monster, but this type the method move_to_room() has a receiver type of Gc<Monster>. This doesn't match cases 1...
RFC 48 RFC 2014-06-10 ~23 min read
rust-lang.github.io
...p == p.join(dot) p == dot.join(p) p == p.root_path().unwrap_or(dot) .join(p.relative_path()) p.relative_path() == match p.root_path() { None => p, Some(root) => p.path_relative_from(root).unwrap() } p == p.dir_path() .join(p.file_name().unwrap_or(dot)) p == p.iter...
RFC 474 RFC 2014-11-12 ~13 min read
rust-lang.github.io
...A pattern Foo { .. } can match more things than just the expression Foo { .. }, because the pattern matches any value of the unmentioned fields, but the expression sets them to a particular value. This means that, with the unstable inline_const_pat, the arm const { Foo { .. } } => matches less than the arm Foo...
RFC 3681 RFC 2024-08-22 ~44 min read
rust-lang.github.io
...this: match (self, other) { (&Unknown(ref s1), &Unknown(ref s2)) => s1 == s2, (&SuccessfulCompletion, &SuccessfulCompletion) => true, (&Warning, &Warning) => true, (&DynamicResultSetsReturned, &DynamicResultSetsReturned) => true, (&ImplicitZeroBitPadding, &ImplicitZeroBitPadding) => true, . . . (_, _) => false } Even with optimisations enabled, this code is very suboptimal, producing this code. A way to extract the discriminant would allow this code: match (self, other...
RFC 639 RFC 2015-01-21 ~4 min read
rust-lang.github.io
...the type for<'a> fn(Foo<'a>) is Copy for all user-defined types Foo, but there is no way to implement Clone, which is a supertrait of Copy, for it (an impl<T> Clone for fn(T) won't match against the higher-ranked type). The MIR shims for...
RFC 2133 RFC 2017-08-28 ~4 min read
rust-lang.github.io
...The structs can be constructed, destructed, and participate in pattern matches. Private fields on tuple structs will prevent the following behaviors: • Private fields cannot be bound in patterns (both in irrefutable and refutable contexts, i.e. let and match statements). • Private fields cannot be specified outside of the defining module...
RFC 1 RFC 2014-03-11 ~5 min read
rust-lang.github.io
...An enum may be #[repr(transparent)] if it has exactly one variant, and that variant matches the same conditions which struct requires for transparency. Some concrete illustrations follow. A union may be #[repr(transparent)] if it has exactly one non-zero-sized field: // This union has the same representation as...
RFC 2645 RFC 2019-02-13 ~8 min read
rust-lang.github.io
...The crate file I downloaded matches the cksum in the index; the index matches the cksum in the audit log; the public key used in the audit log is the one I expected. This scheme could be augmented to allow the use of several signing technologies. We would need to...
RFC 3231 RFC 2022-02-02 ~24 min read
rust-lang.github.io
...Commands such as cargo check --workspace skip workspace members whose requirements do not match the selected target, much like required-features skips cargo-targets when their required features are not enabled. [package] name = "hello_cargo" required-targets = 'cfg(any(target_os = "linux", target_os = "macos"))' Motivation For more background, see...
RFC 4013 RFC 2026-10-02 ~28 min read
rust-lang.github.io
...Except for the cases handled below, these operations produce results that exactly match IEEE 754-2008 (with roundTiesToEven [except for float-to-int casts, which round towards zero] and default exception handling without traps, without abruptUnderflow/flush-to-zero). % matches the behavior of fmod in C (this operation is not...
RFC 3514 RFC 2023-10-14 ~25 min read
rust-lang.github.io
...Many constructs like match and if, which use curly braces, also do not require semicolons when they begin a statement. Drawbacks • This introduces a difference between different macro invocation delimiters, where previously there was no difference. • This requires the use of semicolons in a few places where it was not...
RFC 378 RFC 2014-10-09 ~2 min read
rust-lang.github.io
...usize) -> u8 { x.drain_range(index).next().unwrap() } fn pop(x: &mut Vec<u8>) -> Option<u8> { match x.len() { 0 => None, n => x.drain_range(n-1).next() } } fn drain(x: &mut Vec<u8>) -> DrainRange<u8> { x.drain_range(0..) } fn clear(x: &mut Vec<u8>) { x.drain_range(0...
RFC 574 RFC 2015-01-12 ~2 min read
rust-lang.github.io
...impl Bar for &str { fn bound(&self) -> &int { ... } } // elided impl<'a> Bar<'a> for &'a str { fn bound<'b>(&'b self) -> &'b int { ... } } // expanded // Note that the preceding example's expanded methods do not match the // signatures from the above trait definition for `Bar`; in the general // case, if the...
RFC 141 RFC 2014-06-24 ~9 min read
rust-lang.github.io
...pub struct Foo(SomeType); // in downstream code let Foo(_) = foo; Changing Foo to a normal struct can break code that matches on it -- but there is never any real reason to match on it in that circumstance, since you cannot extract any fields or learn anything of interest about the...
RFC 1105 RFC 2015-05-04 ~23 min read
rust-lang.github.io
...Drawbacks The intrinsics cannot be used to hint at arms in match expressions. However, given that hints would need to be variants, a simple intrinsic would not be sufficient for those purposes. Alternatives Expose an expect intrinsic. This is what gcc/clang does with __builtin_expect. However there is a...
RFC 1131 RFC 2015-05-20 ~2 min read
"(...) complexity in programming is just like energy in physics: it cannot be created, nor destroyed, but only transformed. So, if a programming langua..."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.