]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMove `next_disambiguator` to `Resolver`
marmeladema [Sun, 21 Jun 2020 22:49:06 +0000 (23:49 +0100)]
Move `next_disambiguator` to `Resolver`

4 years agoAlways create a root definition when creating a new `Definitions` object.
marmeladema [Sun, 21 Jun 2020 14:49:38 +0000 (15:49 +0100)]
Always create a root definition when creating a new `Definitions` object.

4 years agoMove remaining `NodeId` APIs from `Definitions` to `Resolver`
marmeladema [Sat, 20 Jun 2020 18:59:29 +0000 (19:59 +0100)]
Move remaining `NodeId` APIs from `Definitions` to `Resolver`

4 years agoAuto merge of #73546 - RalfJung:miri, r=RalfJung
bors [Sun, 21 Jun 2020 09:28:26 +0000 (09:28 +0000)]
Auto merge of #73546 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/73405
Cc @rust-lang/miri r? @ghost

4 years agoAuto merge of #71911 - wesleywiser:const_prop_small_cleanups, r=oli-obk
bors [Sun, 21 Jun 2020 05:56:26 +0000 (05:56 +0000)]
Auto merge of #71911 - wesleywiser:const_prop_small_cleanups, r=oli-obk

[mir-opt] Small ConstProp cleanup

4 years agoAuto merge of #70946 - jumbatm:clashing-extern-decl, r=nagisa
bors [Sun, 21 Jun 2020 02:20:07 +0000 (02:20 +0000)]
Auto merge of #70946 - jumbatm:clashing-extern-decl, r=nagisa

Add a lint to catch clashing `extern` fn declarations.

Closes #69390.

Adds lint `clashing_extern_decl` to detect when, within a single crate, an extern function of the same name is declared with different types. Because two symbols of the same name cannot be resolved to two different functions at link time, and one function cannot possibly have two types, a clashing extern declaration is almost certainly a mistake.

This lint does not run between crates because a project may have dependencies which both rely on the same extern function, but declare it in a different (but valid) way. For example, they may both declare an opaque type for one or more of the arguments (which would end up distinct types), or use types that are valid conversions in the language the extern fn is defined in. In these cases, we can't say that the clashing declaration is incorrect.

r? @eddyb

4 years agoAuto merge of #73563 - Manishearth:rollup-oowgwwm, r=Manishearth
bors [Sat, 20 Jun 2020 22:53:46 +0000 (22:53 +0000)]
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

4 years agoRollup merge of #73443 - pietroalbini:gha-auto-fallible, r=Mark-Simulacrum
Manish Goregaokar [Sat, 20 Jun 2020 21:45:04 +0000 (14:45 -0700)]
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

4 years agoRollup merge of #73411 - ehuss:bump-stage0, r=Mark-Simulacrum
Manish Goregaokar [Sat, 20 Jun 2020 21:45:02 +0000 (14:45 -0700)]
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

4 years agoRollup merge of #73378 - matthewjasper:arena-not-special, r=oli-obk
Manish Goregaokar [Sat, 20 Jun 2020 21:45:00 +0000 (14:45 -0700)]
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

4 years agoRollup merge of #73291 - marmeladema:hir-id-ification-fix, r=petrochenkov
Manish Goregaokar [Sat, 20 Jun 2020 21:44:58 +0000 (14:44 -0700)]
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

4 years agoRollup merge of #73287 - davidtwco:issue-73251-opaque-types-in-projections, r=estebank
Manish Goregaokar [Sat, 20 Jun 2020 21:44:57 +0000 (14:44 -0700)]
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).

4 years agoRollup merge of #73227 - camelid:multiple-asm-options, r=Amanieu
Manish Goregaokar [Sat, 20 Jun 2020 21:44:55 +0000 (14:44 -0700)]
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

4 years agoRollup merge of #72790 - jonhoo:duration-is-zero, r=LukasKalbertodt
Manish Goregaokar [Sat, 20 Jun 2020 21:44:53 +0000 (14:44 -0700)]
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.

4 years agoRollup merge of #72788 - matthewjasper:projection-bound-validation, r=nikomatsakis
Manish Goregaokar [Sat, 20 Jun 2020 21:44:52 +0000 (14:44 -0700)]
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

