]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoBan `...X` pats, harden tests, and improve diagnostics.
Mazdak Farrokhzad [Sat, 11 Jan 2020 05:49:43 +0000 (06:49 +0100)]
Ban `...X` pats, harden tests, and improve diagnostics.

Also fix a bug with the span passed in `mk_range`.

4 years agoAuto merge of #65241 - tmiasko:no-std-san, r=alexcrichton
bors [Fri, 10 Jan 2020 23:26:21 +0000 (23:26 +0000)]
Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichton

build-std compatible sanitizer support

### Motivation

When using `-Z sanitizer=*` feature it is essential that both user code and
standard library is instrumented. Otherwise the utility of sanitizer will be
limited, or its use will be impractical like in the case of memory sanitizer.

The recently introduced cargo feature build-std makes it possible to rebuild
standard library with arbitrary rustc flags. Unfortunately, those changes alone
do not make it easy to rebuild standard library with sanitizers, since runtimes
are dependencies of std that have to be build in specific environment,
generally not available outside rustbuild process. Additionally rebuilding them
requires presence of llvm-config and compiler-rt sources.

The goal of changes proposed here is to make it possible to avoid rebuilding
sanitizer runtimes when rebuilding the std, thus making it possible to
instrument standard library for use with sanitizer with simple, although
verbose command:

```
env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu
```

### Implementation

* Sanitizer runtimes are no long packed into crates. Instead, libraries build
  from compiler-rt are used as is, after renaming them into `librusc_rt.*`.
* rustc obtains runtimes from target libdir for default sysroot, so that
  they are not required in custom build sysroots created with build-std.
* The runtimes are only linked-in into executables to address issue #64629.
  (in previous design it was hard to avoid linking runtimes into static
  libraries produced by rustc as demonstrated by sanitizer-staticlib-link
  test, which still passes despite changes made in #64780).

cc @kennytm, @japaric, @firstyear, @choller

4 years agoAuto merge of #68101 - JohnTitor:rollup-mvmjukr, r=JohnTitor
bors [Fri, 10 Jan 2020 20:08:58 +0000 (20:08 +0000)]
Auto merge of #68101 - JohnTitor:rollup-mvmjukr, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #66045 (Add method Result::into_ok)
 - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns)
 - #68014 (Unify output of "variant not found" errors)
 - #68019 (Build compiletest with in-tree libtest)
 - #68039 (remove explicit strip-hidden pass from compiler doc generation)
 - #68050 (Canonicalize rustc_error imports)
 - #68059 (Allow specifying LLVM args in target specifications)
 - #68075 (rustbuild: Cleanup book generation)

Failed merges:

 - #68089 (Unstabilize `Vec::remove_item`)

r? @ghost

4 years agoRollup merge of #68075 - ollie27:rustbuild_books, r=Mark-Simulacrum
Yuki Okushi [Fri, 10 Jan 2020 19:50:56 +0000 (04:50 +0900)]
Rollup merge of #68075 - ollie27:rustbuild_books, r=Mark-Simulacrum

rustbuild: Cleanup book generation

The Cargo book can be generated the same way as the other books.

4 years agoRollup merge of #68059 - jethrogb:jb/target-llvm-args, r=alexcrichton
Yuki Okushi [Fri, 10 Jan 2020 19:50:54 +0000 (04:50 +0900)]
Rollup merge of #68059 - jethrogb:jb/target-llvm-args, r=alexcrichton

Allow specifying LLVM args in target specifications

4 years agoRollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum
Yuki Okushi [Fri, 10 Jan 2020 19:50:53 +0000 (04:50 +0900)]
Rollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum

Canonicalize rustc_error imports

r? @Mark-Simulacrum

4 years agoRollup merge of #68039 - euclio:remove-strip-hidden, r=dtolnay
Yuki Okushi [Fri, 10 Jan 2020 19:50:51 +0000 (04:50 +0900)]
Rollup merge of #68039 - euclio:remove-strip-hidden, r=dtolnay

remove explicit strip-hidden pass from compiler doc generation

`strip-hidden` is now implied by `--document-private-items` with #67875, so there's no need to specify it anymore.

4 years agoRollup merge of #68019 - cuviper:in-tree-compiletest, r=Mark-Simulacrum
Yuki Okushi [Fri, 10 Jan 2020 19:50:49 +0000 (04:50 +0900)]
Rollup merge of #68019 - cuviper:in-tree-compiletest, r=Mark-Simulacrum

Build compiletest with in-tree libtest

