Rollup of 6 pull requests
Successful merges:
- #109609 (Separate AnonConst from ConstBlock in HIR.)
- #112166 (bootstrap: Rename profile = user to profile = dist)
- #112168 (Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem`)
- #112183 (Normalize anon consts in new solver)
- #112211 (pass `--lib` to `x doc`)
- #112223 (Don't ICE in new solver when auto traits have associated types)
r? `@ghost`
`@rustbot` modify labels: rollup
Normalize anon consts in new solver
We don't do any of that `expand_abstract_consts` stuff so this isn't sufficient to make GCE work, but it does allow, e.g. `[(); 1]: Default`, to solve.
r? `@BoxyUwU`
Rollup of 6 pull requests
Successful merges:
- #111647 (use c literals in compiler and library)
- #112165 (Rename `impl_defaultness` to `defaultness`)
- #112182 (CFI: Fix cfi with repr(transparent): transform_ty: unexpected Alias(Proj)
- #112189 (Debug-assert that closures and generators are made with the right number of substitutions)
- #112205 (Add rustdoc test for double-hyphen to dash doc comment conversion)
- #112206 (Fix typo in `std::cell` module docs)
r? `@ghost`
`@rustbot` modify labels: rollup
use c literals in compiler and library
Use c literals #108801 in compiler and library
currently blocked on:
* <strike>rustfmt: don't know how to format c literals</strike> nope, nightly one works.
* <strike>bootstrap</strike>
r? `@ghost`
`@rustbot` blocked
Fix the progress message for `x doc rustc`
This makes it more clear that we're using stage 0 *to document* rustc, not that we're documenting stage0 rustc itself.
It also fixes a bug in `msg_sysroot_tool` that would print `Docing`, and removes the `Debug` impl for `Kind` to make sure it doesn't happen again.
Before:
```
Documenting stage0 compiler {rustc-main} (aarch64-apple-darwin)
```
After:
```
Documenting compiler {rustc-main} (stage0 -> stage1, aarch64-apple-darwin)
```
thanks `@BoxyUwU` for catching this!
Fix Assist "replace named generic type with impl trait"
This is a follow-up PR to fix the assist "replace named generic type with impl trait" described in #14626 to filter invalid param types. It integrates the feedback given in PR #14816 .
The change updates the logic to determine when a function parameter is safe to replace a type param with its trait implementation. Some parameter definitions are invalid & should not be replaced by their traits, therefore skipping the assist completely.
First, all usages of the generic type under the cursor are determined. These usage references are checked to see if they occur outside the function parameter list. If an outside reference is found, e.g. in body, return type or where clause, the assist is skipped. All remaining usages need to appear only in the function param list. For each usage the param type is further inspected to see if it's valid. The logic to determine if a function parameter is valid, follows a heuristic and may not cover all possible parameter definitions.
With this change the following param types (as given in [this comment](https://github.com/rust-lang/rust-analyzer/pull/14816#discussion_r1206834603)) are not replaced & therefore skip the assist.
```rust
fn foo<P: Trait>(
_: <P as Trait>::Assoc, // within path type qualifier
_: <() as OtherTrait<P>>::Assoc, // same as above
_: P::Assoc, // associated type shorthand
_: impl OtherTrait<P> // generic arg in impl trait (note that associated type bindings are fine)
_: &dyn Fn(P) // param type and/or return type for Fn* traits
) {}
```
The change updates the logic to determine if a function parameter is
valid for replacing the type param with the trait implementation.
First all usages are determined, to check if they are used outside the function
parameter list. If an outside reference is found, e.g. in body, return type or
where clause, the assist is skipped. All remaining usages only appear in the
function param list. For each usage the param type is checked to see if
it's valid.
**Please note** the logic currently follows a heuristic and may not cover
all existing parameter declarations.
* determine valid usage references by checking ancestors (on AST level)
* split test into separate ones