summary refs log tree commit diff
path: root/tests/ui/rfcs
AgeCommit message (Collapse)AuthorLines
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-3/+3
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-26Auto merge of #116167 - RalfJung:structural-eq, r=lcnrbors-120/+31
remove StructuralEq trait The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more. One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good. Fixes https://github.com/rust-lang/rust/issues/115881
2024-01-24remove StructuralEq traitRalf Jung-120/+31
2024-01-23Remove track_errors entirelyOli Scherer-12/+2
2024-01-22Rollup merge of #120104 - Nadrieril:never-pat-diverges, r=compiler-errorsMatthias Krüger-0/+262
never_patterns: Count `!` bindings as diverging A binding that is a never pattern is not reachable, hence counts as diverging code. This allows in particular `fn foo(!: Void) -> SomeType {}` to typecheck. r? ``@compiler-errors``
2024-01-22Auto merge of #120242 - matthiaskrgr:rollup-a93yj3i, r=matthiaskrgrbors-0/+75
Rollup of 10 pull requests Successful merges: - #117910 (Refactor uses of `objc_msgSend` to no longer have clashing definitions) - #118639 (Undeprecate lint `unstable_features` and make use of it in the compiler) - #119801 (Fix deallocation with wrong allocator in (A)Rc::from_box_in) - #120058 (bootstrap: improvements for compiler builds) - #120059 (Make generic const type mismatches not hide trait impls from the trait solver) - #120097 (Report unreachable subpatterns consistently) - #120137 (Validate AggregateKind types in MIR) - #120164 (`maybe_lint_impl_trait`: separate `is_downgradable` from `is_object_safe`) - #120181 (Allow any `const` expression blocks in `thread_local!`) - #120218 (rustfmt: Check that a token can begin a nonterminal kind before parsing it as a macro arg) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-22Rollup merge of #120097 - Nadrieril:consistent_unreachable_subpats, ↵Matthias Krüger-0/+75
r=compiler-errors Report unreachable subpatterns consistently We weren't reporting unreachable subpatterns in function arguments and `let` expressions. This wasn't very important, but never patterns make it more relevant: a user might write `let (Ok(x) | Err(!)) = ...` in a case where `let Ok(x) = ...` is accepted, so we should report the `Err(!)` as redundant. r? ```@compiler-errors```
2024-01-22Test async fnNadrieril-0/+34
2024-01-22Use `-> !` to test divergenceNadrieril-5/+8
2024-01-22Rollup merge of #119948 - asquared31415:unsafe_op_in_unsafe_fn_fix, r=TaKO8KiMatthias Krüger-0/+1
Make `unsafe_op_in_unsafe_fn` migrated in edition 2024 fixes rust-lang/rust#119823
2024-01-22Never pattern in `let` statement divergesNadrieril-15/+27
2024-01-22Never pattern in function arguments divergesNadrieril-0/+213
2024-01-19Rollup merge of #120009 - Nadrieril:never_patterns_tyck, r=compiler-errorsMatthias Krüger-0/+191
never_patterns: typecheck never patterns This checks that a `!` pattern is only used on an uninhabited type (modulo match ergonomics, i.e. `!` is allowed on `&Void`). r? `@compiler-errors`
2024-01-18Split-off the passing tests to ensure they passNadrieril-17/+24
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