This updates compiletest to build in `Mode::ToolStd`, using the locally-built crates for `std` and especially `test`. This way we're immune to unstable differences in the bootstrap compiler crates, whether that's a prior-release stage0 or a current release local rebuild. Fixes #59264.

As a minor cleanup, this also removes the unused `llvm_tools` flag.

4 years agoRollup merge of #68014 - estebank:unify-e0599, r=cramertj
Yuki Okushi [Fri, 10 Jan 2020 19:50:48 +0000 (04:50 +0900)]
Rollup merge of #68014 - estebank:unify-e0599, r=cramertj

Unify output of "variant not found" errors

Fix #49566.

4 years agoRollup merge of #67258 - Centril:open-ended-ranges, r=oli-obk
Yuki Okushi [Fri, 10 Jan 2020 19:50:46 +0000 (04:50 +0900)]
Rollup merge of #67258 - Centril:open-ended-ranges, r=oli-obk

Introduce `X..`, `..X`, and `..=X` range patterns

Tracking issue: https://github.com/rust-lang/rust/issues/67264
Feature gate: `#![feature(half_open_range_patterns)]`

---------------------------

In this PR, we introduce range-from (`X..`), range-to (`..X`), and range-to-inclusive (`..=X`) patterns.
These correspond to the `RangeFrom`, `RangeTo`, and `RangeToInclusive` expression forms introduced with the same syntaxes. The correspondence is both syntactic and semantic (in the sense that e.g. a `X..` pattern matching on a scrutinee `s` holds exactly when `(X..).contains(&s)` holds).

---------------------------

Noteworthy:

- The compiler complexity added with this PR is around 10 lines (discounting new tests, which account for the large PR size).

- `...X` is accepted syntactically with the same meaning as `..=X`. This is done primarily to simplify and unify the implementation & spec. If-and-when we decide to make `X...Y` a hard error on a new edition, we can do the same for `...X` patterns as well.

- `X...` and `X..=` is rejected syntactically just like it is for the expression equivalents. We should perhaps make these into semantic restrictions (cc @petrochenkov).

- In HAIR, these half-open ranges are represented by inserting the max/min values for the approprate types. That is, `X..` where `X: u8` would become `X..=u8::MAX` in HAIR (note the `..=` since `RangeFrom` includes the end).

- Exhaustive integer / char matching does not (yet) allow for e.g. exhaustive matching on `0usize..` or `..5usize | 5..` (same idea for `isize`). This would be a substantially more invasive change, and could be added in some other PR.

- The issues with slice pattern syntax has been resolved as we decided to use `..` to mean a "rest-pattern" and `[xs @ ..]` to bind the rest to a name in a slice pattern.

- Like with https://github.com/rust-lang/rust/pull/35712, which provided `X..Y` range patterns, this is not yet backed up by an RFC. I'm providing this experimental implementation now to have something concrete to discuss. I would be happy to provide an RFC for this PR as well as for #35712 to finalize and confirm the ideas with the larger community.

Closes https://github.com/rust-lang/rfcs/issues/947.

---------------------------

r? @varkor cc @matthewjasper @oli-obk

I would recommend reviewing this (in particular HAIR-lowering and pattern parsing changes) with whitespace changes ignored.

4 years agoRollup merge of #66045 - mzabaluev:unwrap-infallible, r=dtolnay
Yuki Okushi [Fri, 10 Jan 2020 19:50:45 +0000 (04:50 +0900)]
Rollup merge of #66045 - mzabaluev:unwrap-infallible, r=dtolnay

Add method Result::into_ok

Implementation of https://github.com/rust-lang/rfcs/pull/2799

Tracking issue #61695

4 years agoAuto merge of #67996 - JohnTitor:clippy-up, r=JohnTitor
bors [Fri, 10 Jan 2020 16:53:17 +0000 (16:53 +0000)]
Auto merge of #67996 - JohnTitor:clippy-up, r=JohnTitor

Update Clippy

Fixes #67994

r? @ghost

4 years agoAuto merge of #67397 - michaelwoerister:query-keys-in-self-profiling, r=wesleywiser
bors [Fri, 10 Jan 2020 12:18:46 +0000 (12:18 +0000)]
Auto merge of #67397 - michaelwoerister:query-keys-in-self-profiling, r=wesleywiser

self-profiling: Support recording query keys

This PR makes self-profiling able to record query keys. The implementation is not as efficient as it could be yet (all query keys except for `DefId`s cause string data to be duplicated) and the rendered strings could be nicer too. But the implementation is functional and introduces the basic framework for emitting per-query-invocation event data.

