Commit Graph

208698 Commits

Author SHA1 Message Date
Matthias Krüger
1d3aa7bce7
Rollup merge of - notriddle:notriddle/out-of-band, r=GuillaumeGomez
rustdoc: remove unused CSS `.out-of-band { font-weight: normal }`

This CSS was added in 083c3952e0 to normalize the appearance of out-of-band elements that were nested directly below headers.

Now, the only use of `out-of-band` is in the main page header, and it is nested below a wrapper, not the `<h1>` itself.
2022-10-22 00:14:04 +02:00
Matthias Krüger
66f33dff2d
Rollup merge of - notriddle:notriddle/toggles, r=jsha
rustdoc: clean up rustdoc-toggle CSS
2022-10-22 00:14:03 +02:00
Matthias Krüger
1b2f594f48
Rollup merge of - WaffleLapkin:drain_no_mut_qqq, r=scottmcm
Remove incorrect comment in `Vec::drain`

r? ``@scottmcm``

Turns out this comment wasn't correct for 6 years, since , which switched from using `slice::IterMut` into using `slice::Iter`.
2022-10-22 00:14:03 +02:00
Matthias Krüger
ed430ca5fe
Rollup merge of - oli-obk:tilde_const_impls, r=fee1-dead
Require Drop impls to have the same constness on its bounds as the bounds on the struct have

r? ``@fee1-dead``
2022-10-22 00:14:02 +02:00
Matthias Krüger
db4696a546
Rollup merge of - Rageking8:add-test-for-issue-97607, r=compiler-errors
Add test for issue 97607

Fixes 

r? ``@compiler-errors``

Not sure which UI test dir to put this under, kindly let me know of a better dir if necessary and I will change it. Thanks.
2022-10-22 00:14:01 +02:00
Matthias Krüger
b21eb5e5ba
Rollup merge of - RalfJung:winconsole, r=thomcc
WinConsole::new is not actually fallible

I just noticed this while reading the code for other reasons.
r? ``@thomcc``
2022-10-22 00:14:01 +02:00
Matthias Krüger
7ee0aeacaf
Rollup merge of - Rageking8:fix-some-typos, r=fee1-dead
Fix some typos
2022-10-22 00:14:00 +02:00
Matthias Krüger
e67f09ac79
Rollup merge of - SarthakSingh31:issue-89008, r=jackh726
Replaced wrong test with the correct mcve

Closes .

