Commit Graph

122825 Commits

Author SHA1 Message Date
Aleksey Kladov
058c1b60a5 Add rust-analyzer submodule
The current plan is that submodule tracks the `release` branch of
rust-analyzer, which is updated once a week.

rust-analyzer is a workspace (with a virtual manifest), the actual
binary is provide by `crates/rust-analyzer` package.

Note that we intentionally don't add rust-analyzer to `Kind::Test`,
for two reasons.

*First*, at the moment rust-analyzer's test suite does a couple of
things which might not work in the context of rust repository. For
example, it shells out directly to `rustup` and `rustfmt`. So, making
this work requires non-trivial efforts.

*Second*, it seems unlikely that running tests in rust-lang/rust repo
would provide any additional guarantees. rust-analyzer builds with
stable and does not depend on the specifics of the compiler, so
changes to compiler can't break ra, unless they break stability
guarantee. Additionally, rust-analyzer itself is gated on bors, so we
are pretty confident that test suite passes.
2020-07-03 16:55:35 +02:00
bors
cd1a46d644 Auto merge of #73882 - nnethercote:avoid-unwrap_or_else-in-allocate_in, r=Amanieu
Avoid `unwrap_or_else` in `RawVec::allocate_in`.

This reduces the amount of LLVM IR generated by up to 1 or 2%.

r? @Amanieu
2020-07-03 03:18:28 +00:00
bors
5f4abc16e1 Auto merge of #73977 - Manishearth:rollup-2x4s7c6, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #73454 (Move contributing.md to rustc-dev-guide and point at getting started)
 - #73724 (Use WASM's saturating casts if they are available)
 - #73726 (resolve: disallow labelled breaks/continues through closures/async blocks)
 - #73753 (Use 'tcx for references to AccessLevels wherever possible.)
 - #73781 (Update psm version)
 - #73952 (Add option for local docker testing.)
 - #73957 (disable BTree min_max test in Miri for now)
 - #73975 (Document rustc_ast::ast::Pat)

Failed merges:

r? @ghost
2020-07-02 23:18:15 +00:00
Manish Goregaokar
7bd2f97cb6
Rollup merge of #73975 - pierwill:patch-3, r=jonas-schievink
Document rustc_ast::ast::Pat
2020-07-02 15:56:03 -07:00
Manish Goregaokar
5702b27fcd
Rollup merge of #73957 - RalfJung:btree-min-max, r=shepmaster
disable BTree min_max test in Miri for now

Until https://github.com/rust-lang/rust/issues/73915 is fixed, better skip this test in Miri so that we can test the others at least.
2020-07-02 15:56:01 -07:00
Manish Goregaokar
441dd5ad45
Rollup merge of #73952 - ehuss:docker-dev, r=Mark-Simulacrum
Add option for local docker testing.

This adds the option `--dev` to `src/ci/docker/run.sh` so that it will enter an interactive environment for local testing. I have often needed this for testing things, but I always needed to edit this script. I wanted the ability to interact in the environment, run different commands, inspect errors, etc.
2020-07-02 15:55:59 -07:00
Manish Goregaokar
7ad8ed96f2
Rollup merge of #73781 - nagisa:psm-up, r=Mark-Simulacrum
Update psm version

This new version includes a fix for building on aarch64 windows.

cc #72881
2020-07-02 15:55:57 -07:00
Manish Goregaokar
d6bfca2ccf
Rollup merge of #73753 - eddyb:extraneous-lifetime, r=Manishearth
Use 'tcx for references to AccessLevels wherever possible.

Most of the changes are just fallout from removing a lifetime parameter from structs, and mostly in clippy.

r? @Manishearth
2020-07-02 15:55:55 -07:00
Manish Goregaokar
2d83cbb8b6
Rollup merge of #73726 - davidtwco:issue-73541-labelled-break-through-closure-async, r=petrochenkov
resolve: disallow labelled breaks/continues through closures/async blocks

Fixes #73541.

This PR modifies name resolution to prohibit labelled breaks/continues through closures or async blocks, fixing an ICE. In addition, it improves the diagnostics surrounding labelled breaks/continues through closures or async blocks by informing the user if the label exists in an parent scope and telling them that won't work.