I tried to add proper documentation on how everything works. Let me know if more documentation is needed.

r? @wesleywiser

@Mark-Simulacrum, heads up: This updates `measureme` to 0.7.0 which means that `summarize` on perf.rlo needs to be update accordingly once this is merged.

4 years agoFix some rebasing fallout.
Michael Woerister [Fri, 10 Jan 2020 09:32:16 +0000 (10:32 +0100)]
Fix some rebasing fallout.

4 years agoUpdate measureme to 0.7.1 in order to fix compilation error on big-endian platforms.
Michael Woerister [Fri, 3 Jan 2020 11:01:53 +0000 (12:01 +0100)]
Update measureme to 0.7.1 in order to fix compilation error on big-endian platforms.

4 years agoRun 'x.py fmt'.
Michael Woerister [Fri, 3 Jan 2020 10:49:14 +0000 (11:49 +0100)]
Run 'x.py fmt'.

4 years agoself-profile: Fix issue with handling query blocking.
Michael Woerister [Wed, 18 Dec 2019 15:39:06 +0000 (16:39 +0100)]
self-profile: Fix issue with handling query blocking.

4 years agoInitial support for recording query keys in self-profiling data.
Michael Woerister [Tue, 17 Dec 2019 13:44:07 +0000 (14:44 +0100)]
Initial support for recording query keys in self-profiling data.

4 years agoUse 'relaxed' memory ordering for simple atomic counters in dep-graph.
Michael Woerister [Fri, 13 Dec 2019 13:46:10 +0000 (14:46 +0100)]
Use 'relaxed' memory ordering for simple atomic counters in dep-graph.

4 years agoself-profile: Switch to new approach for event_id generation that enables query-invoc...
Michael Woerister [Fri, 13 Dec 2019 13:44:08 +0000 (14:44 +0100)]
self-profile: Switch to new approach for event_id generation that enables query-invocation-specific event_ids.

4 years agoAllow specifying LLVM args in target specifications
Jethro Beekman [Thu, 9 Jan 2020 15:40:40 +0000 (16:40 +0100)]
Allow specifying LLVM args in target specifications

4 years agonix syntax::errors & prefer rustc_errors over errors
Mazdak Farrokhzad [Thu, 9 Jan 2020 10:18:47 +0000 (11:18 +0100)]
nix syntax::errors & prefer rustc_errors over errors

4 years agoIntroduce `#![feature(half_open_range_patterns)]`.
Mazdak Farrokhzad [Wed, 11 Dec 2019 09:04:34 +0000 (10:04 +0100)]
Introduce `#![feature(half_open_range_patterns)]`.

This feature adds `X..`, `..X`, and `..=X` patterns.

4 years agoAuto merge of #68078 - Centril:rollup-qvq052k, r=Centril
bors [Fri, 10 Jan 2020 02:09:41 +0000 (02:09 +0000)]
Auto merge of #68078 - Centril:rollup-qvq052k, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #66463 (Point at opaque and closure type definitions in type errors)
 - #67501 (Reduce special treatment for zsts)
 - #67820 (Parse the syntax described in RFC 2632)
 - #67922 (rustc_ast_lowering: misc cleanup & rustc dep reductions)
 - #68071 (Extend support of `_` in type parameters)
 - #68073 (expect `fn` after `const unsafe` / `const extern`)

Failed merges:

r? @ghost

4 years agoRollup merge of #68073 - Centril:fix-68062, r=estebank
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:36 +0000 (02:47 +0100)]
Rollup merge of #68073 - Centril:fix-68062, r=estebank

expect `fn` after `const unsafe` / `const extern`

Fixes #68062

r? @estebank @petrochenkov
cc @Aaron1011

4 years agoRollup merge of #68071 - estebank:ice-67995, r=Centril
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:34 +0000 (02:47 +0100)]
Rollup merge of #68071 - estebank:ice-67995, r=Centril

Extend support of `_` in type parameters

 - Account for `impl Trait<_>`.
 - Provide a reasonable `Span` for empty `Generics` in `impl`s.
 - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
 - Fix #67995. Follow up to #67597.

4 years agoRollup merge of #67922 - Centril:lowering-cleanup, r=petrochenkov
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:33 +0000 (02:47 +0100)]
Rollup merge of #67922 - Centril:lowering-cleanup, r=petrochenkov

rustc_ast_lowering: misc cleanup & rustc dep reductions

- The first two commits do some code simplification.
- The next three do some file splitting (getting `lib.rs` below the 3kloc tidy lint).
- The remaining commits reduce the number of `rustc::` imports. This works towards making lowering independent of the `rustc` crate.

