Commit Graph

170680 Commits

Author SHA1 Message Date
bors
dc80ca78b6 Auto merge of #98098 - bjorn3:archive_refactor, r=michaelwoerister
Remove the source archive functionality of ArchiveWriter

We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts. This is simpler and makes it easier to swap out the archive writer in https://github.com/rust-lang/rust/pull/97485.
2022-06-21 16:24:56 +00:00
bors
72fd41a8b4 Auto merge of #98335 - JohnTitor:rollup-j2zudxv, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #94033 (Improve docs for `is_running` to explain use case)
 - #97269 (adjust transmute const stabilization version)
 - #97805 (Add proper tracing spans to rustc_trait_selection::traits::error_reporting)
 - #98022 (Fix erroneous span for borrowck error)
 - #98124 (Improve loading of crates.js and sidebar-items.js)
 - #98278 (Some token stream cleanups)
 - #98306 (`try_fold_unevaluated` for infallible folders)
 - #98313 (Remove lies in comments.)
 - #98323 (⬆️ rust-analyzer)
 - #98329 (Avoid an ICE and instead let the compiler report a useful error)
 - #98330 (update ioslice docs to use shared slices)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-21 13:41:37 +00:00
Yuki Okushi
e5092425eb
Rollup merge of #98330 - conradludgate:io-slice-mut-docs, r=Dylan-DPC
update ioslice docs to use shared slices

I noticed that IoSlice docs were taking unnecessary mut slices, when they only accept shared slices
2022-06-21 20:08:17 +09:00
Yuki Okushi
1b48f09536
Rollup merge of #98329 - oli-obk:fast_path_ice, r=cjgillot
Avoid an ICE and instead let the compiler report a useful error

Fixes #98299
2022-06-21 20:08:16 +09:00
Yuki Okushi
21a20b419a
Rollup merge of #98323 - lnicola:rust-analyzer-2022-06-21, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2022-06-21 20:08:15 +09:00
Yuki Okushi
18b01d5ea0
Rollup merge of #98313 - m-ou-se:fix-comments, r=joshtriplett
Remove lies in comments.

> does not have a const constructor

> pub const fn new() -> Self

🤔
2022-06-21 20:08:14 +09:00
Yuki Okushi
51a60911fb
Rollup merge of #98306 - eggyal:add-unevaluated-to-blanket-fallibletypefolder, r=nnethercote
`try_fold_unevaluated` for infallible folders

#97447 added folding of unevaluated constants, but did not include an override of the default (fallible) operation in the blanket impl of `FallibleTypeFolder` for infallible folders.  Here we provide that missing override.

r? ```@nnethercote```
2022-06-21 20:08:13 +09:00
Yuki Okushi
b1d2e5c0cc
Rollup merge of #98278 - nnethercote:some-token-stream-cleanups, r=petrochenkov
Some token stream cleanups

Best reviewed one commit at a time.

r? ```@petrochenkov```
2022-06-21 20:08:12 +09:00
Yuki Okushi
75f17ed909
Rollup merge of #98124 - jsha:defer-crates, r=GuillaumeGomez
Improve loading of crates.js and sidebar-items.js

Now that the "All Crates" dropdown is only rendered on the search results page,
there is no need to load crates.js on most pages. Load it only on crate pages.
Also, add the `defer` attribute so it does not block HTML parsing.

For sidebar-items.js, move the script tag to `<head>`. Since it already has the
defer attribute it won't block loading. The defer attribute does preserve
ordering between scripts, so instead of the callback on load, it can set a
global variable on load, which is slightly simpler. Also, since it is required
to finish rendering the page, beginning its load earlier is better.

Remove generation and handling of sidebar-vars. Everything there can be computed
with information available in JS via other means.

Remove the extra_scripts fields of the `Page` template. They were only
used by source-script.js and source-files.js, which are now linked by the template
based on whether it is rendering a source page.

Remove the "other" wrapper in the sidebar. It was unnecessary.

r? ```@GuillaumeGomez```

Demo: https://rustdoc.crud.net/jsha/defer-crates/std/index.html
2022-06-21 20:08:11 +09:00
Yuki Okushi
a7f789b502
Rollup merge of #98022 - compiler-errors:erroneous-borrowck-span, r=oli-obk
Fix erroneous span for borrowck error

I am not confident that this is the correct fix, but it does the job. Open to suggestions for a real fix instead.

Fixes #97997

