]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoRollup merge of #102524 - notriddle:notriddle/unsafe-function, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 21:32:03 +0000 (23:32 +0200)]
Rollup merge of #102524 - notriddle:notriddle/unsafe-function, r=GuillaumeGomez

rustdoc: remove weird `<a href="#">` wrapper around unsafe triangle

This DOM cleanup changes the color of the triangle, from blue to black, but since it's still a different color from the link it's next to, it should still be noticeable.

# Before

![image](https://user-images.githubusercontent.com/1593513/193352428-929b3026-acc3-448e-9bac-44dddf206b1d.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193352500-2f7a0112-b478-4cc4-9ddb-32ba11575530.png)

21 months agoRollup merge of #99880 - compiler-errors:escape-ascii-is-not-exact-size-iterator...
Matthias Krüger [Sat, 8 Oct 2022 21:32:02 +0000 (23:32 +0200)]
Rollup merge of #99880 - compiler-errors:escape-ascii-is-not-exact-size-iterator, r=thomcc

`EscapeAscii` is not an `ExactSizeIterator`

Fixes #99878

Do we want/need `EscapeAscii` to be an `ExactSizeIterator`? I guess we could precompute the length of the output if so?

21 months agoRollup merge of #99194 - simlay:simlay/update-rust-gdbgui-gdb-args-to-gdb-cmd, r...
Matthias Krüger [Sat, 8 Oct 2022 21:32:01 +0000 (23:32 +0200)]
Rollup merge of #99194 - simlay:simlay/update-rust-gdbgui-gdb-args-to-gdb-cmd, r=Mark-Simulacrum

Fix gdb-cmd for rust-gdbgui

With https://github.com/cs01/gdbgui/pull/198, the way that gdbgui arguments were specified changed. I've tested this with program generated from `cargo new --bin` and it worked as gdbgui should.

Closes #76383.

21 months agoAuto merge of #102315 - RalfJung:assert_unsafe_precondition, r=thomcc
bors [Sat, 8 Oct 2022 17:59:45 +0000 (17:59 +0000)]
Auto merge of #102315 - RalfJung:assert_unsafe_precondition, r=thomcc

add a few more assert_unsafe_precondition

Add debug-assertion checking for `ptr.read()`, `ptr.write(_)`, and `unreachable_unchecked.`

This is quite useful for [cargo-careful](https://github.com/RalfJung/cargo-careful).

21 months agorustdoc: add test case for dimensions and color of unsafe `<sup>`
Michael Howell [Sat, 8 Oct 2022 16:36:37 +0000 (09:36 -0700)]
rustdoc: add test case for dimensions and color of unsafe `<sup>`

21 months agorustdoc: remove weird `<a href="#">` wrapper around unsafe triangle
Michael Howell [Fri, 30 Sep 2022 20:32:33 +0000 (13:32 -0700)]
rustdoc: remove weird `<a href="#">` wrapper around unsafe triangle

This DOM cleanup changes the color of the triangle, from blue to black, but
since it's still a different color from the link it's next to, it should
still be noticeable.

21 months agoAuto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgr
bors [Sat, 8 Oct 2022 14:58:11 +0000 (14:58 +0000)]
Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #101520 (Allow transmutes between the same types after erasing lifetimes)
 - #102675 (Remove `mir::CastKind::Misc`)
 - #102778 (Fix MIR inlining of asm_unwind)
 - #102785 (Remove `DefId` from some `SelectionCandidate` variants)
 - #102788 (Update rustc-dev-guide)
 - #102789 (Update browser UI test version)
 - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`)
 - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoRollup merge of #102798 - notriddle:notriddle/text-decoration-underline, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 12:38:21 +0000 (14:38 +0200)]
Rollup merge of #102798 - notriddle:notriddle/text-decoration-underline, r=GuillaumeGomez

rustdoc: add main-heading and example-wrap link CSS to big selector

This makes the stylesheet more consistent about how it handles link hover.

21 months agoRollup merge of #102797 - notriddle:notriddle/rightside-position, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 12:38:21 +0000 (14:38 +0200)]
Rollup merge of #102797 - notriddle:notriddle/rightside-position, r=GuillaumeGomez

rustdoc: remove no-op CSS `.rightside { position: initial }`

This CSS, added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, overrode CSS that was applied to the `.since` class:

https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/static/rustdoc.css#L782-L795

The absolute positioning for `.since` was abandoned in favor of always floating it, so this is no longer needed:

https://github.com/rust-lang/rust/commit/5de1391b88007a1d4f7b1517657a86aae352af1e#diff-7dc22a0530802d77c2f2ec9e834024a5657b6eab4055520fca46edc99a544413L902-L904

21 months agoRollup merge of #102789 - GuillaumeGomez:update-browser-ui-test-version, r=notriddle
Matthias Krüger [Sat, 8 Oct 2022 12:38:20 +0000 (14:38 +0200)]
Rollup merge of #102789 - GuillaumeGomez:update-browser-ui-test-version, r=notriddle

Update browser UI test version

It added the possibility to concatenate strings and numbers and updated the `goto` command so it doesn't stand on its own anymore.

r? ````@notriddle````

21 months agoRollup merge of #102788 - joshtriplett:bump-rustc-dev-guide, r=ehuss
Matthias Krüger [Sat, 8 Oct 2022 12:38:20 +0000 (14:38 +0200)]
Rollup merge of #102788 - joshtriplett:bump-rustc-dev-guide, r=ehuss

Update rustc-dev-guide

- .gitattributes: Mark minified javascript as binary to filter greps
- fix very minor punctuation typo
- diagnostic structs: derive on enum (#1477)
- Update running tests with the new flags (#1476)
- Rename typeck to hir_analysis (#1475)
- fix typo and make paragraph consistent (#1474)
- Update about-this-guide.md
- Link to the correct page in "about this guide"
- Update r-a config suggestions
- don't refer to the compile-time interpreter as "Miri" (#1471)
- UPDATE - Diagnostic docs to reflect renamed traits and macros in rustc PR#101558
- Update mdbook and its extensions versions
- Remove unmaintained action
- Update some actions versions
- Fix some typos

Update motivated in large part by the most recent commit, to fix `git
grep`.

21 months agoRollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errors
Matthias Krüger [Sat, 8 Oct 2022 12:38:19 +0000 (14:38 +0200)]
Rollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errors

Remove `DefId` from some `SelectionCandidate` variants

They are both from `obligation.predicate.def_id()`, which do not need to be on the `SelectionCandidate`.

cc ````@lcnr```` ````@compiler-errors````

21 months agoRollup merge of #102778 - nbdd0121:mir, r=tmiasko
Matthias Krüger [Sat, 8 Oct 2022 12:38:19 +0000 (14:38 +0200)]
Rollup merge of #102778 - nbdd0121:mir, r=tmiasko

Fix MIR inlining of asm_unwind

The MIR inlining currently doesn't handle inline asm's unwind edge correctly.

This code will cause ICE:
```rust
struct D;

impl Drop for D {
    fn drop(&mut self) {}
}

#[inline(always)]
fn foo() {
    let _d = D;
    unsafe { std::arch::asm!("", options(may_unwind)) };
}

pub fn main() {
    foo();
}
```

This PR fixes this issue. I also take the opportunity to extract common code into a method.

21 months agoRollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk
Matthias Krüger [Sat, 8 Oct 2022 12:38:18 +0000 (14:38 +0200)]
Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk

Remove `mir::CastKind::Misc`

As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast.

r? ````@oli-obk````

21 months agoRollup merge of #101520 - oli-obk:transmute_lifetimes, r=compiler-errors
Matthias Krüger [Sat, 8 Oct 2022 12:38:18 +0000 (14:38 +0200)]
Rollup merge of #101520 - oli-obk:transmute_lifetimes, r=compiler-errors

Allow transmutes between the same types after erasing lifetimes

r? ````@compiler-errors````  on the impl

fixes #101081

See discussion in the issue and at https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23101081.3A.20Regression.20transmuting.20.60RwLockReadGuard.3CT.3A.20.3FSized.3E.E2.80.A6

I think this may need lang team signoff as its implications may go beyond the jurisdiction of T-types

I'll write up a proper summary later

21 months agoAuto merge of #100720 - camsteffen:representable, r=cjgillot
bors [Sat, 8 Oct 2022 11:53:25 +0000 (11:53 +0000)]
Auto merge of #100720 - camsteffen:representable, r=cjgillot

Rewrite representability

 * Improve placement of `Box` in the suggestion
 * Multiple items in a cycle emit 1 error instead of an error for each item in the cycle
 * Introduce `representability` query to avoid traversing an item every time it is used.
 * Also introduce `params_in_repr` query to avoid traversing generic items every time it is used.

21 months agoAuto merge of #99505 - joboet:futex_once, r=thomcc
bors [Sat, 8 Oct 2022 03:50:07 +0000 (03:50 +0000)]
Auto merge of #99505 - joboet:futex_once, r=thomcc

std: use futex in `Once`

Now that we have efficient locks, let's optimize the rest of `sync` as well. This PR adds a futex-based implementation for `Once`, which drastically simplifies the implementation compared to the generic version, which is provided as fallback for platforms without futex (Windows only supports them on newer versions, so it uses the fallback for now).

Instead of storing a linked list of waiters, the new implementation adds another state (`QUEUED`), which is set when there are waiting threads. These now use `futex_wait` on that state and are woken by the running thread when it finishes and notices the `QUEUED` state, thereby avoiding unnecessary calls to `futex_wake_all`.

21 months agorustdoc: add main-heading and example-wrap link CSS to big selector
Michael Howell [Sat, 8 Oct 2022 00:05:30 +0000 (17:05 -0700)]
rustdoc: add main-heading and example-wrap link CSS to big selector

This makes the stylesheet more consistent about how it handles link hover.

21 months agoAuto merge of #102792 - weihanglo:update-cargo, r=ehuss
bors [Fri, 7 Oct 2022 23:59:08 +0000 (23:59 +0000)]
Auto merge of #102792 - weihanglo:update-cargo, r=ehuss

Update cargo

4 commits in 0b84a35c2c7d70df4875a03eb19084b0e7a543ef..3cdf1ab25dc4fe56f890e8c7330d53a23ad905d3

2022-10-03 19:13:21 +0000 to 2022-10-07 17:34:03 +0000
- fix(test): Distinguish 'testname' from escaped arguments (rust-lang/cargo#11190)
- Fix sparse registry lockfile urls containing 'registry+sparse+' (rust-lang/cargo#11177)
- doc(features2): polish docs a bit (rust-lang/cargo#11185)
- Import `cargo remove` into cargo (rust-lang/cargo#11099)

21 months agorustdoc: remove no-op CSS `.rightside { position: initial }`
Michael Howell [Fri, 7 Oct 2022 23:47:44 +0000 (16:47 -0700)]
rustdoc: remove no-op CSS `.rightside { position: initial }`

This CSS, added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, overrode CSS
that was applied to the `.since` class:

https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/static/rustdoc.css#L782-L795

The absolute positioning for `.since` was abandoned in favor of always
floating it, so this is no longer needed:

https://github.com/rust-lang/rust/commit/5de1391b88007a1d4f7b1517657a86aae352af1e#diff-7dc22a0530802d77c2f2ec9e834024a5657b6eab4055520fca46edc99a544413L902-L904

21 months agoAuto merge of #102091 - RalfJung:const_err, r=oli-obk
bors [Fri, 7 Oct 2022 20:50:51 +0000 (20:50 +0000)]
Auto merge of #102091 - RalfJung:const_err, r=oli-obk

make const_err a hard error

This lint has been deny-by-default with future incompat wording since [Rust 1.51](https://github.com/rust-lang/rust/pull/80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;)

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/71800
Fixes https://github.com/rust-lang/rust/issues/100114

21 months agoUpdate cargo
Weihang Lo [Fri, 7 Oct 2022 19:10:52 +0000 (20:10 +0100)]
Update cargo

4 commits in 0b84a35c2c7d70df4875a03eb19084b0e7a543ef..3cdf1ab25dc4fe56f890e8c7330d53a23ad905d3

2022-10-03 19:13:21 +0000 to 2022-10-07 17:34:03 +0000
- fix(test): Distinguish 'testname' from escaped arguments (rust-lang/cargo#11190)
- Fix sparse registry lockfile urls containing 'registry+sparse+' (rust-lang/cargo#11177)
- doc(features2): polish docs a bit (rust-lang/cargo#11185)
- Import `cargo remove` into cargo (rust-lang/cargo#11099)

21 months agoUpdate rustdoc-gui test to new browser-ui-test version
Guillaume Gomez [Fri, 7 Oct 2022 18:17:05 +0000 (20:17 +0200)]
Update rustdoc-gui test to new browser-ui-test version

21 months agoUpdate browser-ui-test version
Guillaume Gomez [Fri, 7 Oct 2022 18:17:16 +0000 (20:17 +0200)]
Update browser-ui-test version

21 months agoAuto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPC
bors [Fri, 7 Oct 2022 17:37:39 +0000 (17:37 +0000)]
Auto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #102300 (Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere)
 - #102475 (unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update)
 - #102760 (Avoid repeated re-initialization of the BufReader buffer)
 - #102764 (Check `WhereClauseReferencesSelf` after all other object safety checks)
 - #102779 (Fix `type_of` ICE)
 - #102780 (run Miri CI when std::sys changes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoFix test
Gary Guo [Fri, 7 Oct 2022 17:01:17 +0000 (18:01 +0100)]
Fix test

21 months agoUpdate rustc-dev-guide
Josh Triplett [Fri, 7 Oct 2022 16:38:34 +0000 (17:38 +0100)]
Update rustc-dev-guide

- .gitattributes: Mark minified javascript as binary to filter greps
- fix very minor punctuation typo
- diagnostic structs: derive on enum (#1477)
- Update running tests with the new flags (#1476)
- Rename typeck to hir_analysis (#1475)
- fix typo and make paragraph consistent (#1474)
- Update about-this-guide.md
- Link to the correct page in "about this guide"
- Update r-a config suggestions
- don't refer to the compile-time interpreter as "Miri" (#1471)
- UPDATE - Diagnostic docs to reflect renamed traits and macros in rustc PR#101558
- Update mdbook and its extensions versions
- Remove unmaintained action
- Update some actions versions
- Fix some typos

Update motivated in large part by the most recent commit, to fix `git
grep`.

21 months agoRollup merge of #102780 - RalfJung:miri-lib-sys, r=Mark-Simulacrum
Dylan DPC [Fri, 7 Oct 2022 16:35:32 +0000 (22:05 +0530)]
Rollup merge of #102780 - RalfJung:miri-lib-sys, r=Mark-Simulacrum

run Miri CI when std::sys changes

r? `@Mark-Simulacrum`

21 months agoRollup merge of #102779 - TaKO8Ki:fix-type-of-ice-102768, r=fee1-dead
Dylan DPC [Fri, 7 Oct 2022 16:35:32 +0000 (22:05 +0530)]
Rollup merge of #102779 - TaKO8Ki:fix-type-of-ice-102768, r=fee1-dead

Fix `type_of` ICE

Fixes #102768

21 months agoRollup merge of #102764 - compiler-errors:issue-102762, r=jackh726
Dylan DPC [Fri, 7 Oct 2022 16:35:31 +0000 (22:05 +0530)]
Rollup merge of #102764 - compiler-errors:issue-102762, r=jackh726

Check `WhereClauseReferencesSelf` after all other object safety checks

This fixes the ICE because it causes us to detect another *non-lint* `MethodViolationCode` first, instead of breaking on `WhereClauseReferencesSelf`.

We could also approach this issue by instead returning a vector of *all* of the `MethodViolationCode`s, and just reporting the first one we see, but treating it as a hard error if we return both `WhereClauseReferencesSelf` and some other violation code -- let me know if this is desired.

Fixes #102762

21 months agoRollup merge of #102760 - saethlin:dont-reinit-buffer, r=Mark-Simulacrum
Dylan DPC [Fri, 7 Oct 2022 16:35:31 +0000 (22:05 +0530)]
Rollup merge of #102760 - saethlin:dont-reinit-buffer, r=Mark-Simulacrum

Avoid repeated re-initialization of the BufReader buffer

Fixes https://github.com/rust-lang/rust/issues/102727

We accidentally removed this in https://github.com/rust-lang/rust/pull/98748. It looks so redundant. But it isn't.

The default `Read::read_buf` will defensively initialize the whole buffer, if any of it is indicated to be uninitialized. In uses where reads from the wrapped `Read` impl completely fill the `BufReader`, `initialized` and `filled` are the same, and this extra member isn't required. But in the reported issue, the `BufReader` wraps a `Read` impl which will _never_ fill the whole buffer. So the default `Read::read_buf` implementation repeatedly re-initializes the extra space in the buffer.

This adds back the extra `initialized` member, which ensures that the default `Read::read_buf` only zero-initialized the buffer once, and I've tried to add a comment which explains this whole situation.

21 months agoRollup merge of #102475 - RalfJung:unsafe, r=dtolnay
Dylan DPC [Fri, 7 Oct 2022 16:35:30 +0000 (22:05 +0530)]
Rollup merge of #102475 - RalfJung:unsafe, r=dtolnay

unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update

Having a safe `fn` in an `unsafe trait` vs an `unsafe fn` in a safe `trait` are pretty different situations, but the distinction is subtle and can confuse even seasoned Rust developers. So let's have explicit examples of both. I also removed the existing `unsafe trait` example since it was rather strange.

Also the `unsafe_op_in_unsafe_fn` lint can help disentangle the two sides of `unsafe`, so update the docs to account for that.

21 months agoRollup merge of #102300 - scottmcm:simpler-fold-closures, r=Mark-Simulacrum
Dylan DPC [Fri, 7 Oct 2022 16:35:29 +0000 (22:05 +0530)]
Rollup merge of #102300 - scottmcm:simpler-fold-closures, r=Mark-Simulacrum

Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere

Also use that macro to replace a bunch of places that had custom closure-wrappers.

+35 -114 sounds good to me.

21 months agoAllow transmutes between the same types after erasing lifetimes
Oli Scherer [Wed, 7 Sep 2022 07:51:11 +0000 (07:51 +0000)]
Allow transmutes between the same types after erasing lifetimes

21 months agomake const_err a hard error
Ralf Jung [Wed, 21 Sep 2022 11:05:20 +0000 (13:05 +0200)]
make const_err a hard error

21 months agoRemove `DefId` from some `SelectionCandidate` variants
Deadbeef [Fri, 7 Oct 2022 15:08:59 +0000 (15:08 +0000)]
Remove `DefId` from some `SelectionCandidate` variants

21 months agoRewrite representability
Cameron Steffen [Mon, 15 Aug 2022 19:11:11 +0000 (14:11 -0500)]
Rewrite representability

21 months agoAuto merge of #101632 - camsteffen:refactor-infer-err, r=lcnr
bors [Fri, 7 Oct 2022 13:54:55 +0000 (13:54 +0000)]
Auto merge of #101632 - camsteffen:refactor-infer-err, r=lcnr

Remove `TypeckResults` from `InferCtxt`

`InferCtxt` currently has `in_progress_typeck_results` which is only used for some diagnostics during typeck. It adds a lifetime which propagates through a lot of code. This PR moves that field into a new helper struct `TypeErrCtxt`.

21 months agoreview feedback
Ralf Jung [Fri, 7 Oct 2022 13:21:47 +0000 (15:21 +0200)]
review feedback

21 months agofix Miri
Ralf Jung [Fri, 7 Oct 2022 12:57:41 +0000 (14:57 +0200)]
fix Miri

21 months agorun Miri CI when std::sys changes
Ralf Jung [Fri, 7 Oct 2022 12:39:07 +0000 (14:39 +0200)]
run Miri CI when std::sys changes

21 months agoadd a few more assert_unsafe_precondition
Ralf Jung [Mon, 26 Sep 2022 14:54:22 +0000 (16:54 +0200)]
add a few more assert_unsafe_precondition

21 months agoChange InferCtxtBuilder from enter to build
Cameron Steffen [Tue, 20 Sep 2022 03:03:59 +0000 (22:03 -0500)]
Change InferCtxtBuilder from enter to build

21 months agofix a ICE #102768
Takayuki Maeda [Fri, 7 Oct 2022 12:10:08 +0000 (21:10 +0900)]
fix a ICE #102768

21 months agoRemove a reference from Inherited
Cameron Steffen [Fri, 9 Sep 2022 20:25:29 +0000 (15:25 -0500)]
Remove a reference from Inherited

21 months agoRemove TypeckResults from InferCtxt
Cameron Steffen [Fri, 9 Sep 2022 18:01:06 +0000 (13:01 -0500)]
Remove TypeckResults from InferCtxt

21 months agoIntroduce TypeErrCtxt
Cameron Steffen [Fri, 9 Sep 2022 20:08:06 +0000 (15:08 -0500)]
Introduce TypeErrCtxt

TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't
need to.

21 months agoFix MIR inlining of asm_unwind
Gary Guo [Fri, 7 Oct 2022 11:59:26 +0000 (12:59 +0100)]
Fix MIR inlining of asm_unwind

21 months agoAuto merge of #102025 - chenyukang:fix-102002, r=jyn514
bors [Fri, 7 Oct 2022 10:46:04 +0000 (10:46 +0000)]
Auto merge of #102025 - chenyukang:fix-102002, r=jyn514

Delete the stage1 and stage0-sysroot directories when using download-rustc

Fixes #102002

21 months agostd: use futex in `Once`
joboet [Sun, 4 Sep 2022 16:47:59 +0000 (18:47 +0200)]
std: use futex in `Once`

21 months agoAuto merge of #102767 - matthiaskrgr:rollup-vcbt81v, r=matthiaskrgr
bors [Fri, 7 Oct 2022 07:31:53 +0000 (07:31 +0000)]
Auto merge of #102767 - matthiaskrgr:rollup-vcbt81v, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102577 (Warn about Visual Studio Code branding confusion)
 - #102720 (do not reverse the expected type and found type for ObligationCauseCo…)
 - #102744 (rustdoc: remove unused CSS `.content .item-list`)
 - #102747 (rustdoc: remove unused CSS `.docblock a:not(.srclink)`)
 - #102748 (Disable compressed debug sections on i586-gnu)
 - #102761 (let-else: test else block with non-never uninhabited type)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoRollup merge of #102761 - est31:let_else_uninhabited_test, r=compiler-errors
Matthias Krüger [Fri, 7 Oct 2022 05:28:12 +0000 (07:28 +0200)]
Rollup merge of #102761 - est31:let_else_uninhabited_test, r=compiler-errors

let-else: test else block with non-never uninhabited type

let else currently does not allow uninhabited types for the `else` block that aren't `!`. One can maybe think about relaxing this in the future, but if it is done, it should be an explicit choice and not an unexpected side effect of e.g. a refactor. Thus, I'm extending a test that will fail if the behaviour changes.

21 months agoRollup merge of #102748 - cuviper:i586-gnu-uncompress, r=pietroalbini
Matthias Krüger [Fri, 7 Oct 2022 05:28:11 +0000 (07:28 +0200)]
Rollup merge of #102748 - cuviper:i586-gnu-uncompress, r=pietroalbini

Disable compressed debug sections on i586-gnu

Compressed debug is enabled by default for gas (assembly) on Linux/x86
targets, and we started building our own in #102530, but that made our
`compiler_builtins` incompatible with binutils < 2.32. Add an explicit
option to disable that in our crosstool-ng config. Fixes #102703.

21 months agoRollup merge of #102747 - notriddle:notriddle/docblock-a-not-srclink, r=GuillaumeGomez
Matthias Krüger [Fri, 7 Oct 2022 05:28:11 +0000 (07:28 +0200)]
Rollup merge of #102747 - notriddle:notriddle/docblock-a-not-srclink, r=GuillaumeGomez

rustdoc: remove unused CSS `.docblock a:not(.srclink)`

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480, because the list of impl items could be nested below `docblock`.

https://github.com/rust-lang/rust/blob/c7312fbae4979c6d4fdfbd1f55a71cd47d82a480/src/librustdoc/html/render.rs#L3841-L3845

Now that rustdoc toggles have been switched to `<details>`, there shouldn't be any need to put things inside docblock containers just to give them disclosure toggles.

21 months agoRollup merge of #102744 - notriddle:notriddle/content-item-list, r=GuillaumeGomez
Matthias Krüger [Fri, 7 Oct 2022 05:28:10 +0000 (07:28 +0200)]
Rollup merge of #102744 - notriddle:notriddle/content-item-list, r=GuillaumeGomez

rustdoc: remove unused CSS `.content .item-list`

When these rules were added in 4fd061c426902b0904c65e64a3780b21f9ab3afb (yeah, that's the very first commit of rustdoc_ng), `.item-list` was a `<ul>`, and this would override the default style for that tag.

In c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4, it was changed to use a `<div>` tag, so these rules are both no-ops.

21 months agoRollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errors
Matthias Krüger [Fri, 7 Oct 2022 05:28:10 +0000 (07:28 +0200)]
Rollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errors

do not reverse the expected type and found type for ObligationCauseCo…

…de of IfExpressionWithNoElse

this will fix #102397

21 months agoRollup merge of #102577 - kornelski:non-code-visual-studio, r=wesleywiser
Matthias Krüger [Fri, 7 Oct 2022 05:28:09 +0000 (07:28 +0200)]
Rollup merge of #102577 - kornelski:non-code-visual-studio, r=wesleywiser

Warn about Visual Studio Code branding confusion

VS Code is a popular companion for Rust, but Microsoft's branding is confusing, and users [may not understand](https://users.rust-lang.org/t/complie-error-when-i-run-rustc/82127) they also need the *other* VS.

21 months agoAuto merge of #101988 - petrochenkov:flavor2, r=lqd
bors [Fri, 7 Oct 2022 03:35:02 +0000 (03:35 +0000)]
Auto merge of #101988 - petrochenkov:flavor2, r=lqd

rustc_target: Refactor internal linker flavors

In accordance with the design from https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595

`lld_flavor` and `linker_is_gnu` fields are removed from internal target specs, but still parsed from JSON specs using compatibility layer introduced in https://github.com/rust-lang/rust/pull/100552.
r? `@lqd`

21 months agoAvoid defensive re-initialization of the BufReader buffer
Ben Kimock [Fri, 7 Oct 2022 00:09:54 +0000 (20:09 -0400)]
Avoid defensive re-initialization of the BufReader buffer

21 months agoCheck WhereClauseReferencesSelf after all other object safety checks
Michael Goulet [Fri, 7 Oct 2022 02:29:19 +0000 (02:29 +0000)]
Check WhereClauseReferencesSelf after all other object safety checks

21 months agolet-else: test else block with non-never uninhabited type
est31 [Fri, 7 Oct 2022 00:42:02 +0000 (02:42 +0200)]
let-else: test else block with non-never uninhabited type

21 months agoAuto merge of #102729 - flip1995:clippyup, r=Manishearth
bors [Thu, 6 Oct 2022 23:11:18 +0000 (23:11 +0000)]
Auto merge of #102729 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

21 months agoWarn about Visual Studio Code branding confusion
Kornel [Sun, 2 Oct 2022 12:18:54 +0000 (13:18 +0100)]
Warn about Visual Studio Code branding confusion

21 months agoAuto merge of #102741 - matthiaskrgr:rollup-63no5tz, r=matthiaskrgr
bors [Thu, 6 Oct 2022 19:55:48 +0000 (19:55 +0000)]
Auto merge of #102741 - matthiaskrgr:rollup-63no5tz, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #98496 (make `compare_const_impl` a query and use it in `instance.rs`)
 - #102680 (Fix overconstrained Send impls in btree internals)
 - #102718 (Fix `opaque_hidden_inferred_bound` lint ICE)
 - #102725 (Remove `-Ztime`)
 - #102736 (Migrate search input color to CSS variable)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoDisable compressed debug sections on i586-gnu
Josh Stone [Thu, 6 Oct 2022 19:13:23 +0000 (12:13 -0700)]
Disable compressed debug sections on i586-gnu

Compressed debug is enabled by default for gas (assembly) on Linux/x86
targets, and we started building our own in #102530, but that made our
`compiler_builtins` incompatible with binutils < 2.32. Add an explicit
option to disable that in our crosstool-ng config. Fixes #102703.

21 months agorustdoc: remove unused CSS `.docblock a:not(.srclink)`
Michael Howell [Thu, 6 Oct 2022 18:20:37 +0000 (11:20 -0700)]
rustdoc: remove unused CSS `.docblock a:not(.srclink)`

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480,
because the list of impl items could be nested below `docblock`.

https://github.com/rust-lang/rust/blob/c7312fbae4979c6d4fdfbd1f55a71cd47d82a480/src/librustdoc/html/render.rs#L3841-L3845

Now that rustdoc toggles have been switched to `<details>`, there shouldn't
be any need to put things inside docblock containers just to give them
disclosure toggles.

21 months agorustdoc: remove unused HTML `class="item-list"`
Michael Howell [Thu, 6 Oct 2022 17:20:47 +0000 (10:20 -0700)]
rustdoc: remove unused HTML `class="item-list"`

Since 50f662e99ec372a3c9558876d4164e8665859217, there is no CSS or JS
targeting this class.

21 months agorustdoc: remove unused CSS `.content .item-list`
Michael Howell [Thu, 6 Oct 2022 17:18:16 +0000 (10:18 -0700)]
rustdoc: remove unused CSS `.content .item-list`

When these rules were added in 4fd061c426902b0904c65e64a3780b21f9ab3afb
(yeah, that's the very first commit of rustdoc_ng), `.item-list` was a
`<ul>`, and this would override the default style for that tag.

In c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4, it was changed to use a
`<div>` tag, so these rules are both no-ops.

21 months agoMerge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyup
Philipp Krones [Thu, 6 Oct 2022 15:41:53 +0000 (17:41 +0200)]
Merge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyup

21 months agoAuto merge of #9593 - Andy-Python-Programmer:master, r=llogiq
bors [Thu, 6 Oct 2022 14:39:26 +0000 (14:39 +0000)]
Auto merge of #9593 - Andy-Python-Programmer:master, r=llogiq

lint::unsafe_removed_from_name: fix false positive result when allowed

changelog: [`unsafe_removed_from_name`] Fix allowing on imports produces a false positive on `useless_attribute`.

Fixes: #9197
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
21 months agoRollup merge of #102736 - GuillaumeGomez:search-input-color, r=notriddle
Matthias Krüger [Thu, 6 Oct 2022 14:29:45 +0000 (16:29 +0200)]
Rollup merge of #102736 - GuillaumeGomez:search-input-color, r=notriddle

Migrate search input color to CSS variable

Part of https://github.com/rust-lang/rust/pull/98460.

No UI changes.

r? `@notriddle`

21 months agoRollup merge of #102725 - nnethercote:rm-Z-time, r=davidtwco
Matthias Krüger [Thu, 6 Oct 2022 14:29:45 +0000 (16:29 +0200)]
Rollup merge of #102725 - nnethercote:rm-Z-time, r=davidtwco

Remove `-Ztime`

Because it has a lot of overlap with `-Ztime-passes` but is generally less useful. Plus some related cleanups.

Best reviewed one commit at a time.

r? `@davidtwco`

21 months agoRollup merge of #102718 - compiler-errors:opaque-bound-lint-ice, r=fee1-dead
Matthias Krüger [Thu, 6 Oct 2022 14:29:44 +0000 (16:29 +0200)]
Rollup merge of #102718 - compiler-errors:opaque-bound-lint-ice, r=fee1-dead

Fix `opaque_hidden_inferred_bound` lint ICE

Fixes #102705

21 months agoRollup merge of #102680 - dtolnay:btreesend, r=thomcc
Matthias Krüger [Thu, 6 Oct 2022 14:29:44 +0000 (16:29 +0200)]
Rollup merge of #102680 - dtolnay:btreesend, r=thomcc

Fix overconstrained Send impls in btree internals

Fixes https://github.com/dtolnay/async-trait/issues/215.

Minimal repro:

```rust
use std::collections::btree_map::Iter;

fn require_send<T: Send>(_: T) {}

fn main() {
    require_send(async {
        let _iter = None::<Iter<(), &()>>;
        async {}.await;
    });
}
```

```console
error: higher-ranked lifetime error
 --> src/main.rs:6:5
  |
6 | /     require_send(async {
7 | |         let _iter = None::<Iter<(), &()>>;
8 | |         async {}.await;
9 | |     });
  | |______^
  |
  = note: could not prove `impl Future<Output = ()>: Send`
```

Not-quite-so-minimal repro:

```rust
use std::collections::BTreeMap;
use std::future::Future;

fn spawn<T: Future + Send>(_: T) {}

async fn f() {
    let map = BTreeMap::<u32, Box<dyn Send + Sync>>::new();
    for _ in &map {
        async {}.await;
    }
}

fn main() {
    spawn(f());
}
```

```console
error: higher-ranked lifetime error
  --> src/main.rs:14:5
   |
14 |     spawn(f());
   |     ^^^^^^^^^^
   |
   = note: could not prove `impl Future<Output = ()>: Send`
```

I am not familiar with the btree internals, but it seems clear to me that the `async fn f` above should return a Send future. Using HashMap instead of BTreeMap in that code makes it already return a Send future.

The _"higher-ranked lifetime error"_ message may be a regression in Rust 1.63. Using older compilers the error message was more detailed:

```console
error: implementation of `Send` is not general enough
  --> src/main.rs:14:5
   |
14 |     spawn(f());
   |     ^^^^^ implementation of `Send` is not general enough
   |
   = note: `Send` would have to be implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'0>, u32, Box<(dyn Send + Sync + '1)>, alloc::collections::btree::node::marker::LeafOrInternal>`, for any two lifetimes `'0` and `'1`...
   = note: ...but `Send` is actually implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'2>, u32, Box<dyn Send + Sync>, alloc::collections::btree::node::marker::LeafOrInternal>`, for some specific lifetime `'2`

error: implementation of `Send` is not general enough
  --> src/main.rs:14:5
   |
14 |     spawn(f());
   |     ^^^^^ implementation of `Send` is not general enough
   |
   = note: `Send` would have to be implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'0>, u32, Box<(dyn Send + Sync + '1)>, alloc::collections::btree::node::marker::Leaf>`, for any two lifetimes `'0` and `'1`...
   = note: ...but `Send` is actually implemented for the type `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Immut<'2>, u32, Box<dyn Send + Sync>, alloc::collections::btree::node::marker::Leaf>`, for some specific lifetime `'2`
```

