Commit graph

153517 commits

Author SHA1 Message Date
Niko Matsakis
c1b4824800 factor fallback code into its own module 2021-08-19 17:28:24 -04:00
Joe Ardent
52a988344b Update release note for 1.55.0.
Added a line about new formatting option, `{lib}`, for `cargo
tree` (https://github.com/rust-lang/cargo/pull/9663).
2021-08-19 13:54:26 -07:00
bors
6d64f7f695 Auto merge of #88165 - GuillaumeGomez:rollup-4o0v2ps, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #86123 (Preserve more spans in internal `rustc_queries!` macro)
 - #87874 (Add TcpStream type to TcpListener::incoming docs)
 - #88034 (rustc_privacy: Replace `HirId`s and `DefId`s with `LocalDefId`s where possible)
 - #88050 (Remove `HashStable` impls for `FileName` and `RealFileName`)
 - #88093 ([rustdoc] Wrap code blocks in `<code>` tag)
 - #88146 (Add tests for some `feature(const_evaluatable_checked)` incr comp issues)
 - #88153 (Update .mailmap)
 - #88159 (Use a trait instead of the now disallowed missing trait there)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-19 20:31:05 +00:00
Dan Gohman
e555003e6d Factor out a common RawFd/AsRawFd/etc for Unix and WASI. 2021-08-19 13:27:19 -07:00
Ellen
c2b61fbafe move code to InferCtxt method 2021-08-19 21:04:09 +01:00
Dan Gohman
0377a63352 Fix syntax for non-doc comments, and use crate:: instead of std::. 2021-08-19 12:23:04 -07:00
Cameron Steffen
ada92825c9 Fix clippy let expressions fallout 2021-08-19 14:17:05 -05:00
Dan Gohman
187ee5c824 Add I/O safety trait impls for process::Stdio and process::Child. 2021-08-19 12:02:41 -07:00
Dan Gohman
6f872880b4 Use the correct into_* on Windows to avoid dropping a stdio handle.
Use `into_raw_handle()` rather than `into_inner()` to completely consume a
`Handle` without dropping its contained handle.
2021-08-19 12:02:41 -07:00
Dan Gohman
9b99f8c454 Remove the #![feature(io_safety)] from lib.rs. 2021-08-19 12:02:40 -07:00
Dan Gohman
a7d9ab5835 Fix an unused import warning. 2021-08-19 12:02:40 -07:00
Dan Gohman
cada5fb336 Update PidFd for the new I/O safety APIs. 2021-08-19 12:02:40 -07:00
Dan Gohman
1ae1eeec25 Rename OptionFileHandle to HandleOrInvalid and make it just wrap an Option<OwnedHandle>
The name (and updated documentation) make the FFI-only usage clearer, and wrapping Option<OwnedHandle> avoids the need to write a separate Drop or Debug impl.

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19 12:02:40 -07:00
Dan Gohman
18a9f4628a Don't encourage migration until io_safety is stablized. 2021-08-19 12:02:40 -07:00
Dan Gohman
1dbd6d60f0 Factor out Unix and WASI fd code into a common module. 2021-08-19 12:02:40 -07:00
Dan Gohman
71dab738ac Synchronize minor differences between Unix and WASI implementations. 2021-08-19 12:02:40 -07:00
Dan Gohman
907f00be30 Add more comments about the INVALID_HANDLE_VALUE situation. 2021-08-19 12:02:40 -07:00
Dan Gohman
ab08639e59 Add comments about impls for File, TcpStream, ChildStdin, etc. 2021-08-19 12:02:40 -07:00
Dan Gohman
68964a7d68 Fix copypasta of "Unix" within the WASI directory. 2021-08-19 12:02:40 -07:00
Dan Gohman
1b35f7405a Reword the description of dup2/dup3. 2021-08-19 12:02:40 -07:00
Dan Gohman
6d7211738d Add Safety comments to the As* for Owned* implementations. 2021-08-19 12:02:40 -07:00
Dan Gohman
6486f89cbc Add Owned*, Borrowed*, and As* to the preludes. 2021-08-19 12:02:39 -07:00
Dan Gohman
0cb69dec57 Rename OwnedFd's private field to match it's debug output. 2021-08-19 12:02:39 -07:00
Dan Gohman
45b5de3376 Delete a spurious empty comment line. 2021-08-19 12:02:39 -07:00
Dan Gohman
926344a80f Add a comment about how OwnedHandle should not be used with registry handles. 2021-08-19 12:02:39 -07:00
Dan Gohman
31f7bf8271 Add a comment about OptionFileHandle. 2021-08-19 12:02:39 -07:00
Dan Gohman
6b4dbdbf47 Be more precise about mmap and undefined behavior.
`mmap` doesn't *always* cause undefined behavior; it depends on the
details of how you use it.
2021-08-19 12:02:39 -07:00
Dan Gohman
1f8a450cdd Add a test to ensure that RawFd is the size we assume it is. 2021-08-19 12:02:39 -07:00
Dan Gohman
1c6bf04edb Update library/std/src/os/windows/io/socket.rs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19 12:02:39 -07:00
Dan Gohman
a23ca7ceb1 Update library/std/src/os/windows/io/handle.rs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19 12:02:39 -07:00
Dan Gohman
3a38511ab3 Update library/std/src/os/unix/io/fd.rs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19 12:02:39 -07:00
Dan Gohman
d15418586c I/O safety.
Introduce `OwnedFd` and `BorrowedFd`, and the `AsFd` trait, and
implementations of `AsFd`, `From<OwnedFd>` and `From<T> for OwnedFd`
for relevant types, along with Windows counterparts for handles and
sockets.

Tracking issue:
 - <https://github.com/rust-lang/rust/issues/87074>

RFC:
 - <https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md>
2021-08-19 12:02:39 -07:00
Ellen
ab61e722ee regression tests 2021-08-19 19:47:38 +01:00
Ellen
696c88d69c canonicalize const equate predicates 2021-08-19 19:47:38 +01:00
Charles Lew
c22dfab215 Add assertion to ensure the query doesn't get called before type infererence is done. 2021-08-20 02:37:00 +08:00
Andy Wang
08c55bdce5
Test presence of remapped path 2021-08-19 19:04:46 +01:00
Andy Wang
70b9a7b988
Make test function pub 2021-08-19 19:01:19 +01:00
Guillaume Gomez
1095bb1eb2
Rollup merge of #88159 - spastorino:fix-unused-generic-param-test, r=oli-obk
Use a trait instead of the now disallowed missing trait there

To properly test the unused generic parameter and just that we need to use a trait in the tait. Missing the trait there is already tested and is not what we meant to test here.

r? `@oli-obk`
2021-08-19 19:30:12 +02:00
Guillaume Gomez
bcc3b4ef62
Rollup merge of #88153 - hkmatsumoto:mailmap, r=Mark-Simulacrum
Update .mailmap
2021-08-19 19:30:11 +02:00
Guillaume Gomez
01b0a8dce7
Rollup merge of #88146 - BoxyUwU:tests-cec-incr-comp, r=oli-obk
Add tests for some `feature(const_evaluatable_checked)` incr comp issues

Closes #77650
Closes #79251

#79251 didn't seem to be ICEing anymore so added regression tests for that aswell

r? `@oli-obk`
2021-08-19 19:30:10 +02:00
Guillaume Gomez
10165f8af9
Rollup merge of #88093 - Kobzol:rustdoc-wrap-code-in-code-tag, r=GuillaumeGomez
[rustdoc] Wrap code blocks in <code> tag

This PR modifies Rustdoc output so that fenced code snippets, items and whole file source codes are wrapped in `<pre><code>` instead of just `<pre>`. This should improve the semantic meaning of the generated content.

I'm not sure what to do about `render_attributes_in_pre` and `render_attributes_in_code`. These functions were clearly expected to be used for things inside `<pre>` or `<code>`, and since I added `<code>` in this PR, some of them will be used in a different context than before. However, it seems to me that even before they were not consistent. For example, `item_constant` used `render_attributes_in_code` for its attributes, however there was no `<code>` used for constants before this PR...

Should I create some `rustdoc-gui` tests? For example to check that all `<pre>` tags have a `<code>` child?

Fixes: https://github.com/rust-lang/rust/issues/88020
2021-08-19 19:30:09 +02:00
Guillaume Gomez
09d56a749c
Rollup merge of #88050 - Aaron1011:filename-hash-stable, r=michaelwoerister
Remove `HashStable` impls for `FileName` and `RealFileName`

These impls were unused, and incorrectly hashed the local
(non-remapped) path for `RealFileName::Remapped` (which would
break reproducible builds if these impls were used).
2021-08-19 19:30:07 +02:00
Guillaume Gomez
8b9a4c3c4b
Rollup merge of #88034 - petrochenkov:localevel2, r=wesleywiser
rustc_privacy: Replace `HirId`s and `DefId`s with `LocalDefId`s where possible

Follow up to https://github.com/rust-lang/rust/pull/87568
2021-08-19 19:30:06 +02:00
Guillaume Gomez
6ce8a371bd
Rollup merge of #87874 - schneems:schneems/tcpstream-iterator-type, r=Mark-Simulacrum
Add TcpStream type to TcpListener::incoming docs

## Context

While going through the "The Rust Programming Language" book (Klabnik & Nichols), the TCP server example directs us to use TcpListener::incoming. I was curious how I could pass this value to a function (before reading ahead in the book), so I looked up the docs to determine the signature.

When I opened the docs, I found https://doc.rust-lang.org/std/net/struct.TcpListener.html#method.incoming, which didn't mention TcpStream anywhere in the example.

Eventually, I clicked on https://doc.rust-lang.org/std/net/struct.TcpListener.html#method.accept in the docs (after clicking a few other locations first), and was able to surmise that the value contained TcpStream.

## Opportunity

While this type is mentioned several times in this doc, I feel that someone should be able to fully use the results of the TcpListner::incoming iterator based solely on the docs of just this method.

## Implementation

I took the code from the top-level TcpListener https://doc.rust-lang.org/std/net/struct.TcpListener.html#method.incoming and blended it with the existing docs for TcpListener::incoming https://doc.rust-lang.org/std/net/struct.TcpListener.html#method.incoming.

It does make the example a little longer, and it also introduces a little duplication. It also gives the reader the type signatures they need to move on to the next step.

## Additional considerations

I noticed that in this doc, `handle_connection` and `handle_client` are both used to accept a TcpStream in the docs on this page. I want to standardize on one function name convention, so readers don't accidentally think two different concepts are being referenced. I didn't want to cram do too much in one PR, I can update this PR to make that change, or I could send another PR (if you would like).

First attempted contribution to Rust (and I'm also still very new, hence reading through the rust book for the first time)! Would you please let me know what you think?
2021-08-19 19:30:05 +02:00
Guillaume Gomez
def6393a8b
Rollup merge of #86123 - Aaron1011:query-span, r=cjgillot
Preserve more spans in internal `rustc_queries!` macro

We now preserve the span of the various query modifiers, and
use the span of the query's name for the commas that we
generate to separate the modifiers. This makes debugging issues with the
internal query macro infrastructure much nicer - previously, we
would get errors messages pointing at the entire call site
(the `rustc_queries!` invocation), which isn't very useful.

This should have no effect when compilation succeeds.

A concrete example of an error message produced after this changed:

```
error: local ambiguity: multiple parsing options: built-in NTs tt ('modifiers') or 1 other option.
    --> /home/aaron/repos/rust/compiler/rustc_middle/src/query/mod.rs:23:11
     |
12   | / rustc_queries! {
13   | |     query trigger_delay_span_bug(key: DefId) -> () {
14   | |         desc { "trigger a delay span bug" }
15   | |     }
...    |
23   | |     query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
     | |           ^^^^^^^^^
...    |
1715 | |     }
1716 | | }
     | |_- in this expansion of `rustc_query_append!`
     |
    ::: compiler/rustc_query_impl/src/lib.rs:51:1
     |
51   |   rustc_query_append! { [define_queries!][<'tcx>] }
     |   ------------------------------------------------- in this macro invocation
```

The particular bug shown in this error message will be fixed
in a separate PR.
2021-08-19 19:30:04 +02:00
bors
7960030d69 Auto merge of #88151 - alexcrichton:update-backtrace, r=Mark-Simulacrum
Update the backtrace crate in libstd

This commit updates the backtrace crate in libstd now that dependencies
have been updated to use `memchr` from the standard library as well.
This is mostly just making sure deps are up-to-date and have all the
latest-and-greatest fixes and such.

Closes rust-lang/backtrace-rs#432
2021-08-19 17:20:59 +00:00
Augie Fackler
c4e6185385 PassWrapper: adapt for LLVM 14 changes
These API changes appear to have all taken place in
https://reviews.llvm.org/D105007, which moved HWAddressSanitizerPass and
AddressSanitizerPass to only accept their options type as a ctor
argument instead of the sequence of bools etc. This required a couple of
parameter additions, which I made match the default prior to the
mentioned upstream LLVM change.

This patch restores rustc to building (though not quite passing all
tests, I've mailed other patches for those issues) against LLVM HEAD.
2021-08-19 12:44:54 -04:00
bors
2451f42c1d Auto merge of #88124 - tmiasko:start-block-critical-edge, r=oli-obk
Split critical edge targeting the start block

Fixes #88043.
2021-08-19 14:35:16 +00:00
Alex Crichton
4a3e73643a Update the backtrace crate in libstd
This commit updates the backtrace crate in libstd now that dependencies
have been updated to use `memchr` from the standard library as well.
This is mostly just making sure deps are up-to-date and have all the
latest-and-greatest fixes and such.

Closes rust-lang/backtrace-rs#432
2021-08-19 07:31:49 -07:00
Santiago Pastorino
df8a64327c
Use a trait instead of the now disallowed missing trait there 2021-08-19 10:48:20 -03:00