Commit Graph

122971 Commits

Author SHA1 Message Date
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
Yuki Okushi
84282fd6f1
Audit uses of tool_only_span_suggestion 2020-07-02 15:18:33 +09:00
Yuki Okushi
ec31b4e3a8
Audit uses of span_suggestion_short 2020-07-02 15:18:33 +09:00
Yashhwanth Ram
8dc1e42515 libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]
Enclose unsafe operations in unsafe blocks
2020-07-02 11:33:37 +05:30
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
Manish Goregaokar
244dd2806d
Rollup merge of #73839 - crlf0710:snapshot_the_reality, r=Manishearth
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
2020-07-01 20:35:52 -07:00
Manish Goregaokar
5d429f3847
Rollup merge of #73803 - Aaron1011:feature/angle-field-recovery, 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.
2020-07-01 20:35:50 -07:00
Manish Goregaokar
ce49944171
Rollup merge of #73569 - Aaron1011:fix/macro-rules-group, r=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 (https://github.com/rust-lang/rust/pull/72121#issuecomment-646924847). 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.
2020-07-01 20:35:48 -07:00
Manish Goregaokar
6b57050b17
Rollup merge of #73449 - ehuss:duplicate-lang-item, r=matthewjasper
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
```
2020-07-01 20:35:46 -07:00
Manish Goregaokar
8ed5c0d37a
Rollup merge of #73345 - petrochenkov:nointerp, r=Aaron1011
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 https://github.com/rust-lang/rust/issues/72545#issuecomment-640276791.

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 https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/pull/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
2020-07-01 20:35:44 -07:00
Manish Goregaokar
3d391d2a73
Rollup merge of #73306 - calebzulawski:target-feature-11-fn-trait-soundness, r=nikomatsakis
Don't implement Fn* traits for #[target_feature] functions

Closes #72012.
2020-07-01 20:35:43 -07:00
Manish Goregaokar
fb976e65a0
Rollup merge of #72569 - ChrisDenton:remove-innosetup, r=nikomatsakis
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 #24397
2020-07-01 20:35:41 -07:00
Eric Huss
0b9bc79738 Tests for number of times rustdoc is built with x.py test and doc. 2020-07-01 15:51:35 -07:00
bors
9491f18c5d Auto merge of #72053 - Mark-Simulacrum:32bitcheck, r=pietroalbini
Test UI tests for pass=check

I'm going to just compare the builder times since I wasn't able to get this working nicely locally (hit some obscure linker error).

Fixes part of #69823
2020-07-01 21:01:36 +00:00
CAD97
7498cad0d8 Reclarify safety comments in Weak::as_ptr 2020-07-01 16:02:34 -04:00
Gary Guo
86d8644c1b Optimise fast path of checked_ops with unlikely 2020-07-01 20:06:22 +01:00
CAD97
98789ac75a Simplify Weak::as_ptr impl 2020-07-01 15:06:07 -04:00
CAD97
ac40d1eff3 Apply documentation review suggestions
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-07-01 15:05:37 -04:00
Vadim Petrochenkov
eb4ba55055 Add an issue number for the pretty_printing_compatibility_hack FIXME 2020-07-01 20:23:06 +03:00
aspen
67b162f043
Explicitly check for iOS/tvOS. 2020-07-01 13:19:09 -04:00
Dan Aloni
f77b6fe571 Review fix 2020-07-01 20:05:56 +03:00
David Hewitt
10ebb2cbb2 Update src/librustc_builtin_macros/format.rs
Apply suggestion from varkor

Co-authored-by: varkor <github@varkor.com>
2020-07-01 18:00:39 +01:00
Aaron Hill
1ded7a5815
Handle None-delimited groups when parsing macro_rules! macro
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 https://github.com/rust-lang/rust/pull/73569#issuecomment-650860457
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
2020-07-01 12:42:31 -04:00
Aaron Hill
c84402872e
Don't print additional spaces when pretty-printing NoDelim groups 2020-07-01 12:42:31 -04:00
Aaron Hill
5da0576d83
Insert NoDelim groups around nonterminals when lowering macro_rules 2020-07-01 12:42:30 -04:00
aspen
22e8ced9fd
Also document iphoneos-version-min. 2020-07-01 12:21:48 -04:00
aspen
4fd1c77a24
Document the CMake defines. 2020-07-01 12:15:24 -04:00
KRAAI, MATTHEW [VISUS]
9ce1d197ca Fix comment typo 2020-07-01 08:35:09 -07:00
Eduardo Sánchez Muñoz
aac2f734de Improve comments from https://github.com/rust-lang/rust/pull/72617, as suggested by RalfJung. 2020-07-01 16:59:50 +02:00
bors
f781babf87 Auto merge of #73924 - Manishearth:rollup-8r51ld9, r=Manishearth
Rollup of 17 pull requests

Successful merges:

 - #72071 (Added detailed error code explanation for issue E0687 in Rust compiler.)
 - #72369 (Bring net/parser.rs up to modern up to date with modern rust patterns)
 - #72445 (Stabilize `#[track_caller]`.)
 - #73466 (impl From<char> for String)
 - #73548 (remove rustdoc warnings)
 - #73649 (Fix sentence structure)
 - #73678 (Update Box::from_raw example to generalize better)
 - #73705 (stop taking references in Relate)
 - #73716 (Document the static keyword)
 - #73752 (Remap Windows ERROR_INVALID_PARAMETER to ErrorKind::InvalidInput from Other)
 - #73776 (Move terminator to new module)
 - #73778 (Make `likely` and `unlikely` const, gated by feature `const_unlikely`)
 - #73805 (Document the type keyword)
 - #73806 (Use an 'approximate' universal upper bound when reporting region errors)
 - #73828 (Fix wording for anonymous parameter name help)
 - #73846 (Fix comma in debug_assert! docs)
 - #73847 (Edit cursor.prev() method docs in lexer)