4 years agoRollup merge of #72456 - ldm0:dereftrait, r=estebank
Manish Goregaokar [Sat, 20 Jun 2020 21:44:50 +0000 (14:44 -0700)]
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

4 years agoFix broken inner_deref doc tests.
Eric Huss [Sat, 20 Jun 2020 19:27:16 +0000 (12:27 -0700)]
Fix broken inner_deref doc tests.

4 years agoAuto merge of #73550 - RalfJung:rollup-5huj1k1, r=RalfJung
bors [Sat, 20 Jun 2020 19:14:52 +0000 (19:14 +0000)]
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

4 years agoUpdate bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15)
Eric Huss [Tue, 16 Jun 2020 15:52:00 +0000 (08:52 -0700)]
Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15)

4 years agoRun `./x.py fmt`
Camelid [Sat, 20 Jun 2020 03:25:36 +0000 (20:25 -0700)]
Run `./x.py fmt`

4 years agoFix duplicate options error
Camelid [Sat, 20 Jun 2020 03:18:32 +0000 (20:18 -0700)]
Fix duplicate options error

The UI isn't glitching anymore.

4 years agoUse `p.token` instead of `p.look_ahead()`
Camelid [Thu, 18 Jun 2020 02:02:57 +0000 (19:02 -0700)]
Use `p.token` instead of `p.look_ahead()`

4 years agoAdd documentation
Camelid [Wed, 17 Jun 2020 01:10:26 +0000 (18:10 -0700)]
Add documentation

4 years agoCreate a separate, tool-only suggestion for the comma
Camelid [Tue, 16 Jun 2020 19:43:03 +0000 (12:43 -0700)]
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.

4 years agoMake suggestion machine-applicable
Camelid [Tue, 16 Jun 2020 19:32:13 +0000 (12:32 -0700)]
Make suggestion machine-applicable

4 years agoAdd more to duplicate options test
Camelid [Tue, 16 Jun 2020 19:03:19 +0000 (12:03 -0700)]
Add more to duplicate options test

4 years agoUse `span_suggestion` instead of `span_label`
Camelid [Tue, 16 Jun 2020 18:54:12 +0000 (11:54 -0700)]
Use `span_suggestion` instead of `span_label`

4 years agoUse bitflags function instead of custom one
Camelid [Mon, 15 Jun 2020 20:30:13 +0000 (13:30 -0700)]
Use bitflags function instead of custom one

4 years agoGet option name from symbol instead of snippet
Camelid [Mon, 15 Jun 2020 19:07:46 +0000 (12:07 -0700)]
Get option name from symbol instead of snippet

4 years agoUpdate duplicate options test
Camelid [Mon, 15 Jun 2020 19:11:49 +0000 (12:11 -0700)]
Update duplicate options test

4 years agoUse `span_label`
Camelid [Mon, 15 Jun 2020 18:57:49 +0000 (11:57 -0700)]
Use `span_label`

4 years agoMake warning an error; use help instead of suggestion; clean up code
Camelid [Sun, 14 Jun 2020 20:38:09 +0000 (13:38 -0700)]
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.

4 years agoAdd UI test for duplicate `asm!` options warning
Camelid [Sun, 14 Jun 2020 00:59:13 +0000 (17:59 -0700)]
Add UI test for duplicate `asm!` options warning

4 years agoWarn on duplicate `asm!` options
Camelid [Sun, 14 Jun 2020 00:06:35 +0000 (17:06 -0700)]
Warn on duplicate `asm!` options

4 years agoAdd codegen test for multiple `asm!` options
Camelid [Fri, 12 Jun 2020 19:12:36 +0000 (12:12 -0700)]
Add codegen test for multiple `asm!` options

4 years agoClean up
Camelid [Fri, 12 Jun 2020 18:39:52 +0000 (11:39 -0700)]
Clean up

4 years agoUse `Vec<Span>` instead of `Option<Vec<Span>>`
Camelid [Fri, 12 Jun 2020 18:31:41 +0000 (11:31 -0700)]
Use `Vec<Span>` instead of `Option<Vec<Span>>`

4 years agoUpdate tests
Camelid [Thu, 11 Jun 2020 01:21:22 +0000 (18:21 -0700)]
Update tests

4 years agoAllow multiple `asm!` options
Camelid [Thu, 11 Jun 2020 00:47:13 +0000 (17:47 -0700)]
Allow multiple `asm!` options