r? @petrochenkov (resolve)
cc @estebank (diagnostic changes) @tmandry (issue is from `wg-async-foundations`)
2020-07-02 15:55:53 -07:00
Manish Goregaokar
65342fd341
Rollup merge of #73724 - CryZe:wasm-saturating-casts, r=alexcrichton
Use WASM's saturating casts if they are available

WebAssembly supports saturating floating point to integer casts behind a target feature. The feature is already available on many browsers. Beginning with 1.45 Rust will start defining the behavior of floating point to integer casts to be saturating as well. For this Rust constructs additional checks on top of the `fptoui` / `fptosi` instructions it emits. Here we introduce the possibility for the codegen backend to construct saturating casts itself and only fall back to constructing the checks ourselves if that is not possible.

Resolves part of #73591
2020-07-02 15:55:52 -07:00
Manish Goregaokar
dc6a19c2f0
Rollup merge of #73454 - mark-i-m:contributing, r=nikomatsakis
Move contributing.md to rustc-dev-guide and point at getting started

See description on https://github.com/rust-lang/rustc-dev-guide/pull/753
2020-07-02 15:55:50 -07:00
pierwill
3c139ae929
Document rustc_ast::ast::Pat 2020-07-02 15:11:03 -07:00
Eduard-Mihai Burtescu
874f406ffd Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
bors
3503f565e1 Auto merge of #73751 - eddyb:no-empty-tables, r=nikomatsakis
Remove `TypeckTables::empty(None)` and make hir_owner non-optional.

Each commit before the last one removes uses of `TypeckTables::empty(None)`, replacing the empty tables with having `Option` around the `&'tcx TypeckTables<'tcx>` that HIR visitors kept track of.

The last commit removes the concept of "empty `TypeckTables`" altogether, guaranteeing that every `TypeckTables` corresponds to a HIR body owner.

r? @nikomatsakis
2020-07-02 16:33:00 +00:00
Eduard-Mihai Burtescu
4b2d9e60f4 Remove TypeckTables::empty(None) and make hir_owner non-optional. 2020-07-02 16:51:07 +03:00
Eduard-Mihai Burtescu
547be8c249 rustc_lint: avoid using TypeckTables::empty for LateContext. 2020-07-02 16:51:04 +03:00
Eduard-Mihai Burtescu
c0348746c3 rustc_save_analysis: avoid using TypeckTables::empty for SaveContext. 2020-07-02 16:50:39 +03:00
Eduard-Mihai Burtescu
780d6cb140 rustc_privacy: avoid using TypeckTables::empty for {Name,Type}PrivacyVisitor. 2020-07-02 16:49:41 +03:00
Eduard-Mihai Burtescu
883ece499f rustc_passes/dead: avoid using TypeckTables::empty for MarkSymbolVisitor. 2020-07-02 16:49:09 +03:00
Eduard-Mihai Burtescu
1b58ab73fd rustc_passes/reachable: avoid using TypeckTables::empty for ReachableContext. 2020-07-02 16:49:04 +03:00
Eduard-Mihai Burtescu
c49b664e81 rustc_driver/pretty: avoid using TypeckTables::empty for TypedAnnotation. 2020-07-02 16:48:35 +03:00
David Wood
cb541dc12c
resolve: disallow label use through closure/async
This commit modifies resolve to disallow `break`/`continue` to labels
through closures or async blocks. This doesn't make sense and should
have been prohibited anyway.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-02 13:48:32 +01:00
bors
8a6d4342be Auto merge of #73954 - Manishearth:rollup-8qvh170, r=Manishearth
Rollup of 10 pull requests

Successful merges:

 - #73414 (Implement `slice_strip` feature)
 - #73564 (linker: Create GNU_EH_FRAME header by default when producing ELFs)
 - #73622 (Deny unsafe ops in unsafe fns in libcore)
 - #73684 (add spans to injected coverage counters, extract with CoverageData query)
 - #73812 (ast_pretty: Pass some token streams and trees by reference)
 - #73853 (Add newline to rustc MultiSpan docs)
 - #73883 (Compile rustdoc less often.)
 - #73885 (Fix wasm32 being broken due to a NodeJS version bump)
 - #73903 (Changes required for rustc/cargo to build for iOS targets)
 - #73938 (Optimise fast path of checked_ops with `unlikely`)

Failed merges:

r? @ghost
2020-07-02 12:35:08 +00:00
bors
b7856f695d Auto merge of #73950 - Manishearth:rollup-0dtxnit, r=Manishearth
Rollup of 16 pull requests

Successful merges:

 - #72569 (Remove legacy InnoSetup GUI installer)
 - #73306 (Don't implement Fn* traits for #[target_feature] functions)
 - #73345 (expand: Stop using nonterminals for passing tokens to attribute and derive macros)
 - #73449 (Provide more information on duplicate lang item error.)
 - #73569 (Handle `macro_rules!` tokens consistently across crates)
 - #73803 (Recover extra trailing angle brackets in struct definition)
 - #73839 (Split and expand nonstandard-style lints unicode unit test.)
 - #73841 (Remove defunct `-Z print-region-graph`)
 - #73848 (Fix markdown rendering in librustc_lexer docs)
 - #73865 (Fix Zulip topic format)
 - #73892 (Clean up E0712 explanation)
 - #73898 (remove duplicate test for #61935)
 - #73906 (Add missing backtick in `ty_error_with_message`)
 - #73909 (`#[deny(unsafe_op_in_unsafe_fn)]` in libstd/fs.rs)
 - #73910 (Rewrite a few manual index loops with while-let)
 - #73929 (Fix comment typo)

Failed merges:

r? @ghost
2020-07-02 08:35:53 +00:00
Ralf Jung
dca9310ceb disable BTree min_max test in Miri for now 2020-07-02 10:26:37 +02:00
Christopher Serr
838c497a45 Address review comments and add UI test 2020-07-02 09:35:37 +02:00
Christopher Serr
8f8c90e5b5 Add comments and format the code 2020-07-02 09:32:12 +02:00
Christopher Serr
4c08451fc4 Add codegen tests 2020-07-02 09:32:09 +02:00
Christopher Serr
b2490299fc Check for feature with pre-interned symbol 2020-07-02 09:32:06 +02:00
Christopher Serr
94cd4f15d6 Use WASM's saturating casts if they are available
WebAssembly supports saturating floating point to integer casts behind a
target feature. The feature is already available on many browsers.
Beginning with 1.45 Rust will start defining the behavior of floating
point to integer casts to be saturating as well. For this Rust
constructs additional checks on top of the `fptoui` / `fptosi`
instructions it emits. Here we introduce the possibility for the codegen
backend to construct saturating casts itself and only fall back to
constructing the checks ourselves if that is not possible.
2020-07-02 09:32:03 +02:00
Manish Goregaokar
4f536f2c36
Rollup merge of #73938 - nbdd0121:checked_opt, r=nagisa
Optimise fast path of checked_ops with `unlikely`

This PR marks paths returning `None` in checked_ops as unlikely to improvde codegen.

Fixes #73731
2020-07-02 00:16:41 -07:00
Manish Goregaokar
061f1c6863
Rollup merge of #73903 - luxxxxy:ios-rustc, r=nikomatsakis
Changes required for rustc/cargo to build for iOS targets

cargo, rustc, clippy, rust-src, and rust-analysis successfully build for `aarch64-apple-ios` with these changes.

NOTE: cargo required arm64-ios openssl/libcurl to be linked.

