]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #68378 - billyrieger:btreemap-remove-entry, r=KodrAus
Yuki Okushi [Wed, 29 Jan 2020 00:34:45 +0000 (09:34 +0900)]
Rollup merge of #68378 - billyrieger:btreemap-remove-entry, r=KodrAus

Add BTreeMap::remove_entry

Implements https://github.com/rust-lang/rust/issues/66714.

4 years agoRollup merge of #68289 - pnkfelix:issue-62649-dont-ice-on-path-collision-in-dep-graph...
Yuki Okushi [Wed, 29 Jan 2020 00:34:43 +0000 (09:34 +0900)]
Rollup merge of #68289 - pnkfelix:issue-62649-dont-ice-on-path-collision-in-dep-graph, r=michaelwoerister

Don't ICE on path-collision in dep-graph

Collisions in the dep-graph due to path-reuse are rare but can occur.

So, instead of ICE'ing, just fail to mark green in such cases (for `DepKind::{Hir, HirBody, CrateMetadata}`).

Fix #62649.

4 years agoAuto merge of #68606 - jonas-schievink:normalize-fastpath, r=Zoxc
bors [Tue, 28 Jan 2020 20:26:24 +0000 (20:26 +0000)]
Auto merge of #68606 - jonas-schievink:normalize-fastpath, r=Zoxc

Add an early-exit to `QueryNormalizer::fold_ty`

Pulled out from https://github.com/rust-lang/rust/pull/68524, this results in a ~60-70% reduction in compile time for the await-call-tree benchmarks. This should unblock https://github.com/rust-lang/rust/issues/67982 as well.

r? @Zoxc

4 years agoAdd an early-exit to `QueryNormalizer::fold_ty`
Jonas Schievink [Mon, 27 Jan 2020 23:52:21 +0000 (00:52 +0100)]
Add an early-exit to `QueryNormalizer::fold_ty`

4 years agoAuto merge of #68533 - tmiasko:compiletest, r=nikomatsakis
bors [Tue, 28 Jan 2020 16:25:35 +0000 (16:25 +0000)]
Auto merge of #68533 - tmiasko:compiletest, r=nikomatsakis

compiletest: Unit tests for `EarlyProps` (+ small cleanup)

* Parse `EarlyProps` from a reader
* Add unit tests for `EarlyProps`
* Remove unused `llvm-cxxflags` option
* Remove unnecessary memory allocations in `iter_header`
* Update mode list displayed in `--help`

4 years agoAuto merge of #68529 - TimDiekmann:rename-alloc, r=Amanieu
bors [Tue, 28 Jan 2020 08:44:20 +0000 (08:44 +0000)]
Auto merge of #68529 - TimDiekmann:rename-alloc, r=Amanieu

Rename `Alloc` to `AllocRef`

The allocator-wg has decided to merge this change upstream in https://github.com/rust-lang/wg-allocators/issues/8#issuecomment-577122958.

This renames `Alloc` to `AllocRef` because types that implement `Alloc` are a reference, smart pointer, or ZSTs. It is not possible to have an allocator like `MyAlloc([u8; N])`, that owns the memory and also implements `Alloc`, since that would mean, that moving a `Vec<T, MyAlloc>` would need to correct the internal pointer, which is not possible as we don't have move constructors.

For further explanation please see https://github.com/rust-lang/wg-allocators/issues/8#issuecomment-489464843 and the comments after that one.

Additionally it clarifies the semantics of `Clone` on an allocator. In the case of `AllocRef`, it is clear that the cloned handle still points to the same allocator instance, and that you can free data allocated from one handle with another handle.

The initial proposal was to rename `Alloc` to `AllocHandle`, but `Ref` expresses the semantics better than `Handle`. Also, the only appearance of `Handle` in `std` are for windows specific resources, which might be confusing.

Blocked on https://github.com/rust-lang/miri/pull/1160

4 years agoAdd BTreeMap::remove_entry
Billy Rieger [Mon, 20 Jan 2020 02:44:46 +0000 (21:44 -0500)]
Add BTreeMap::remove_entry

Mainly for API parity with HashMap.

- Add BTreeMap::remove_entry
- Rewrite BTreeMap::remove to use remove_entry
- Use btreemap_remove_entry feature in doc comment

4 years agoAuto merge of #68234 - CAD97:slice-from-raw-parts, r=KodrAus
bors [Tue, 28 Jan 2020 05:31:34 +0000 (05:31 +0000)]
Auto merge of #68234 - CAD97:slice-from-raw-parts, r=KodrAus

Stabilize ptr::slice_from_raw_parts[_mut]

Closes #36925, the tracking issue.
Initial impl: #60667

r? @rust-lang/libs

In addition to stabilizing, I've adjusted the example of `ptr::slice_from_raw_parts` to use `slice_from_raw_parts` instead of `slice_from_raw_parts_mut`, which was unnecessary for the example as written.

