Commit Graph

199260 Commits

Author SHA1 Message Date
Nixon Enraght-Moony
b76a012be1 Rustdoc-Json: Add enum discriminant 2022-09-03 22:15:26 +01:00
Matthias Krüger
6f4726541e more clippy::perf fixes 2022-09-03 22:57:22 +02:00
bors
84f0c3f79a Auto merge of #101214 - cjgillot:old-no-lt, r=estebank
Do not call object_lifetime_default on lifetime params.

Small cleanup to avoid unnecessary query invocations in trivial cases.
2022-09-03 19:32:41 +00:00
Michael Goulet
771456264b Don't delay invalid lhs bug unless we know it'll be replaced by one in check_overloaded_binop 2022-09-03 19:12:44 +00:00
Camille GILLOT
e7164267a2 Do not call object_lifetime_default on lifetime params. 2022-09-03 21:11:42 +02:00
Bart Massey
3afbc115f7 updated description of File struct in std::fs 2022-09-03 11:09:06 -07:00
bors
dec689432f Auto merge of #101342 - saethlin:update-backtrace, r=Mark-Simulacrum
Update backtrace

Most notably, this pulls in ebc9a85466, which is both a bugfix and a significant performance improvement for Miri, since fixing the bug makes `RUST_BACKTRACE=1` backtraces much smaller: https://github.com/rust-lang/miri/issues/2273, https://github.com/rust-lang/miri-test-libstd/issues/8

This also pulls in other commits which turn the backtrace-rs CI green. That's nice.
2022-09-03 17:12:17 +00:00
bors
ae0030beb0 Auto merge of #101378 - matthiaskrgr:rollup-s1awa47, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #101335 (rustdoc: remove old CSS selector that causes weird spacing)
 - #101347 (ffx component run should provide a collection)
 - #101364 (Shrink suggestion span of argument mismatch error)
 - #101365 (remove redundant clones)

Failed merges:

 - #101349 (rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-03 14:23:58 +00:00
Matthias Krüger
01da61a9bf
Rollup merge of #101365 - matthiaskrgr:clones2, r=fee1-dead
remove redundant clones
2022-09-03 14:20:53 +02:00
Matthias Krüger
3c2780cf16
Rollup merge of #101364 - compiler-errors:arg-suggestion-spans, r=wesleywiser
Shrink suggestion span of argument mismatch error

This doesn't really help with #101242, but I wanted to put this up while I work on other fixes.
2022-09-03 14:20:52 +02:00
Matthias Krüger
525e386822
Rollup merge of #101347 - diminishedprime:patch-4, r=tmandry
ffx component run should provide a collection

In the future,`ffx component run` will not default to the using the `/core/ffx-laboratory` collection. Updated the run commands to include this.
2022-09-03 14:20:51 +02:00
Matthias Krüger
5e34b79c29
Rollup merge of #101335 - notriddle:notriddle/methods-stability, r=notriddle
rustdoc: remove old CSS selector that causes weird spacing

It was added with e08a84a0c1 (actually, it was called `.methods > .stability` at the time) and was directly nested that way.

**EDIT**: It is technically reachable code still, but it seems wrong.

## With the old CSS rule still present

https://notriddle.com/notriddle-rustdoc-test/weird-spacing/lib/struct.Foo.html