The issue is that we pass a [dummy location](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/mir/visit.rs.html#302) when type-checking the ["required consts"](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.required_consts) that are needed by the MIR body during borrowck. This means that when we fail to evaluate the constant, we use the span of `bb0[0]`, instead of the actual span of the constant.

There are quite a few other places that use `START_BLOCK.start_location()`, `Location::START`, etc. when calling for a random/unspecified `Location` value. This is because, unlike (for example) `Span`, we don't have a dummy/miscellaneous value to use instead. I would appreciate guidance (either in this PR, or a follow-up) on what needs to be done to clean this up in general.
2022-06-21 20:08:10 +09:00
Yuki Okushi
9c800ec4e9
Rollup merge of #97805 - coolreader18:trace-suggestions, r=oli-obk
Add proper tracing spans to rustc_trait_selection::traits::error_reporting

While I was trying to figure out #97704 I did some of this to make the logs more legible, so I figured I'd do the whole module and open a PR with it. afaict this is an ongoing process in the compiler from the log->tracing transition? but lmk if there was a reason for the more verbose forms of logging as they are.

Also, for some of the functions with only one log in them, I put the function name as a message for that log instead of `#[instrument]`-ing the whole function with a span? but maybe the latter would actually be preferable, I'm not actually sure.
2022-06-21 20:08:09 +09:00
Yuki Okushi
b20aff2b33
Rollup merge of #97269 - RalfJung:transmute, r=m-ou-se
adjust transmute const stabilization version

With 1.46, this became callable only in `const`/`static` items.

Only since 1.56 is this callable in `const fn`: [changelog](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1560-2021-10-21)

Also see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/transmute.20const.20fn.20stabilization).
2022-06-21 20:08:08 +09:00
Yuki Okushi
84c17c200a
Rollup merge of #94033 - joshtriplett:documentation-is-running-better-go-catch-it, r=m-ou-se
Improve docs for `is_running` to explain use case
2022-06-21 20:08:07 +09:00
bors
a25b1315ee Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obk
Remove dereferencing of Box from codegen

Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains.

Hopefully, this is the end of the Box<T, A> ICEs.
2022-06-21 11:00:39 +00:00
Conrad Ludgate
44dbd9808e update ioslice docs to use shared slices 2022-06-21 11:45:17 +02:00
Oli Scherer
d2ea7e2059 Avoid an ICE and instead let the compiler report a useful error 2022-06-21 08:47:02 +00:00
bors
abace0a1f1 Auto merge of #97657 - Urgau:check-cfg-many-mut, r=oli-obk
Use get_many_mut to reduce the cost of setting up check cfg values

