about summary refs log tree commit diff
path: root/tests/ui/rfcs
AgeCommit message (Collapse)AuthorLines
2023-11-04Add testsNadrieril-0/+96
2023-11-04Rollup merge of #117343 - Nadrieril:cleanup_check_match, r=davidtwcoTakayuki Maeda-22/+22
Cleanup `rustc_mir_build/../check_match.rs` The file had become pretty unwieldy, with a fair amount of duplication. As a bonus, I discovered that we weren't running some pattern checks in if-let chains. I recommend looking commit-by-commit. The last commit is a whim, I think it makes more sense that way but I don't hold this opinion strongly.
2023-11-03Tweak spans for "adt defined here" noteNadrieril-22/+22
2023-11-02Pretty print Fn traits in rustc_on_unimplementedMichael Goulet-15/+15
2023-11-02add test for #113375Matthias Krüger-0/+18
Fixes #113375
2023-11-02add test for #113381Matthias Krüger-0/+26
Fixes #113381 r? fee1-dead
2023-11-01Stabilize C string literalsJohn Millikin-40/+0
2023-10-30Rollup merge of #117205 - weiznich:multiple_notes_for_on_unimplemented, ↵León Orell Valerian Liehr-0/+3
r=compiler-errors Allows `#[diagnostic::on_unimplemented]` attributes to have multiple notes This commit extends the `#[diagnostic::on_unimplemented]` (and `#[rustc_on_unimplemented]`) attributes to allow multiple `note` options. This enables emitting multiple notes for custom error messages. For now I've opted to not change any of the existing usages of `#[rustc_on_unimplemented]` and just updated the relevant compile tests. r? `@compiler-errors` I'm happy to adjust any of the existing changed location to emit the old error message if that's desired.
2023-10-28make pointer_structural_match warn-by-defaultRalf Jung-10/+113
2023-10-28also lint against fn ptr and raw ptr nested inside the constRalf Jung-3/+19
2023-10-28patterns: reject raw pointers that are not just integersRalf Jung-2/+2
2023-10-27Auto merge of #103208 - cjgillot:match-fake-read, r=oli-obk,RalfJungbors-10/+9
Allow partially moved values in match This PR attempts to unify the behaviour between `let _ = PLACE`, `let _: TY = PLACE;` and `match PLACE { _ => {} }`. The logical conclusion is that the `match` version should not check for uninitialised places nor check that borrows are still live. The `match PLACE {}` case is handled by keeping a `FakeRead` in the unreachable fallback case to verify that `PLACE` has a legal value. Schematically, `match PLACE { arms }` in surface rust becomes in MIR: ```rust PlaceMention(PLACE) match PLACE { // Decision tree for the explicit arms arms, // An extra fallback arm _ => { FakeRead(ForMatchedPlace, PLACE); unreachable } } ``` `match *borrow { _ => {} }` continues to check that `*borrow` is live, but does not read the value. `match *borrow {}` both checks that `*borrow` is live, and fake-reads the value. Continuation of ~https://github.com/rust-lang/rust/pull/102256~ ~https://github.com/rust-lang/rust/pull/104844~ Fixes https://github.com/rust-lang/rust/issues/99180 https://github.com/rust-lang/rust/issues/53114
2023-10-27Allows `#[diagnostic::on_unimplemented]` attributes to have multipleGeorg Semmler-0/+3
notes This commit extends the `#[diagnostic::on_unimplemented]` (and `#[rustc_on_unimplemented]`) attributes to allow multiple `note` options. This enables emitting multiple notes for custom error messages. For now I've opted to not change any of the existing usages of `#[rustc_on_unimplemented]` and just updated the relevant compile tests.
2023-10-26Deny providing explicit effect paramsDeadbeef-0/+185
2023-10-24Use `PlaceMention` for match scrutinees.Camille GILLOT-10/+9
2023-10-23Update `since` stability attributes in testsDavid Tolnay-1/+1
2023-10-22Rollup merge of #117034 - Nadrieril:fix-117033, r=cjgillotMatthias Krüger-0/+7
Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint Oops Fixes https://github.com/rust-lang/rust/issues/117033
2023-10-21Fix #117033Nadrieril-0/+7
2023-10-21Rollup merge of #116992 - estebank:issue-69492, r=oli-obkMatthias Krüger-0/+1
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-10-21Mention the syntax for `use` on `mod foo;` if `foo` doesn't existEsteban Küber-0/+1
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-10-21Auto merge of #116734 - Nadrieril:lint-per-column, r=cjgillotbors-88/+135
Lint `non_exhaustive_omitted_patterns` by columns This is a rework of the `non_exhaustive_omitted_patterns` lint to make it more consistent. The intent of the lint is to help consumers of `non_exhaustive` enums ensure they stay up-to-date with all upstream variants. This rewrite fixes two cases we didn't handle well before: First, because of details of exhaustiveness checking, the following wouldn't lint `Enum::C` as missing: ```rust match Some(x) { Some(Enum::A) => {} Some(Enum::B) => {} _ => {} } ``` Second, because of the fundamental workings of exhaustiveness checking, the following would treat the `true` and `false` cases separately and thus lint about missing variants: ```rust match (true, x) { (true, Enum::A) => {} (true, Enum::B) => {} (false, Enum::C) => {} _ => {} } ``` Moreover, it would correctly not lint in the case where the pair is flipped, because of asymmetry in how exhaustiveness checking proceeds. A drawback is that it no longer makes sense to set the lint level per-arm. This will silently break the lint for current users of it (but it's behind a feature gate so that's ok). The new approach is now independent of the exhaustiveness algorithm; it's a separate pass that looks at patterns column by column. This is another of the motivations for this: I'm glad to move it out of the algorithm, it was akward there. This PR is almost identical to https://github.com/rust-lang/rust/pull/111651. cc `@eholk` who reviewed it at the time. Compared to then, I'm more confident this is the right approach.
2023-10-20s/generator/coroutine/Oli Scherer-14/+14
2023-10-20s/Generator/Coroutine/Oli Scherer-7/+7
2023-10-17Auto merge of #116756 - fee1-dead-contrib:dupe-those-bounds, r=oli-obkbors-32/+563
Duplicate `~const` bounds with a non-const one in effects desugaring This should unblock #116058. r? `@oli-obk`
2023-10-15Duplicate `~const` bounds with a non-const one in effects desugaringDeadbeef-32/+563
2023-10-14Lint `non_exhaustive_omitted_patterns` per columnNadrieril-127/+68
2023-10-14Add and prepare testsNadrieril-48/+154
2023-10-13Stabilize AFIT and RPITITMichael Goulet-9/+7
2023-10-08remove trailing dotsAli MJ Al-Nasrawy-6/+6
2023-10-08always show and explain sub regionAli MJ Al-Nasrawy-1/+15
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+10
2023-09-30Validate `~const` trait bounds on associated fns.Raekye-12/+105
Previously, any associated function could have `~const` trait bounds on generic parameters, which could lead to ICEs when these bounds were used on associated functions of non-`#[const_trait] trait` or non-`impl const` blocks. Includes changes as per @fee1-dead's comments in #116210.
2023-09-22Auto merge of #116077 - matthiaskrgr:rollup-2y1buzg, r=matthiaskrgrbors-6/+6
Rollup of 6 pull requests Successful merges: - #115770 (Match on elem first while building move paths) - #115999 (Capture scrutinee of if let guards correctly) - #116056 (Make unsized casts illegal) - #116061 (Remove TaKO8Ki from review rotation) - #116062 (Change `start` to `#[start]` in some diagnosis) - #116067 (Open the FileEncoder file for reading and writing) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-22Auto merge of #116001 - fmease:validate-crate-name-extern-cli-opt, r=est31bors-15/+1
[breaking change] Validate crate name in `--extern` [MCP 650] Reject non-ASCII-identifier crate names passed to the CLI option `--extern` (`rustc`, `rustdoc`). Implements [MCP 650](https://github.com/rust-lang/compiler-team/issues/650) (except that we only allow ASCII identifiers not arbitrary Rust identifiers). Fixes #113035. [As mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Disallow.20non-identifier-valid.20--extern.20cr.E2.80.A6.20compiler-team.23650/near/376826988), doing a crater run probably doesn't make sense since it wouldn't yield anything. Most users don't interact with `rustc` directly but only ever through Cargo which always passes a valid crate name to `--extern` when it invokes `rustc` and `rustdoc`. In any case, the user wouldn't be able to use such a crate name in the source code anyway. Note that I'm not using [`rustc_session::output::validate_crate_name`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/output/fn.validate_crate_name.html) (used for `--crate-name` and `#![crate_name]`) since the latter doesn't reject non-ASCII crate names and ones that start with a digit. As an aside, I've also thought about getting rid of `validate_crate_name` entirely in a separate PR (with another MCP) in favor of `is_ascii_ident` to reject more weird `--crate-name`s, `#![crate_name]`s and file names but I think that would lead to a lot of actual breakage, namely because of file names starting with a digit. In `tests/ui` 9 tests would be impacted for example. CC `@estebank` r? `@est31`
2023-09-22Change `start` to `#[start]` in some diagnosisEduardo Sánchez Muñoz-6/+6
They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-22Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, r=oli-obkbors-54/+47
Enable effects for libcore ~~r? `@oli-obk~~` forgot you are on vacation, oops
2023-09-20Validate crate name in CLI option --externLeón Orell Valerian Liehr-15/+1
2023-09-20bless the known-bug testsDeadbeef-74/+59
2023-09-20Enable effects for libcoreDeadbeef-113/+121
2023-09-19Add more if let guard testsMatthew Jasper-0/+247
2023-09-15Auto merge of #115859 - compiler-errors:effect-fallback, r=fee1-deadbors-1/+8
Fallback effects even if types also fallback `||` is short circuiting, so if we do ty/int var fallback, we *don't* do effect fallback 😸 r? `@fee1-dead` or `@oli-obk` Fixes #115791 Fixes #115842
2023-09-14Fallback effects even if types also fall backMichael Goulet-1/+8
2023-09-14Auto merge of #115677 - matthewjasper:let-expr-recovery, r=b-naberbors-1694/+1881
Improve invalid let expression handling - Move all of the checks for valid let expression positions to parsing. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress some later errors and MIR construction for invalid let expressions. - Fix a (drop) scope issue that was also responsible for #104172. Fixes #104172 Fixes #104868
2023-09-13Address review commentsMatthew Jasper-0/+343
- Add doc comment to new type - Restore "only supported directly in conditions of `if` and `while` expressions" note - Rename variant with clearer name
2023-09-11Reduce double errors for invalid let expressionsMatthew Jasper-121/+1241
Previously some invalid let expressions would result in both a feature error and a parsing error. Avoid this and ensure that we only emit the parsing error when this happens.
2023-09-11Move let expression checking to parsingMatthew Jasper-1794/+476
There was an incomplete version of the check in parsing and a second version in AST validation. This meant that some, but not all, invalid uses were allowed inside macros/disabled cfgs. It also means that later passes have a hard time knowing when the let expression is in a valid location, sometimes causing ICEs. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress later errors and MIR construction for invalid let expressions.
2023-09-11Don't create drop scopes after item statementsMatthew Jasper-0/+42
These scopes would not exist in MIR and can cause ICEs with invalid uses of let expressions.
2023-09-10Implement fallback for effect paramDeadbeef-0/+9
2023-09-03Auto merge of #115270 - sebastiantoh:issue-105479, r=Nadrierilbors-2/+3
Add note on non-exhaustiveness when matching on str and nested non-exhaustive enums Fixes https://github.com/rust-lang/rust/issues/105479 r? `@Nadrieril`
2023-09-03Improve clarity of diagnostic message on non-exhaustive matchesSebastian Toh-1/+1