about summary refs log tree commit diff
path: root/src/test/ui/rfc-2497-if-let-chains
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-3317/+0
2022-12-10Introduce `with_forced_trimmed_paths`Esteban Küber-19/+19
2022-11-23Add regression test for issue 99938est31-0/+31
That issue was a dupe of 99852, but it's always better to have multiple regression tests rather than one.
2022-11-14Show a note where a macro failed to matchNilstrieb-0/+6
This shows a small note on what the macro matcher was currently processing to aid with "no rules expected the token X" errors.
2022-10-14Suppress irrefutable let patterns lint for prefixes in match guardsest31-14/+23
In match guards, irrefutable prefixes might use the bindings created by the match pattern. Ideally, we check for this, but we can do the next best thing and just not lint for irrefutable prefixes in match guards.
2022-10-06Rollup merge of #102708 - TaKO8Ki:improve-eqeq-suggestion, r=estebankMatthias Krüger-2/+2
Suggest `==` to wrong assign expr Given the following code: ```rust fn main() { let x = 3; let y = 3; if x == x && y = y { println!("{}", x); } } ``` Current output is: ``` error[E0308]: mismatched types --> src/main.rs:4:18 | 4 | if x == x && y = y { | ^ expected `bool`, found integer error[E0308]: mismatched types --> src/main.rs:4:8 | 4 | if x == x && y = y { | ^^^^^^^^^^^^^^^ expected `bool`, found `()` ``` This adds a suggestion: ```diff error[E0308]: mismatched types --> src/main.rs:6:18 | 6 | if x == x && y = y { | ^ expected `bool`, found integer error[E0308]: mismatched types --> src/main.rs:6:8 | 6 | if x == x && y = y { | ^^^^^^^^^^^^^^^ expected `bool`, found `()` | + help: you might have meant to compare for equality + | + 6 | if x == x && y == y { + | + ``` And this fixes a part of #97469
2022-10-05suggest `==` to the rest of assign exprTakayuki Maeda-2/+2
2022-10-01bless ui testsMaybe Waffle-2/+2
2022-09-15Remove the let_else feature gate from the testsuiteest31-1/+1
Result of running: rg -l "feature.let_else" src/test/ | xargs sed -s -i "s#^...feature.let_else..\$##" Plus manual tidy fixes.
2022-09-04Use head span for rustc_on_unimplemented's enclosing_scope attrMichael Goulet-33/+15
2022-08-29Revert let_chains stabilizationNilstrieb-340/+478
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-01Use expr parse restrictions for let expr parsingMichael Goulet-242/+312
2022-07-16Stabilize `let_chains`Caio-468/+330
2022-07-08Fix last let_chains blockerCaio-269/+730
2022-07-08Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebankbors-2/+2
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-07Review comments: wordingEsteban Küber-6/+6
2022-07-07Tweak wording and spansEsteban Küber-6/+6
2022-07-07On partial uninit error point at where we need initEsteban Küber-9/+21
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.
2022-07-07Shorten span for closures.Camille GILLOT-2/+2
2022-06-25[rustc_parse] Forbid lets in certain placesCaio-186/+409
2022-06-21Improve suggestion for calling closure on type mismatchMichael Goulet-0/+8
2022-06-16diagnostics: fix trailing spaceklensy-4/+4
2022-06-13Improve parsing errors and suggestions for bad if statementsMichael Goulet-12/+30
2022-03-31[let_chains] Forbid let inside parenthesesCaio-461/+709
2022-03-25Minor `let_chains` modificationCaio-11/+11
2022-03-16Rollup merge of #94974 - c410-f3r:let-chain-dashufwrqwemkf-let-else, ↵Dylan DPC-0/+173
r=joshtriplett Ensure that `let_else` does not interact with `let_chains` As requested on https://github.com/rust-lang/rust/pull/94927. cc `@joshtriplett` `@estebank`
2022-03-16Extend the irrefutable_let_patterns lint to let chainsest31-10/+158
Only look for complete suffixes or prefixes of irrefutable let patterns, so that an irrefutable let pattern in a chain surrounded by refutable ones is not linted, as it is an useful pattern.
2022-03-15Ensure that `let_else` does not interact with `let_chains`Caio-0/+173
2022-03-09Warn users about || in let chain expressionsCaio-55/+110
2022-02-27Make deref suggestion betterMichael Goulet-0/+12
2022-01-22Fix let_chains and if_let_guard feature flagsCaio-0/+30
2022-01-19Add tests to ensure that let_chains works with if_let_guardCaio-2/+26
2022-01-18Formally implement let chainsCaio-214/+337
2021-12-14Make TyS::is_suggestable more structualMichael Goulet-2/+6
2021-12-01Pretty print empty blocks as {}David Tolnay-1/+1
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-45/+0
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-55/+55
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-118/+108
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-408/+155
2021-08-11Modify structured suggestion outputEsteban Küber-13/+18
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-07-30Use multispan suggestions more oftenEsteban Küber-8/+12
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-9/+45
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-05-06Better rustc_on_unimplemented, and UI test fixesScott McMurray-21/+21
2021-03-10Rollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakisDylan DPC-1/+1
Edition-specific preludes This changes `{std,core}::prelude` to export edition-specific preludes under `rust_2015`, `rust_2018` and `rust_2021`. (As suggested in https://github.com/rust-lang/rust/issues/51418#issuecomment-395630382.) For now they all just re-export `v1::*`, but this allows us to add things to the 2021edition prelude soon. This also changes the compiler to make the automatically injected prelude import dependent on the selected edition. cc `@rust-lang/libs` `@djc`
2021-03-07Remove notes, increase S/N ratioEsteban Küber-3/+0
2021-03-07Add help suggesting `matches` to `let_chains` lintEsteban Küber-0/+32
2021-03-07Account for `if (let pat = expr) {}`Esteban Küber-188/+112
Partially address #82827.
2021-02-25Update test output for edition preludes.Mara Bos-1/+1
2020-12-26update testsBastian Kauschke-1/+0
2020-10-26Suggest expressions that look like const generic arguments should be ↵varkor-5/+21
enclosed in brackets Co-Authored-By: Esteban Kuber <github@kuber.com.ar>