rustdoc: remove unused mobile CSS `.rustdoc { padding-top: 0 }`
When this rule was added in dd437ee6ed, as `body { padding-top: 0 }`, the desktop body tag had non-zero top padding. This padding was removed in 135281ed15.
This rule no longer overrides a rule in rustdoc's desktop styles, and also doesn't override the UA stylesheet, since the [HTML standard] has only margin, not padding, on the page body.
[HTML standard]: https://html.spec.whatwg.org/multipage/rendering.html#the-page
rustdoc: Fix merge of attributes for reexports of local items
Fixes https://github.com/rust-lang/rust/issues/84619.
The problem was that we didn't merge attributes between the the reexport and the item.
r? `@notriddle`
Allow use of `-Clto=thin` with `-Ccodegen-units=1` in general
The current logic to ignore ThinLTO when `-Ccodegen-units=1` makes sense for local ThinLTO but even in this scenario, a user may still want (non-local) ThinLTO for the purpose of optimizing dependencies into the final crate which is being compiled with 1 CGU.
The previous behavior was even more confusing because if you were generating a binary (`--emit=link`), then you would get ThinLTO but if you asked for LLVM IR or bytecode, then it would silently change to using regular LTO.
With this change, we only override the defaults for local ThinLTO if you ask for a single output such as LLVM IR or bytecode and in all other cases honor the requested LTO setting.
r? `@michaelwoerister`
fix(generic_const_exprs): Fix predicate inheritance for children of opaque types
Fixes#99705
We currently have a special case to perform predicate inheritance when the const item is in the generics. I think we're also going to need this for opaque return types. When evaluating the predicates applied to the associated item, it'll inherit from its parent, the opaque type, which will never have predicates applied. This PR bypass the opaque typed parent and inherit predicates directly from the function itself.
When this rule was added in dd437ee6ed, as
`body { padding-top: 0 }`, the desktop body tag had non-zero top padding.
This padding was removed in 135281ed15.
This rule no longer overrides a rule in rustdoc's desktop styles, and also
doesn't override the UA stylesheet, since the [HTML standard] has only
margin, not padding, on the page body.
[HTML standard]: https://html.spec.whatwg.org/multipage/rendering.html#the-page
Reorder `walk_` functions in intravisit.rs
Reorder the `walk_` functions to match the order of the `visit_` methods. This is a follow up to https://github.com/rust-lang/rust/pull/103692.
Note that there are some oddballs. I put them where I thought made the most sense:
```diff
$ diff \
<(sed -n 's/^.*\<fn visit_\([^(]*\).*$/\1/;T;p' compiler/rustc_hir/src/intravisit.rs) \
<(sed -n 's/^.*\<fn walk_\([^<]*\).*$/\1/;T;p' compiler/rustc_hir/src/intravisit.rs)
1,5d0
< nested_item
< nested_trait_item
< nested_impl_item
< nested_foreign_item
< nested_body
9,10d3
< id
< name
20c13
< array_length
---
> array_len
30a24
> fn_ret_ty
31a26
> fn_kind
41c36
< variant_data
---
> struct_def
46c41
< infer
---
> inf
54d48
< attribute
```
Also, as some weak evidence that i did things correctly, I get the following before and after the change:
```sh
$ sort compiler/rustc_hir/src/intravisit.rs | openssl sha256
SHA256(stdin)= cac13d2545731ef442f318e2b4286490d7ac5494f4ad10c4cf4c5d4f50d21641
```
r? `@fee1-dead`
rustdoc: simplify mobile item-table CSS
Using flexbox in column direction is needlessly complicated, since no special flex powers are being used here. Just use regular block layout.
This should result in no visible changes.
Gate some parser recovery behind the check
Mainly in `expr.rs`. `may_recover` doesn't do anything useful yet until I implement that on top of #103439.
r? `@compiler-errors`
rustdoc: Do not add external traits to the crate in `register_res`
It's not clear why it was done, and apparently it's no longer necessary now.
Such additions are unpredictable for early doc link resolution and would force us to collect all doc links from all external traits.
Fixes https://github.com/rust-lang/rust/issues/103463
Rollup of 8 pull requests
Successful merges:
- #103072 (compiletest: set the dylib path when gathering target cfg)
- #103084 (Derive `Eq` and `Hash` for `ControlFlow`)
- #103575 (Change #[suggestion_*] attributes to use style="...")
- #103637 (Use stdio in UWP apps)
- #103638 (Add `multivalue` target feature to WASM target)
- #103781 (Detect unused files in `src/test/mir-opt` and error on them in tidy.)
- #103837 (Migrate sidebar-links-color GUI test to functions)
- #103839 (Print valid `--print` requests if request is invalid)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Print valid `--print` requests if request is invalid
When someone makes a typo, it can be useful to see the valid options. This is also useful if someone wants to find out about all the options.
Detect unused files in `src/test/mir-opt` and error on them in tidy.
Closes#97564 .
Determining which files are generated by a given mir opt test is somewhat difficult. Because of this, we extract the logic for doing it out into a common crate that both compiletest and tidy can depend on. This avoids making compiletest a dependency of tidy which would negatively impact compile times for tidy.
Testing for this is that it catches 5 files that violated this lint (and removes them).
Add `multivalue` target feature to WASM target
This PR is similar to #99643 and #97808. It addresses #96472 for the `multivalue` target feature.
The problem I am trying to fix is to remove the following warning when compiling with `-C target-feature=+multivalue` for `--target=wasm32-unknown-unknown`.
```
warning: unknown feature specified for `-Ctarget-feature`: `multivalue`
|
= note: it is still passed through to the codegen backend
= note: consider filing a feature request
```
Change #[suggestion_*] attributes to use style="..."
As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter.
It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all.
Best reviewed commit-by-commit, there's a bit of noise in there.
cc #100717 `@compiler-errors`
r? `@davidtwco`
compiletest: set the dylib path when gathering target cfg
If the compiler is built with `rpath = false`, then it won't find its
own libraries unless the library search path is set. We already do that
while running the actual compiletests, but #100260 added another rustc
command for getting the target cfg.
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
thread 'main' panicked at 'error: failed to get cfg info from "[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc"
--- stdout
--- stderr
[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-a2a76dc626cd02d2.so: cannot open shared object file: No such file or directory
', src/tools/compiletest/src/common.rs:476:13
Now the library path is set here as well, so it works without rpath.
Using flexbox in column direction is needlessly complicated, since no
special flex powers are being used here. Just use regular block layout.
This should result in no visible changes.
Track where diagnostics were created.
This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`.
For example, the following code...
```rust
struct A;
struct B;
fn main(){
let _: A = B;
}
```
...now emits the following error message:
```
error[E0308]: mismatched types
--> src\main.rs:5:16
|
5 | let _: A = B;
| - ^ expected struct `A`, found struct `B`
| |
| expected due to this
-Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31
```