4 years agoAuto merge of #68587 - JohnTitor:rollup-fz45xwc, r=JohnTitor
bors [Tue, 28 Jan 2020 02:17:10 +0000 (02:17 +0000)]
Auto merge of #68587 - JohnTitor:rollup-fz45xwc, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #68200 (Stabilize the debug_map_key_value feature)
 - #68383 (Clean up E0205 explanation)
 - #68412 (Clean up E0207 explanation)
 - #68454 (clean up E0214 explanation)
 - #68482 (clean up error codes explanation)
 - #68563 (Don't call `tcx.fn_sig` on closures)
 - #68570 (Bump LLVM submodule to fix LLVM assertion failure in MSP430 interrupt generation.)
 - #68571 (check_match: extract common logic)
 - #68573 (Clean up E0262 explanation)
 - #68575 (Disable the testcase for Vxworks.)
 - #68581 (Add support for icebreakers-cleanup-crew commands)

Failed merges:

r? @ghost

4 years agoRollup merge of #68581 - spastorino:support-ice-breaker-cleanup-crew, r=Dylan-DPC
Yuki Okushi [Tue, 28 Jan 2020 01:48:23 +0000 (10:48 +0900)]
Rollup merge of #68581 - spastorino:support-ice-breaker-cleanup-crew, r=Dylan-DPC

Add support for icebreakers-cleanup-crew commands

r? @nikomatsakis

4 years agoRollup merge of #68575 - Wind-River:master_2020, r=alexcrichton
Yuki Okushi [Tue, 28 Jan 2020 01:48:21 +0000 (10:48 +0900)]
Rollup merge of #68575 - Wind-River:master_2020, r=alexcrichton

Disable the testcase for Vxworks.

r? @alexcrichton

4 years agoRollup merge of #68573 - GuillaumeGomez:clean-up-e0262, r=Dylan-DPC
Yuki Okushi [Tue, 28 Jan 2020 01:48:20 +0000 (10:48 +0900)]
Rollup merge of #68573 - GuillaumeGomez:clean-up-e0262, r=Dylan-DPC

Clean up E0262 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68571 - Centril:check_in_cx, r=oli-obk
Yuki Okushi [Tue, 28 Jan 2020 01:48:19 +0000 (10:48 +0900)]
Rollup merge of #68571 - Centril:check_in_cx, r=oli-obk

check_match: extract common logic

This is part of work on `hir::ExprKind::Let` which I thought made sense on its own (though makes even more sense with `::Let`).

r? @oli-obk

4 years agoRollup merge of #68570 - cr1901:msp430-fix-1-2020, r=alexcrichton
Yuki Okushi [Tue, 28 Jan 2020 01:48:17 +0000 (10:48 +0900)]
Rollup merge of #68570 - cr1901:msp430-fix-1-2020, r=alexcrichton

Bump LLVM submodule to fix LLVM assertion failure in MSP430 interrupt generation.

