Commit Graph

120547 Commits

Author SHA1 Message Date
bors
4774f9b523 Auto merge of #72474 - mati865:ci-fix, r=pietroalbini
Revert MSYS2 CI workaround

MSYS2 has made workaround for critical packages so older installers like one used by chocolatey can work again.
Fixes https://github.com/rust-lang/rust/issues/72333
2020-05-23 21:21:40 +00:00
bors
8970e8bcf6 Auto merge of #72504 - Dylan-DPC:rollup-6wi1ifz, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #72292 (Replace obligation construction with deref_steps())
 - #72431 (add warning sign to UB examples)
 - #72446 (Impl Ord for proc_macro::LineColumn)
 - #72492 (Add some regression tests)
 - #72496 (Correct small typo: 'not' -> 'note')

Failed merges:

r? @ghost
2020-05-23 17:53:54 +00:00
Dylan DPC
a03bf3f5f5
Rollup merge of #72496 - shepmaster:typo, r=Dylan-DPC
Correct small typo: 'not' -> 'note'
2020-05-23 19:10:02 +02:00
Dylan DPC
e91897d214
Rollup merge of #72492 - JohnTitor:add-tests, r=matthewjasper
Add some regression tests

Closes #69415
Closes #72455

r? @matthewjasper
2020-05-23 19:10:01 +02:00
Dylan DPC
67759b74f4
Rollup merge of #72446 - dtolnay:ord, r=petrochenkov
Impl Ord for proc_macro::LineColumn

```rust
impl Ord for LineColumn {...}
impl PartialOrd for LineColumn {...}
```

for https://doc.rust-lang.org/nightly/proc_macro/struct.LineColumn.html.

The ordering is the natural one you would get by writing one line after another, where we compare line first, then compare columns within the same line.
2020-05-23 19:10:00 +02:00
Dylan DPC
d5e3009bd8
Rollup merge of #72431 - RalfJung:ub-warning, r=shepmaster
add warning sign to UB examples

Just to make it less likely that people miss the fact that these are examples for how to *not* do it.
2020-05-23 19:09:58 +02:00
Dylan DPC
b24030fc3e
Rollup merge of #72292 - ldm0:derefsteps, r=estebank
Replace obligation construction with deref_steps()

1. Use `probe()` to avoid unwanted binding committing during `deref_steps()`.
2. Fixes #59819 again by using `deref_steps()`, make the code cleaner. And if we want to suggest multiple dereferences (like: `consider dereferencing the borrow: "****a"`) in the future, this change will make it easier to achieve.
2020-05-23 19:09:57 +02:00
Ralf Jung
1c9b96b754 add warning sign to UB examples 2020-05-23 14:00:55 +02:00
Jake Goulding
749d9e7a26 Correct small typo: 'not' -> 'note' 2020-05-23 07:29:22 -04:00
Yuki Okushi
47e35cb9bd
Add test for #72455 2020-05-23 17:53:14 +09:00
Yuki Okushi
58fe05a124
Add test for #69415 2020-05-23 17:53:14 +09:00
bors
75b0a68f35 Auto merge of #72478 - Dylan-DPC:rollup-vval8du, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #71289 (Allow using `Self::` in doc)
 - #72375 (Improve E0599 explanation)
 - #72385 (Add some teams to prioritization exclude_labels)
 - #72395 (Allow rust-highfive to label issues it creates.)
 - #72453 (Add flag to open docs:  x.py doc --open)
 - #72459 (Add core::future::IntoFuture)
 - #72461 (Clean up E0600 explanation)

Failed merges:

r? @ghost
2020-05-23 07:18:17 +00:00
bors
7f940ef5d9 Auto merge of #72256 - ecstatic-morse:once-cell, r=Mark-Simulacrum
Use `once_cell` crate instead of custom data structure