This PR use the newly added [`get_many_mut`](https://github.com/rust-lang/rust/issues/97601) function in [`HashMap`](https://doc.rust-lang.org/nightly/std/collections/hash_map/struct.HashMap.html#method.get_many_mut) to reduce the cost of setting up the initial check cfg values.

cc `@petrochenkov`
2022-06-21 07:40:32 +00:00
Laurențiu Nicola
db542e46c2 ⬆️ rust-analyzer 2022-06-21 08:12:17 +03:00
bors
42dcf70f99 Auto merge of #98148 - c410-f3r:assert-compiler, r=oli-obk
[RFC 2011] Expand expressions where possible

Tracking issue: https://github.com/rust-lang/rust/issues/44838
Fourth step of https://github.com/rust-lang/rust/pull/96496

Extends https://github.com/rust-lang/rust/pull/97665 considering expressions that are good candidates for expansion.

r? `@oli-obk`
2022-06-21 03:44:54 +00:00
bors
0887113991 Auto merge of #98307 - matthiaskrgr:rollup-rb3huha, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #98235 (Drop magic value 3 from code)
 - #98267 (Don't omit comma when suggesting wildcard arm after macro expr)
 - #98276 (Mention formatting macros when encountering `ArgumentV1` method in const)
 - #98296 (Add a link to the unstable book page on Generator doc comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-20 22:34:50 +00:00
Mara Bos
a171a6b7ec Remove lies in comments. 2022-06-20 23:02:21 +02:00
Josh Triplett
7098a714e8 Improve docs for is_running to explain use case 2022-06-20 13:42:49 -07:00
Matthias Krüger
dfa933d420
Rollup merge of #98296 - JohnTitor:generator-unstable-book-link, r=Dylan-DPC
Add a link to the unstable book page on Generator doc comment

This makes it easier to jump into the Generator section on the unstable book.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-20 20:13:12 +02:00
Matthias Krüger
5eb7238928
Rollup merge of #98276 - compiler-errors:const-format-macro, r=oli-obk
Mention formatting macros when encountering `ArgumentV1` method in const

Also open to just closing this if it's overkill. There are a lot of other distracting error messages around, so maybe it's not worth fixing just this one.

Fixes #93665
2022-06-20 20:13:11 +02:00
Matthias Krüger
3e5800b8d3
Rollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obk
Don't omit comma when suggesting wildcard arm after macro expr

* Also adds `Span::eq_ctxt` to consolidate the various usages of `span.ctxt() == other.ctxt()`
* Also fixes an unhygenic usage of spans which caused the suggestion to render weirdly when we had one arm match in a macro
* Also always suggests a comma (i.e. even after a block) if we're rendering a wildcard arm in a single-line match (looks prettier 🌹)

Fixes #94866
2022-06-20 20:13:10 +02:00
Matthias Krüger
eac149368b
Rollup merge of #98235 - liuw:mir-gen-drop-magic-value, r=davidtwco
Drop magic value 3 from code

Magic value 3 is used to create state for a yield point. It is in fact
the number of reserved variants.

Lift RESERVED_VARIANTS out to module scope and use it instead.
2022-06-20 20:13:09 +02:00
Jacob Hoffman-Andrews
27dcebeb3e Improve loading of crates.js and sidebar-items.js
Now that the "All Crates" dropdown is only rendered on the search results page,
there is no need to load crates.js on most pages. Load it only on crate pages.
Also, add the `defer` attribute so it does not block page rendering.

For sidebar-items.js, move the script tag to `<head>`. Since it already has the
defer attribute it won't block loading. The defer attribute does preserve
ordering between scripts, so instead of the callback on load, it can set a
global variable on load, which is slightly simpler. Also, since it is required
to finish rendering the page, beginning its load earlier is better.

Remove generation and handling of sidebar-vars. Everything there can be computed
with information available in JS via other means.

Remove the "other" wrapper in the sidebar. It was unnecessary.

Remove excess script fields
2022-06-20 11:12:55 -07:00
bors
5750a6aa27 Auto merge of #93765 - zhangyunhao116:heapsort, r=m-ou-se
Optimize heapsort

The new implementation is about 10% faster than the previous one(sorting random 1000 items).
2022-06-20 18:09:30 +00:00
Alan Egerton
bd604750ae
try_fold_unevaluated for infallible folders
#97447 added folding of unevaluated constants, but did not include an override of the default (fallible) operation in the blanket impl of `FallibleTypeFolder` for infallible folders.  Here we provide that missing override.

r? @nnethercote
2022-06-20 19:03:37 +01:00
Yuki Okushi
51cc665b33
Add a link to the unstable book page on Generator doc comment
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-20 23:19:50 +09:00
bors
b12708f7f4 Auto merge of #98292 - Dylan-DPC:rollup-hueb8tm, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #93080 (Implement `core::slice::IterMut::as_mut_slice` and `impl<T> AsMut<[T]> for IterMut<'_, T>`)
 - #94855 (Panic when advance_slices()'ing too far and update docs.)
 - #96609 (Add `{Arc, Rc}::downcast_unchecked`)
 - #96719 (Fix the generator example for `pin!()`)
 - #97149 (Windows: `CommandExt::async_pipes`)
 - #97150 (`Stdio::makes_pipe`)
 - #97837 (Document Rust's stance on `/proc/self/mem`)
 - #98159 (Include ForeignItem when visiting types for WF check)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-20 13:24:31 +00:00
Dylan DPC
7bde23bb4f
Rollup merge of #98159 - PrestonFrom:issue_95665, r=petrochenkov
Include ForeignItem when visiting types for WF check

Addresses Issue 95665 by including `hir::Node::ForeignItem` as a valid
type to visit in `diagnostic_hir_wf_check`.

Fixes #95665
2022-06-20 14:56:41 +02:00
Dylan DPC
ce1151c04c
Rollup merge of #97837 - sunfishcode:sunfishcode/proc-self-mem, r=m-ou-se
Document Rust's stance on `/proc/self/mem`

Add documentation to `std::os::unix::io` describing Rust's stance on
`/proc/self/mem`, treating it as an external entity which is outside
the scope of Rust's safety guarantees.
2022-06-20 14:56:40 +02:00
Dylan DPC
2807f28de5
Rollup merge of #97150 - ChrisDenton:stdio-create_pipe, r=m-ou-se
`Stdio::makes_pipe`

Wrappers around `std::process::Command` may want to be able to override pipe creation. However, [`std::process::Stdio`](https://doc.rust-lang.org/std/process/struct.Stdio.html) is opaque so there's no way to tell if `Command` was told to create new pipes or not.

This is in some ways a more generic (and cross-platform) alternative to #97149. However, unlike that feature, this comes with the price of the user needing to actually create their own pipes rather than reusing the std one. So I think it stands (or not) on its own.

# Example

```rust
#![feature(stdio_makes_pipe)]
use std::process::Stdio;

let io = Stdio::piped();
assert_eq!(io.makes_pipe(), true);
```
2022-06-20 14:56:39 +02:00
Dylan DPC
85f1de20e7
Rollup merge of #97149 - ChrisDenton:win_async_pipes, r=m-ou-se
Windows: `CommandExt::async_pipes`

Discussed in https://github.com/tokio-rs/tokio/issues/4670 was the need for third party crates to be able to force `process::Command::spawn` to create pipes as async.

This implements the suggestion for a `async_pipes` method that gives third party crates that option.

# Example:

```rust
use std::process::{Command, Stdio};

Command::new("cmd")
    .async_pipes(true)
    .stdin(Stdio::piped())
    .stdout(Stdio::piped())
    .stderr(Stdio::piped())
    .spawn()
    .unwrap();
```
2022-06-20 14:56:38 +02:00
Dylan DPC
625c929a9f
Rollup merge of #96719 - mbartlett21:patch-4, r=Dylan-DPC
Fix the generator example for `pin!()`

The previous generator example is not actually self-referential, since the reference is created after the yield.

CC #93178 (tracking issue)
2022-06-20 14:56:36 +02:00
Dylan DPC
7372bf88ee
Rollup merge of #96609 - ibraheemdev:arc-downcast-unchecked, r=m-ou-se
Add `{Arc, Rc}::downcast_unchecked`

Part of #90850.
2022-06-20 14:56:35 +02:00
Dylan DPC
99620ad721
Rollup merge of #94855 - m-ou-se:advance-slice-panic-docs, r=kennytm
Panic when advance_slices()'ing too far and update docs.

This updates advance_slices() to panic when advancing too far, like advance() already does. And updates the docs to say so.

See https://github.com/rust-lang/rust/issues/62726#issuecomment-1065253213
2022-06-20 14:56:34 +02:00
Dylan DPC
fd9ca0c25e
Rollup merge of #93080 - SkiFire13:itermut-as_mut_slice, r=m-ou-se
Implement `core::slice::IterMut::as_mut_slice` and `impl<T> AsMut<[T]> for IterMut<'_, T>`

As per [the zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60std.3A.3Aslice.3A.3AIterMut.3A.3Aas_mut_slice.60), the `AsMut` impl has been commented out, with a comment near the `#[unstable(...)]` to uncomment it when `as_mut_slice` gets stabilized.
2022-06-20 14:56:33 +02:00
Chris Denton
740a54c69b
Windows: CommandExt::async_pipes 2022-06-20 12:21:39 +01:00
bors
1d6010816c Auto merge of #97674 - nnethercote:oblig-forest-tweaks, r=nikomatsakis
Obligation forest tweaks

A few minor improvements to the code.

r? `@nikomatsakis`
2022-06-20 10:58:56 +00:00
Chris Denton
8b93147f7e
Stdio::make_pipe 2022-06-20 11:58:38 +01:00
Wei Liu
c5f4880e91 Drop magic value 3 from code
Magic value 3 is used to create state for a yield point. It is in fact
the number of reserved variants.

Lift RESERVED_VARIANTS out to module scope and use it instead.
2022-06-20 10:05:04 +00:00
zhangyunhao
98507f202d Optimize heapsort 2022-06-20 08:30:27 +00:00
bors
4104596251 Auto merge of #98284 - JohnTitor:rollup-7lbs143, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #98183 (Fix pretty printing of empty bound lists in where-clause)
 - #98268 (Improve `lifetime arguments are not allowed on` error message)
 - #98273 (Fix minor documentation typo)
 - #98274 (Minor improvements on error for `Self` type in items that don't allow it)
 - #98281 (Fix typo in `HashMap::drain` docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-20 08:18:07 +00:00
Mara Bos
c867529461
Show #![feature] in example. 2022-06-20 10:00:55 +02:00
Yuki Okushi
66dbc3fda7
Rollup merge of #98281 - Nilstrieb:map-drain-typo, r=JohnTitor
Fix typo in `HashMap::drain` docs

It's a map, not a vector.

Fixes #98275.
2022-06-20 16:41:50 +09:00
Yuki Okushi
1888499be3
Rollup merge of #98274 - compiler-errors:self-type-error, r=cjgillot
Minor improvements on error for `Self` type in items that don't allow it

Fixes #93796
2022-06-20 16:41:49 +09:00
Yuki Okushi
f459d8d6b9
Rollup merge of #98273 - Piturnah:patch-1, r=compiler-errors
Fix minor documentation typo

Fixes incorrect pluralisation of `crate` in documentation for rustc_trait_selection
2022-06-20 16:41:48 +09:00
Yuki Okushi
e635704643
Rollup merge of #98268 - compiler-errors:disallowed-generics-better, r=lcnr
Improve `lifetime arguments are not allowed on` error message

Actually mention what thing we're improperly trying to add lifetime generics to.
2022-06-20 16:41:47 +09:00