r? @oli-obk cc @Zoxc

4 years agoRollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:32 +0000 (02:47 +0100)]
Rollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk

Parse the syntax described in RFC 2632

This adds support for both `impl const Trait for Ty` and `?const Trait` bound syntax from rust-lang/rfcs#2632 to the parser. For now, both modifiers end up in a newly-added `constness` field on `ast::TraitRef`, although this may change once the implementation is fleshed out.

I was planning on using `delay_span_bug` when this syntax is encountered during lowering, but I can't write `should-ice` UI tests. I emit a normal error instead, which causes duplicates when the feature gate is not enabled (see the `.stderr` files for the feature gate tests). Not sure what the desired approach is; Maybe just do nothing when the syntax is encountered with the feature gate is enabled?

@oli-obk I went with `const_trait_impl` and `const_trait_bound_opt_out` for the names of these features. Are these to your liking?

cc #67792 #67794

r? @Centril

4 years agoRollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJung
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:30 +0000 (02:47 +0100)]
Rollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJung

Reduce special treatment for zsts

addresses https://github.com/rust-lang/rust/pull/67467#discussion_r360650846

cc @RalfJung

4 years agoRollup merge of #66463 - estebank:point-at-closure-and-opaque-types, r=Centril
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:29 +0000 (02:47 +0100)]
Rollup merge of #66463 - estebank:point-at-closure-and-opaque-types, r=Centril

Point at opaque and closure type definitions in type errors

Fixes #57266, fixes #67117.

4 years agoAdd test for `?const` in nested impl/dyn trait
Dylan MacKenzie [Mon, 6 Jan 2020 00:34:26 +0000 (16:34 -0800)]
Add test for `?const` in nested impl/dyn trait

4 years agoMake `bound_context` more like neighboring functions
Dylan MacKenzie [Mon, 6 Jan 2020 00:33:26 +0000 (16:33 -0800)]
Make `bound_context` more like neighboring functions

4 years agoAdd test for `?const` and `?` on the same bound
Dylan MacKenzie [Sun, 5 Jan 2020 05:47:11 +0000 (21:47 -0800)]
Add test for `?const` and `?` on the same bound

4 years agoCall all visit methods on trait definitions
Dylan MacKenzie [Sun, 5 Jan 2020 02:34:10 +0000 (18:34 -0800)]
Call all visit methods on trait definitions

4 years agoAdd tests for RFC 2632
Dylan MacKenzie [Fri, 3 Jan 2020 00:31:30 +0000 (16:31 -0800)]
Add tests for RFC 2632

4 years agoCheck for `?const` in invalid contexts during AST validation
Dylan MacKenzie [Sun, 5 Jan 2020 00:29:45 +0000 (16:29 -0800)]
Check for `?const` in invalid contexts during AST validation

4 years agoReject `const` in inherent impls
Dylan MacKenzie [Sat, 4 Jan 2020 00:32:01 +0000 (16:32 -0800)]
Reject `const` in inherent impls

4 years agoError when new syntax is lowered
Dylan MacKenzie [Fri, 3 Jan 2020 00:35:07 +0000 (16:35 -0800)]
Error when new syntax is lowered

This means the new syntax will always fail to compile, even when the
feature gate is enabled. These checks will be removed in a later PR
once the implementation is done.

4 years agoParse `?const Trait` bound syntax
Dylan MacKenzie [Thu, 2 Jan 2020 23:50:18 +0000 (15:50 -0800)]
Parse `?const Trait` bound syntax

The grammar also handles `?const ?Trait` even though this is
semantically redundant.

4 years agoParse `impl const Trait for Ty` syntax
Dylan MacKenzie [Thu, 2 Jan 2020 23:49:45 +0000 (15:49 -0800)]
Parse `impl const Trait for Ty` syntax

4 years agoAdd a `constness` field to `ast::TraitRef`
Dylan MacKenzie [Thu, 2 Jan 2020 23:47:27 +0000 (15:47 -0800)]
Add a `constness` field to `ast::TraitRef`

This is used for both the `?const` syntax in bounds as well as the `impl
const Trait` syntax. I also considered handling these separately by
adding a variant of `TraitBoundModifier` and a field to
`ItemKind::Impl`, but this approach was less intrusive.

4 years agoAdd `const_trait_bound_opt_out` feature gate
Dylan MacKenzie [Thu, 2 Jan 2020 23:46:30 +0000 (15:46 -0800)]
Add `const_trait_bound_opt_out` feature gate

