about summary refs log tree commit diff
path: root/tests/ui/rfcs
AgeCommit message (Collapse)AuthorLines
2024-01-18Typecheck never patternsNadrieril-5/+78
2024-01-18Add testsNadrieril-0/+111
2024-01-18Rollup merge of #119869 - oli-obk:track_errors2, r=matthewjasperMatthias Krüger-2/+12
replace `track_errors` usages with bubbling up `ErrorGuaranteed` more of the same as https://github.com/rust-lang/rust/pull/117449 (removing `track_errors`)
2024-01-18Consistently warn unreachable subpatternsNadrieril-4/+18
2024-01-18Add testsNadrieril-0/+61
2024-01-18Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkovMatthias Krüger-0/+0
Detect `NulInCStr` error earlier. By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars. NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together. One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error. r? ```@fee1-dead```
2024-01-17Move `check_mod_impl_wf` query call out of track_errors and bubble errors up ↵Oli Scherer-2/+12
instead.
2024-01-15make unsafe_op_in_unsafe_fn MachineApplicable and add it to 2024 compatibilityasquared31415-0/+1
2024-01-15Auto merge of #119610 - Nadrieril:never_pattern_bindings, r=compiler-errorsbors-1/+104
never patterns: Check bindings wrt never patterns Never patterns: - Shouldn't contain bindings since they never match anything; - Don't count when checking that or-patterns have consistent bindings. r? `@compiler-errors`
2024-01-13Auto merge of #119088 - George-lewis:glewis/suggest-upgrading-compiler, ↵bors-0/+45
r=Nilstrieb Suggest Upgrading Compiler for Gated Features This PR addresses #117318 I have a few questions: 1. Do we want to specify the current version and release date of the compiler? I have added this in via environment variables, which I found in the code for the rustc cli where it handles the `--version` flag a. How can I handle the changing message in the tests? 3. Do we want to only show this message when the compiler is old? a. How can we determine when the compiler is old? I'll wait until we figure out the message to bless the tests
2024-01-13Bless testsGeorge-lewis-0/+45
Update tests
2024-01-12Allow `~const` on assoc ty bounds againLeón Orell Valerian Liehr-59/+149
2024-01-12Detect `NulInCStr` error earlier.Nicholas Nethercote-0/+0
By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars. NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together. One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error.
2024-01-10Add more testsNadrieril-1/+46
2024-01-09Auto merge of #117449 - oli-obk:query_merge_immobile_game, r=matthewjasperbors-50/+205
Avoid silencing relevant follow-up errors r? `@matthewjasper` This PR only adds new errors to tests that are already failing and fixes one ICE. Several tests were changed to not emit new errors. I believe all of them were faulty tests, and not explicitly testing for the code that had new errors.
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-50/+205
2024-01-09Check bindings around never patternsNadrieril-40/+27
2024-01-09Add testsNadrieril-0/+71
2024-01-08Remove logic in one_bound in astconv that prefers non-const boundsMichael Goulet-12/+11
2024-01-08~const trait or projection bounds do not imply non-const boundsMichael Goulet-33/+208
2024-01-08Rollup merge of #119705 - fmease:tilde-const-assoc-fns-trait-impls, ↵Matthias Krüger-17/+49
r=compiler-errors Support `~const` in associated functions in trait impls Fixes #119700.
2024-01-07effects: support ~const in assoc fns in trait implsLeón Orell Valerian Liehr-17/+49
2024-01-05Rollup merge of #119622 - Nadrieril:never_patterns_macros, r=compiler-errorsMatthias Krüger-0/+54
never patterns: Document behavior of never patterns with macros-by-example `never_patterns` makes `!` parse as a pattern so I was worried about breaking macros-by-example matching. Turns out we're fine because the cases that now match `$p:pat` used to error in the past. The only tricky case is `!` by itself, which backwards-compatibly doesn't match `$p:pat`. I have no idea why tho, I didn't think of that when I was implementing parsing :sweat_smile:. This adds tests so we don't regress the current behavior. r? `@compiler-errors`
2024-01-05Rollup merge of #119554 - matthewjasper:remove-guard-distinction, ↵Matthias Krüger-2/+104
r=compiler-errors Fix scoping for let chains in match guards If let guards were previously represented as a different type of guard in HIR and THIR. This meant that let chains in match guards were not handled correctly because they were treated exactly like normal guards. - Remove `hir::Guard` and `thir::Guard`. - Make the scoping different between normal guards and if let guards also check for let chains. closes #118593
2024-01-05Document behavior of `!` with MbENadrieril-0/+54
2024-01-05Restore if let guard temporary scoping differenceMatthew Jasper-0/+72
Match guards with an if let guard or an if let chain guard should have a temporary scope of the whole arm. This is to allow ref bindings to temporaries to borrow check.
2024-01-05Remove `thir::Guard`Matthew Jasper-0/+30
Use Expr instead. Use `ExprKind::Let` to represent if let guards.
2024-01-05Remove `hir::Guard`Matthew Jasper-2/+2
Use Expr instead. Use `ExprKind::Let` to represent if let guards.
2024-01-05Stabilize THIR unsafeckMatthew Jasper-24/+24
2024-01-05Remove revisions for THIR unsafeckMatthew Jasper-37/+152
This is to make the diff when stabilizing it easier to review.
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-11/+11
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-04Rollup merge of #119540 - fmease:no-effect-args-inside-dyn-trait, ↵Matthias Krüger-2/+32
r=compiler-errors Don't synthesize host effect args inside trait object types While we were indeed emitting an error for `~const` & `const` trait bounds in trait object types, we were still synthesizing host effect args for them. Since we don't record the original trait bound modifiers for dyn-Trait in `hir::TyKind::TraitObject` (unlike we do for let's say impl-Trait, `hir::TyKind::OpaqueTy`), AstConv just assumes `ty::BoundConstness::NotConst` in `conv_object_ty_poly_trait_ref` which given `<host> dyn ~const NonConstTrait` resulted in us not realizing that `~const` was used on a non-const trait which lead to a failed assertion in the end. Instead of updating `hir::TyKind::TraitObject` to track this kind of information, just strip the user-provided constness (similar to #119505). Fixes #119524.
2024-01-03Rollup merge of #119505 - fmease:no-host-param-for-trait-fns, r=fee1-deadLeón Orell Valerian Liehr-0/+80
Don't synthesize host effect params for trait associated functions marked const Fixes #113378. r? fee1-dead or compiler
2024-01-03Don't synthesize host effect args inside trait object typesLeón Orell Valerian Liehr-2/+32
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-11/+11
2024-01-02E0379: Provide suggestionsLeón Orell Valerian Liehr-3/+55
2024-01-02E0379: Make diagnostic more preciseLeón Orell Valerian Liehr-3/+3
2024-01-02Don't synthesize host effect params for trait assoc fns marked constLeón Orell Valerian Liehr-0/+28
2024-01-01Pretty-print always-const trait predicates correctlyLeón Orell Valerian Liehr-3/+73
2023-12-30Auto merge of #119284 - Nadrieril:fix-bodiless-arm-parse, r=cjgillotbors-0/+37
Don't drop a hir node after lowering Fixes https://github.com/rust-lang/rust/issues/119271. It seems that all hir nodes that get allocated an id must be placed within the hir on pain of ICEs. In https://github.com/rust-lang/rust/pull/118527 I dropped guards on never patterns since they're not useful, which caused the ICE.
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-75/+317
2023-12-26Don't drop a hir node after loweringNadrieril-0/+37
2023-12-25Auto merge of #119122 - matthewjasper:if-let-guard-scoping, r=TaKO8Kibors-0/+134
Give temporaries in if let guards correct scopes Temporaries in if-let guards have scopes that escape the match arm, this causes problems because the drops might be for temporaries that are not storage live. This PR changes the scope of temporaries in if-let guards to be limited to the arm: ```rust _ if let Some(s) = std::convert::identity(&Some(String::new())) => {} // Temporary for Some(String::new()) is dropped here ^ ``` We also now deduplicate temporaries between copies of the guard created for or-patterns: ```rust // Only create a single Some(String::new()) temporary variable _ | _ if let Some(s) = std::convert::identity(&Some(String::new())) => {} ``` This changes MIR building to pass around `ExprId`s rather than `Expr`s so that we have a way to index different expressions. cc #51114 Closes #116079
2023-12-23add a test for ICE #112822Deadbeef-0/+34
2023-12-23Auto merge of #119072 - fee1-dead-contrib:effects-fixes, r=compiler-errorsbors-86/+96
Clean up `check_consts` and misc fixes 1. Remove most of the logic around erroring with trait methods. I have kept the part resolving it to a concrete impl, as that is used for const stability checks. 2. Turning on `effects` causes ICE with generic args, due to `~const Tr` when `Tr` is not `#[const_trait]` tripping up expectation in code that handles generic args, more specifically here: https://github.com/rust-lang/rust/blob/8681e077b8afa99d60acf8f8470a012a3ce709a5/compiler/rustc_hir_analysis/src/astconv/generics.rs#L377 We set `arg_count.correct` to `Err` to correctly signal that an error has already been reported. 3. UI test blesses. Edit(fmease): Fixes #117244 (UI test is in #119099 for now). r? compiler-errors
2023-12-21Give temporaries in if let guards correct scopesMatthew Jasper-0/+134
- Make temporaries in if-let guards be the same variable in MIR when the guard is duplicated due to or-patterns. - Change the "destruction scope" for match arms to be the arm scope rather than the arm body scope. - Add tests.
2023-12-19bless ui testsDeadbeef-86/+96
2023-12-18Check const_eval_select intrinsic correctlyMichael Goulet-1/+6
2023-12-18Check FnPtr/FnDef built-in fn traits correctly with effectsMichael Goulet-2/+13
2023-12-18Rollup merge of #119059 - fmease:no-tilde-const-in-inh-impl-headers, r=fee1-deadMatthias Krüger-17/+19
Deny `~const` trait bounds in inherent impl headers Follow-up to #117817. Implements https://github.com/rust-lang/rust/pull/117817#discussion_r1416213747. Fixes #117004. r? fee1-dead or compiler