21 months agoRollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr
Matthias Krüger [Thu, 6 Oct 2022 14:29:43 +0000 (16:29 +0200)]
Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr

make `compare_const_impl` a query and use it in `instance.rs`

Fixes #88365

the bug in #88365 was caused by some `instance.rs` code using the `PartialEq` impl on `Ty` to check that the type of the associated const in an impl is the same as the type of the associated const in the trait definition. This was wrong for two reasons:
- the check typeck does is that the impl type is a subtype of the trait definition's type (see `mismatched_impl_ty_2.rs` which [was ICEing](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f6d60ebe6745011f0d52ab2bc712025d) before this PR on stable)
- it assumes that if two types are equal then the `PartialEq` impl will reflect that which isnt true for higher ranked types or type level constants when `feature(generic_const_exprs)` is enabled (see `mismatched_impl_ty_3.rs` for higher ranked types which was [ICEing on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7af131a655ed515b035624626c62c71))

r? `@lcnr`

21 months agoAuto merge of #9599 - nyurik:inline-crash, r=flip1995
bors [Thu, 6 Oct 2022 14:12:29 +0000 (14:12 +0000)]
Auto merge of #9599 - nyurik:inline-crash, r=flip1995

Add a temporary workaround for  multiline formart arg inlining

per suggestion in
https://github.com/rust-lang/rust/pull/102729#discussion_r988990080

