[`option_if_let_else`]: suggest `.as_ref()` if scrutinee is of type `&Option<_>`
Fixes#10729
`Option::map_or` takes ownership, so if matching on an `&Option<_>`, we need to suggest `.as_ref()` before calling `map_or` to get the same effect and to not cause a borrowck error.
changelog: [`option_if_let_else`]: suggest `.as_ref()`/`.as_mut()` if scrutinee is of type `&Option<_>`/`&mut Option<_>`
Rollup of 6 pull requests
Successful merges:
- #111571 (Implement proposed API for `proc_macro_span`)
- #112236 (Simplify computation of killed borrows)
- #112867 (More `ImplSource` nits)
- #113019 (add note for non-exhaustive matches with guards)
- #113094 (Fix invalid HTML DIV tag used in HEAD)
- #113111 (add myself to review for t-types stuff)
r? `@ghost`
`@rustbot` modify labels: rollup
Try running a sync automatically
absolutely no clue if this works, but it happens after the zulip message, so worst case we'll see the failure after the cron job did everything it currently does.
add note for non-exhaustive matches with guards
Associated issue: #92197
When a match statement includes guards on every match arm (and is therefore necessarily non-exhaustive), add a note to the error E0004 diagnostic noting this.
[`unused_async`]: don't lint if function is part of a trait
Fixes#10459.
We shouldn't lint if the function is part of a trait, because the user won't be able to easily remove the `async`, as this will then not match with the function signature in the trait definition
changelog: [`unused_async`]: don't lint if function is part of a trait
New lints ['`needless_pub_self`], [`pub_with_shorthand`] and [`pub_without_shorthand`]
Closes#10963Closes#10964
changelog: New lints ['`needless_pub_self`], [`pub_with_shorthand`] and [`pub_without_shorthand`]
Validate fluent variable references in tests
Closes#101109
Under `cfg(test)`, the `fluent_messages` macro will emit a list of variables referenced by each message and its attributes. The derive attribute will now emit a `#[test]` that checks that each referenced variable exists in the structure it's applied to.
Use substring matching for TESTNAME
Restores the previous behaviour of matching using a substring match rather than needing a full match
changelog: none
To make it easier to verify that the output snapshots have been migrated
faithfully, this change adds some temporary helper code that lets us avoid
having to completely re-bless the existing snapshots.
A later change in this PR will then re-bless the tests and remove the temporary
helper code.
Currently a test without a `failure-status` directive is treated as having an
expected failure-status of 1, but `run-coverage` tests will want to treat those
tests as expecting success instead.
This will allow the `run-coverage` mode to easily set environment variable
`LLVM_PROFILE_FILE`, and to prevent the executable from being deleted after a
successful run.
mir opt + codegen: handle subtyping
fixes#107205
the same issue was caused in multiple places:
- mir opts: both copy and destination propagation
- codegen: assigning operands to locals (which also propagates values)
I changed codegen to always update the type in the operands used for locals which should guard against any new occurrences of this bug going forward. I don't know how to make mir optimizations more resilient here. Hopefully the added tests will be enough to detect any trivially wrong optimizations going forward.