Commit Graph

122408 Commits

Author SHA1 Message Date
Adrian Taylor
a63eb3c678 Clarify --extern documentation.
Fixes #64731, #73531.

See also #64402#issuecomment-530852886
2020-06-20 17:02:18 -07:00
David Tolnay
4896a06667
Update stability attribute of new Vec PartialEq impls 2020-06-20 16:02:21 -07:00
bors
7058471ade Auto merge of #73563 - Manishearth:rollup-oowgwwm, r=Manishearth
Rollup of 9 pull requests

Successful merges:

 - #72456 (Try to suggest dereferences on trait selection failed)
 - #72788 (Projection bound validation)
 - #72790 (core/time: Add Duration methods for zero)
 - #73227 (Allow multiple `asm!` options groups and report an error on duplicate options)
 - #73287 (lint: normalize projections using opaque types)
 - #73291 (Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs)
 - #73378 (Remove use of specialization from librustc_arena)
 - #73411 (Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15))
 - #73443 (ci: allow gating GHA on everything but macOS)

Failed merges:

r? @ghost
2020-06-20 22:53:46 +00:00
Solomon Ucko
fc60282dae
impl PartialEq<Vec<B>> for &[A], &mut [A] 2020-06-20 15:51:20 -07:00
Manish Goregaokar
929f032742
Rollup merge of #73443 - pietroalbini:gha-auto-fallible, r=Mark-Simulacrum
ci: allow gating GHA on everything but macOS

In our GitHub Actions setup macOS is too unreliable to gate on it, but the other builders work fine. This commit splits the macOS builders into a separate job (called `auto-fallible`), allowing us to gate on the auto job without failing due to macOS spurious failures.

cc https://github.com/rust-lang/rust-central-station/issues/848
r? @Mark-Simulacrum
2020-06-20 14:45:04 -07:00
Manish Goregaokar
9a82736e94
Rollup merge of #73411 - ehuss:bump-stage0, r=Mark-Simulacrum
Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15)

Pulls in changes from #73326.

Closes #73286
2020-06-20 14:45:02 -07:00
Manish Goregaokar
a876a5adcf
Rollup merge of #73378 - matthewjasper:arena-not-special, r=oli-obk
Remove use of specialization from librustc_arena

This reworks the macro so that specialization, `transmute` and `#[marker]` are not used.

r? @oli-obk
2020-06-20 14:45:00 -07:00
Manish Goregaokar
0a8fd43e2d
Rollup merge of #73291 - marmeladema:hir-id-ification-fix, r=petrochenkov
Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs

cc #50928

I don't know who is exactly the best person to review this.

r? @petrochenkov
2020-06-20 14:44:58 -07:00
Manish Goregaokar
9003087655
Rollup merge of #73287 - davidtwco:issue-73251-opaque-types-in-projections, r=estebank
lint: normalize projections using opaque types

Fixes #73251.

This PR normalizes projections which use opaque types (opaque types are otherwise linted against, which is would have previously made the test cases added in this PR fail).
2020-06-20 14:44:57 -07:00
Manish Goregaokar
45d6aefc60
Rollup merge of #73227 - camelid:multiple-asm-options, r=Amanieu
Allow multiple `asm!` options groups and report an error on duplicate options

Fixes #73193

Cc @joshtriplett @Amanieu

- [x] Allow multiple options
- [x] Update existing test
- [x] Add new tests
- [x] Check for duplicate options
- [x] Add duplicate options tests
- [x] Finalize suggestion format for duplicate options error
2020-06-20 14:44:55 -07:00
Manish Goregaokar
c47550f9e4
Rollup merge of #72790 - jonhoo:duration-is-zero, r=LukasKalbertodt
core/time: Add Duration methods for zero

This patch adds two methods to `Duration`. The first, `Duration::zero`,
provides a `const` constructor for getting an zero-length duration. This
is also what `Default` provides (this was clarified in the docs), though
`default` is not `const`.

The second, `Duration::is_zero`, returns true if a `Duration` spans no
time (i.e., because its components are all zero). Previously, the way to
do this was either to compare both `as_secs` and `subsec_nanos` to 0, to
compare against `Duration::new(0, 0)`, or to use the `u128` method
`as_nanos`, none of which were particularly elegant.
2020-06-20 14:44:53 -07:00
Manish Goregaokar
1a171d0d5b
Rollup merge of #72788 - matthewjasper:projection-bound-validation, r=nikomatsakis
Projection bound validation

During selection we use bounds declared on associated types (e.g. `type X: Copy`) to satisfy trait/projection bounds. This would be fine so long as those bounds are checked on any impls/trait objects. For simple cases they are because the bound `Self::X: Copy` gets normalized when we check the impl.

However, for default values with specialization and higher-ranked bounds from GATs or otherwise, we can't normalize when checking the impl, and so we use the bound from the trait to prove that the bound applies to the impl, which is clearly unsound.

