rust-lang.github.io
...Only types which have the "structural match" property can be used as const parameters. This would exclude floats, for example.
The structural match property is intended as a stopgap until a final solution for matching against consts has been arrived at. It is important for the purposes of type equality...
RFC 2000
RFC
2017-05-01
~11 min read
rust-lang.github.io
...The compiler's searching and file matching logic would be altered to only match crates based on name. If two versions of a crate are found, the compiler will unconditionally emit an error. It will be up to the user to move the two libraries on the filesystem and control...
RFC 109
RFC
2014-06-24
~7 min read
rust-lang.github.io
...let a: [uint; 2] = [0u; 2];
Match patterns
In match patterns, .. is always interpreted as a wildcard for constructor arguments (or for slice patterns under the advanced_slice_patterns feature gate). This RFC does not change that. In a match pattern, .. will always be interpreted as a wildcard, and never...
RFC 520
RFC
2014-12-13
~5 min read
rust-lang.github.io
...However, if you're using Clippy, this will cause the match_same_arms lint to trip! You can silence the lint in this spot, and provide an explanation that indicates you are doing so deliberately, by placing this attribute above the match line:
#[allow(match_same_arms, reason = "The arms...
RFC 2383
RFC
2018-04-02
~9 min read
rust-lang.github.io
...In the MIR, all drops are explicit, including those that result from panics and unwinding.
• How matches are desugared. Reasoning about matches has been a traditional source of complexity. Matches combine traversing types with borrows, moves, and all sorts of other things, depending on the precise patterns in use. This...
RFC 1211
RFC
2015-07-14
~27 min read
github.com
...However, if you're using Clippy, this
will cause the `match_same_arms` lint to trip! You can silence the lint in this
spot, and provide an explanation that indicates you are doing so deliberately,
by placing this attribute above the `match` line:
```rust
#[allow(match_same_arms, reason = "The...
RFC 2383
RFC
2018-04-02
~10 min read
rust-lang.github.io
...Attribute invocations can only match the attr rules, and non-attribute invocations can only match the non-attr rules. This allows adding attr rules to an existing macro without breaking backwards compatibility.
An attribute macro may emit code containing another attribute, including one provided by an attribute macro. An attribute...
RFC 3697
RFC
2024-09-20
~7 min read
rust-lang.github.io
...cannot move out of borrowed content
--> /Users/jturner/Source/errors/borrowck-move-out-of-vec-tail.rs:30:17
I’m trying to track the ownership of the contents of `tail`, which is borrowed, through this match
statement:
29 | match tail {
In this match, you use an expression of the...
RFC 1644
RFC
2016-06-07
~13 min read
rust-lang.github.io
...Since we already allow recursion via const fn and termination of said recursion via if or match, all code enabled by const recursion is already legal now. Some algorithms are better expressed as imperative loops and a lot of Rust code uses loops instead of recursion. Allowing loops in constants...
RFC 2344
RFC
2018-02-18
~2 min read
github.com
...Attribute
invocations can only match the `attr` rules, and non-attribute invocations can
only match the non-`attr` rules. This allows adding `attr` rules to an existing
macro without breaking backwards compatibility.
An attribute macro may emit code containing another attribute, including one
provided by an attribute macro. An attribute...
RFC 3697
RFC
2024-09-20
~8 min read
rust-lang.github.io
...The migration lint will be implemented as follows:
• Find method calls matching the name of one of the newly added traits' methods. This can be done either by hardcoding these method names or by setting up some kind of registry through the use of an attribute on the relevant traits...
RFC 3114
RFC
2021-02-16
~6 min read
rust-lang.github.io
...match msg {
// you can reorder too!
Bind { values, formats, .. } => ...
// ...
}
versus
match msg {
Bind(_, _, formats, values, _) => ...
// ...
}
This feature gate was originally put in place because there were many serious bugs in the compiler's support for struct variants. This is not the case today. The issue tracker does not appear have...
RFC 418
RFC
2014-10-25
~2 min read
rust-lang.github.io
...If you publish a crate with a cfg(windows) dependency then crates.io could expand this to all known triples which match cfg(windows) when storing the metadata internally. This would mean that crates using cfg syntax would continue to be compatible with older versions of Cargo so long as...
RFC 1361
RFC
2015-11-10
~4 min read
rust-lang.github.io
...possible extensions
match_cfg
The original version of this RFC was more expansive, and proposed a match_cfg macro that provided some additional checking.
The match_cfg macro takes a sequence of cfg patterns, followed by => and an expression. Its syntax and semantics resembles that of match. However, there are...
RFC 1868
RFC
2016-11-15
~20 min read
rust-lang.github.io
...Features:
+ perf Enables all performance related features
+ perf-dfa Enables the use of a lazy DFA for matching
+ perf-inline Enables the use of aggressive inlining inside
match routines
+ perf-literal Enables the use of literal optimizations for
speeding up matches
+ std When enabled, this will cause regex to use...
RFC 3485
RFC
2023-09-09
~5 min read
rust-lang.github.io
...If any of the strings mentioned in metabuild do not match one of the build-dependencies, Cargo should produce an error (before attempting to generate and compile a build.rs script). However, if a string matches a conditional build-dependency, such as one conditional on a feature or target, then...
RFC 2196
RFC
2017-10-31
~5 min read
rust-lang.github.io
...If we consider a program such as ripgrep, where should hypothetical uses of dbg! print to in the case of rg some_word < input_file > matching_lines? Should they end up on the terminal or in the file matching_lines? Clearly the former is correct in this case.
Outputting lit...
RFC 2361
RFC
2018-03-13
~7 min read
rust-lang.github.io
...High-level summary:
• several unnecessary uses of repr(packed) (patches have been submitted and merged to remove all of these)
• most necessary ones are to match the declaration of a struct in C
• many "necessary" uses can be replaced by byte arrays/arrays of smaller types
• 8 crates are currently...
RFC 1240
RFC
2015-08-06
~10 min read
rust-lang.github.io
...Make extern crate match fuzzily
Alternatively, we can have the compiler consider hyphens and underscores as equal while looking up a crate. In other words, the crate flim-flam would match both extern crate flim_flam and extern crate "flim-flam" as flim_flam.
This involves much more magic than...
RFC 940
RFC
2015-03-05
~3 min read
rust-lang.github.io
...i32 = 3.pow(3);
match x {
CUBE => println!("three cubed"),
_ => {}
}
}
If that const is only used inside a single pattern, writing the code using an inline const block makes it easier to scan.
fn foo(x: i32) {
match x {
const { 3.pow(3) } => println!("three cubed"),
_ => {}
}
}
Reference-level explanation
This...
RFC 2920
RFC
2020-04-30
~7 min read