Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 16 pull requests #73944

Closed
wants to merge 44 commits into from

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

ChrisDenton and others added 30 commits May 25, 2020 13:53
On Windows the InnoSetup installer was superseded by the MSI installer. It's no longer needed.
This commit applies the existing 'extra angle bracket recovery' logic
when parsing fields in struct definitions. This allows us to continue
parsing the struct's fields, avoiding spurious 'missing field' errors in
code that tries to use the struct.
Use back-ticks instead of quotation marks in docs for the block comment
variant of TokenKind.
Also adds back-ticks when referring to the contents of this collection.
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 (rust-lang#73526).
When a `macro_rules!` macro expands to another `macro_rules!` macro, we
may see `None`-delimited groups in odd places when another crate
deserializes the 'inner' macro. This commit 'unwraps' an outer
`None`-delimited group to avoid breaking existing code.

See rust-lang#73569 (comment)
for more details.

The proper fix is to handle `None`-delimited groups systematically
throughout the parser, but that will require significant work. In the
meantime, this hack lets us fix important hygiene bugs in macros
Apply suggestion from varkor

Co-authored-by: varkor <github@varkor.com>
…omatsakis

Remove legacy InnoSetup GUI installer

On Windows the InnoSetup `.exe` installer was superseded by the MSI installer long ago. It's no longer needed.

The `.exe` installer hasn't been linked from the [other installation methods](https://forge.rust-lang.org/infra/other-installation-methods.html#standalone) page in many years. As far as I can tell the intent was always to remove this installer once the MSI proved itself. Though admittedly both installers feel very "legacy" at this point.

Removing this would mean we only maintain one Windows GUI installer and would speed up the distribution phase.

As a result of removing InnoSetup, this closes rust-lang#24397
Rename TypeckTables to TypeckResults.

Originally suggested by @eddyb.
…trait-soundness, r=nikomatsakis

Don't implement Fn* traits for #[target_feature] functions

Closes rust-lang#72012.
expand: Stop using nonterminals for passing tokens to attribute and derive macros

Make one more step towards fully token-based expansion and fix issues described in rust-lang#72545 (comment).

Now `struct S;` is passed to `foo!(struct S;)` and `#[foo] struct S;` in the same way - as a token stream `struct S ;`, rather than a single non-terminal token `NtItem` which is then broken into parts later.

The cost is making pretty-printing of token streams less pretty.
Some of the pretty-printing regressions will be recovered by keeping jointness with each token, which we will need to do anyway.

Unfortunately, this is not exactly the same thing as rust-lang#73102.
One more observable effect is how `$crate` is printed in the attribute input.
Inside `NtItem` was printed as `crate` or `that_crate`, now as a part of a token stream it's printed as `$crate` (there are good reasons for these differences, see rust-lang#62393 and related PRs).
This may break old proc macros (custom derives) written before the main portion of the proc macro API (macros 1.2) was stabilized, those macros did `input.to_string()` and reparsed the result, now that result can contain `$crate` which cannot be reparsed.

So, I think we should do this regardless, but we need to run crater first.
r? @Aaron1011
…wjasper

Provide more information on duplicate lang item error.

This gives some notes on the location of the files where the lang items were loaded from. Some duplicate lang item errors can be a little confusing, and this might help in diagnosing what has happened.

Here's an example when hitting a bug with Cargo's build-std:

```
error: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `try`.
  |
  = note: the lang item is first defined in crate `core` (which `z10` depends on)
  = note: first definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-a764da499c7385f4.rmeta
  = note: second definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-5b082675aea34986.rmeta
```
…petrochenkov

Handle `macro_rules!` tokens consistently across crates

When we serialize a `macro_rules!` macro, we used a 'lowered' `TokenStream` for its body, which has all `Nonterminal`s expanded in-place via `nt_to_tokenstream`. This matters when an 'outer' `macro_rules!` macro expands to an 'inner' `macro_rules!` macro - the inner macro may use tokens captured from the 'outer' macro in its definition.

This means that invoking a foreign `macro_rules!` macro may use a different body `TokenStream` than when the same `macro_rules!` macro is invoked in the same crate. This difference is observable by proc-macros invoked by a `macro_rules!` macro - a `None`-delimited group will be seen in the same-crate case (inserted when convering `Nonterminal`s to the `proc_macro` crate's structs), but no `None`-delimited group in the cross-crate case.

To fix this inconsistency, we now insert `None`-delimited groups when 'lowering' a `Nonterminal` `macro_rules!` body, just as we do in `proc_macro_server`. Additionally, we no longer print extra spaces for `None`-delimited groups - as far as pretty-printing is concerned, they don't exist (only their contents do). This ensures that `Display` output of a `TokenStream` does not depend on which crate a `macro_rules!` macro was invoked from.

This PR is necessary in order to patch the `solana-genesis-programs` for the upcoming hygiene serialization breakage (rust-lang#72121 (comment)). The `solana-genesis-programs` crate will need to use a proc macro to re-span certain tokens in a nested `macro_rules!`, which requires us to consistently use a `None`-delimited group.

See `src/test/ui/proc-macro/nested-macro-rules.rs` for an example of the kind of nested `macro_rules!` affected by this crate.
…varkor

Add `format_args_capture` feature

This is the initial implementation PR for [RFC 2795](rust-lang/rfcs#2795).

Note that, as dicussed in the tracking issue (rust-lang#67984), the feature gate has been called `format_args_capture`.

Next up I guess I need to add documentation for this feature. I've not written any docs before for rustc / std so I would appreciate suggestions on where I should add docs.
…ery, r=matthewjasper

Recover extra trailing angle brackets in struct definition

This commit applies the existing 'extra angle bracket recovery' logic
when parsing fields in struct definitions. This allows us to continue
parsing the struct's fields, avoiding spurious 'missing field' errors in
code that tries to use the struct.
ast_pretty: Pass some token streams and trees by reference

Salvaged from an intermediate version of rust-lang#73345.
…nishearth

Split and expand nonstandard-style lints unicode unit test.

RFC 2457 requested that the `nonstandard_style` series of linted be adjusted to cover the non_ascii_identifier case. However when i read the code of those implementations, it seems they're already supporting non_ascii_identifiers. But the exact rules is a little different than what's proposed in RFC 2457.

So I splitted and expanded the existing test case to try to exercise every branch in the code. I think it'll also be easier to examine the cases in these unit tests to see whether it's ok to just leave them as is, or some adjustments are needed.

r? @Manishearth
…Simulacrum

Remove defunct `-Z print-region-graph`
…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?
…jonas-schievink

Add newline to rustc MultiSpan docs

Also adds back-ticks when referring to the contents of this collection.
Fix Zulip topic format

Yet another instance of me making a mistake after copy-pasting :D
r? @Dylan-DPC
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 (rust-lang#73526).
@Manishearth
Copy link
Member Author

@rustbot modify labels: +rollup
@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 2, 2020

📌 Commit 8d0d244 has been approved by Manishearth

@rustbot rustbot added the rollup A PR which is a rollup label Jul 2, 2020
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 2, 2020
@bors
Copy link
Contributor

bors commented Jul 2, 2020

⌛ Testing commit 8d0d244 with merge 2ced7467cc86dff1d6928465fefba2d76070ed79...

@bors
Copy link
Contributor

bors commented Jul 2, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 2, 2020
@Manishearth
Copy link
Member Author

``` 2020-07-02T01:23:34.6745917Z failures: 2020-07-02T01:23:34.6776793Z 2020-07-02T01:23:34.6777741Z ---- [ui] ui/fmt/format-args-capture.rs stdout ---- 2020-07-02T01:23:34.6777869Z 2020-07-02T01:23:34.6778019Z error: test run failed! 2020-07-02T01:23:34.6778161Z status: exit code: 101 2020-07-02T01:23:34.6778651Z command: "/node-v9.2.0-linux-x64/bin/node" "/checkout/src/etc/wasm32-shim.js" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fmt/format-args-capture/a.wasm" 2020-07-02T01:23:34.6778892Z stdout: 2020-07-02T01:23:34.6779197Z ------------------------------------------ 2020-07-02T01:23:34.6779281Z 2020-07-02T01:23:34.6779718Z ------------------------------------------ 2020-07-02T01:23:34.6780143Z stderr: 2020-07-02T01:23:34.6780484Z ------------------------------------------ 2020-07-02T01:23:34.6780632Z RuntimeError: unreachable 2020-07-02T01:23:34.6780937Z at __rust_start_panic (wasm-function[71]:1) 2020-07-02T01:23:34.6784824Z at rust_panic (wasm-function[67]:39) 2020-07-02T01:23:34.6785686Z at _ZN3std9panicking20rust_panic_with_hook17h0f0f5f15fb4d96a5E (wasm-function[62]:300) 2020-07-02T01:23:34.6786146Z at _ZN3std9panicking11begin_panic17hf152d23817f4c89eE.llvm.3685695550328072697 (wasm-function[3]:63) 2020-07-02T01:23:34.6786668Z at _ZN19format_args_capture49panic_with_single_argument_does_not_get_formatted28_$u7b$$u7b$closure$u7d$$u7d$17hd89a552a94891368E.llvm.3685695550328072697 (wasm-function[5]:1) 2020-07-02T01:23:34.6787056Z at _ZN3std9panicking3try17h6bf86b1b1823b488E (wasm-function[4]:1) 2020-07-02T01:23:34.6787438Z at _ZN19format_args_capture4main17h64e7f2babf424377E (wasm-function[1]:639) 2020-07-02T01:23:34.6787869Z at _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h9d63bb236469fc68E (wasm-function[9]:25) 2020-07-02T01:23:34.6788295Z at _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h1d43db6386b866d9E (wasm-function[53]:8) 2020-07-02T01:23:34.6788695Z at _ZN3std2rt19lang_start_internal17h682f4d41ea4333a0E (wasm-function[68]:229) 2020-07-02T01:23:34.6789027Z at main (wasm-function[2]:46) 2020-07-02T01:23:34.6789368Z at Object. (/checkout/src/etc/wasm32-shim.js:20:20) 2020-07-02T01:23:34.6789570Z at Module._compile (module.js:641:30) 2020-07-02T01:23:34.6789733Z at Object.Module._extensions..js (module.js:652:10) 2020-07-02T01:23:34.6789893Z at Module.load (module.js:560:32) 2020-07-02T01:23:34.6790045Z at tryModuleLoad (module.js:503:12) 2020-07-02T01:23:34.6790200Z at Function.Module._load (module.js:495:3) 2020-07-02T01:23:34.6790356Z at Function.Module.runMain (module.js:682:10) 2020-07-02T01:23:34.6790510Z at startup (bootstrap_node.js:191:16) 2020-07-02T01:23:34.6790664Z at bootstrap_node.js:613:3 2020-07-02T01:23:34.6790757Z 2020-07-02T01:23:34.6791402Z ------------------------------------------ 2020-07-02T01:23:34.6791462Z 2020-07-02T01:23:34.6791531Z 2020-07-02T01:23:34.6791593Z 2020-07-02T01:23:34.6791695Z failures: 2020-07-02T01:23:34.6791923Z [ui] ui/fmt/format-args-capture.rs 2020-07-02T01:23:34.6791984Z 2020-07-02T01:23:34.6792268Z test result: �[31mFAILED�(B�[m. 9876 passed; 1 failed; 545 ignored; 0 measured; 0 filtered out 2020-07-02T01:23:34.6792360Z 2020-07-02T01:23:34.6806229Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:344:22 2020-07-02T01:23:34.6806658Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 2020-07-02T01:23:34.6825558Z ```

@Manishearth Manishearth closed this Jul 2, 2020
@Manishearth Manishearth deleted the rollup-xxg63mr branch July 18, 2020 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.