4 years agoAdd `const_trait_impl` feature gate
Dylan MacKenzie [Thu, 2 Jan 2020 23:45:48 +0000 (15:45 -0800)]
Add `const_trait_impl` feature gate

4 years agorustbuild: Cleanup book generation
Oliver Middleton [Thu, 9 Jan 2020 23:45:06 +0000 (23:45 +0000)]
rustbuild: Cleanup book generation

The Cargo book can be generated the same way as the other books.

4 years agoreview comments: more tests
Esteban Küber [Thu, 9 Jan 2020 22:53:17 +0000 (14:53 -0800)]
review comments: more tests

4 years agoUpdate Clippy
Yuki Okushi [Wed, 8 Jan 2020 07:47:57 +0000 (16:47 +0900)]
Update Clippy

4 years agoExtend support of `_` in type parameters
Esteban Küber [Thu, 9 Jan 2020 21:46:37 +0000 (13:46 -0800)]
Extend support of `_` in type parameters

 - Account for `impl Trait<_>`.
 - Provide a reasonable `Span` for empty `Generics` in `impl`s.
 - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
 - Fix #67995.

4 years agoexpect `fn` after `const unsafe` / `const extern`
Mazdak Farrokhzad [Thu, 9 Jan 2020 22:00:28 +0000 (23:00 +0100)]
expect `fn` after `const unsafe` / `const extern`

4 years agoAuto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor
bors [Thu, 9 Jan 2020 19:21:58 +0000 (19:21 +0000)]
Auto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #66254 (Make Layout::new const)
 - #67122 (Do not deduplicate diagnostics in UI tests)
 - #67358 (Add HashSet::get_or_insert_owned)
 - #67725 (Simplify into_key_slice_mut)
 - #67935 (Relax the Sized bounds on Pin::map_unchecked(_mut))
 - #67967 (Delay bug to prevent ICE in MIR borrowck)
 - #67975 (Export public scalar statics in wasm)
 - #68006 (Recognise riscv64 in compiletest)
 - #68040 (Cleanup)
 - #68054 (doc: add Null-unchecked version section to mut pointer as_mut method)

Failed merges:

 - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns)

r? @ghost

4 years agoRollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj
Yuki Okushi [Thu, 9 Jan 2020 19:18:43 +0000 (04:18 +0900)]
Rollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj

doc: add Null-unchecked version section to mut pointer as_mut method

The [`as_ref`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref-1) method already has a *Null-unchecked version* section, its example is a modification of the example in the main `as_ref` section. Similarly the example in this PR is a modification of the example in main [`as_mut`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_mut) section.

Fixes #68032.

4 years agoRollup merge of #68040 - sinkuu:unused, r=petrochenkov
Yuki Okushi [Thu, 9 Jan 2020 19:18:42 +0000 (04:18 +0900)]
Rollup merge of #68040 - sinkuu:unused, r=petrochenkov

Cleanup

4 years agoRollup merge of #68006 - infinity0:master, r=nikomatsakis
Yuki Okushi [Thu, 9 Jan 2020 19:18:40 +0000 (04:18 +0900)]
Rollup merge of #68006 - infinity0:master, r=nikomatsakis

Recognise riscv64 in compiletest

Otherwise tests can't run, fails with "Cannot determine Architecture from triple"

4 years agoRollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton
Yuki Okushi [Thu, 9 Jan 2020 19:18:39 +0000 (04:18 +0900)]
Rollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton

Export public scalar statics in wasm

Fixes #67453

I am not sure which export level statics should get when exporting them in wasm. This small change fixes the issue that I had, but this might not be the correct way to implement this.

4 years agoRollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasper
Yuki Okushi [Thu, 9 Jan 2020 19:18:37 +0000 (04:18 +0900)]
Rollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasper

Delay bug to prevent ICE in MIR borrowck

Fixes #67947

r? @matthewjasper

4 years agoRollup merge of #67935 - Thomasdezeeuw:issue_67669, r=withoutboats
Yuki Okushi [Thu, 9 Jan 2020 19:18:36 +0000 (04:18 +0900)]
Rollup merge of #67935 - Thomasdezeeuw:issue_67669, r=withoutboats

Relax the Sized bounds on Pin::map_unchecked(_mut)

Fixes #67669.

4 years agoRollup merge of #67725 - ssomers:into_key_slice_mut, r=RalfJung
Yuki Okushi [Thu, 9 Jan 2020 19:18:34 +0000 (04:18 +0900)]
Rollup merge of #67725 - ssomers:into_key_slice_mut, r=RalfJung