4 years agoRevise according to review
Jon Gjengset [Sat, 20 Jun 2020 14:55:39 +0000 (10:55 -0400)]
Revise according to review

4 years agoDoctests need feature
Jon Gjengset [Sat, 30 May 2020 19:20:09 +0000 (15:20 -0400)]
Doctests need feature

4 years agocore/time: Add Duration methods for zero
Jon Gjengset [Sat, 30 May 2020 18:55:38 +0000 (14:55 -0400)]
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.

4 years agoRollup merge of #73543 - GuillaumeGomez:cleanup-e0695, r=Dylan-DPC
Ralf Jung [Sat, 20 Jun 2020 14:40:01 +0000 (16:40 +0200)]
Rollup merge of #73543 - GuillaumeGomez:cleanup-e0695, r=Dylan-DPC

Clean up E0695 explanation

r? @Dylan-DPC

4 years agoRollup merge of #73539 - LukasKalbertodt:deprecate-vec-remove-item, r=Mark-Simulacrum
Ralf Jung [Sat, 20 Jun 2020 14:39:59 +0000 (16:39 +0200)]
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.

4 years agoRollup merge of #73471 - raoulstrackx:raoul/fpu_tag_word, r=jethrogb
Ralf Jung [Sat, 20 Jun 2020 14:39:57 +0000 (16:39 +0200)]
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

4 years agoRollup merge of #73444 - pietroalbini:ci-remove-try-alt, r=Mark-Simulacrum
Ralf Jung [Sat, 20 Jun 2020 14:39:55 +0000 (16:39 +0200)]
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

4 years agoRollup merge of #73404 - ajpaverd:cfguard_syntax, r=Mark-Simulacrum
Ralf Jung [Sat, 20 Jun 2020 14:39:53 +0000 (16:39 +0200)]
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

4 years agoRollup merge of #73171 - tblah:riscv-qemu-test, r=pietroalbini
Ralf Jung [Sat, 20 Jun 2020 14:39:51 +0000 (16:39 +0200)]
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

4 years agoRollup merge of #73058 - tmiasko:aarch64-san, r=nagisa
Ralf Jung [Sat, 20 Jun 2020 14:39:49 +0000 (16:39 +0200)]
Rollup merge of #73058 - tmiasko:aarch64-san, r=nagisa

Support sanitizers on aarch64-unknown-linux-gnu