This PR makes 2 fixes for this:

1. Requiring that the bounds on the trait apply to a projection type with the corresponding substs, so a bound `for<'a> <Self as X<'a>>::U: Copy` on the trait cannot be used to prove `<T as X<'_>>::U: Copy`.
2. Actually checking that the bounds that we still allow apply to generic/default associated types.

Opening for a crater run.

Closes #68641
Closes #68642
Closes #68643
Closes #68644
Closes #68645
Closes #68656

r? @ghost
2020-06-20 14:44:52 -07:00
Manish Goregaokar
a1404a93f9
Rollup merge of #72456 - ldm0:dereftrait, r=estebank
Try to suggest dereferences on trait selection failed

Fixes #39029 Fixes #62530
This PR consists of two parts:
1. Decouple `Autoderef` with `FnCtxt` and move `Autoderef` to `librustc_trait_selection`.
2. Try to suggest dereferences when trait selection failed.

The first is needed because:
1. For suggesting dereferences, the struct `Autoderef` should be used. But before this PR, it is placed in `librustc_typeck`, which depends on `librustc_trait_selection`. But trait selection error emitting happens in `librustc_trait_selection`, if we want to use `Autoderef` in it, dependency loop is inevitable. So I moved the `Autoderef` to `librustc_trait_selection`.
2. Before this PR, `FnCtxt` is coupled to `Autoderef`, and `FnCtxt` only exists in `librustc_typeck`. So decoupling is needed.

After this PR, we can get suggestion like this:
```
error[E0277]: the trait bound `&Baz: Happy` is not satisfied
  --> $DIR/trait-suggest-deferences-multiple.rs:34:9
   |
LL | fn foo<T>(_: T) where T: Happy {}
   |                          ----- required by this bound in `foo`
...
LL |     foo(&baz);
   |         ^^^^
   |         |
   |         the trait `Happy` is not implemented for `&Baz`
   |         help: consider adding dereference here: `&***baz`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
```

r? @estebank
2020-06-20 14:44:50 -07:00
Christian Poveda
935516803e update tests 2020-06-20 20:38:57 +00:00
Eric Huss
bfb0e8db88 Fix broken inner_deref doc tests. 2020-06-20 12:27:16 -07:00
bors
f455e46eae Auto merge of #73550 - RalfJung:rollup-5huj1k1, r=RalfJung
Rollup of 9 pull requests

Successful merges:

 - #72600 (Properly encode AnonConst into crate metadata)
 - #73055 (remove leftover mentions of `skol` and `int` from the compiler)
 - #73058 (Support sanitizers on aarch64-unknown-linux-gnu)
 - #73171 (RISC-V Emulated Testing)
 - #73404 (Update CFGuard syntax)
 - #73444 (ci: disable alt build during try builds)
 - #73471 (Prevent attacker from manipulating FPU tag word used in SGX enclave)
 - #73539 (Deprecate `Vec::remove_item`)
 - #73543 (Clean up E0695 explanation)

Failed merges:

r? @ghost
2020-06-20 19:14:52 +00:00
Eric Huss
5a8e915725 Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15) 2020-06-20 11:13:47 -07:00
Camelid
c31785a4ed Run ./x.py fmt 2020-06-20 11:12:43 -07:00
Camelid
8d80cc5679 Fix duplicate options error
The UI isn't glitching anymore.
2020-06-20 11:12:43 -07:00
Camelid
58f812bd61 Use p.token instead of p.look_ahead() 2020-06-20 11:12:43 -07:00
Camelid
db9d3769b4 Add documentation 2020-06-20 11:12:43 -07:00
Camelid
8fe6710b4d Create a separate, tool-only suggestion for the comma
That way the comma isn't highlighted as part of the option in the UI.

Weirdly, the comma removal suggestion shows up in the UI.
2020-06-20 11:12:43 -07:00
Camelid
4ba66970d8 Make suggestion machine-applicable 2020-06-20 11:12:43 -07:00
Camelid
f4dfc61e84 Add more to duplicate options test 2020-06-20 11:12:43 -07:00
Camelid
b00b1a4598 Use span_suggestion instead of span_label 2020-06-20 11:12:43 -07:00
Camelid
e8be7971d1 Use bitflags function instead of custom one 2020-06-20 11:12:43 -07:00
Camelid
c7da50d23f Get option name from symbol instead of snippet 2020-06-20 11:12:43 -07:00
Camelid
7c5b66f328 Update duplicate options test 2020-06-20 11:12:43 -07:00
Camelid
ac54265b13 Use span_label 2020-06-20 11:12:43 -07:00
Camelid
b94b7e7f1b Make warning an error; use help instead of suggestion; clean up code
For some reason, the help message is now in a separate message, which
adds a lot of noise. I would like to try to get it back to one message.
2020-06-20 11:12:42 -07:00
Camelid
7aaadb69e4 Add UI test for duplicate asm! options warning 2020-06-20 11:12:42 -07:00
Camelid
2be403ce3e Warn on duplicate asm! options 2020-06-20 11:12:42 -07:00
Camelid
820bba1c46 Add codegen test for multiple asm! options 2020-06-20 11:12:42 -07:00
Camelid
27cc7c7d9f Clean up 2020-06-20 11:12:42 -07:00
Camelid
1d2acdf8ec Use Vec<Span> instead of Option<Vec<Span>> 2020-06-20 11:12:42 -07:00
Camelid
e61411673c Update tests 2020-06-20 11:12:42 -07:00
Camelid
c883fa45d3 Allow multiple asm! options 2020-06-20 10:42:49 -07:00
Jon Gjengset
386114bfd3
Revise according to review 2020-06-20 10:55:39 -04:00
Jon Gjengset
ad7fd6265e
Doctests need feature 2020-06-20 10:53:39 -04:00
Jon Gjengset
3ff5879f8d
core/time: Add Duration methods for zero
This patch adds two methods to `Duration`. The first, `Duration::zero`,
provides a `const` constructor for getting an zero-length duration. This
is also what `Default` provides (this was clarified in the docs), though
`default` is not `const`.

