Add `type_ascribe!` macro as placeholder syntax for type ascription
This makes it still possible to test the internal semantics of type ascription even once the `:`-syntax is removed from the parser. The macro now gets used in a bunch of UI tests that test the semantics and not syntax of type ascription.
I might have forgotten a few tests but this should hopefully be most of them. The remaining ones will certainly be found once type ascription is removed from the parser altogether.
Part of #101728
rustc_ast_lowering: Stop lowering imports into multiple items
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
rustdoc: remove redundant CSS `div.desc { display: block }`
DIV tags have block display by default. It is from when this rule used to target a SPAN tag, but became redundant in 4bd6748bb9.
`#![custom_mir]`: Various improvements
This PR makes a bunch of improvements to `#![custom_mir]`. Ideally this would be 4 PRs, one for each commit, but those would take forever to get merged and be a pain to juggle. Should still be reviewed one commit at a time though.
### Commit 1: Support arbitrary `let`
Before this change, all locals used in the body need to be declared at the top of the `mir!` invocation, which is rather annoying. We attempt to change that.
Unfortunately, we still have the requirement that the output of the `mir!` macro must resolve, typecheck, etc. Because of that, we can't just accept this in the THIR -> MIR parser because something like
```rust
{
let x = 0;
Goto(other)
}
other = {
RET = x;
Return()
}
```
will fail to resolve. Instead, the implementation does macro shenanigans to find the let declarations and extract them as part of the `mir!` macro. That *works*, but it is fairly complicated and degrades debuginfo by quite a bit. Specifically, the spans for any statements and declarations that are affected by this are completely wrong. My guess is that this is a net improvement though.
One way to recover some of the debuginfo would be to not support type annotations in the `let` statements, which would allow us to parse like `let $stmt:stmt`. That seems quite surprising though.
### Commit 2: Parse consts
Reuses most of the const parsing from regular Mir building for building custom mir
### Commit 3: Parse statics
Statics are slightly weird because the Mir primitive associated with them is a reference/pointer to them, so this is factored out separately.
### Commit 4: Fix some spans
A bunch of the spans were non-ideal, so we adjust them to be much more helpful.
r? `@oli-obk`
Rollup of 9 pull requests
Successful merges:
- #103065 (rustdoc-json: Document and Test that args can be patterns.)
- #104865 (Don't overwrite local changes when updating submodules)
- #104895 (Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code)
- #105063 (Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.)
- #105064 (rustdoc: add comment to confusing CSS `main { min-width: 0 }`)
- #105074 (Add Nicholas Bishop to `.mailmap`)
- #105081 (Add a regression test for #104322)
- #105086 (rustdoc: clean up sidebar link CSS)
- #105091 (add Tshepang Mbambo to .mailmap)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Extract WStrUnits to sys_common::wstr
This commit extracts WStrUnits from sys::windows::args to sys_common::wstr. This allows using the same structure for other targets which use wtf8 (example UEFI).
This was originally a part of https://github.com/rust-lang/rust/pull/100316
Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver
fixes#9901fixes#9777
changelog: `explicit_auto_deref`: Don't lint when the initial value is neither a reference, nor a receiver
rustdoc: clean up sidebar link CSS
Group `text-overflow: ellipses` along with `white-space: nowrap`. It makes no sense to try to apply it to links with `overflow-wrap: anywhere`, because it can't actually make ellipses when that's turned on.
Simplify the selector for the 25rem left padding on sidebar links, to match up with the style for the container left padding that makes room for it.
rustdoc: add comment to confusing CSS `main { min-width: 0 }`
This CSS was added in cad0fce205, but the reason why it was necessary was unclear. This comment makes it clear.