Avoid reporting overflow in `is_impossible_method`
Fixes#100620
We're evaluating a new predicate in a different param-env than it was checked during typeck, so be more careful about handling overflow errors. Instead of using `FulfillmentCtxt`, using `InferCtxt::evaluate_obligation` by itself will give us back the overflow error, so we can throw it away properly.
This may give us more false-positives, but it doesn't regress the `<HashMap as Iterator>::rev` example that originally motivated adding `is_impossible_method` in the first place.
Elaborate all box dereferences in `ElaborateBoxDerefs`
so that it is the only pass responsible for elaboration, instead of
splitting this responsibility between the `StateTransform` and
`ElaborateBoxDerefs`.
distinguish the method and associated function diagnostic information
Methods are defined within the context of a struct and their first parameter is always self
Associated functions don’t take self as a parameter
```
modified: compiler/rustc_typeck/src/check/method/suggest.rs
modified: src/test/ui/auto-ref-slice-plus-ref.stderr
modified: src/test/ui/block-result/issue-3563.stderr
modified: src/test/ui/issues/issue-28344.stderr
modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr
modified: src/test/ui/suggestions/suggest-methods.stderr
modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr
```
add `depth_limit` in `QueryVTable` to avoid entering a new tcx in `layout_of`
Fixes#49735
Updates #48685
The `layout_of` query needs to check whether it overflows the depth limit, and the current implementation needs to create a new `ImplicitCtxt` inside `layout_of`. However, `start_query` will already create a new `ImplicitCtxt`, so we can check the depth limit in `start_query`.
We can tell whether we need to check the depth limit simply by whether the return value of `to_debug_str` of the query is `layout_of`. But I think adding the `depth_limit` field in `QueryVTable` may be more elegant and more scalable.
so that it is the only pass responsible for elaboration, instead of
splitting this responsibility between the `StateTransform` and
`ElaborateBoxDerefs`.
Check projection types before inlining MIR
Fixes https://github.com/rust-lang/rust/issues/100550
I'm very unhappy with this solution, having to duplicate MIR validation code, but at least it removes the ICE.
r? `@compiler-errors`
A resume place is evaluated and assigned to only after a yield
terminator resumes. Ensure that locals used when evaluating the
resume place are live across the yield.
Elide superfluous storage markers
Follow the existing strategy of omitting the storage markers for temporaries
introduced for internal usage when elaborating derefs and deref projections.
Those temporaries are simple scalars which are used immediately after being
defined and never have their address taken. There is no benefit from storage
markers from either liveness analysis or code generation perspective.
Sync rustc_codegen_cranelift
The main highlights this time are support for parallel compilation of codegen units (by me) and improved windows support (by ``@afonso360)`` In addition ``@afonso360`` added abi-checker to cg_clif's CI. This has already catched an abi compatibility issue with AArch64. The fix has landed on Cranelift's main branch, but doesn't yet have a release. ``@uweigand`` also submitted a couple of PR's that will are prerequisites for supporting IBM's s390x architecture.
r? ``@ghost``
``@rustbot`` label +A-codegen +A-cranelift +T-compiler
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?
This should both make the code easier to read and also greatly reduce the amount of codegen
the compiler has to do, since it only needs to monomorphize `create_query_frame` for each
new key and not for each query.
Rustdoc documents these with the name of the type alias instead of normalizing them to the underlying type.
Use associated types instead so that the generated docs for nightly-rustc are easier to read.
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.