workaround for an internal crash when handling multi-line format argument inlining.

changelog: none

(no point for changelog because it is still a new lint being introduced)

21 months agoAdd a temporary workaround for multiline formart arg inlining
Yuri Astrakhan [Thu, 6 Oct 2022 13:12:37 +0000 (09:12 -0400)]
Add a temporary workaround for  multiline formart arg inlining

per suggestion in
https://github.com/rust-lang/rust/pull/102729#discussion_r988990080

workaround for an internal crash when handling multi-line format
argument inlining.

21 months agoAuto merge of #9598 - nyurik:fix-comment, r=Alexendoo
bors [Thu, 6 Oct 2022 12:56:27 +0000 (12:56 +0000)]
Auto merge of #9598 - nyurik:fix-comment, r=Alexendoo

lint: fix a few comments

minor cleanup per `@Alexendoo` [comment](https://github.com/rust-lang/rust-clippy/pull/9586#discussion_r988991976)

changelog: none

21 months agolint: fix a few comments
Yuri Astrakhan [Thu, 6 Oct 2022 12:54:07 +0000 (08:54 -0400)]
lint: fix a few comments

21 months agoRemove `mir::CastKind::Misc`
ouz-a [Tue, 4 Oct 2022 18:39:43 +0000 (21:39 +0300)]
Remove `mir::CastKind::Misc`

21 months agoAuto merge of #99497 - vladimir-ea:stdlib_os_api_watchos, r=thomcc
bors [Thu, 6 Oct 2022 12:14:21 +0000 (12:14 +0000)]
Auto merge of #99497 - vladimir-ea:stdlib_os_api_watchos, r=thomcc

Standard library OS support for Apple WatchOS

This PR was split from https://github.com/rust-lang/rust/pull/98101

21 months agoMigrate search input color to CSS variable
Guillaume Gomez [Thu, 6 Oct 2022 11:01:07 +0000 (13:01 +0200)]
Migrate search input color to CSS variable

21 months agorustc_target: Refactor internal linker flavors
Vadim Petrochenkov [Sat, 6 Aug 2022 18:08:46 +0000 (21:08 +0300)]
rustc_target: Refactor internal linker flavors

In accordance with the design from https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595

21 months agoAuto merge of #102707 - fmease:rustdoc-render-more-cross-crate-hrtbs-properly, r...
bors [Thu, 6 Oct 2022 08:58:01 +0000 (08:58 +0000)]
Auto merge of #102707 - fmease:rustdoc-render-more-cross-crate-hrtbs-properly, r=GuillaumeGomez

rustdoc: render more cross-crate HRTBs properly

Follow-up to #102439.
Render the `for<>` parameter lists of cross-crate higher-rank trait bounds (in where-clauses and in `impl Trait`).

I've added a new field `bound_params` to `clean::WherePredicate::EqPredicate` (mirroring its sibling variant `BoundPredicate`). However, I had to box the existing fields since `EqPredicate` used to be the largest variant (128 bytes on 64-bit systems) and it would only have gotten bigger).
Not sure if you like that approach. As an alternative, I could pass the uncleaned `ty::Predicate` alongside the cleaned `WherePredicate` to the various re-sugaring methods (similar to what `clean::AutoTraitFinder::param_env_to_generics` does).

I haven't yet added the HTML & JSON rendering code for the newly added `bound_params` field since I am waiting for your opinion. Those two rendering code paths should actually be unreachable in practice given we re-sugar all(?) equality predicates to associated type bindings (and arbitrary equality predicates are not part of the Rust surface language at the time of this writing).

If you agree with storing `bound_params` in `EqPredicate`, I think I can use it to greatly simplify the `clean::auto_trait` module (by also using `simplify::merge_bounds`). Maybe I can do that in any case though.

`@rustbot` label T-rustdoc A-cross-crate-reexports
r? `@GuillaumeGomez`

21 months agoUpdate Cargo.lock
Philipp Krones [Thu, 6 Oct 2022 07:45:08 +0000 (09:45 +0200)]
Update Cargo.lock

21 months agoMerge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup
Philipp Krones [Thu, 6 Oct 2022 07:44:38 +0000 (09:44 +0200)]
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup

21 months agoAuto merge of #9596 - flip1995:rustup, r=flip1995
bors [Thu, 6 Oct 2022 07:23:08 +0000 (07:23 +0000)]
Auto merge of #9596 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

21 months agoBump nightly version -> 2022-10-06
Philipp Krones [Thu, 6 Oct 2022 07:19:51 +0000 (09:19 +0200)]
Bump nightly version -> 2022-10-06

21 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 6 Oct 2022 07:19:29 +0000 (09:19 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

21 months agoreviews
Boxy [Thu, 6 Oct 2022 06:00:38 +0000 (07:00 +0100)]
reviews

21 months agoAuto merge of #102726 - matthiaskrgr:rollup-2ghn38b, r=matthiaskrgr
bors [Thu, 6 Oct 2022 05:58:27 +0000 (05:58 +0000)]
Auto merge of #102726 - matthiaskrgr:rollup-2ghn38b, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #102672 (rustdoc: remove unused CSS class `in-band`)
 - #102693 (Revert "Use getentropy when possible on all Apple platforms")
 - #102694 (Suggest calling method if fn does not exist)
 - #102708 (Suggest `==` to wrong assign expr)
 - #102710 (Add test for issue 82633)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

21 months agoRollup merge of #102710 - Rageking8:add-test-for-issue-82633, r=estebank
Matthias Krüger [Thu, 6 Oct 2022 05:07:37 +0000 (07:07 +0200)]
Rollup merge of #102710 - Rageking8:add-test-for-issue-82633, r=estebank

Add test for issue 82633

Fixes #82633

r? `@estebank`

The current stderr looks slightly different from [source](https://github.com/rust-lang/rust/pull/83915/files#diff-8c64c576ccaceb816e71d2279a6ee4bf79211bc06f55c46dda3f98a18748ad7a), so I used the latest one from nightly. Do let me know if anything is wrong.

21 months agoRollup merge of #102708 - TaKO8Ki:improve-eqeq-suggestion, r=estebank
Matthias Krüger [Thu, 6 Oct 2022 05:07:37 +0000 (07:07 +0200)]
Rollup merge of #102708 - TaKO8Ki:improve-eqeq-suggestion, r=estebank

Suggest `==` to wrong assign expr

Given the following code:

```rust
fn main() {
    let x = 3;
    let y = 3;
    if x == x && y = y {
        println!("{}", x);
    }
}
```

Current output is:

```
error[E0308]: mismatched types
 --> src/main.rs:4:18
  |
4 |     if x == x && y = y {
  |                  ^ expected `bool`, found integer

error[E0308]: mismatched types
 --> src/main.rs:4:8
  |
4 |     if x == x && y = y {
  |        ^^^^^^^^^^^^^^^ expected `bool`, found `()`
```

This adds a suggestion:

```diff
error[E0308]: mismatched types
 --> src/main.rs:6:18
  |
6 |     if x == x && y = y {
  |                  ^ expected `bool`, found integer

error[E0308]: mismatched types
 --> src/main.rs:6:8
  |
6 |     if x == x && y = y {
  |        ^^^^^^^^^^^^^^^ expected `bool`, found `()`
  |
+ help: you might have meant to compare for equality
+   |
+ 6 |     if x == x && y == y {
+   |                     +
```

And this fixes a part of #97469

21 months agoRollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwco
Matthias Krüger [Thu, 6 Oct 2022 05:07:36 +0000 (07:07 +0200)]
Rollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwco

Suggest calling method if fn does not exist

I tried to split this up into two commits, the first where we stash the resolution error until typeck (which causes a bunch of diagnostics changes because the ordering of error messages change), then the second commit is the actual logic that actually implements the suggestion.

I am not in love with the presentation of the suggestion, so I could use some advice for how to format the actual messaging.

r? diagnostics

Fixes #102518

21 months agoRollup merge of #102693 - BlackHoleFox:revert-apple-entropy-changes, r=thomcc
Matthias Krüger [Thu, 6 Oct 2022 05:07:36 +0000 (07:07 +0200)]
Rollup merge of #102693 - BlackHoleFox:revert-apple-entropy-changes, r=thomcc

Revert "Use getentropy when possible on all Apple platforms"

Per https://github.com/rust-lang/rust/issues/102643, This reverts commit 3fc35b5b935e390c61ea2bbf744838b2632b2df1 to avoid breaking any Rust on iOS users.

Closes https://github.com/rust-lang/rust/issues/102643

21 months agoRollup merge of #102672 - notriddle:notriddle/fqn-in-band, r=GuillaumeGomez
Matthias Krüger [Thu, 6 Oct 2022 05:07:35 +0000 (07:07 +0200)]
Rollup merge of #102672 - notriddle:notriddle/fqn-in-band, r=GuillaumeGomez

rustdoc: remove unused CSS class `in-band`

Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code headers, the only remaining uses of the `in-band` class are:

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402

https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525

Since all of these uses are nested below `h1.fqn`, we can get rid of it, and the support code that was used for when `in-band` was part of item rendering.

21 months agoBe consistent about deciding whether to print pass data.
Nicholas Nethercote [Thu, 6 Oct 2022 04:39:27 +0000 (15:39 +1100)]
Be consistent about deciding whether to print pass data.

`print_time_passes_entry` unconditionally prints data about a pass. The
most commonly used call site, in `VerboseTimingGuard::drop`, guards it
with a `should_print_passes` test. But there are a couple of other call
sites that don't do that test.

This commit moves the `should_print_passes` test within
`print_time_passes_entry` so that all passes are treated equally.

21 months agoRemove `-Ztime` option.
Nicholas Nethercote [Thu, 6 Oct 2022 03:51:45 +0000 (14:51 +1100)]
Remove `-Ztime` option.

The compiler currently has `-Ztime` and `-Ztime-passes`. I've used
`-Ztime-passes` for years but only recently learned about `-Ztime`.

What's the difference? Let's look at the `-Zhelp` output:
```
  -Z        time=val -- measure time of rustc processes (default: no)
  -Z time-passes=val -- measure time of each rustc pass (default: no)
```
The `-Ztime-passes` description is clear, but the `-Ztime` one is less so.
Sounds like it measures the time for the entire process?

No. The real difference is that `-Ztime-passes` prints out info about passes,
and `-Ztime` does the same, but only for a subset of those passes. More
specifically, there is a distinction in the profiling code between a "verbose
generic activity" and an "extra verbose generic activity". `-Ztime-passes`
prints both kinds, while `-Ztime` only prints the first one. (It took me
a close reading of the source code to determine this difference.)

In practice this distinction has low value. Perhaps in the past the "extra
verbose" output was more voluminous, but now that we only print stats for a
pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also,
a lot of the "extra verbose" cases are for individual lint passes, and you need
to also use `-Zno-interleave-lints` to see those anyway.

Therefore, this commit removes `-Ztime` and the associated machinery. One thing
to note is that the existing "extra verbose" activities all have an extra
string argument, so the commit adds the ability to accept an extra argument to
the "verbose" activities.

21 months agoFix some comments.
Nicholas Nethercote [Thu, 6 Oct 2022 03:13:12 +0000 (14:13 +1100)]
Fix some comments.

- It's `--print`, not `--prints`.
- `-Ztime` and `-Ztime-passes` print to stderr, not stdout.

21 months agoAuto merge of #99324 - reez12g:issue-99144, r=jyn514
bors [Thu, 6 Oct 2022 03:01:57 +0000 (03:01 +0000)]
Auto merge of #99324 - reez12g:issue-99144, r=jyn514

Enable doctests in compiler/ crates

Helps with https://github.com/rust-lang/rust/issues/99144