Failed merges:

r? @ghost
2020-07-01 14:45:56 +00:00
Manish Goregaokar
c9b3e86977
Rollup merge of #73847 - pierwill:pierwill-cursor-doc, r=matthewjasper
Edit cursor.prev() method docs in lexer

Fix missing punctuation
2020-07-01 07:43:02 -07:00
Manish Goregaokar
affd950ed2
Rollup merge of #73846 - pierwill:pierwill-patch-2, r=joshtriplett
Fix comma in debug_assert! docs
2020-07-01 07:43:00 -07:00
Manish Goregaokar
db900d4ef3
Rollup merge of #73828 - nop:fix/parameter-name-help, r=estebank
Fix wording for anonymous parameter name help

```
 --> exercises/functions/functions2.rs:8:15
  |
8 | fn call_me(num) {
  |               ^ expected one of `:`, `@`, or `|`
  |
  = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this is a `self` type, give it a parameter name
  |
8 | fn call_me(self: num) {
  |            ^^^^^^^^^
help: if this was a parameter name, give it a type
  |
8 | fn call_me(num: TypeName) {
  |            ^^^^^^^^^^^^^
help: if this is a type, explicitly ignore the parameter name
  |
8 | fn call_me(_: num) {
  |
```
This commit changes "if this was a parameter name" to "if this is a parameter name" to match the wording of similar errors.
2020-07-01 07:42:58 -07:00
Manish Goregaokar
f213957c2e
Rollup merge of #73806 - Aaron1011:feature/approx-universal-upper, r=estebank
Use an 'approximate' universal upper bound when reporting region errors

Fixes #67765

When reporting errors during MIR region inference, we sometimes use
`universal_upper_bound` to obtain a named universal region that we
can display to the user. However, this is not always possible - in a
case like `fn foo<'a, 'b>() { .. }`, the only upper bound for a region
containing `'a` and `'b` is `'static`. When displaying diagnostics, it's
usually better to display *some* named region (even if there are
multiple involved) rather than fall back to a generic error involving
`'static`.

This commit adds a new `approx_universal_upper_bound` method, which
uses the lowest-numbered universal region if the only alternative is to
return `'static`.
2020-07-01 07:42:56 -07:00
Manish Goregaokar
178b0c2e99
Rollup merge of #73805 - poliorcetics:type-keyword, r=kennytm
Document the type keyword

Partial fix of #34601.

Two small examples, one clarifying that `type` only defines an alias, not a completely new type, the other explaining the use in traits.

@rustbot modify labels: T-doc,C-enhancement
2020-07-01 07:42:54 -07:00
Manish Goregaokar
ec41d01d4f
Rollup merge of #73778 - nbdd0121:const_likely, r=oli-obk
Make `likely` and `unlikely` const, gated by feature `const_unlikely`

This PR also contains a fix to allow `#[allow_internal_unstable]` to work properly with `#[rustc_const_unstable]`.

cc @RalfJung @nagisa

r? @oli-obk
2020-07-01 07:42:52 -07:00
Manish Goregaokar
d6bee55855
Rollup merge of #73776 - aszenz:refactor_mir_module, r=wesleywiser
Move terminator to new module

Moves terminator types from `librustc_middle/mir/mod.rs` into submodule
Fixes #73723
2020-07-01 07:42:50 -07:00
Manish Goregaokar
3951a98ec5
Rollup merge of #73752 - TyPR124:invalid-parameter-error, r=LukasKalbertodt
Remap Windows ERROR_INVALID_PARAMETER to ErrorKind::InvalidInput from Other

I don't know if this is acceptable or how likely it is to break existing code, but it seem to me ERROR_INVALID_PARAMETER "The parameter is incorrect" should map to ErrorKind::InvalidInput "A parameter was incorrect". Previously this value fell through to ErrorKind::Other.

I can't speak for anyone but myself, but I instinctively thought it would be InvalidInput.
2020-07-01 07:42:48 -07:00
Manish Goregaokar
8ac17d14aa
Rollup merge of #73716 - poliorcetics:static-keyword, r=LukasKalbertodt
Document the static keyword

Partial fix of #34601.

This documents the `static` keyword. It's basically a simplified version of the reference with more examples.

@rustbot modify labels: T-doc,C-enhancement
2020-07-01 07:42:46 -07:00