Internally, we use the [`Once`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/sync/struct.Once.html) type for shared data that is initialized exactly once and only read from afterwards. `Once` uses a `parking_lot::Mutex` when the parallel compiler is enabled and a `RefCell` when it is not. This PR switches to the [`once_cell`](https://crates.io/crates/once_cell) crate, which also uses a `parking_lot::Mutex` for its `sync` version (because we enable the `parking_lot` feature) but has zero overhead for its `unsync` one.

This PR adds `once_cell` to the list of whitelisted dependencies. I think this is acceptable because it is already used in `rustc_driver`, is owned by a well-known community member (cc @matklad), and has a stable release. cc @rust-lang/compiler

`once_cell` has a slightly more minimal API than `Once`, which allows for initialization to be either optimistic (evaluate the initializer and then synchronize) or pessimistic (synchronize and then evaluate the initializer). `once_cell`'s `get_or_init` is always pessimistic. The optimistic version is only used once in the current `master`.

r? @Mark-Simulacrum
2020-05-23 03:30:07 +00:00
Dylan MacKenzie
307153e611 Switch to non-doc comment 2020-05-22 13:31:02 -07:00
Dylan MacKenzie
f17e2c93a6 Use OnceCell for predecessor cache 2020-05-22 13:31:02 -07:00
Dylan MacKenzie
c282c1c654 Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00
Dylan MacKenzie
9f82785c81 Replace rustc_data_structures::sync::Once with OnceCell 2020-05-22 13:26:39 -07:00
Dylan DPC
bf1b998be6
Rollup merge of #72461 - GuillaumeGomez:cleanup-e0600, r=Dylan-DPC
Clean up E0600 explanation

r? @Dylan-DPC
2020-05-22 21:45:04 +02:00
Dylan DPC
141ce5f2ad
Rollup merge of #72459 - yoshuawuyts:into-future, r=nikomatsakis
Add core::future::IntoFuture

This patch reintroduces the `core::future::IntoFuture` trait. However unlike earlier PRs this patch does not integrate it into the `async/.await` lowering since that lead to performance regressions. By introducing the trait separately from the integration, the integration PR can be more narrowly scoped, and people can start trying out the `IntoFuture` trait today. Thanks heaps!

cc/ @rust-lang/wg-async-foundations

## References
- Original PR adding `IntoFuture` https://github.com/rust-lang/rust/pull/65244
- Open issue to re-land `IntoFuture` (assigned to me) https://github.com/rust-lang/rust/issues/67982
- Tracking issue for `IntoFuture` https://github.com/rust-lang/rust/issues/67644
2020-05-22 21:45:01 +02:00
Dylan DPC
3083ce7ab1
Rollup merge of #72453 - dtolnay:open, r=Mark-Simulacrum
Add flag to open docs:  x.py doc --open

This aligns with Cargo's flag `cargo doc --open`.

Tested with:

```bash
   # opens doc/index.html
x.py doc --stage 0 --open
x.py doc --stage 0 --open src/doc

   # opens doc/book/index.html
x.py doc --stage 0 --open src/doc/book

   # opens doc/std/index.html
x.py doc --stage 0 --open src/libstd

   # opens doc/proc_macro/index.html
x.py doc --stage 0 --open src/libproc_macro

   # opens both
x.py doc --stage 0 --open src/libstd src/libproc_macro
```
2020-05-22 21:45:00 +02:00
Dylan DPC
01adfe1bc3
Rollup merge of #72395 - Elinvynia:highfive, r=Mark-Simulacrum
Allow rust-highfive to label issues it creates.

This is my first meaningful PR, I am unsure how to test this code so any pointers would be welcome!

I am about 50% sure it works.
2020-05-22 21:44:58 +02:00
Dylan DPC
84fbbded1e
Rollup merge of #72385 - spastorino:add-exclude-labels, r=Mark-Simulacrum
Add some teams to prioritization exclude_labels

r? @Mark-Simulacrum @LeSeulArtichaut
2020-05-22 21:44:56 +02:00
Dylan DPC
47f3c440ec
Rollup merge of #72375 - GuillaumeGomez:cleanup-e0599, r=Dylan-DPC
Improve E0599 explanation

r? @Dylan-DPC
2020-05-22 21:44:54 +02:00
Dylan DPC
dd78839432
Rollup merge of #71289 - xliiv:70802-intra-self, r=GuillaumeGomez
Allow using `Self::` in doc

Closes #70802
2020-05-22 21:44:52 +02:00
Mateusz Mikuła
4b516279a9 Revert MSYS2 CI workaround 2020-05-22 19:08:39 +02:00
David Tolnay
07b1de4e9a
Report error from opener in bootstrap
On my machine, an error looks like:

    Finished release [optimized] target(s) in 0.29s
    Opening doc /git/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html
    command 'xdg-open (internal)' did not execute successfully; exit code: 4
    command stderr:
    gio: file:///git/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html: Error when getting information for file “/git/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html”: No such file or directory

    Build completed successfully in 0:00:08
2020-05-22 09:51:46 -07:00
bors
215f2d3294 Auto merge of #72464 - RalfJung:rollup-xhm7w7u, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #71829 (Fix suggestion to borrow in struct)
 - #72123 (Stabilize process_set_argv0 feature for Unix)
 - #72235 (Clean up E0590 explanation)
 - #72345 (Clean up E0593 explanation)
 - #72376 ([self-profling] Record the cgu name when doing codegen for a module)
 - #72399 (Add fast-path optimization for Ipv4Addr::fmt)
 - #72435 (rustllvm: Fix warnings about unused function parameters)

Failed merges:

r? @ghost
2020-05-22 15:33:32 +00:00
Elinvynia
dc4b9fd863 Allow rust-highfive to label issues it creates.
Replace sets with lists.
2020-05-22 17:28:22 +02:00
Ralf Jung
e7503ca7bf
Rollup merge of #72435 - petrochenkov:cratetypesopt, r=Mark-Simulacrum
rustllvm: Fix warnings about unused function parameters

And then perform corresponding cleanups on Rust side.

Fixes https://github.com/rust-lang/rust/issues/72427
2020-05-22 16:58:37 +02:00
Ralf Jung
37587af8d5
Rollup merge of #72399 - Lucretiel:ipv4-display-fast, r=kennytm
Add fast-path optimization for Ipv4Addr::fmt

Don't use an intermediary buffer when writing an IPv4 address without any specific alignment options
2020-05-22 16:58:36 +02:00
Ralf Jung
a116e7b02f
Rollup merge of #72376 - wesleywiser:record_cgu_name, r=Mark-Simulacrum
[self-profling] Record the cgu name when doing codegen for a module
2020-05-22 16:58:31 +02:00
Ralf Jung
f7ed13b6a5
Rollup merge of #72345 - GuillaumeGomez:cleanup-e0593, r=Dylan-DPC
Clean up E0593 explanation

r? @Dylan-DPC
2020-05-22 16:58:29 +02:00
Ralf Jung
02eb002ee3
Rollup merge of #72235 - GuillaumeGomez:cleanup-E0590, r=Dylan-DPC
Clean up E0590 explanation

r? @Dylan-DPC
2020-05-22 16:58:26 +02:00
Ralf Jung
53d0046983
Rollup merge of #72123 - jsgf:stabilize-arg0, r=sfackler
Stabilize process_set_argv0 feature for Unix

This stabilizes process_set_argv0 targeting 1.45.0. It has been
useful in practice and seems useful as-is.

The equivalent feature could be implemented for Windows, but as far as I
know nobody has. That can be done separately.

Tracking issue: #66510
2020-05-22 16:58:24 +02:00
Ralf Jung
9c34481c49
Rollup merge of #71829 - kper:issue71136, r=matthewjasper
Fix suggestion to borrow in struct

The corresponding issue is #71136.
The compiler suggests that borrowing `the_foos` might solve the problem. This is obviously incorrect.
```
struct Foo(u8);

#[derive(Clone)]
struct FooHolster {
    the_foos: Vec<Foo>,
}
```

I propose as fix to check if there is any colon in the span. However, there might a case where `my_method(B { a: 1, b : foo })` would be appropriate to show a suggestion for `&B ...`.  To fix that too, we can simply check if there is a bracket in the span. This is only possible because both spans are different.
Issue's span: `the_foos: Vec<Foo>`
other's span: `B { a : 1, b : foo }`
2020-05-22 16:58:19 +02:00
Tymoteusz Jankowski
fc0675bf75
Allow using Self:: in doc 2020-05-22 13:57:05 +02:00
Guillaume Gomez
985ebf2c4a Clean up E0590 explanation 2020-05-22 13:26:11 +02:00
Guillaume Gomez
6e5cb37b66 Clean up E0600 explanation 2020-05-22 13:24:34 +02:00
bors
a9ca1ec928 Auto merge of #72460 - RalfJung:rollup-28fs06y, r=RalfJung
Rollup of 4 pull requests

Successful merges:

 - #71610 (InvalidUndefBytes: Track size of undef region used)
 - #72161 (Replace fcntl-based file lock with flock)
 - #72306 (Break tokens before checking if they are 'probably equal')
 - #72325 (Always generated object code for `#![no_builtins]`)

Failed merges:

r? @ghost
2020-05-22 11:24:24 +00:00
Ralf Jung
1119421e26
Rollup merge of #72325 - alexcrichton:ignore-linker-plugin-lto, r=nnethercote
Always generated object code for `#![no_builtins]`

This commit updates the code generation for `#![no_builtins]` to always
produce object files instead of conditionally respecting
`-Clinker-plugin-lto` and sometimes producing bitcode. This is intended
to address rust-lang/cargo#8239.

The issue at hand here is that Cargo has tried to get "smarter" about
codegen in whole crate graph scenarios. When LTO is enabled it attempts
to avoid codegen on as many crates as possible, opting to pass
`-Clinker-plugin-lto` where it can to only generate bitcode. When this
is combined with `-Zbuild-std`, however, it means that
`compiler-builtins` only generates LLVM bitcode instead of object files.
Rustc's own LTO passes then explicitly skip `compiler-builtins` (because
it wouldn't work anyway) which means that LLVM bitcode gets sent to the
linker, which chokes most of the time.

The fix in this PR is to not actually respect `-Clinker-plugin-lto` for
`#![no_builtins]` crates. These crates, even if slurped up by the linker
rather than rustc, will not work with LTO. They define symbols which are
only referenced as part of codegen, so LTO's aggressive internalization
would trivially remove the symbols only to have the linker realize later
that the symbol is undefined. Since pure-bitcode never makes sense for
these libraries, the `-Clinker-plugin-lto` flag is silently ignored.
2020-05-22 11:32:25 +02:00
Ralf Jung
62d4e9eedd
Rollup merge of #72306 - Aaron1011:feature/turbo-spacing, r=petrochenkov
Break tokens before checking if they are 'probably equal'

Fixes #68489
Fixes #70987

When checking two `TokenStreams` to see if they are 'probably equal',
we ignore the `IsJoint` information associated with each `TokenTree`.
However, the `IsJoint` information determines whether adjacent tokens
will be 'glued' (if possible) when construction the `TokenStream` - e.g.
`[Gt Gt]` can be 'glued' to `BinOp(Shr)`.

Since we are ignoring the `IsJoint` information, 'glued' and 'unglued'
tokens are equivalent for determining if two `TokenStreams` are
'probably equal'. Therefore, we need to 'unglue' all tokens in the
stream to avoid false negatives (which cause us to throw out the cached
tokens, losing span information).
2020-05-22 11:32:23 +02:00
Ralf Jung
a8018e224e
Rollup merge of #72161 - nbdd0121:master, r=cuviper
Replace fcntl-based file lock with flock

WSL1 does not support `fcntl`-based lock and will always report success,
therefore creating a race condition when multiple rustc processes are
modifying shared data such as `search-index.js`. WSL1 does however
support `flock`.

`flock` is supported by all unix-like platforms. The only caveat is that
Linux 2.6.11 or earlier does not support `flock` on NFS mounts, but as
the minimum supported Linux version is 2.6.18, it is not an issue.

Fixes #72157
2020-05-22 11:32:21 +02:00
Ralf Jung
2059112eb4
Rollup merge of #71610 - divergentdave:InvalidUndefBytes-range, r=RalfJung
InvalidUndefBytes: Track size of undef region used

This PR adds a size to `UndefinedBehaviorInfo::InvalidUndefBytes`, to keep track of how many undefined bytes in a row were accessed, and changes a few methods to pass this information through. This additional information will eventually be used in Miri to improve diagnostics for this UB error. See also rust-lang/miri#1354 for prior discussion.

I expect Miri will break the next time its submodule is updated, due to this change to the `InvalidUndefBytes`. (The current commit for src/tools/miri predates rust-lang/miri#1354, and thus does not try to destructure the `InvalidUndefBytes` variant) I have a corresponding change prepared for that repository.

r? @RalfJung
2020-05-22 11:32:18 +02:00
Yoshua Wuyts
9ff502029d Add core::future::IntoFuture
This patch adds `core::future::IntoFuture`. However unlike earlier PRs this patch does not integrate it into the `async/.await` lowering. That integration should be done in a follow-up PR.
2020-05-22 10:55:01 +02:00
Kevin Per
e776121431 Using !span.from_expansion() instead of snippets 2020-05-22 10:52:06 +02:00
bors
de6060b09d Auto merge of #72458 - RalfJung:rollup-g1w1vws, r=RalfJung
Rollup of 6 pull requests

Successful merges:

 - #71607 (clarify interaction of pin drop guarantee and panics)
 - #72125 (remove broken link)
 - #72133 (Add target thumbv7a-uwp-windows-msvc)
 - #72304 (rustc_target: Avoid an inappropriate use of `post_link_objects`)
 - #72309 (Some renaming and minor refactoring for `NativeLibraryKind`)
 - #72438 (Enable ARM TME (Transactional Memory Extensions))

Failed merges:

r? @ghost
2020-05-22 08:04:45 +00:00
Ralf Jung
64beaffd6a
Rollup merge of #72438 - vertexclique:vcq/aarch64-tme-features, r=Amanieu
Enable ARM TME (Transactional Memory Extensions)

Enables ARM TME coming up with LLVM 10. Related ARM TME intrinsics are included by the merge of #67900.

Enables: https://github.com/rust-lang/stdarch/pull/855
2020-05-22 08:54:55 +02:00
Ralf Jung
afbbb86200
Rollup merge of #72309 - petrochenkov:linkunspec, r=matthewjasper
Some renaming and minor refactoring for `NativeLibraryKind`
2020-05-22 08:54:53 +02:00
Ralf Jung
0eba15220d
Rollup merge of #72304 - petrochenkov:sgxunwind, r=nikomatsakis,jethrogb,dingelish
rustc_target: Avoid an inappropriate use of `post_link_objects`

It isn't supposed to be used for linking libraries.
Also linking libunwind unconditionally (and not together with the `src/libunwind` crate) is suspicious.

@jethrogb @VardhanThigle
Could you verify that it works as expected?
2020-05-22 08:54:51 +02:00
Ralf Jung
715f1e8478
Rollup merge of #72133 - bdbai:master, r=joshtriplett
Add target thumbv7a-uwp-windows-msvc

Add target spec for thumbv7a-uwp-windows-msvc, so that libraries written in Rust will have a chance to run on ARM-based devices with Windows 10.

So far I managed to create a proof-of-concept library for Universal Windows Platform apps to consume and it worked on a Windows Phone. However, building a standalone executable seemed troublesome due to `LLVM ERROR: target does not implement codeview register mapping` stuff (see also https://github.com/rust-lang/rust/issues/52659#issuecomment-408233322 ).

Steps to test:
1. Clone and build this version
```sh
git clone https://github.com/bdbai/rust.git
cd rust
python x.py build -i --target thumbv7a-uwp-windows-msvc --stage 1 src/libstd
rustup toolchain link arm-uwp-stage1 .\build\x86_64-pc-windows-msvc\stage1\
```
2. Create a new library crate
```sh
cargo new --lib arm-uwp-test
cd arm-uwp-test
```
3. Change `crate-type` in `Cargo.toml` to `staticlib`
```toml
[lib]
crate-type=["staticlib"]
```
4. Replace the following code in `src/lib.rs`
```rust
#[no_mangle]
pub extern "system" fn call_rust() -> i32 {
    2333
}
```
5. Build the crate
```sh
cargo +arm-uwp-stage1 build -v --target thumbv7a-uwp-windows-msvc
```
6. `arm-uwp-test.lib` should appear in `target\thumbv7a-uwp-windows-msvc\debug`

To consume this library:
1. Make sure Visual Studio 2017 and Windows 10 SDK (10.0.17134 or above) are installed
2. Create a new Blank App (C++/WinRT) in Visual Studio 2017 (Visual Studio 2019 cannot deploy UWP apps to Windows Phone)
3. Go to Property Pages, and then Linker->Input->Additional Dependencies, add `arm-uwp-test.lib` produced just now
4. Manually declare function prototypes in `MainPage.h`
```c++
extern "C" {
    int call_rust();
}
```
5. Replace the `ClickHandler` part in `MainPage.cpp`
```c++
myButton().Content(box_value(std::to_wstring(call_rust())));
```
6. Build and deploy this app to an ARM device running Windows 10. The app should run and show `2333` when the button is clicked.
2020-05-22 08:54:49 +02:00