4 years agoRollup merge of #73055 - lcnr:skol-no-more, r=matthewjasper
Ralf Jung [Sat, 20 Jun 2020 14:39:47 +0000 (16:39 +0200)]
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`.

4 years agoRollup merge of #72600 - Aaron1011:fix/anon-const-encoding, r=varkor
Ralf Jung [Sat, 20 Jun 2020 14:39:45 +0000 (16:39 +0200)]
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.

4 years agoExplain what the substs we're creating are
Matthew Jasper [Sat, 13 Jun 2020 16:31:48 +0000 (17:31 +0100)]
Explain what the substs we're creating are

4 years agoMove bounds on associated types to the type
Matthew Jasper [Thu, 11 Jun 2020 15:50:34 +0000 (16:50 +0100)]
Move bounds on associated types to the type

Given `trait X { type U; }` the bound `<Self as X>::U` now lives
on the type, rather than the trait. This is feature gated on
`feature(generic_associated_types)` for now until more testing can
be done.

The also enabled type-generic associated types since we no longer
need "implies bounds".

4 years agoDon't set STILL_FURTHER_SPECIALIZABLE for regions/bound variables
Matthew Jasper [Wed, 10 Jun 2020 08:48:56 +0000 (09:48 +0100)]
Don't set STILL_FURTHER_SPECIALIZABLE for regions/bound variables

4 years agoCheck associated type satisfy their bounds
Matthew Jasper [Sat, 30 May 2020 16:21:25 +0000 (17:21 +0100)]
Check associated type satisfy their bounds

This was currently only happening due to eager normalization, which
isn't possible if there's specialization or bound variables.

4 years agoPre-compute `def_id_to_hir_id` table
marmeladema [Fri, 12 Jun 2020 18:56:16 +0000 (19:56 +0100)]
Pre-compute `def_id_to_hir_id` table

4 years agoPrevent incorrect help message for dereference suggestion
Donough Liu [Sat, 20 Jun 2020 12:00:36 +0000 (20:00 +0800)]
Prevent incorrect help message for dereference suggestion

4 years agoupdate Miri
Ralf Jung [Sat, 20 Jun 2020 11:33:47 +0000 (13:33 +0200)]
update Miri

4 years agoClean up E0695 explanation
Guillaume Gomez [Sat, 20 Jun 2020 11:28:01 +0000 (13:28 +0200)]
Clean up E0695 explanation

4 years agoConsider fewer predicates for projection candidates
Matthew Jasper [Sat, 30 May 2020 16:19:31 +0000 (17:19 +0100)]
Consider fewer predicates for projection candidates

We now require that projection candidates are applicable with the
idenitity substs of the trait, rather than allowing predicates that are
only applicable for certain substs.

4 years agoCorrectly handle binders inside trait predicates
Matthew Jasper [Sat, 30 May 2020 16:03:32 +0000 (17:03 +0100)]
Correctly handle binders inside trait predicates

4 years agolint: normalize projections using opaque types
David Wood [Fri, 12 Jun 2020 16:42:08 +0000 (17:42 +0100)]
lint: normalize projections using opaque types

This commit normalizes projections which contain opaque types (opaque types
are otherwise linted against, which is would have previously made the
test cases added in this commit fail).

Signed-off-by: David Wood <david@davidtw.co>
4 years agoTry to suggest dereferences when trait selection failed.
Donough Liu [Sat, 20 Jun 2020 10:30:12 +0000 (18:30 +0800)]
Try to suggest dereferences when trait selection failed.

4 years agoDecouple `Autoderef` with `FnCtxt` and move `Autoderef` to `librustc_trait_selection`.
Donough Liu [Sat, 20 Jun 2020 10:29:13 +0000 (18:29 +0800)]
Decouple `Autoderef` with `FnCtxt` and move `Autoderef` to `librustc_trait_selection`.

4 years agoRemove uses of `Vec::remove_item`
Lukas Kalbertodt [Sat, 20 Jun 2020 09:38:15 +0000 (11:38 +0200)]
Remove uses of `Vec::remove_item`

4 years agoPre-compute `hir_id_to_def_id` mapping
marmeladema [Fri, 12 Jun 2020 18:17:44 +0000 (19:17 +0100)]
Pre-compute `hir_id_to_def_id` mapping

4 years agoRemove `HirId` to `NodeId` conversion APIs
marmeladema [Fri, 12 Jun 2020 17:43:58 +0000 (18:43 +0100)]
Remove `HirId` to `NodeId` conversion APIs

4 years agoRemove `NodeId` to `HirId` conversion APIs
marmeladema [Fri, 12 Jun 2020 17:36:58 +0000 (18:36 +0100)]
Remove `NodeId` to `HirId` conversion APIs

4 years agoMove `trait_map` into `hir::Crate`
marmeladema [Fri, 12 Jun 2020 17:13:10 +0000 (18:13 +0100)]
Move `trait_map` into `hir::Crate`

4 years agoDeprecate `Vec::remove_item`
Lukas Kalbertodt [Sat, 20 Jun 2020 09:09:53 +0000 (11:09 +0200)]
Deprecate `Vec::remove_item`

4 years agoremove `pop_placeholders`
Bastian Kauschke [Sat, 6 Jun 2020 14:41:48 +0000 (16:41 +0200)]
remove `pop_placeholders`

4 years agoint -> i32
Bastian Kauschke [Sat, 6 Jun 2020 10:05:37 +0000 (12:05 +0200)]
int -> i32

4 years agoskol -> placeholder
Bastian Kauschke [Sat, 6 Jun 2020 09:52:02 +0000 (11:52 +0200)]
skol -> placeholder

4 years agobootstrap: Factor out common code in supported_sanitizers
Tomasz Miąsko [Mon, 8 Jun 2020 00:00:00 +0000 (00:00 +0000)]
bootstrap: Factor out common code in supported_sanitizers

4 years agoci: Enable sanitizers on dist-aarch64-linux
Tomasz Miąsko [Thu, 4 Jun 2020 00:00:00 +0000 (00:00 +0000)]
ci: Enable sanitizers on dist-aarch64-linux

4 years agobootstrap: Build sanitizer runtimes for aarch64-unknown-linux-gnu
Tomasz Miąsko [Sat, 6 Jun 2020 00:00:00 +0000 (00:00 +0000)]
bootstrap: Build sanitizer runtimes for aarch64-unknown-linux-gnu

4 years agoSupport sanitizers on aarch64-unknown-linux-gnu
Tomasz Miąsko [Thu, 4 Jun 2020 00:00:00 +0000 (00:00 +0000)]
Support sanitizers on aarch64-unknown-linux-gnu

4 years agoUpdate existing test cases.
jumbatm [Mon, 6 Apr 2020 10:00:42 +0000 (20:00 +1000)]
Update existing test cases.

- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for #5791
- Update test case for #1866
- Update extern-abi-from-macro test case

4 years agoAdd clashing-extern-fn.rs stderr.
jumbatm [Sun, 5 Apr 2020 14:01:24 +0000 (00:01 +1000)]
Add clashing-extern-fn.rs stderr.

4 years agoAdd ClashingExternDecl lint.
jumbatm [Fri, 19 Jun 2020 08:14:54 +0000 (18:14 +1000)]
Add ClashingExternDecl lint.

This lint checks that all declarations for extern fns of the same name
are declared with the same types.

4 years agoAdd ClashingExternDecl test case.
jumbatm [Tue, 31 Mar 2020 08:24:59 +0000 (18:24 +1000)]
Add ClashingExternDecl test case.

4 years agoAuto merge of #73528 - Manishearth:rollup-7djz8nd, r=Manishearth
bors [Sat, 20 Jun 2020 02:45:08 +0000 (02:45 +0000)]
Auto merge of #73528 - Manishearth:rollup-7djz8nd, r=Manishearth

Rollup of 16 pull requests

Successful merges:

 - #71420 (Specialization is unsound)
 - #71899 (Refactor `try_find` a little)
 - #72689 (add str to common types)
 - #72791 (update coerce docs and unify relevant tests)
 - #72934 (forbid mutable references in all constant contexts except for const-fns)
 - #73027 (Make `need_type_info_err` more conservative)
 - #73347 (Diagnose use of incompatible sanitizers)
 - #73359 (shim.rs: avoid creating `Call` terminators calling `Self`)
 - #73399 (Clean up E0668 explanation)
 - #73436 (Clean up E0670 explanation)
 - #73440 (Add src/librustdoc as an alias for src/tools/rustdoc)
 - #73442 (pretty/mir: const value enums with no variants)
 - #73452 (Unify region variables when projecting associated types)
 - #73458 (Use alloc::Layout in DroplessArena API)
 - #73484 (Update the doc for std::prelude to the correct behavior)
 - #73506 (Bump Rustfmt and RLS)

Failed merges:

r? @ghost

4 years agoRollup merge of #73506 - Xanewok:update-rls, r=Xanewok
Manish Goregaokar [Sat, 20 Jun 2020 02:43:13 +0000 (19:43 -0700)]
Rollup merge of #73506 - Xanewok:update-rls, r=Xanewok

Bump Rustfmt and RLS

Fixes #73406
Fixes #73199
Fixes #73407
Fixes #73200

cc @calebcartwright @topecongiro

r? @ghost

Let's see what CI says first

4 years agoRollup merge of #73484 - poliorcetics:use-prelude-doc, r=sfackler
Manish Goregaokar [Sat, 20 Jun 2020 02:43:11 +0000 (19:43 -0700)]
Rollup merge of #73484 - poliorcetics:use-prelude-doc, r=sfackler

Update the doc for std::prelude to the correct behavior

Fixes #64686.

One line change to ensure the docs are correct about the behavior of the compiler when inserting`std::prelude::v1`.

I don't think examples are necessary but I can add some (especially those from the original issue) if needed.

4 years agoRollup merge of #73458 - tmiasko:arena-layout, r=matthewjasper
Manish Goregaokar [Sat, 20 Jun 2020 02:43:09 +0000 (19:43 -0700)]
Rollup merge of #73458 - tmiasko:arena-layout, r=matthewjasper

Use alloc::Layout in DroplessArena API

4 years agoRollup merge of #73452 - matthewjasper:auto-rec, r=nikomatsakis
Manish Goregaokar [Sat, 20 Jun 2020 02:43:07 +0000 (19:43 -0700)]
Rollup merge of #73452 - matthewjasper:auto-rec, r=nikomatsakis

Unify region variables when projecting associated types

This is required to avoid cycles when evaluating auto trait predicates.
Notably, this is required to be able add Chalk types to `CtxtInterners` for `cfg(parallel_compiler)`.

r? @nikomatsakis

4 years agoRollup merge of #73442 - davidtwco:issue-72181-pretty-print-const-val-enum-no-variant...
Manish Goregaokar [Sat, 20 Jun 2020 02:43:05 +0000 (19:43 -0700)]
Rollup merge of #73442 - davidtwco:issue-72181-pretty-print-const-val-enum-no-variants, r=oli-obk

pretty/mir: const value enums with no variants

Fixes #72181.

This PR modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants).

I'm not convinced that this is the correct approach, folks more familiar with `destructure_const` would be able to say - happy to adjust the PR. Looking through `destructure_const` and the functions that it invokes, it didn't seem like it was written to handle zero-variant-enums - I assume that case is handled earlier in some way so `destructure_const` doesn't need to under normal circumstances. It didn't seem like it would be straightforward to make `destructure_const` handle this case in a first-class-feeling way (e.g. adding a `Variants::None` variant), so this PR makes some minimal changes to avoid ICEs.

4 years agoRollup merge of #73440 - jyn514:bootstrap/build-rustdoc, r=Mark-Simulacrum
Manish Goregaokar [Sat, 20 Jun 2020 02:43:03 +0000 (19:43 -0700)]
Rollup merge of #73440 - jyn514:bootstrap/build-rustdoc, r=Mark-Simulacrum

Add src/librustdoc as an alias for src/tools/rustdoc

No one actually works with src/tools/rustdoc, it's almost empty.

Closes https://github.com/rust-lang/rust/issues/73439

4 years agoRollup merge of #73436 - GuillaumeGomez:cleanup-e0670, r=Dylan-DPC
Manish Goregaokar [Sat, 20 Jun 2020 02:43:01 +0000 (19:43 -0700)]
Rollup merge of #73436 - GuillaumeGomez:cleanup-e0670, r=Dylan-DPC

Clean up E0670 explanation

r? @Dylan-DPC

4 years agoRollup merge of #73399 - GuillaumeGomez:cleanup-e0668, r=Dylan-DPC
Manish Goregaokar [Sat, 20 Jun 2020 02:42:59 +0000 (19:42 -0700)]
Rollup merge of #73399 - GuillaumeGomez:cleanup-e0668, r=Dylan-DPC

Clean up E0668 explanation

r? @Dylan-DPC

4 years agoRollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasper
Manish Goregaokar [Sat, 20 Jun 2020 02:42:57 +0000 (19:42 -0700)]
Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasper

shim.rs: avoid creating `Call` terminators calling `Self`

Also contains some cleanup and doc comment additions so I could make sense of the code.

Fixes https://github.com/rust-lang/rust/issues/73109
Closes https://github.com/rust-lang/rust/pull/73175

r? @matthewjasper

4 years agoRollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikic
Manish Goregaokar [Sat, 20 Jun 2020 02:42:55 +0000 (19:42 -0700)]
Rollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikic

Diagnose use of incompatible sanitizers

Emit an error when incompatible sanitizer are configured through command
line options. Previously the last one configured prevailed and others
were silently ignored.

Additionally use a set to represent configured sanitizers, making it
possible to enable multiple sanitizers at once. At least in principle,
since currently all of them are considered to be incompatible with
others.

4 years agoRollup merge of #73027 - doctorn:issue-72690, r=estebank
Manish Goregaokar [Sat, 20 Jun 2020 02:42:53 +0000 (19:42 -0700)]
Rollup merge of #73027 - doctorn:issue-72690, r=estebank

Make `need_type_info_err` more conservative

Makes sure arg patterns we are going to suggest on are actually contained within the span of the obligation that caused the inference error (credit to @lcnr for suggesting this fix).

There's a subtle trade-off regarding the handling of local patterns which I've left a comment about.

Resolves #72690

4 years agoRollup merge of #72934 - christianpoveda:mut-borrows-in-consts, r=oli-obk
Manish Goregaokar [Sat, 20 Jun 2020 02:42:51 +0000 (19:42 -0700)]
Rollup merge of #72934 - christianpoveda:mut-borrows-in-consts, r=oli-obk

forbid mutable references in all constant contexts except for const-fns

PR to address #71212

cc: @ecstatic-morse

4 years agoRollup merge of #72791 - lcnr:coerce-refactor, r=estebank
Manish Goregaokar [Sat, 20 Jun 2020 02:42:49 +0000 (19:42 -0700)]
Rollup merge of #72791 - lcnr:coerce-refactor, r=estebank

update coerce docs and unify relevant tests

Merges `test/ui/coerce` with `test/ui/coercion`.
Updates the documentation of `librustc_typeck/check/coercion.rs`.
Adds 2 new coercion tests.

4 years agoRollup merge of #72689 - lcnr:common_str, r=estebank
Manish Goregaokar [Sat, 20 Jun 2020 02:42:47 +0000 (19:42 -0700)]
Rollup merge of #72689 - lcnr:common_str, r=estebank

add str to common types

I already expected this to be the case and it may slightly improve perf.

Afaict if we ever want to change str into a lang item this would have to get reverted.
As that would be fairly simple I don't believe this to cause any problems in the future.

4 years agoRollup merge of #71899 - cuviper:try_find_map, r=dtolnay
Manish Goregaokar [Sat, 20 Jun 2020 02:42:45 +0000 (19:42 -0700)]
Rollup merge of #71899 - cuviper:try_find_map, r=dtolnay

Refactor `try_find` a little

~~This works like `find_map`, but mapping to a `Try` type. It stops when `Ok` is `Some(value)`, with an additional short-circuit on `Try::Error`. This is similar to the unstable `try_find`, but has the advantage of being able to directly return the user's `R: Try` type directly, rather than converting to `Result`.~~
(removed -- `try_find_map` was declined in review)

This PR also refactors `try_find` a little to match style. The `E` type parameter was unnecessary, so it's now removed. The folding closure now has reduced parametricity on just `T = Self::Item`, rather
than the whole `Self` iterator type. There's otherwise no functional change in this.

4 years agoRollup merge of #71420 - RalfJung:specialization-incomplete, r=matthewjasper
Manish Goregaokar [Sat, 20 Jun 2020 02:42:43 +0000 (19:42 -0700)]
Rollup merge of #71420 - RalfJung:specialization-incomplete, r=matthewjasper

Specialization is unsound

As discussed in https://github.com/rust-lang/rust/issues/31844#issuecomment-617013949, it might be a good idea to warn users of specialization that the feature they are using is unsound.

I also expanded the "incomplete feature" warning to link the user to the tracking issue.

4 years agoAuto merge of #73511 - Manishearth:rollup-3iffxd8, r=Manishearth
bors [Fri, 19 Jun 2020 23:04:41 +0000 (23:04 +0000)]
Auto merge of #73511 - Manishearth:rollup-3iffxd8, r=Manishearth

Rollup of 13 pull requests

Successful merges:

 - #71568 (Document unsafety in slice/sort.rs)
 - #72709 (`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc)
 - #73214 (Add asm!() support for hexagon)
 - #73248 (save_analysis: improve handling of enum struct variant)
 - #73257 (ty: projections in `transparent_newtype_field`)
 - #73261 (Suggest `?Sized` when applicable for ADTs)
 - #73300 (Implement crate-level-only lints checking.)
 - #73334 (Note numeric literals that can never fit in an expected type)
 - #73357 (Use `LocalDefId` for import IDs in trait map)
 - #73364 (asm: Allow multiple template string arguments; interpret them as newline-separated)
 - #73382 (Only display other method receiver candidates if they actually apply)
 - #73465 (Add specialization of `ToString for char`)
 - #73489 (Refactor hir::Place)

Failed merges:

r? @ghost

4 years agoRefactor `try_find` a little
Josh Stone [Mon, 4 May 2020 18:25:54 +0000 (11:25 -0700)]
Refactor `try_find` a little

The `E` type parameter was unnecessary, so it's now removed. The folding
closure now has reduced parametricity on just `T = Self::Item`, rather
than the whole `Self` iterator type. There's otherwise no functional
change in this.