![image](https://user-images.githubusercontent.com/65794972/86178510-75d78080-baf6-11ea-9c17-b74bd6c85272.png)
![image](https://user-images.githubusercontent.com/65794972/86178525-7bcd6180-baf6-11ea-9974-f99980cbdb24.png)
2020-07-02 00:16:40 -07:00
Manish Goregaokar
4593e9f49f
Rollup merge of #73885 - pietroalbini:ci-fix-wasm32, r=kennytm
Fix wasm32 being broken due to a NodeJS version bump

Emscripten's SDK [recently bumped the version of NodeJS they shipped](https://github.com/emscripten-core/emsdk/pull/529), but our Dockerfile for the wasm32 builder hardcoded the version number. This will cause consistent CI failures once the currently cached image is rebuilt (either due to a change or due to the cache expiring).

This PR fixes the problem by finding the latest version of NodeJS in the Emscripten SDK and symlinking it to a "latest" directory, which is then added to the `PATH`.
2020-07-02 00:16:38 -07:00
Manish Goregaokar
7b2f44a57b
Rollup merge of #73883 - ehuss:rustdoc-stage-previous, r=Mark-Simulacrum
Compile rustdoc less often.

Previously rustdoc was built 3 times with `x.py test`:

1. stage2 (using stage1 compiler) for compiletest tests (stage1-tools copied to stage2).
2. stage1 (using stage0 compiler) for std crate tests (stage0-tools copied to stage1).
3. stage2 test (using stage2 compiler) for rustdoc crate tests and error_index_generator (stage2-tools).

This PR removes the majority of number 3, where it will instead use the stage1 compiler, which will share the artifacts from number 1.

This matches the behavior of the libstd crate tests. I don't think it is entirely necessary to run the tests using stage2.

At `-j2`, the last build step goes from about 300s to 70s on my machine. It's not a huge win, but shaving 4 minutes isn't bad.

The other two builds would be pretty difficult (or undesired or impossible) to unify. It looks like std tests use stage1 very intentionally (see `force_use_stage1` and its history), and compiletests use the top stage very intentionally.

Unfortunately the linkchecker builds all docs at stage2 (stage2-tools), which means a few build script artifacts are not shared. It's not really clear to me how to fix that (because it uses `default_doc`, there doesn't seem to be any control over the stages).

---

For `x.py doc`, rustdoc was previously built three times (with compiler-docs):

1. stage2 (using stage1 compiler) for normal documentation output (stage1-tools copied to stage2).
2. stage1 (using stage0 compiler) for compiler-docs
3. stage2 (using stage2 compiler) for error_index_generator (stage2-tools)

This PR combines these so that they consistently use the "top stage" rustdoc. I don't know why the compiler-docs was written to use stage minus one, but it seems better to be consistent across the doc steps.

---

I've tried to test this with a variety of commands (`x.py doc`, `x.py test`, different `--stage` flags, `full-bootstrap`, setting `--target`, etc.) to try to make sure there aren't significant regressions here. It's tricky since there are so many variables, and this stuff is difficult for me to fully understand.

Closes #70799 (I think)
2020-07-02 00:16:36 -07:00
Manish Goregaokar
294b97251d
Rollup merge of #73853 - pierwill:pierwill-multispan-doc, r=jonas-schievink
Add newline to rustc MultiSpan docs

Also adds back-ticks when referring to the contents of this collection.
2020-07-02 00:16:34 -07:00
Manish Goregaokar
32f5e633c7
Rollup merge of #73812 - petrochenkov:prettyref, r=varkor
ast_pretty: Pass some token streams and trees by reference

Salvaged from an intermediate version of https://github.com/rust-lang/rust/pull/73345.
2020-07-02 00:16:32 -07:00
Manish Goregaokar
dc762cea33
Rollup merge of #73684 - richkadel:llvm-coverage-map-gen-2, r=wesleywiser
add spans to injected coverage counters, extract with CoverageData query

This is the next iteration on the Rust Coverage implementation, and follows PR #73488

@tmandry @wesleywiser

I came up with an approach for coverage spans, pushing them through the Call terminator as additional args so they can be extracted by the CoverageData query.

I'm using an IndexVec to store them in CoverageData such that there can be only one per index (even if parts of the MIR get duplicated during optimization).

If this approach works for you, I can quickly expand on this to build a separate IndexVec for counter expressions, using a separate call that will be ignored during code generation, but from which I can extract the counter expression values.

Let me know your thoughts. Thanks!

r? @tmandry

Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
2020-07-02 00:16:30 -07:00
Manish Goregaokar
500634bf10
Rollup merge of #73622 - LeSeulArtichaut:unsafe-libcore, r=nikomatsakis
Deny unsafe ops in unsafe fns in libcore

After `liballoc`, It's time for `libcore` :D

I planned to do this bit by bit to avoid having a big chunk of diffs, so to make reviews easier, and to make the unsafe blocks narrower and take the time to document them properly.

r? @nikomatsakis cc @RalfJung
2020-07-02 00:16:28 -07:00
Manish Goregaokar
1c68bb6ec9
Rollup merge of #73564 - petrochenkov:ehdr, r=Amanieu
linker: Create GNU_EH_FRAME header by default when producing ELFs

Do it in a centralized way in `link.rs` instead of individual target specs.

The opt-out is `-Clink-arg=(-Wl,)--no-eh-frame-hdr` if necessary.

Fixes https://github.com/rust-lang/rust/issues/73451
cc https://github.com/rust-lang/rust/pull/73483
2020-07-02 00:16:26 -07:00
Manish Goregaokar
63d392e44f
Rollup merge of #73414 - lzutao:slice_strip, r=dtolnay
Implement `slice_strip` feature

Tracking issue: #73413
2020-07-02 00:16:24 -07:00
Eric Huss
4dc5685220 Add option for local docker testing. 2020-07-01 21:03:14 -07:00
Manish Goregaokar
d7be1e4e33
Rollup merge of #73929 - kraai:fix-comment-typo, r=jonas-schievink
Fix comment typo
2020-07-01 20:36:10 -07:00
Manish Goregaokar
8fcb015b44
Rollup merge of #73910 - cuviper:while-indexing, r=oli-obk
Rewrite a few manual index loops with while-let

There were a few instances of this pattern:

```rust
while index < vec.len() {
    let item = &vec[index];
    // ...
}
```

These can be indexed at once:

```rust
while let Some(item) = vec.get(index) {
    // ...
}
```

Particularly in `ObligationForest::process_obligations`, this mitigates
a codegen regression found with LLVM 11 (#73526).
2020-07-01 20:36:08 -07:00
Manish Goregaokar
441f04b56b
Rollup merge of #73909 - eltonlaw:unsafe-libstd-fs-rs, r=sfackler
`#[deny(unsafe_op_in_unsafe_fn)]` in libstd/fs.rs

The `libstd/fs.rs` part of https://github.com/rust-lang/rust/issues/73904 . Wraps the two calls to an unsafe fn `Initializer::nop()` in an `unsafe` block.

Followed instructions in parent issue, ran `./x.py check src/libstd/` after adding the lint and two warnings were given. After adding these changes, those disappear.
2020-07-01 20:36:06 -07:00
Manish Goregaokar
9046f230fd
Rollup merge of #73906 - JohnTitor:missing-bt, r=jonas-schievink
Add missing backtick in `ty_error_with_message`
2020-07-01 20:36:04 -07:00
Manish Goregaokar
37e812e53d
Rollup merge of #73898 - lcnr:issue61383, r=jonas-schievink
remove duplicate test for #61935

Apparently I somehow messed up the issue number in #67890
which caused us to add this test twice, both as https://github.com/rust-lang/rust/blob/master/src/test/ui/const-generics/issues/issue-61935.rs and https://github.com/rust-lang/rust/blob/master/src/test/ui/const-generics/lazy-normalization/issue-71922.rs

#61935 is the actually fixed issue while #71922 is still not working, as it depends on lazy norm of repeat expressions
2020-07-01 20:36:02 -07:00
Manish Goregaokar
1b37bfa537
Rollup merge of #73892 - GuillaumeGomez:cleanup-e0712, r=Dylan-DPC
Clean up E0712 explanation

r? @Dylan-DPC
2020-07-01 20:36:00 -07:00
Manish Goregaokar
89429a854d
Rollup merge of #73865 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Fix Zulip topic format

Yet another instance of me making a mistake after copy-pasting :D
r? @Dylan-DPC
2020-07-01 20:35:58 -07:00
Manish Goregaokar
8d638f456a
Rollup merge of #73848 - pierwill:pierwill-lexer-block-doc, r=jonas-schievink
Fix markdown rendering in librustc_lexer docs

Use back-ticks instead of quotation marks in docs for the block comment variant of TokenKind.

## [Before](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/enum.TokenKind.html#variant.BlockComment) and after

<img width="1103" alt="Screen Shot 2020-06-28 at 1 22 30 PM" src="https://user-images.githubusercontent.com/19642016/85957562-446a8380-b943-11ea-913a-442cf7744083.png">

<img width="1015" alt="Screen Shot 2020-06-28 at 1 28 29 PM" src="https://user-images.githubusercontent.com/19642016/85957566-4af8fb00-b943-11ea-8fef-a09c1d586772.png">

## Question

For visual consistency, should we use back-ticks throughout the docs for these enum variants?
2020-07-01 20:35:56 -07:00
Manish Goregaokar
e04070a351
Rollup merge of #73841 - tmiasko:print-region-graph, r=Mark-Simulacrum
Remove defunct `-Z print-region-graph`
2020-07-01 20:35:54 -07:00