Simplify into_key_slice_mut

Remove a rare and tiny but superfluous run-time check from into_key_slice_mut.

In #67459, I wrote that "`get_mut` [...] does visit `into_key_slice_mut`" and that was wrong. No function that operates on a map that (still) has a shared root ever dives into `into_key_slice_mut`.  So it's more clear to remove the (previously existing, and always incomplete) code it has for dealing with shared roots, as well as a petty performance improvement for those using exotically aligned key types.

~~Also, some testing of the `range` function initially added to #67686 but hardly related.~~

r? @RalfJung

4 years agoRollup merge of #67358 - cuviper:get_or_insert_owned, r=LukasKalbertodt
Yuki Okushi [Thu, 9 Jan 2020 19:18:32 +0000 (04:18 +0900)]
Rollup merge of #67358 - cuviper:get_or_insert_owned, r=LukasKalbertodt

Add HashSet::get_or_insert_owned

This is an extension for tracking issue #60896. The more-general `get_or_insert_with` has potential for misuse, so we might remove it, but I think `get_or_insert_owned` covers most use cases.

4 years agoRollup merge of #67122 - petrochenkov:nodedup, r=estebank
Yuki Okushi [Thu, 9 Jan 2020 19:18:30 +0000 (04:18 +0900)]
Rollup merge of #67122 - petrochenkov:nodedup, r=estebank

Do not deduplicate diagnostics in UI tests

Error reporting infrastructure deduplicates identical diagnostics with identical spans.

While it's preferable to do this in "release"/"user-facing" mode, it sometimes brings [confusion](https://github.com/rust-lang/rust/pull/50682#issuecomment-390949878) and hides details that may be important during development.

Do we run some passes multiple times when we could do it once?
How many times we run them exactly? Can this number be large? Can the multiplied error construction be expensive? Can speculative checks be made cheaper if they don't report errors?

*Relying* on this mechanism to deduplicate some specific error never looks like a proper solution to me personally.

In this PR I attempt to disable this deduplication by applying `-Z deduplicate-diagnostics=no` to UI tests.

4 years agoRollup merge of #66254 - CAD97:patch-1, r=KodrAus
Yuki Okushi [Thu, 9 Jan 2020 19:18:29 +0000 (04:18 +0900)]
Rollup merge of #66254 - CAD97:patch-1, r=KodrAus

Make Layout::new const

This seems like a reasonable change to make. If we don't provide `Layout::new::<T>` as `const`, then users can just instead do the more error prone `Layout::from_size_align_unchecked(mem::size_of::<T>(), mem::align_of::<T>())` for the same effect and an extra `unsafe { }` incantation.

4 years agoAddress review comments + Update NLL tests
Vadim Petrochenkov [Wed, 8 Jan 2020 20:16:57 +0000 (23:16 +0300)]
Address review comments + Update NLL tests

4 years agoMark Layout::new as const stable
CAD97 [Tue, 17 Dec 2019 19:55:46 +0000 (14:55 -0500)]
Mark Layout::new as const stable

4 years agoMake Layout::new const
Christopher Durham [Sat, 9 Nov 2019 18:43:11 +0000 (13:43 -0500)]
Make Layout::new const

4 years agoUpdate tests
Vadim Petrochenkov [Wed, 8 Jan 2020 17:02:10 +0000 (20:02 +0300)]
Update tests

4 years agocompiletest: Do not deduplicate diagnostics in UI tests
Vadim Petrochenkov [Wed, 8 Jan 2020 12:07:26 +0000 (15:07 +0300)]
compiletest: Do not deduplicate diagnostics in UI tests

4 years agoAuto merge of #68047 - pietroalbini:fix-toolstate-again, r=Mark-Simulacrum
bors [Thu, 9 Jan 2020 16:10:01 +0000 (16:10 +0000)]
Auto merge of #68047 - pietroalbini:fix-toolstate-again, r=Mark-Simulacrum

ci: another take at fixing toolstate

Seems like the variable showed by `$(ciCheckoutPath)` on Azure Pipelines was wrong, making the toolstate script fail. This commit changes that function to return the variable previously used by the toolstate script. Other uses of the function were audited, and there should be no conflict.

Failure log: https://dev.azure.com/rust-lang/rust/_build/results?buildId=17933
r? @Mark-Simulacrum

4 years agodoc: add Null-unchecked version section to mut pointer as_mut method
Trevor Spiteri [Thu, 9 Jan 2020 13:51:58 +0000 (14:51 +0100)]
doc: add Null-unchecked version section to mut pointer as_mut method