![image](https://user-images.githubusercontent.com/1593513/188216226-c667c560-d33d-494f-a492-4e0ec3ac0009.png)

## Version 2 (an older version of this PR)

https://notriddle.com/notriddle-rustdoc-test/normal-spacing-2/lib/struct.Foo.html

![image](https://user-images.githubusercontent.com/1593513/188216418-9fcd3109-f1b2-425d-b4fc-0c6b3b54e48e.png)

## Version 3 (with alignment fix for mobile)

https://notriddle.com/notriddle-rustdoc-test/normal-spacing-3/lib/struct.Foo.html

![image](https://user-images.githubusercontent.com/1593513/188223161-0e1ebce7-842f-41cb-8a0c-ae43aedcfccc.png)
2022-09-03 14:20:49 +02:00
joboet
8c37fdf2d7
std: make ReentrantMutex movable and const; simplify Stdout initialization 2022-09-03 14:05:28 +02:00
bors
47d1cdb0bc Auto merge of #100574 - Urgau:check-cfg-warn-cfg, r=petrochenkov
Add warning against unexpected --cfg with --check-cfg

This PR adds a warning when an unexpected `--cfg` is specified but not in the specified list of `--check-cfg`.

This is the follow-up PR I mentioned in https://github.com/rust-lang/rust/pull/99519.

r? `@petrochenkov`
2022-09-03 12:02:14 +00:00
bors
06b72b06a2 Auto merge of #101154 - RalfJung:validation-perf, r=oli-obk
interpret: fix unnecessary allocation in validation visitor

Should fix the perf regression introduced by https://github.com/rust-lang/rust/pull/100043.

r? `@oli-obk`
2022-09-03 09:20:54 +00:00
Michael Goulet
be53bd8380 Include enum path in variant suggestion 2022-09-03 08:11:17 +00:00
Michael Goulet
e9b01c745d Fix global_asm macro pretty printing 2022-09-03 08:06:35 +00:00
Michael Goulet
fdbede7ad8 Suggest copied or cloned 2022-09-03 07:30:30 +00:00
Michael Goulet
12a4952369 Suggest associated method on deref types 2022-09-03 07:24:55 +00:00
bors
92086258e3 Auto merge of #101361 - Dylan-DPC:rollup-xj1syld, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #99736 (Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref`)
 - #100928 (Migrate rustc_metadata to SessionDiagnostics)
 - #101217 ([drop tracking] Use parent expression for scope, not parent node )
 - #101325 (Windows RNG: Use `BCRYPT_RNG_ALG_HANDLE` by default)
 - #101330 (Fix `std::collections::HashSet::drain` documentation)
 - #101338 (Fix unsupported syntax in .manifest file)
 - #101348 (Cleanup css theme)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-03 07:00:07 +00:00
Matthias Krüger
57198b549f remove redundant clones 2022-09-03 07:58:41 +02:00
Michael Goulet
b0f3a551f2 Shrink suggestion span of argument mismatch error 2022-09-03 05:54:13 +00:00
Michael Goulet
91674cc56c Suggest removing unnecessary prefix let in patterns 2022-09-03 05:39:46 +00:00
Dylan DPC
7eed25b200
Rollup merge of #101348 - GuillaumeGomez:cleanup-css-theme, r=notriddle
Cleanup css theme

Follow-up of https://github.com/rust-lang/rust/pull/100494.

The change for the border color of the search input in the dark mode was actually a weird case: the search input border was unique, it didn't share the same variable with other items with borders. This weird case being unique to the dark theme, I removed it, hence the modification in the GUI test.

Live demo is [here](https://rustdoc.crud.net/imperio/cleanup-css-theme/std/index.html).

cc `@jsha`
r? `@notriddle`
2022-09-03 10:33:09 +05:30
Dylan DPC
9ed2deb0de
Rollup merge of #101338 - diminishedprime:patch-2, r=tmandry
Fix unsupported syntax in .manifest file

Fuchsia .manifest files do not support a `#` comment syntax. Because of this, if you copy and paste the current example code for this file, and then remove the line you don't need, you still see an error. To make this a bit easier to follow, split this into two code blocks, one for rustc, and one for cargo.
2022-09-03 10:33:08 +05:30
Dylan DPC
414d79d567
Rollup merge of #101330 - wkordalski:hashset-drain-doc, r=jyn514
Fix `std::collections::HashSet::drain` documentation

Hi!

`std::collections::HashSet::drain` contains small typo in the docstring.

I didn't read too much about the model of contributing to Rust, so merge this PR or close and fix the typo the right way :)

Thanks for Rust!
2022-09-03 10:33:07 +05:30
Dylan DPC
c42df986da
Rollup merge of #101325 - ChrisDenton:BCRYPT_RNG_ALG_HANDLE, r=thomcc
Windows RNG: Use `BCRYPT_RNG_ALG_HANDLE` by default

This only changes a small amount of actual code, the rest is documentation outlining the history of this module as I feel it will be relevant to any future issues that might crop up.

The code change is to use the `BCRYPT_RNG_ALG_HANDLE` [pseudo-handle](https://docs.microsoft.com/en-us/windows/win32/seccng/cng-algorithm-pseudo-handles) by default, which simply uses the default RNG. Previously we used `BCRYPT_USE_SYSTEM_PREFERRED_RNG` which has to load the system configuration and then find and load that RNG. I suspect this was the cause of failures on some systems (e.g. due to corrupted config). However, this is admittedly speculation as I can't reproduce the issue myself (and it does seem quite rare even in the wild). Still, removing a possible point of failure is likely worthwhile in any case.

r? libs
2022-09-03 10:33:06 +05:30
Dylan DPC
dc8fe633d5
Rollup merge of #101217 - eholk:drop-tracking-73137, r=jyn514
[drop tracking] Use parent expression for scope, not parent node

Previously we were just using the parent node as the scope for a temporary value, but it turns out this is too narrow. For example, in an expression like

    Foo {
        b: &42,
        a: async { 0 }.await,
    }

the scope for the &42 was set to the ExprField node for `b: &42`, when we actually want to use the Foo struct expression.

We fix this by recursively searching through parent nodes until we find a Node::Expr. It may be that we don't find one, and if so that's okay, we will just fall back on the enclosing temporary scope which is always sufficient.

Helps with #97331

r? ``@jyn514``
2022-09-03 10:33:06 +05:30
Dylan DPC
a0056795da
Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco
Migrate rustc_metadata to SessionDiagnostics

Migrate rustc_metadata to SessionDiagnostics.

Part of https://github.com/rust-lang/rust/issues/100717
2022-09-03 10:33:05 +05:30
Dylan DPC
2ed716a81d
Rollup merge of #99736 - lopopolo:lopopolo/gh-80996-partial-stabilization-bounds-as-ref, r=dtolnay
Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref`

Stabilizing `Bound::as_ref` will simplify the implementation for `RangeBounds<usize>` for custom range types:

```rust
impl RangeBounds<usize> for Region {
    fn start_bound(&self) -> Bound<&usize> {
        // TODO: Use `self.start.as_ref()` when upstream `std` stabilizes:
        // https://github.com/rust-lang/rust/issues/80996
        match self.start {
            Bound::Included(ref bound) => Bound::Included(bound),
            Bound::Excluded(ref bound) => Bound::Excluded(bound),
            Bound::Unbounded => Bound::Unbounded,
        }
    }

    fn end_bound(&self) -> Bound<&usize> {
        // TODO: Use `self.end.as_ref()` when upstream `std` stabilizes:
        // https://github.com/rust-lang/rust/issues/80996
        match self.end {
            Bound::Included(ref bound) => Bound::Included(bound),
            Bound::Excluded(ref bound) => Bound::Excluded(bound),
            Bound::Unbounded => Bound::Unbounded,
        }
    }
}
```

See:

- #80996
- https://github.com/rust-lang/rust/issues/80996#issuecomment-1194575470

cc `@yaahc` who suggested partial stabilization.
2022-09-03 10:33:04 +05:30
bors
0421444f8f Auto merge of #101139 - nnethercote:shrink-thir-Pat, r=cjgillot
Shrink `thir::Pat`

r? `@cjgillot`
2022-09-03 04:19:00 +00:00
bors
0209485578 Auto merge of #100966 - compiler-errors:revert-remove-deferred-sized-checks, r=pnkfelix
Revert "Remove deferred sized checks"

cc: https://github.com/rust-lang/rust/pull/100652#issuecomment-1225798572

I'm okay with reverting this for now, and I will look into the diagnostic regressions.

This reverts commit 33212bf7f5.

r? `@pnkfelix`

----

EDIT: This _also_ fixes #101066, a regression in method selection logic/coercion(?) due to the early registering of a `Sized` bound.
2022-09-03 00:02:41 +00:00
asquared31415
80e035c9e4 implement IsZero for Saturating and Wrapping 2022-09-02 19:55:01 -04:00
Matt Hamrick
c528f70325
ffx component run should provide a collection
In the future,`ffx component run` will not default to the using the `/core/ffx-laboratory` collection. Updated the run commands to include this.
2022-09-02 15:16:51 -07:00
Guillaume Gomez
30bdf54827 Update rustdoc-gui tests for search-input border color on dark theme 2022-09-03 00:16:10 +02:00
Guillaume Gomez
7fb0a89bec Clean up themes CSS 2022-09-03 00:16:09 +02:00
bors
8c6ce6b91b Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett
Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE`

When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program

```rust
fn main() { loop { println!("hello world"); } }
```

will print an error if used with a short-lived pipe, e.g.

    % ./main | head -n 1
    hello world
    thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

by enabling `#[unix_sigpipe = "sig_dfl"]` like this

```rust
#![feature(unix_sigpipe)]
#[unix_sigpipe = "sig_dfl"]
fn main() { loop { println!("hello world"); } }
```

there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately:

    % ./main | head -n 1
    hello world

The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`.

With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`.

See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself

See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR.

Tracking issue: https://github.com/rust-lang/rust/issues/97889
2022-09-02 21:08:08 +00:00
Michael Howell
0f29824760 rustdoc: put in rule to get alignment in desktop and mobile layouts 2022-09-02 13:13:22 -07:00
Ben Kimock
a7b4f189d8 Update backtrace 2022-09-02 16:09:58 -04:00
Michael Howell
6f95c89c4d rustdoc: remove incorrect CSS rule causing misaligned item-info 2022-09-02 11:50:19 -07:00
Michael Howell
df0904750d rustdoc: remove unused CSS selector .methods > .item-info
It was added with e08a84a0c1
(actually, it was called `.methods > .stability` at the time) and was
directly nested that way.

But with the switch to `<details>`, the code has changed drastically out from
under it, to the point where you have to go out of your way to actually get
it to render this way, and the result looks overly-tight and weird alongside
the normal version where this code is not reachable.
2022-09-02 11:45:16 -07:00
bors
9ba169a73a Auto merge of #101333 - matthiaskrgr:rollup-qpf1otj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #100121 (Try normalizing types without RevealAll in ParamEnv in MIR validation)
 - #100200 (Change implementation of `-Z gcc-ld` and `lld-wrapper` again)
 - #100814 ( Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1)
 - #101215 (Also replace the version placeholder in rustc_attr)
 - #101260 (Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag)
 - #101323 (Remove unused .toggle-label CSS rule)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-02 18:40:21 +00:00
Matt Hamrick
6fbc4d9165
Fix unsupported syntax in .manifest file
Fuchsia .manifest files do not support a `#` comment syntax. Because of this, if you copy and paste the current example code for this file, and then remove the line you don't need, you still see an error. To make this a bit easier to follow, split this into two code blocks, one for rustc, and one for cargo.
2022-09-02 11:14:22 -07:00
Cameron Steffen
9ea82d57e2 clippy: BindingAnnotation change 2022-09-02 13:03:11 -05:00
Cameron Steffen
ac4bb0085b rustfmt: BindingAnnotation change 2022-09-02 12:55:05 -05:00
Cameron Steffen
02ba216e3c Refactor and re-use BindingAnnotation 2022-09-02 12:55:05 -05:00
Matthias Krüger
e77b8ce100
Rollup merge of #101323 - GuillaumeGomez:remove-unused-css, r=notriddle
Remove unused .toggle-label CSS rule

It was added in https://github.com/rust-lang/rust/pull/44192 but since we moved to `<details>`, we don't use this rule any more.

r? `@notriddle`
2022-09-02 18:22:04 +02:00
Matthias Krüger
1e008fec04
Rollup merge of #101260 - ChrisDenton:attribute-tag, r=thomcc
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag

I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct.

r? ```````@thomcc``````` since you've made changes here recently (which is why I have this code on my mind atm)
2022-09-02 18:22:02 +02:00
Matthias Krüger
5a23efd31e
Rollup merge of #101215 - est31:rustdoc_version_placeholder, r=Mark-Simulacrum
Also replace the version placeholder in rustc_attr

Replace the version placeholder with the current version in the rustc_attr crate too so that users won't see the placeholder but instead the explicit version. This especially fixes the bug for rustdoc not showing it but instead the placeholder.

Originally reported [here](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/libs.20stabilization.20placeholder/near/296057188).

cc #100591

![Screenshot_20220830_233727](https://user-images.githubusercontent.com/8872119/187548079-6207776b-4481-4351-afff-607f5b3fe03a.png)
2022-09-02 18:22:01 +02:00
Matthias Krüger
c8749f0453
Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco
Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1

``@rustbot`` label +A-translation

r? rust-lang/diagnostics
cc #100717
2022-09-02 18:22:00 +02:00