let-else: break out to one scope higher for let-else
```@est31``` This PR follows up with #99518 which is to break out to the last remainder scope. It breaks to the out-most `region_scope` of the block if the first statement is a `let-else`.
Rollup of 15 pull requests
Successful merges:
- #99993 (linker: Update some outdated comments)
- #100220 (Properly forward `ByRefSized::fold` to the inner iterator)
- #100826 (sugg: take into count the debug formatting)
- #100855 (Extra documentation for new formatting feature)
- #100888 (Coherence negative impls implied bounds)
- #100901 (Make some methods private)
- #100906 (Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing)
- #100912 (Diagnose missing includes in run-make tests)
- #100919 (Use par_body_owners for liveness)
- #100922 (Rewrite error index generator to greatly reduce the size of the pages)
- #100926 (Update README.md)
- #100930 (Use `--userns=keep-id` when "docker" is really podman)
- #100938 (rustdoc: remove unused CSS rule)
- #100940 (Do not suggest adding a bound to a opaque type)
- #100945 (Add a missing test case for impl generic mismatch)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Use par_body_owners for liveness
I did this refactoring while working on something else. Liveness is about bodies, there is no reason to use par_for_each_module here.
Tests are updated because things are visited in a different order. I checked diagnostics are same, just in a different (and IMO, better) order.
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing
The error can be quite confusing to newcomers.
Fixes#100873.
I'm not so sure about the message, open to wording suggestions.
Coherence negative impls implied bounds
Fixes#93875
This PR is rebased on top of #100789 and it would need to include that one which is already r+ed.
r? ``@nikomatsakis``
cc ``@lcnr`` (which I've talked about 3222f420d9, I guess after you finish your reordering of modules and work with OutlivesEnvironmentEnv this commit can just be reverted).
sugg: take into count the debug formatting
Closes https://github.com/rust-lang/rust/issues/100648
This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way
``@rustbot`` r? ``@compiler-errors``
N.B: I did not find a full way to test the change, any idea?
fluent: mandate slug names to be prefixed by crate name
This is currently only convention, but not actively checked for.
Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it.
This will conflict with #100671, so I'll leave it as draft until that's merged.
Fix rustc_parse_format precision & width spans
When a `precision`/`width` was `CountIsName - {:name$}` or `CountIs - {:10}` the `precision_span`/`width_span` was set to `None`
For `width` the name span in `CountIsName(_, name_span)` had its `.start` off by one
r? ``@fee1-dead`` / cc ``@PrestonFrom`` since this is similar to #99987
Migrate `rustc_plugin_impl` to `SessionDiagnostic`
Migration of the `rustc_plugin_impl` crate.
~Draft PR because it is blocked on #100694 for `#[fatal(...)]` support~ (this has been merged, and I've changed over to `#[diag(...)]` now too), but I would also like to know if what I did with `LoadPluginError` is okay, because all it does is display the error message from `libloading` ([See conversation on zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20diagnostic.20translation/near/294327843)). This crate is apparently for a deprecated feature which is used by servo, so I don't know how much this matters anyway.
InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>
Fixes#100321.
Use Cell<Option<ErrorGuaranteed>> to guarantee that we emit an error when that flag is set.
Do not re-parse function signatures to suggest generics
This PR uses the existing resolution rib infrastructure to channel the correct span information to suggest generic parameters. This allows to avoid re-parsing a function's source code.
Drive-by cleanup: this removes useless `FnItemRibKind` from late resolution ribs. All the use cases are already covered by `ItemRibKind` and `AssocItemRibKind` which have more precise semantics.
Refactor part of codegen_call_terminator
I was reading through this code and found the chain of `if let` and a nested match on the same value that was matched in the `if let` to be kind of hard to follow. This PR cleans it up by flattening the `if let` chain and nested match into a single `match` expression.
Use separate infcx to solve obligations during negative coherence
I feel like I fixed this already but I may have fixed it then forgot to push the branch...
Also fixes up some redundant param-envs being passed around (since they're already passed around in the `Obligation`)
Fixes#99662
r? ``@spastorino``
Add the armv4t-none-eabi target to the supported_targets
This target was added in #100244 but forgot to add it to the macro in the `mod.rs` file.
``@Lokathor``
Make the GATS self outlives error take into GATs in the inputs
Before, the reasoning was that outlives should factor in to the outlives error, because that value is produced and inputs aren't. However, this is potentially confusing, and we can just require this for now and relax it later if we need. GATs in where clauses still don't count for the self outlives error, and I've added a test for that.
This now errors:
```rust
trait Input {
type Item<'a>;
//~^ missing required
fn takes_item<'a>(&'a self, item: Self::Item<'a>);
}
```
I've also added a test that this does not:
```rust
trait WhereClause {
type Item<'a>;
fn takes_item<'a>(&'a self) where Self::Item<'a>: ;
}
```
r? ``@compiler-errors``
UnreachableProp: Preserve unreachable branches for multiple targets
Before, UnreachablePropagation removed all unreachable branches. This was a pessimization, as it removed information about reachability that was used later in the optimization pipeline.
For example, this code
```rust
pub enum Two { A, B }
pub fn identity(x: Two) -> Two {
match x {
Two::A => Two::A,
Two::B => Two::B,
}
}
```
basically has `switchInt() -> [0: 0, 1: 1, otherwise: unreachable]` for the match. This allows it to be transformed into a simple `x`. If we remove the unreachable branch, the transformation becomes illegal.
This was the problem keeping `UnreachablePropagation` from being enabled, so we can enable it now.
Something similar already happened in #77800, but it did not show a perf improvement there. Let's try it again anyways!
Fixes#68105, although that issue has been fixed for a long time (see #77680).
Convert diagnostics in parser/expr to SessionDiagnostic
This migrates all the easy cases in `rustc_parse::parser::expr` to `SessionDiagnostic`s, I've left things such as `multipart_suggestion`s out for now in the hopes of a derive API being developed soon.