The as_ref method already has a Null-unchecked version section, its
example is a modification of the example in the main as_ref section.
Similarly the example in this commit is a modification of the example
in main as_mut section.

4 years agoAuto merge of #67988 - Zoxc:prof-fix, r=michaelwoerister
bors [Thu, 9 Jan 2020 11:36:44 +0000 (11:36 +0000)]
Auto merge of #67988 - Zoxc:prof-fix, r=michaelwoerister

Change -Z time event naming scheme and make them generic activities

I made the `-Z time-passes` only events (which encodes argument in the event id) use a `extra_verbose_generic_activity` function which does not emit self-profiling events.

r? @michaelwoerister
cc @wesleywiser

4 years agoSwitch assertion order to be more helpful to ppl that encounter them
Oliver Scherer [Thu, 9 Jan 2020 11:03:37 +0000 (12:03 +0100)]
Switch assertion order to be more helpful to ppl that encounter them

4 years agoRename `Unsized` to `Meta`
Oliver Scherer [Thu, 9 Jan 2020 11:02:44 +0000 (12:02 +0100)]
Rename `Unsized` to `Meta`

4 years agoApply suggestions from code review
Stein Somers [Thu, 9 Jan 2020 11:03:49 +0000 (12:03 +0100)]
Apply suggestions from code review

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoSimplify into_key_slice_mut and document bits and bobs
Stein Somers [Thu, 2 Jan 2020 11:42:31 +0000 (12:42 +0100)]
Simplify into_key_slice_mut and document bits and bobs

4 years agoUpdate src/librustc_mir/interpret/place.rs
Oliver Scherer [Thu, 9 Jan 2020 09:56:05 +0000 (10:56 +0100)]
Update src/librustc_mir/interpret/place.rs

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoci: another take at fixing toolstate
Pietro Albini [Thu, 9 Jan 2020 08:49:25 +0000 (09:49 +0100)]
ci: another take at fixing toolstate

Seems like the variable showed by $(ciCheckoutPath) on Azure Pipelines
was wrong, making the toolstate script fail. This commit changes that
function to return the variable previously used by the toolstate script.
Other uses of the function were audited, and there should be no
conflict.