The old test was wrong and the compiler was [correctly raising an error](https://github.com/rust-lang/rust/issues/89008#issuecomment-1285128060). The bug in the issue was resolved at some point but due to the wrong test the issue was never closed.

This pr replaces that test with the correct MCVE (made by ``@jackh726).``

The error raised by the bug changed between when the bug was posted (2021-09-08) and when the MCVE [was posted](https://github.com/rust-lang/rust/issues/89008#issuecomment-950110735) (2021-10-23).
I ran them both through `nightly-2021-09-08` and they produce identical error messages. They also produce identical but different from before error messages when ran through `nightly-2021-10-23`.

<details>
  <summary>Error message with <code>nightly-2021-09-08</code></summary>

The code with the original bug report:
  ```
error[E0277]: the size for values of type `Repr` cannot be known at compilation time
  --> src/main.rs:23:43
   |
23 |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
   |                        ----               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
   |                        |
   |                        this type parameter needs to be `std::marker::Sized`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `test-234234` due to previous error
  ```

MVCE:
```
error[E0277]: the size for values of type `Repr` cannot be known at compilation time
  --> src/main.rs:30:43
   |
30 |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
   |                        ----               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
   |                        |
   |                        this type parameter needs to be `std::marker::Sized`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `test-234234` due to previous error
```
</details>

<details>
<summary>Error message with <code>nightly-2021-10-23</code></summary>

The code with the original bug report:
```
error[E0271]: type mismatch resolving `<impl futures::Future as futures::Future>::Output == impl futures::Stream`
  --> src/main.rs:23:43
   |
19 |     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
   |                                 ------------------------ the expected opaque type
...
23 |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found struct `futures::stream::Empty`
   |
   = note: expected opaque type `impl futures::Stream`
                   found struct `futures::stream::Empty<_>`

error: could not find defining uses
  --> src/main.rs:19:33
   |
19 |     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0271`.
error: could not compile `test-234234` due to 2 previous errors
```

MCVE:
```
error[E0271]: type mismatch resolving `<impl Future as Future>::Output == impl Stream`
  --> src/main.rs:30:43
   |
28 |     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
   |                                 ------------------------ the expected opaque type
29 |     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
30 |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found struct `Empty`
   |
   = note: expected opaque type `impl Stream`
                   found struct `Empty<_>`

error: could not find defining uses
  --> src/main.rs:28:33
   |
28 |     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0271`.
error: could not compile `test-234234` due to 2 previous errors
```
</details>
2022-10-22 00:14:00 +02:00
Matthias Krüger
ebfdf735ac
Rollup merge of - lcnr:incoherent_auto_trait_objects, r=jackh726
make `order_dependent_trait_objects` show up in future-breakage reports

tried to change it to a hard error in  but breaking the more than 1000 dependents of `traitobject` doesn't feel great 😅

This lint has existed since more than 3 years now and the way this is currently implemented is buggy and will break with . imo we should upgrade it to also report for dependencies and maybe also backport this to beta. Then after maybe 2-3 stable versions I would like to finally convert this lint to a hard error.
2022-10-22 00:13:59 +02:00
Alex Macleod
815876d93f Move MSRV tests into the lint specific test files 2022-10-21 21:35:39 +00:00
Michael Howell
1adb4c338a rustdoc: remove unused CSS .out-of-band { font-weight: normal }
This CSS was added in 083c3952e0 to
normalize the appearance of out-of-band elements that were nested directly
below headers.

Now, the only use of `out-of-band` is in the main page header, and it is
nested below a wrapper, not the `<h1>` itself.
2022-10-21 14:13:18 -07:00
bors
5c8bff74bc Auto merge of - lopopolo:lopopolo/c-unwind-fn-ptr-impls, r=thomcc
Add default trait implementations for "c-unwind" ABI function pointers

Following up on , only add default trait implementations for the `c-unwind` family of function pointers. The previous attempt in  added trait implementations for many more ABIs and ran into concerns regarding the increase in size of the libcore rlib.

An attempt to abstract away function pointer types behind a unified trait to reduce the duplication of trait impls is being discussed in  but this change looks to be blocked on a lang MCP.

Following `@RalfJung's` suggestion in https://github.com/rust-lang/rust/pull/99531#issuecomment-1233440142, this commit is another cut at  but it _only_ adds the impls for `extern "C-unwind" fn` and `unsafe extern "C-unwind" fn`.

I am interested in landing this patch to unblock the stabilization of the `c_unwind` feature.

RFC: https://github.com/rust-lang/rfcs/pull/2945
Tracking Issue: https://github.com/rust-lang/rust/issues/74990
2022-10-21 20:59:03 +00:00
bors
b72e451310 Auto merge of - kraktus:ref_option_ref, r=xFrednet
`ref_option_ref` do not lint when inner reference is mutable

changelog: FP: [`ref_option_ref`]: No longer lints if the inner reference is mutable

fix https://github.com/rust-lang/rust-clippy/issues/9682
2022-10-21 20:19:30 +00:00
bors
b2e5a719bb Auto merge of - kraktus:collapsible_match, r=llogiq
[`collapsible_match`] specify field name when destructuring structs

changelog: [`collapsible_match`] specify field name when destructuring structs

fix https://github.com/rust-lang/rust-clippy/issues/9647

I wasn't the sure about the best way to convey the message in the lint message since it does not use suggestion. Because I liked the former output highlighting both spans, I've left it as before, only modifying the span label.
2022-10-21 19:27:35 +00:00
Michael Goulet
cb61113cdc tests 2022-10-21 19:04:13 +00:00
Michael Goulet
9f6b9dd644 Delay ambiguity span bug in normalize query iff not rustdoc 2022-10-21 18:53:16 +00:00
bors
57e2c06a8d Auto merge of - sunshowers:signal-mask-inherit, r=sunshowers
Change process spawning to inherit the parent's signal mask by default

Previously, the signal mask was always reset when a child process is
started. This breaks tools like `nohup` which expect `SIGHUP` to be
blocked for all transitive processes.

With this change, the default behavior changes to inherit the signal mask.

This also changes the signal disposition for `SIGPIPE` to only be changed if the `#[unix_sigpipe]` attribute isn't set.
2022-10-21 18:09:03 +00:00
bors
fc3bcacbe7 Auto merge of - ChrisDenton:getfiletype, r=RalfJung
add GetFileType stub

because I'm planning to break miri again https://github.com/rust-lang/rust/pull/103360

See [GetFileType](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletype)
2022-10-21 17:51:44 +00:00
Michael Howell
526c1d32f6 rustdoc: prevent method summary margin from being applied to docblocks 2022-10-21 10:48:41 -07:00
Chris Denton
590834b032
add GetFileType stub 2022-10-21 18:34:51 +01:00
Michael Howell
0dbf233fc9 rustdoc: merge identical CSS blocks 2022-10-21 10:31:33 -07:00
Chris Denton
d7b0bcb20f
Reduce false positives in msys2 detection
This checks that:

* the handle is a pipe
* the pipe's file name starts with "msys-" or "cygwin-" rather than looking in the full path.
2022-10-21 18:06:12 +01:00
bors
6504d2ef5f Auto merge of - pfmooney:libffi, r=RalfJung
Update libffi-sys to 2.0.1

Prior version of libffi [could not be cross-compiled to illumos](https://github.com/tov/libffi-rs/pull/59) due to host-triple complications.  This should fix rustup builds of miri for the illumos platform.
2022-10-21 16:33:36 +00:00
Patrick Mooney
b42721ce45 Update libffi-sys to 2.0.1
Prior version of libffi could not be cross-compiled to illumos due to
host-triple complications.  This should fix rustup builds of miri for
the illumos platform.
2022-10-21 11:18:23 -05:00
Maybe Waffle
e97d295d00 Remove incorrect comment in Vec::drain 2022-10-21 15:29:02 +00:00
bors
ba9d01be67 Auto merge of - lqd:doc-metadata, r=lqd,GuillaumeGomez
Remove more attributes from metadata

A lot of the attributes that are currently stored in the metadata aren't used at all. The biggest metadata usage comes from the doc attributes currently but they are needed by rustdoc so we only removed the ones that cannot be used in downstream crates (doc comments on private items).

r? `@ghost`
2022-10-21 15:27:56 +00:00
Ralf Jung
bdc4acb7bf bootstrap: also create rustc-src component in sysroot 2022-10-21 17:07:27 +02:00
Michael Goulet
419fde7a38 Handle RPITITs properly in register_hidden_type 2022-10-21 14:57:01 +00:00
Oli Scherer
d6cf8934db Require Drop impls to have the same constness on its bounds as the bounds on the struct have 2022-10-21 14:22:13 +00:00
Oli Scherer
349ba6bb51 Remove needless special cases and dead code 2022-10-21 14:21:44 +00:00
bors
8ee23f4f0a Auto merge of - Veykril:disabled-commands, r=Veykril
internal: Properly handle commands in the VSCode client when the server is stopped
2022-10-21 14:05:25 +00:00
Lukas Wirth
1cb46079e4 internal: Properly handle commands in the VSCode client when the server is stopped 2022-10-21 16:00:43 +02:00
clubby789
3f1e99936a Update UI tests 2022-10-21 14:43:58 +01:00
clubby789
717bf35366 Different suggestions for when associated functions are referred to 2022-10-21 14:38:44 +01:00
kraktus
487c6fc9ad [collapsible_match] specify field name when destructuring structs 2022-10-21 14:51:13 +02:00
Andreas Molzer
e3606b2b02 Reduce mutability in std-use of with_metadata_of 2022-10-21 14:49:29 +02:00
bors
233542bf42 Auto merge of - RalfJung:issue-1909, r=RalfJung
add test for 

Fixes https://github.com/rust-lang/miri/issues/1909
2022-10-21 12:48:54 +00:00
Andreas Molzer
71c39dea4d Argument type for mutable with_metadata_of ()
The method takes two pointer arguments: one `self` supplying the pointer
value, and a second pointer supplying the metadata.

The new parameter type more clearly reflects the actual requirements.
The provenance of the metadata parameter is disregarded completely.
Using a mutable pointer in the call site can be coerced to a const
pointer while the reverse is not true.

An example of the current use:

```rust
// Manually taking an unsized object from a `ManuallyDrop` into another allocation.
let val: &core::mem::ManuallyDrop<T> = …;

let ptr = val as *const _ as *mut T;
let ptr = uninit.as_ptr().with_metadata_of(ptr);
```

This could then instead be simplified to:

```rust
// Manually taking an unsized object from a `ManuallyDrop` into another allocation.
let val: &core::mem::ManuallyDrop<T> = …;

let ptr = uninit.as_ptr().with_metadata_of(&**val);
```
2022-10-21 14:46:14 +02:00
bors
657f246812 Auto merge of - Dylan-DPC:rollup-d1rpfvx, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 -  (Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait`)
 -  (Filtering spans when emitting json)
 -  (translation: doc comments with derives, subdiagnostic-less enum variants, more derive use)
 -  (Account for hygiene in typo suggestions, and use them to point to shadowed names)
 -  (Fixup a few tests needing asm support)
 -  (rustdoc: improve appearance of source page navigation bar)

Failed merges:

 -  (Diagnostic derives: allow specifying multiple alternative suggestions)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-21 12:41:09 +00:00
Ralf Jung
f554ebbc77 add test for 2022-10-21 14:28:12 +02:00
bors
9670a3092f Auto merge of - RalfJung:is_terminal, r=RalfJung
Use is_terminal to implement isatty

This means that Linux targets on Windows hosts should give a correct reply. We still don't have an implementation for Windows targets though, that requires some tracking of handles.

Fixes https://github.com/rust-lang/miri/issues/2419

Also restructure our `fs` tests a bit to test the parts that don't need libc separately.

`as_unix_host_fd` is now not used any more, but it could become useful again in the future so I kept it.
2022-10-21 12:23:11 +00:00
Ralf Jung
1c9f3682f5 test is_terminal 2022-10-21 14:22:12 +02:00
Ralf Jung
7300aac798 split libc tests from stdlib tests 2022-10-21 14:22:12 +02:00
Ralf Jung
9a1edc3c06 use is_terminal to implement isatty 2022-10-21 14:22:12 +02:00
Dylan DPC
325e9203ba
Rollup merge of - notriddle:notriddle/source-page-top-bar-layout, r=GuillaumeGomez
rustdoc: improve appearance of source page navigation bar

This commit changes things so that the search bar is exactly centered between the top of the page and the top of the source code content area.

Preview: https://notriddle.com/notriddle-rustdoc-demos/source-page-header/src/std/lib.rs.html

## Before

![image](https://user-images.githubusercontent.com/1593513/197053420-02a64627-48ed-4bb6-9363-a1863d47b092.png)

## After

![image](https://user-images.githubusercontent.com/1593513/197053355-bd6149f9-0f5c-47da-aeb7-590b5eecb5da.png)
2022-10-21 17:30:00 +05:30
Dylan DPC
3055eb9b26
Rollup merge of - cuviper:needs-asm-support, r=fee1-dead
Fixup a few tests needing asm support
2022-10-21 17:29:59 +05:30
Dylan DPC
41a1cfdbaf
Rollup merge of - cjgillot:shadow-label, r=estebank
Account for hygiene in typo suggestions, and use them to point to shadowed names

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

r? `@estebank`
2022-10-21 17:29:59 +05:30
Dylan DPC
e11511dfa6
Rollup merge of - davidtwco:translation-tidying-up, r=compiler-errors
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use

- Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing.
- Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic.
- Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc.

cc 
2022-10-21 17:29:58 +05:30
Dylan DPC
0a0e9f73af
Rollup merge of - kper:bugfix/102902-filtering-json, r=oli-obk
Filtering spans when emitting json

According to the issue , we shouldn't emit spans which have an empty span and no suggested replacement.
2022-10-21 17:29:58 +05:30
Dylan DPC
66d91d8276
Rollup merge of - compiler-errors:unused-must-use-also-supertrait, r=fee1-dead
Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait`

Given `impl Trait`, if one of its supertraits has a `#[must_use]`, then trigger the lint. This means that, for example, `-> impl ExactSizeIterator` also triggers the `must_use` on `trait Iterator`, which fixes .

This might need `@rust-lang/lang` sign-off, since it changes the behavior of the lint, so cc'ing them.
2022-10-21 17:29:57 +05:30