The second, `Duration::is_zero`, returns true if a `Duration` spans no
time (i.e., because its components are all zero). Previously, the way to
do this was either to compare both `as_secs` and `subsec_nanos` to 0, to
compare against `Duration::new(0, 0)`, or to use the `u128` method
`as_nanos`, none of which were particularly elegant.
2020-06-20 10:53:39 -04:00
Ralf Jung
bb0016bdec
Rollup merge of #73543 - GuillaumeGomez:cleanup-e0695, r=Dylan-DPC
Clean up E0695 explanation

r? @Dylan-DPC
2020-06-20 16:40:01 +02:00
Ralf Jung
c1cad70282
Rollup merge of #73539 - LukasKalbertodt:deprecate-vec-remove-item, r=Mark-Simulacrum
Deprecate `Vec::remove_item`

In #40062 we decided to remove that method. In #71834 it was said that we want to deprecate it for a few cycles before removing it. That's what this PR does.
2020-06-20 16:39:59 +02:00
Ralf Jung
96b86ea1a8
Rollup merge of #73471 - raoulstrackx:raoul/fpu_tag_word, r=jethrogb
Prevent attacker from manipulating FPU tag word used in SGX enclave

Insufficient sanitization of the x87 FPU tag word in the trusted enclave runtime allowed unprivileged adversaries in the containing host application to induce incoherent or unexpected results for ABI-compliant compiled enclave application code that uses the x87 FPU.

Vulnerability was disclosed to us by Fritz Alder, Jo Van Bulck, David Oswald and Frank Piessens

cc: @jethrogb
2020-06-20 16:39:57 +02:00
Ralf Jung
7930ee6874
Rollup merge of #73444 - pietroalbini:ci-remove-try-alt, r=Mark-Simulacrum
ci: disable alt build during try builds

The alt build is not actually needed often, and it can be added back on a case-by-case basis if a specific PR needs access to it.

This will free up a builder.

r? @Mark-Simulacrum
2020-06-20 16:39:55 +02:00
Ralf Jung
91bd3337e3
Rollup merge of #73404 - ajpaverd:cfguard_syntax, r=Mark-Simulacrum
Update CFGuard syntax

Update the naming and syntax of the control-flow-guard option, as discussed in #68793.

r? @Mark-Simulacrum
2020-06-20 16:39:53 +02:00
Ralf Jung
77efcab0f2
Rollup merge of #73171 - tblah:riscv-qemu-test, r=pietroalbini
RISC-V Emulated Testing

Adds a disabled docker image on which to run RISC-V tests. Based on the armhf image.

Test using
```
./src/ci/docker/run.sh riscv64gc-linux
```

cc: @msizanoen1
2020-06-20 16:39:51 +02:00
Ralf Jung
913aac8ac2
Rollup merge of #73058 - tmiasko:aarch64-san, r=nagisa
Support sanitizers on aarch64-unknown-linux-gnu
2020-06-20 16:39:49 +02:00
Ralf Jung
b015b28359
Rollup merge of #73055 - lcnr:skol-no-more, r=matthewjasper
remove leftover mentions of `skol` and `int` from the compiler

This PR mostly changes `skol` -> `placeholder` and all cases where `int` is used as a type to `i32`.
2020-06-20 16:39:47 +02:00
Ralf Jung
5431ef6530
Rollup merge of #72600 - Aaron1011:fix/anon-const-encoding, r=varkor
Properly encode AnonConst into crate metadata

Fixes #68104

Previous, we were encoding AnonConst as a regular Const, causing us to
treat them differently after being deserialized in another compilation
session.
2020-06-20 16:39:45 +02:00
Matthew Jasper
5e8c9f4fae Explain what the substs we're creating are 2020-06-20 14:34:51 +01:00