This PR brings in changes introduced by [this cherry-pick](https://github.com/rust-lang/llvm-project/pull/37) to the Rust repository.

Nightlies downloaded from `rustup` do not appear to have llvm assertions enabled; the assertion failure [sometimes](https://github.com/YuhanLiin/msp430fr2355-quickstart/issues/3) causes link errors that shouldn't occur. I couldn't find any indication of other bugs; however, it should still be fixed.

4 years agoRollup merge of #68563 - Aaron1011:fix/fn-sig-closure, r=varkor
Yuki Okushi [Tue, 28 Jan 2020 01:48:16 +0000 (10:48 +0900)]
Rollup merge of #68563 - Aaron1011:fix/fn-sig-closure, r=varkor

Don't call `tcx.fn_sig` on closures

Fixes #68542

4 years agoRollup merge of #68482 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
Yuki Okushi [Tue, 28 Jan 2020 01:48:14 +0000 (10:48 +0900)]
Rollup merge of #68482 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC

clean up error codes explanation

r? @Dylan-DPC

4 years agoRollup merge of #68454 - GuillaumeGomez:clean-up-e0214, r=Dylan-DPC
Yuki Okushi [Tue, 28 Jan 2020 01:48:12 +0000 (10:48 +0900)]
Rollup merge of #68454 - GuillaumeGomez:clean-up-e0214, r=Dylan-DPC

clean up E0214 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68412 - GuillaumeGomez:clean-up-e0207, r=Dylan-DPC
Yuki Okushi [Tue, 28 Jan 2020 01:48:10 +0000 (10:48 +0900)]
Rollup merge of #68412 - GuillaumeGomez:clean-up-e0207, r=Dylan-DPC

Clean up E0207 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68383 - GuillaumeGomez:clean-up-e0205, r=Dylan-DPC
Yuki Okushi [Tue, 28 Jan 2020 01:48:05 +0000 (10:48 +0900)]
Rollup merge of #68383 - GuillaumeGomez:clean-up-e0205, r=Dylan-DPC

Clean up E0205 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68200 - KodrAus:stabilize/debug_map_key_value, r=alexcrichton
Yuki Okushi [Tue, 28 Jan 2020 01:48:04 +0000 (10:48 +0900)]
Rollup merge of #68200 - KodrAus:stabilize/debug_map_key_value, r=alexcrichton

Stabilize the debug_map_key_value feature

RFC: https://github.com/rust-lang/rfcs/pull/2696
Tracking issue: #62482

Stabilizes the `debug_map_key_value` feature, which covers:

```rust
impl<'a, 'b> DebugMap<'a, 'b> {
    pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {}
    pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {}
}
```

These methods are small and self-contained, and are used as the basis for the existing `DebugMap::entry` method, so have been used in the wild for the last 6 months or so.

4 years agostabilize the debug_map_key_value feature
Ashley Mannix [Tue, 14 Jan 2020 04:43:05 +0000 (14:43 +1000)]
stabilize the debug_map_key_value feature

4 years agoAuto merge of #68580 - Mark-Simulacrum:rollup-r80xhus, r=Mark-Simulacrum
bors [Mon, 27 Jan 2020 22:59:38 +0000 (22:59 +0000)]
Auto merge of #68580 - Mark-Simulacrum:rollup-r80xhus, r=Mark-Simulacrum

Rollup of 3 pull requests

Successful merges:

 - #68459 (don't clone types that are copy, round two.)
 - #68576 (update miri)
 - #68579 (Update cargo)

Failed merges:

r? @ghost

4 years agoRename `Alloc` to `AllocRef`
Tim Diekmann [Thu, 23 Jan 2020 00:49:29 +0000 (01:49 +0100)]
Rename `Alloc` to `AllocRef`

4 years agoAdd support for icebreakers-cleanup-crew commands
Santiago Pastorino [Mon, 27 Jan 2020 18:58:27 +0000 (15:58 -0300)]
Add support for icebreakers-cleanup-crew commands

4 years agoRollup merge of #68579 - ehuss:update-cargo, r=Mark-Simulacrum
Mark Rousskov [Mon, 27 Jan 2020 18:42:03 +0000 (13:42 -0500)]
Rollup merge of #68579 - ehuss:update-cargo, r=Mark-Simulacrum

Update cargo

2 commits in b68b0978ab8012f871c80736fb910d14b89c4498..9d32b7b01409024b165545c568b1525d86e2b7cb
2020-01-24 18:26:23 +0000 to 2020-01-26 18:27:29 +0000
- Polish code to clarify meaning (rust-lang/cargo#7836)
- Store maximum queue length (rust-lang/cargo#7829)

4 years agoRollup merge of #68576 - jonhoo:bump-miri, r=oli-obk
Mark Rousskov [Mon, 27 Jan 2020 18:42:02 +0000 (13:42 -0500)]
Rollup merge of #68576 - jonhoo:bump-miri, r=oli-obk

update miri

Bump miri for rust-lang/miri#1150

r? @oli-obk

4 years agoRollup merge of #68459 - matthiaskrgr:clone_on_copy2, r=eddyb
Mark Rousskov [Mon, 27 Jan 2020 18:42:00 +0000 (13:42 -0500)]
Rollup merge of #68459 - matthiaskrgr:clone_on_copy2, r=eddyb

don't clone types that are copy, round two.

Apparently fixing some of these issues makes clippy find even more so I did a couple of rounds now.

r? @eddyb

4 years agoUpdate cargo
Eric Huss [Mon, 27 Jan 2020 18:30:44 +0000 (10:30 -0800)]
Update cargo

4 years agoBump miri for rust-lang/miri#1150
Jon Gjengset [Mon, 27 Jan 2020 17:47:51 +0000 (12:47 -0500)]
Bump miri for rust-lang/miri#1150

4 years agoDisable the testcase for Vxworks.
Umesh Kalappa [Mon, 6 Jan 2020 08:53:23 +0000 (00:53 -0800)]
Disable the testcase for Vxworks.

4 years agoClean up E0262 explanation
Guillaume Gomez [Mon, 27 Jan 2020 16:43:02 +0000 (17:43 +0100)]
Clean up E0262 explanation

4 years agoCollisions in the dep-graph due to path-reuse are rare but can occur.
Felix S. Klock II [Thu, 16 Jan 2020 19:33:18 +0000 (20:33 +0100)]
Collisions in the dep-graph due to path-reuse are rare but can occur.

So, instead of ICE'ing, just fail to mark green in such cases
(for `DepKind::{Hir, HirBody, CrateMetadata}`).

Fix #62649.

4 years agocheck_match: extract common logic
Mazdak Farrokhzad [Thu, 23 Jan 2020 02:30:56 +0000 (03:30 +0100)]
check_match: extract common logic

4 years agoFix LLVM assertion failure in MSP430 interrupt generation.
William D. Jones [Mon, 27 Jan 2020 14:05:31 +0000 (09:05 -0500)]
Fix LLVM assertion failure in MSP430 interrupt generation.

4 years agoUpdate src/librustc_error_codes/error_codes/E0220.md
Guillaume Gomez [Mon, 27 Jan 2020 15:06:38 +0000 (16:06 +0100)]
Update src/librustc_error_codes/error_codes/E0220.md

Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>
4 years agoAuto merge of #68566 - pietroalbini:rollup-22hbo3e, r=pietroalbini
bors [Mon, 27 Jan 2020 11:59:57 +0000 (11:59 +0000)]
Auto merge of #68566 - pietroalbini:rollup-22hbo3e, r=pietroalbini

Rollup of 4 pull requests

Successful merges:

 - #67928 (Update RELEASES.md for 1.41.0)
 - #68370 (Ensure that we error when calling "const extern fn" with wrong convention)
 - #68531 ([self-profiler] Two small cleanups)
 - #68562 (Fix spelling errors)

Failed merges:

r? @ghost

4 years agoRollup merge of #68562 - hjung4:spell, r=jonas-schievink
Pietro Albini [Mon, 27 Jan 2020 11:50:52 +0000 (12:50 +0100)]
Rollup merge of #68562 - hjung4:spell, r=jonas-schievink

Fix spelling errors

4 years agoRollup merge of #68531 - wesleywiser:cleanup_self_profiler, r=michaelwoerister
Pietro Albini [Mon, 27 Jan 2020 11:50:50 +0000 (12:50 +0100)]
Rollup merge of #68531 - wesleywiser:cleanup_self_profiler, r=michaelwoerister

[self-profiler] Two small cleanups

r? @michaelwoerister

4 years agoRollup merge of #68370 - Aaron1011:const-extern-test, r=RalfJung
Pietro Albini [Mon, 27 Jan 2020 11:50:49 +0000 (12:50 +0100)]
Rollup merge of #68370 - Aaron1011:const-extern-test, r=RalfJung

Ensure that we error when calling "const extern fn" with wrong convention

See #64926

4 years agoRollup merge of #67928 - XAMPPRocky:relnotes-1.41.0, r=pietroalbini
Pietro Albini [Mon, 27 Jan 2020 11:50:47 +0000 (12:50 +0100)]
Rollup merge of #67928 - XAMPPRocky:relnotes-1.41.0, r=pietroalbini

Update RELEASES.md for 1.41.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.41.0/RELEASES.md)

cc @rust-lang/release

4 years agoAuto merge of #68165 - thomcc:lt_ones, r=sfackler
bors [Mon, 27 Jan 2020 08:42:56 +0000 (08:42 +0000)]
Auto merge of #68165 - thomcc:lt_ones, r=sfackler

Add leading_ones and trailing_ones methods to the primitive integer types

I was surprised these were missing (given that `leading_zeros` and `trailing_zeros` exist), and they seem trivial and hopefully not controversial.

Note that there's some precedent in that `count_ones` and `count_zeros` are both supported even though only one of these has an intrinsic.

I'm not sure if these need a `rustc_const_unstable` flag (the tests don't seem to mind that it's missing). I just made them const, since there's not really any reason for these to be non-const when the `_zeros` variants are const.

Note: My understanding is trivial stuff like (hopefully) this can land without an RFC, but I'm not fully sure about the process though. Questions like "when does the tracking issue get filed?", are a total mystery to me. So, any guidance is appreciated, and sorry in advance if I should have gone through some more involved process for this.

4 years agoDon't call `tcx.fn_sig` on closures
Aaron Hill [Mon, 27 Jan 2020 05:49:56 +0000 (00:49 -0500)]
Don't call `tcx.fn_sig` on closures

Fixes #68542

4 years agoupdate
comet [Mon, 27 Jan 2020 04:52:13 +0000 (22:52 -0600)]
update

4 years agoEnsure that we error when calling "const extern fn" with wrong convention
Aaron Hill [Sun, 19 Jan 2020 17:53:25 +0000 (12:53 -0500)]
Ensure that we error when calling "const extern fn" with wrong convention

See #64926

4 years agoAuto merge of #68447 - estebank:sugg-type-param, r=petrochenkov
bors [Mon, 27 Jan 2020 03:01:59 +0000 (03:01 +0000)]
Auto merge of #68447 - estebank:sugg-type-param, r=petrochenkov

Suggest defining type parameter when appropriate

```
error[E0412]: cannot find type `T` in this scope
 --> file.rs:3:12
  |
3 | impl Trait<T> for Struct {}
  |     -      ^ not found in this scope
  |     |
  |     help: you might be missing a type parameter: `<T>`
```

Fix #64298.

4 years agomake matches exhaustive
Matthias Krüger [Sun, 26 Jan 2020 13:17:22 +0000 (14:17 +0100)]
make matches exhaustive

4 years agodon't clone types that are copy, round two.
Matthias Krüger [Wed, 22 Jan 2020 15:30:15 +0000 (16:30 +0100)]
don't clone types that are copy, round two.

4 years agoAuto merge of #68122 - Centril:stabilize-transparent-enums, r=petrochenkov
bors [Mon, 27 Jan 2020 00:05:57 +0000 (00:05 +0000)]
Auto merge of #68122 - Centril:stabilize-transparent-enums, r=petrochenkov

Stabilize `#[repr(transparent)]` on `enum`s in Rust 1.42.0

# Stabilization report

The following is the stabilization report for `#![feature(transparent_enums)]`.

Tracking issue: https://github.com/rust-lang/rust/issues/60405
[Version target](https://forge.rust-lang.org/#current-release-versions): 1.42 (2020-01-30 => beta, 2020-03-12 => stable).

## User guide

A `struct` with only a single non-ZST field (let's call it `foo`) can be marked as `#[repr(transparent)]`. Such a `struct` has the same layout and ABI as `foo`. Here, we also extend this ability to `enum`s with only one variant, subject to the same restrictions as for the equivalent `struct`. That is, you can now write:

```rust
#[repr(transparent)]
enum Foo { Bar(u8) }
```

which, in terms of layout and ABI, is equivalent to:

```rust
#[repr(transparent)]
struct Foo(u8);
```

## Motivation

This is not a major feature that will unlock new and important use-cases. The utility of `repr(transparent)` `enum`s is indeed limited. However, there is still some value in it:

1. It provides conceptual simplification of the language in terms of treating univariant `enum`s and `struct`s the same, as both are product types. Indeed, languages like Haskell only have `data` as the only way to construct user-defined ADTs in the language.

2. In rare occasions, it might be that the user started out with a univariant `enum` for whatever reason (e.g. they thought they might extend it later). Now they want to make this `enum` `transparent` without breaking users by turning it into a `struct`. By lifting the restriction here, now they can.

## Technical specification

The reference specifies [`repr(transparent)` on a `struct`](https://doc.rust-lang.org/nightly/reference/type-layout.html#the-transparent-representation) as:

> ### The transparent Representation
>
>  The `transparent` representation can only be used on `struct`s that have:
>  - a single field with non-zero size, and
>  - any number of fields with size 0 and alignment 1 (e.g. `PhantomData<T>`).
>
> Structs with this representation have the same layout and ABI as the single non-zero sized field.
>
> This is different than the `C` representation because a struct with the `C` representation will always have the ABI of a `C` `struct` while, for example, a struct with the `transparent` representation with a primitive field will have the ABI of the primitive field.
>
> Because this representation delegates type layout to another type, it cannot be used with any other representation.

Here, we amend this to include univariant `enum`s as well with the same static restrictions and the same effects on dynamic semantics.

## Tests

All the relevant tests are adjusted in the PR diff but are recounted here:

- `src/test/ui/repr/repr-transparent.rs` checks that `repr(transparent)` on an `enum` must be univariant, rather than having zero or more than one variant. Restrictions on the fields inside the only variants, like for those on `struct`s, are also checked here.

- A number of codegen tests are provided as well:
    - `src/test/codegen/repr-transparent.rs` (the canonical test)
    - `src/test/codegen/repr-transparent-aggregates-1.rs`
    - `src/test/codegen/repr-transparent-aggregates-2.rs`
    - `src/test/codegen/repr-transparent-aggregates-3.rs`

- `src/test/ui/lint/lint-ctypes-enum.rs` tests the interactions with the `improper_ctypes` lint.

## History

- 2019-04-30, RFC https://github.com/rust-lang/rfcs/pull/2645
  Author: @mjbshaw
  Reviewers: The Language Team

  This is the RFC that proposes allowing `#[repr(transparent)]` on `enum`s and `union`.

- 2019-06-11, PR https://github.com/rust-lang/rust/pull/60463
  Author: @mjbshaw
  Reviewers: @varkor and @rkruppe

  The PR implements the RFC aforementioned in full.

- 2019, PR https://github.com/rust-lang/rust/pull/67323
  Author: @Centril
  Reviewers: @davidtwco

  The PR reorganizes the static checks taking advantage of the fact that `struct`s and `union`s are internally represented as ADTs with a single variant.

- This PR stabilizes `transparent_enums`.

## Related / possible future work

The remaining work here is to figure out the semantics of `#[repr(transparent)]` on `union`s and stabilize those. This work continues to be tracked in https://github.com/rust-lang/rust/issues/60405.

4 years agocompiletest: Don't load TestProps from a directories
Tomasz Miąsko [Mon, 27 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Don't load TestProps from a directories

4 years agocompiletest: Derive Default for EarlyProps
Tomasz Miąsko [Mon, 27 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Derive Default for EarlyProps

4 years agocompiletest: Remove unused llvm-cxxflags option
Tomasz Miąsko [Fri, 24 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Remove unused llvm-cxxflags option

4 years agocompiletest: Add unit tests for EarlyProps
Tomasz Miąsko [Fri, 24 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Add unit tests for EarlyProps

4 years agocompiletest: Update mode list displayed in `--help`
Tomasz Miąsko [Fri, 24 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Update mode list displayed in `--help`

4 years agocompiletest: Parse EarlyProps from a reader
Tomasz Miąsko [Fri, 24 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Parse EarlyProps from a reader

4 years agocompiletest: Remove unnecessary memory allocation in iter_header
Tomasz Miąsko [Fri, 24 Jan 2020 00:00:00 +0000 (00:00 +0000)]
compiletest: Remove unnecessary memory allocation in iter_header

Replace `BufRead::lines` with `BuRead::read_line` to reduce memory allocations.

4 years agoAuto merge of #68407 - eddyb:iter-macro-backtrace, r=petrochenkov
bors [Sun, 26 Jan 2020 21:01:13 +0000 (21:01 +0000)]
Auto merge of #68407 - eddyb:iter-macro-backtrace, r=petrochenkov

rustc_span: return an impl Iterator instead of a Vec from macro_backtrace.

Having `Span::macro_backtrace` produce an `impl Iterator<Item = ExpnData>` allows #67359 to use it instead of rolling its own similar functionality.

The move from `MacroBacktrace` to `ExpnData` (which the first two commits are prerequisites for) both eliminates unnecessary allocations, and is strictly more flexible (exposes more information).

r? @petrochenkov

4 years agoSuggest defining type parameter when appropriate
Esteban Küber [Wed, 22 Jan 2020 07:01:21 +0000 (23:01 -0800)]
Suggest defining type parameter when appropriate

```
error[E0412]: cannot find type `T` in this scope
 --> file.rs:3:12
  |
3 | impl Trait<T> for Struct {}
  |     -      ^ not found in this scope
  |     |
  |     help: you might be missing a type parameter: `<T>`
```

Fix #64298.

4 years agorustc_span: return an impl Iterator instead of a Vec from macro_backtrace.
Eduard-Mihai Burtescu [Mon, 20 Jan 2020 23:46:53 +0000 (01:46 +0200)]
rustc_span: return an impl Iterator instead of a Vec from macro_backtrace.

4 years agorustc_span: replace MacroBacktrace with ExpnData.
Eduard-Mihai Burtescu [Mon, 20 Jan 2020 23:27:14 +0000 (01:27 +0200)]
rustc_span: replace MacroBacktrace with ExpnData.

4 years agorustc_span: move pretty syntax from macro_backtrace to ExpnKind::descr.
Eduard-Mihai Burtescu [Mon, 20 Jan 2020 23:02:01 +0000 (01:02 +0200)]
rustc_span: move pretty syntax from macro_backtrace to ExpnKind::descr.

4 years agoDon't use ExpnKind::descr to get the name of a bang macro.
Eduard-Mihai Burtescu [Mon, 20 Jan 2020 20:22:36 +0000 (22:22 +0200)]
Don't use ExpnKind::descr to get the name of a bang macro.

4 years agoAuto merge of #68545 - estebank:verbose-bound-display, r=petrochenkov
bors [Sun, 26 Jan 2020 11:48:34 +0000 (11:48 +0000)]
Auto merge of #68545 - estebank:verbose-bound-display, r=petrochenkov

Use better bound names in `-Zverbose` mode

r? @petrochenkov as per https://github.com/rust-lang/rust/pull/67951/files#r365524015

4 years agoAuto merge of #68522 - estebank:impl-trait-sugg-2, r=oli-obk
bors [Sun, 26 Jan 2020 08:36:23 +0000 (08:36 +0000)]
Auto merge of #68522 - estebank:impl-trait-sugg-2, r=oli-obk

Further improve `impl Trait`/`dyn Trait` suggestions

After reading [_Returning Trait Objects_ by Bryce Fisher-Fleig](https://bryce.fisher-fleig.org/blog/returning-trait-objects/), [I noticed that](https://www.reddit.com/r/rust/comments/esueur/returning_trait_objects/ffczl4k/) #68195 had a few bugs due to not ignoring `ty::Error`.

- Account for `ty::Error`.
- Account for `if`/`else` and `match` blocks when pointing at return types and referencing their types.
- Increase the multiline suggestion output from 6 lines to 20.

4 years agoAuto merge of #68517 - oli-obk:spaces2, r=nagisa
bors [Sun, 26 Jan 2020 05:13:14 +0000 (05:13 +0000)]
Auto merge of #68517 - oli-obk:spaces2, r=nagisa

Don't use spaces before type ascription like colons

Split out of #67133 to make that PR simpler

r? @eddyb

4 years agoAuto merge of #68031 - Marwes:fold_list, r=estebank
bors [Sun, 26 Jan 2020 01:51:50 +0000 (01:51 +0000)]
Auto merge of #68031 - Marwes:fold_list, r=estebank

perf: Avoid creating a SmallVec if nothing changes during a fold

Not sure if this helps but in theory it should be less work than what
the current micro optimization does for `ty::Predicate` lists.

(It would explain the overhead I am seeing from `perf`.)

4 years agoAuto merge of #68546 - JohnTitor:rollup-znuot4b, r=JohnTitor
bors [Sat, 25 Jan 2020 22:44:39 +0000 (22:44 +0000)]
Auto merge of #68546 - JohnTitor:rollup-znuot4b, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #68485 (add a test for #60976)
 - #68498 (Add some type-alias-impl-trait regression tests)
 - #68514 (Use Self instead of self return type)
 - #68534 (Update submodules to rust-lang)
 - #68540 (clean up error codes E0229 and E0261)

Failed merges:

r? @ghost

4 years agoRollup merge of #68540 - GuillaumeGomez:err-codes-cleanup-e0229-e0261, r=Dylan-DPC
Yuki Okushi [Sat, 25 Jan 2020 21:37:24 +0000 (06:37 +0900)]
Rollup merge of #68540 - GuillaumeGomez:err-codes-cleanup-e0229-e0261, r=Dylan-DPC

clean up error codes E0229 and E0261

r? @Dylan-DPC

4 years agoRollup merge of #68534 - JohnTitor:update-remote-url, r=jonas-schievink
Yuki Okushi [Sat, 25 Jan 2020 21:37:22 +0000 (06:37 +0900)]
Rollup merge of #68534 - JohnTitor:update-remote-url, r=jonas-schievink

Update submodules to rust-lang

They're on rust-lang now. Should be green as it's the same change as #65963 but let's make sure CI is green also.

4 years agoRollup merge of #68514 - lzutao:fmt-Self, r=Dylan-DPC
Yuki Okushi [Sat, 25 Jan 2020 21:37:21 +0000 (06:37 +0900)]
Rollup merge of #68514 - lzutao:fmt-Self, r=Dylan-DPC

Use Self instead of self return type

4 years agoRollup merge of #68498 - Aaron1011:tait-regression-tests, r=Centril
Yuki Okushi [Sat, 25 Jan 2020 21:37:19 +0000 (06:37 +0900)]
Rollup merge of #68498 - Aaron1011:tait-regression-tests, r=Centril

Add some type-alias-impl-trait regression tests

Fixes #57611
Fixes #57807

4 years agoRollup merge of #68485 - kingslef:fix/test-60976, r=nikomatsakis
Yuki Okushi [Sat, 25 Jan 2020 21:37:18 +0000 (06:37 +0900)]
Rollup merge of #68485 - kingslef:fix/test-60976, r=nikomatsakis

add a test for #60976

The test fails on 1.36.0 but passes on master.

Huge thanks for @hellow554 actually digging out the minimized version of the
repro.

Fixes #60976.

4 years agoUse better bound names in `-Zverbose` mode
Esteban Küber [Sat, 25 Jan 2020 20:46:43 +0000 (12:46 -0800)]
Use better bound names in `-Zverbose` mode

4 years agoRevert suggestion window size change
Esteban Küber [Sat, 25 Jan 2020 20:26:33 +0000 (12:26 -0800)]
Revert suggestion window size change

4 years agoAuto merge of #68530 - estebank:abolish-ice, r=petrochenkov
bors [Sat, 25 Jan 2020 19:55:26 +0000 (19:55 +0000)]
Auto merge of #68530 - estebank:abolish-ice, r=petrochenkov

Do not ICE on multipart suggestions touching multiple files

When encountering a multipart suggestion with spans belonging to
different contexts, skip that suggestion.

Fix #68449. Similar to #68256.

4 years agoclean up error codeS E0229 and E0261
Guillaume Gomez [Sat, 25 Jan 2020 16:41:55 +0000 (17:41 +0100)]
clean up error codeS E0229 and E0261

4 years agoAuto merge of #68525 - tlively:emcc-codegen-sigsegv-66308, r=alexcrichton
bors [Sat, 25 Jan 2020 16:34:53 +0000 (16:34 +0000)]
Auto merge of #68525 - tlively:emcc-codegen-sigsegv-66308, r=alexcrichton

Update LLVM to fix crash on Emscripten targets

Fixes #66308 (for real this time). r? @alexcrichton

4 years agoAuto merge of #68516 - oli-obk:spaces, r=eddyb
bors [Sat, 25 Jan 2020 13:14:59 +0000 (13:14 +0000)]
Auto merge of #68516 - oli-obk:spaces, r=eddyb

Render const pointers in MIR more compactly

Split out from #67133 to make that PR simpler

cc @RalfJung

r? @eddyb

4 years agoDon't use spaces before type ascription like colons
Oliver Scherer [Fri, 24 Jan 2020 20:04:17 +0000 (21:04 +0100)]
Don't use spaces before type ascription like colons

4 years agoUpdate submodules to rust-lang
Yuki Okushi [Sat, 25 Jan 2020 08:58:10 +0000 (17:58 +0900)]
Update submodules to rust-lang

4 years agoAuto merge of #68448 - maurer:dyn-cdylib, r=alexcrichton
bors [Sat, 25 Jan 2020 07:49:40 +0000 (07:49 +0000)]
Auto merge of #68448 - maurer:dyn-cdylib, r=alexcrichton

rustc: Allow cdylibs to link against dylibs

Previously, rustc mandated that cdylibs could only link against rlibs as dependencies (not dylibs).
This commit disables that restriction and tests that it works in a simple case.

I don't have a windows rustc dev environment, so I guessed at the MSVC test code, I'm hoping the CI can run that for me.

Additionally, we might want to consider emitting (through cargo or rustc) some metadata to help C users of a cdylib figure out where all the dylibs they need are. I don't think that should be needed to land this change, as it will still be usable by homogeneous build systems without it.

My new test was templated off the `tests/run-make-fulldeps/cdylib` test. It seemed more appropriate to have it as a separate test, since both foo.rs and bar.rs would need to be replicated to make that test cover both cases, but I can do that if it would be preferred.

If I'm doing anything out of order/process, please let me know; this is only my second change to rustc and the prior one was trivial.

r? alexcrichton

4 years agoAuto merge of #68269 - csmoe:temp, r=estebank
bors [Sat, 25 Jan 2020 04:42:56 +0000 (04:42 +0000)]
Auto merge of #68269 - csmoe:temp, r=estebank

Suggest to shorten temporary borrow from raw pointer

Closes https://github.com/rust-lang/rust/issues/65436
r? @estebank
cc @tmandry

4 years ago[self-profiler] Clean up `EventFilter`
Wesley Wiser [Sat, 25 Jan 2020 02:35:21 +0000 (21:35 -0500)]
[self-profiler] Clean up `EventFilter`

4 years ago[self-profiler] Use `ThreadId::as_u64()` instead of transmute
Wesley Wiser [Sat, 25 Jan 2020 02:24:24 +0000 (21:24 -0500)]
[self-profiler] Use `ThreadId::as_u64()` instead of transmute

4 years agoAdd some type-alias-impl-trait regression tests
Aaron Hill [Thu, 23 Jan 2020 23:19:59 +0000 (18:19 -0500)]
Add some type-alias-impl-trait regression tests

Fixes #57611
Fixes #57807

4 years agoDo not ICE on multipart suggestions touching multiple files
Esteban Küber [Sat, 25 Jan 2020 02:03:09 +0000 (18:03 -0800)]
Do not ICE on multipart suggestions touching multiple files

When encountering a multipart suggestion with spans belonging to
different contexts, skip that suggestion.

4 years agoAuto merge of #68526 - JohnTitor:rollup-3mmljof, r=JohnTitor
bors [Fri, 24 Jan 2020 23:04:54 +0000 (23:04 +0000)]
Auto merge of #68526 - JohnTitor:rollup-3mmljof, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #68111 (Print constants in `type_name` for const generics)
 - #68374 (Fix invalid link to the C++ Exception Handling ABI documentation)
 - #68504 (Use check-pass mode for lint tests and nll tests)
 - #68509 (Clean up error codes E0223 and E0225 explanations)
 - #68511 (Remove unused ignore-license directives)
 - #68515 (Support feature process_set_argv0 for VxWorks)

Failed merges:

r? @ghost

4 years agoRollup merge of #68515 - Wind-River:master_2020, r=alexcrichton
Yuki Okushi [Fri, 24 Jan 2020 22:45:18 +0000 (07:45 +0900)]
Rollup merge of #68515 - Wind-River:master_2020, r=alexcrichton

Support feature process_set_argv0 for VxWorks

r? @alexcrichton

4 years agoRollup merge of #68511 - tmiasko:ignore-license, r=alexcrichton
Yuki Okushi [Fri, 24 Jan 2020 22:45:16 +0000 (07:45 +0900)]
Rollup merge of #68511 - tmiasko:ignore-license, r=alexcrichton

Remove unused ignore-license directives

The tidy check was removed in rust-lang/rust#53617

4 years agoRollup merge of #68509 - GuillaumeGomez:clean-up-err-codes-e0223-e0225, r=Dylan-DPC
Yuki Okushi [Fri, 24 Jan 2020 22:45:15 +0000 (07:45 +0900)]
Rollup merge of #68509 - GuillaumeGomez:clean-up-err-codes-e0223-e0225, r=Dylan-DPC

Clean up error codes E0223 and E0225 explanations

r? @Dylan-DPC

4 years agoRollup merge of #68504 - tmiasko:check-pass, r=alexcrichton
Yuki Okushi [Fri, 24 Jan 2020 22:45:13 +0000 (07:45 +0900)]
Rollup merge of #68504 - tmiasko:check-pass, r=alexcrichton

Use check-pass mode for lint tests and nll tests

Helps with issue #62277.

4 years agoRollup merge of #68374 - gitletH:patch-1, r=nikomatsakis
Yuki Okushi [Fri, 24 Jan 2020 22:45:11 +0000 (07:45 +0900)]
Rollup merge of #68374 - gitletH:patch-1, r=nikomatsakis

Fix invalid link to the C++ Exception Handling ABI documentation

The original link is longer valid(404). I am assuming it's meant to be pointed to the Itanium C++ Exception Handling ABI documentation.

4 years agoRollup merge of #68111 - varkor:const-generics-type_name, r=oli-obk
Yuki Okushi [Fri, 24 Jan 2020 22:45:10 +0000 (07:45 +0900)]
Rollup merge of #68111 - varkor:const-generics-type_name, r=oli-obk

Print constants in `type_name` for const generics

Fixes https://github.com/rust-lang/rust/issues/65372.

r? @oli-obk as there may have been a deliberate decision not to in https://github.com/rust-lang/rust/commit/5b9848912a85e28d000602fc2e81bad9c2f2a981#diff-4ed1a72c0bfdf17be769ed520932cd02R80.

4 years agoreview comments
Esteban Küber [Fri, 24 Jan 2020 22:03:35 +0000 (14:03 -0800)]
review comments

4 years agoApply `resolve_vars_if_possible` to returned types for more accurate suggestions
Esteban Küber [Fri, 24 Jan 2020 19:47:54 +0000 (11:47 -0800)]
Apply `resolve_vars_if_possible` to returned types for more accurate suggestions

4 years agoIncrease suggestion code window from 6 lines to 20
Esteban Küber [Fri, 24 Jan 2020 19:18:45 +0000 (11:18 -0800)]
Increase suggestion code window from 6 lines to 20

4 years agoNew fix
Thomas Lively [Fri, 24 Jan 2020 19:12:33 +0000 (11:12 -0800)]
New fix

4 years agoUse more accurate return path spans
Esteban Küber [Fri, 24 Jan 2020 18:35:13 +0000 (10:35 -0800)]
Use more accurate return path spans

No longer suggest `Box::new(if foo { Type1 } else { Type2 })`, instead
suggesting `if foo { Box::new(Type1) } else { Box::new(Type2) }`.

4 years agoAdd opt-level=0 to test
Thomas Lively [Fri, 24 Jan 2020 18:25:30 +0000 (10:25 -0800)]
Add opt-level=0 to test

4 years agoUpdate LLVM to fix crash on Emscripten targets
Thomas Lively [Tue, 7 Jan 2020 15:03:45 +0000 (07:03 -0800)]
Update LLVM to fix crash on Emscripten targets

Adds a small Rust regression test for #66308.

r? @alexcrichton

4 years agoSupport feature process_set_argv0 for VxWorks
BaoshanPang [Fri, 17 Jan 2020 17:29:09 +0000 (09:29 -0800)]
Support feature process_set_argv0 for VxWorks