4 years agoDocument sanitizers in unstable-book
Tomasz Miąsko [Wed, 16 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Document sanitizers in unstable-book

4 years agoadd CStore::item_generics_num_lifetimes
Mazdak Farrokhzad [Thu, 9 Jan 2020 08:23:44 +0000 (09:23 +0100)]
add CStore::item_generics_num_lifetimes

4 years agorename a method in Resolver trait
Mazdak Farrokhzad [Wed, 8 Jan 2020 22:16:58 +0000 (23:16 +0100)]
rename a method in Resolver trait

4 years agolowering: remove dep on CrateStore
Mazdak Farrokhzad [Mon, 6 Jan 2020 06:34:52 +0000 (07:34 +0100)]
lowering: remove dep on CrateStore

4 years agolowering: rustc::session -> rustc_session
Mazdak Farrokhzad [Mon, 6 Jan 2020 06:05:04 +0000 (07:05 +0100)]
lowering: rustc::session -> rustc_session

4 years ago{rustc::util -> rustc_data_structures}::captures
Mazdak Farrokhzad [Mon, 6 Jan 2020 06:03:46 +0000 (07:03 +0100)]
{rustc::util -> rustc_data_structures}::captures

4 years agorefactor 'Output = $ty' & reduce rustc dep
Mazdak Farrokhzad [Mon, 6 Jan 2020 05:48:51 +0000 (06:48 +0100)]
refactor 'Output = $ty' & reduce rustc dep

4 years agoextract path lowering -> path.rs
Mazdak Farrokhzad [Mon, 6 Jan 2020 05:28:43 +0000 (06:28 +0100)]
extract path lowering -> path.rs

4 years agomove lower_binding_mode -> pat.rs
Mazdak Farrokhzad [Mon, 6 Jan 2020 05:54:48 +0000 (06:54 +0100)]
move lower_binding_mode -> pat.rs

4 years agoextract pattern lowering -> pat.rs
Mazdak Farrokhzad [Mon, 6 Jan 2020 04:51:59 +0000 (05:51 +0100)]
extract pattern lowering -> pat.rs

4 years agolowering: elide some lifetimes
Mazdak Farrokhzad [Mon, 6 Jan 2020 04:35:18 +0000 (05:35 +0100)]
lowering: elide some lifetimes

4 years agolowering: simplify HoFs
Mazdak Farrokhzad [Mon, 6 Jan 2020 04:32:17 +0000 (05:32 +0100)]
lowering: simplify HoFs

4 years agoAdd bootstrap step for building sanitizer runtimes
Tomasz Miąsko [Thu, 7 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Add bootstrap step for building sanitizer runtimes

4 years agoLink sanitizer runtimes instead of injecting crate dependencies
Tomasz Miąsko [Thu, 7 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Link sanitizer runtimes instead of injecting crate dependencies

4 years agoRemove sanitizer_runtime attribute
Tomasz Miąsko [Mon, 7 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Remove sanitizer_runtime attribute

4 years agoRemove sanitizer runtime crates
Tomasz Miąsko [Sun, 6 Oct 2019 00:00:00 +0000 (00:00 +0000)]
Remove sanitizer runtime crates

4 years agoMore comments
John Kåre Alsaker [Wed, 8 Jan 2020 20:32:00 +0000 (21:32 +0100)]
More comments

4 years agoChange -Z time event naming scheme and make them generic activities
John Kåre Alsaker [Tue, 7 Jan 2020 20:34:08 +0000 (21:34 +0100)]
Change -Z time event naming scheme and make them generic activities

4 years agoRemove unused dependencies
Shotaro Yamada [Thu, 9 Jan 2020 02:52:03 +0000 (11:52 +0900)]
Remove unused dependencies

4 years agoRemove unused `struct ClosureUpvar`
Shotaro Yamada [Thu, 9 Jan 2020 02:47:32 +0000 (11:47 +0900)]
Remove unused `struct ClosureUpvar`

4 years agoremove strip-hidden pass from compiler doc generation
Andy Russell [Thu, 9 Jan 2020 02:43:54 +0000 (21:43 -0500)]
remove strip-hidden pass from compiler doc generation

4 years agoAuto merge of #68034 - Centril:rollup-3d9pq14, r=Centril
bors [Thu, 9 Jan 2020 02:05:15 +0000 (02:05 +0000)]
Auto merge of #68034 - Centril:rollup-3d9pq14, r=Centril

Rollup of 12 pull requests

Successful merges:

 - #67630 (Treat extern statics just like statics in the "const pointer to static" representation)
 - #67747 (Explain that associated types and consts can't be accessed directly on the trait's path)
 - #67884 (Fix incremental builds of core by allowing unused attribute.)
 - #67966 (Use matches macro in libcore and libstd)
 - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup)
 - #67986 (Display more informative ICE)
 - #67990 (slice patterns: harden match-based borrowck tests)
 - #68005 (Improve E0184 explanation)
 - #68009 (Spell check librustc_error_codes)
 - #68023 (Fix issue #68008)
 - #68024 (Remove `-Z continue-parse-after-error`)
 - #68026 (Small improvements in lexical_region_resolve)

Failed merges:

r? @ghost

4 years agoAdd HashSet::get_or_insert_owned
Josh Stone [Mon, 16 Dec 2019 18:53:50 +0000 (10:53 -0800)]
Add HashSet::get_or_insert_owned

4 years agoRollup merge of #68026 - llogiq:ch-ch-ch-ch-changes, r=varkor
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:21 +0000 (00:22 +0100)]
Rollup merge of #68026 - llogiq:ch-ch-ch-ch-changes, r=varkor

Small improvements in lexical_region_resolve

This just replaces a trivial `if` condition with a `|=` in two places.

I could even have used a `fold` in the first case, but I think it would be less readable.

4 years agoRollup merge of #68024 - petrochenkov:recoverall, r=Centril
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:20 +0000 (00:22 +0100)]
Rollup merge of #68024 - petrochenkov:recoverall, r=Centril

Remove `-Z continue-parse-after-error`

We are just always recovering and continuing now.

r? @estebank @Centril

4 years agoRollup merge of #68023 - FSciammarella:master, r=Centril,varkor
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:18 +0000 (00:22 +0100)]
Rollup merge of #68023 - FSciammarella:master, r=Centril,varkor

Fix issue #68008

Correcting Typo on error message. From "substract" to "subtract".

Fixes #68008.

4 years agoRollup merge of #68009 - wcampbell0x2a:spellcheck-librustc_error_codes, r=Centril
Mazdak Farrokhzad [Wed, 8 Jan 2020 23:22:17 +0000 (00:22 +0100)]
Rollup merge of #68009 - wcampbell0x2a:spellcheck-librustc_error_codes, r=Centril

Spell check librustc_error_codes

Found one wrongly spelled error message and decided to check all the
error messages for wrongly spelled statements.