]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #63700 - alexcrichton:update-backtrace, r=sfackler
bors [Mon, 19 Aug 2019 13:17:34 +0000 (13:17 +0000)]
Auto merge of #63700 - alexcrichton:update-backtrace, r=sfackler

std: Update `backtrace` crate dependency

This commit updates the `backtrace` crate from 0.3.34 to 0.3.35. The
[included set of changes][changes] for this update mostly includes some
gimli-related improvements (not relevant for the standard library) but
critically includes a fix for rust-lang/backtrace-rs#230. The standard
library will not aqcuire a session-local lock whenever a backtrace is
generated on Windows to allow external synchronization with the
`backtrace` crate itself, allowing `backtrace` to be safely used while
other threads may be panicking.

[changes]: https://github.com/rust-lang/backtrace-rs/compare/0.3.34...0.3.35

4 years agostd: Update `backtrace` crate dependency
Alex Crichton [Mon, 19 Aug 2019 13:13:18 +0000 (06:13 -0700)]
std: Update `backtrace` crate dependency

This commit updates the `backtrace` crate from 0.3.34 to 0.3.35. The
[included set of changes][changes] for this update mostly includes some
gimli-related improvements (not relevant for the standard library) but
critically includes a fix for rust-lang/backtrace-rs#230. The standard
library will not aqcuire a session-local lock whenever a backtrace is
generated on Windows to allow external synchronization with the
`backtrace` crate itself, allowing `backtrace` to be safely used while
other threads may be panicking.

[changes]: https://github.com/rust-lang/backtrace-rs/compare/0.3.34...0.3.35

4 years agoAuto merge of #63670 - Dante-Broggi:patch-2, r=Centril
bors [Mon, 19 Aug 2019 05:12:58 +0000 (05:12 +0000)]
Auto merge of #63670 - Dante-Broggi:patch-2, r=Centril

Size has a ::zero

4 years agoAuto merge of #63463 - matthewjasper:ty_param_cleanup, r=petrochenkov
bors [Mon, 19 Aug 2019 01:31:35 +0000 (01:31 +0000)]
Auto merge of #63463 - matthewjasper:ty_param_cleanup, r=petrochenkov

Don't special case the `Self` parameter by name

This results in a couple of small diagnostic regressions. They could be avoided by keeping the special case just for diagnostics, but that seems worse.

closes #50125
cc #60869

4 years agoAuto merge of #63045 - Rosto75:master, r=jonas-schievink
bors [Sun, 18 Aug 2019 22:01:21 +0000 (22:01 +0000)]
Auto merge of #63045 - Rosto75:master, r=jonas-schievink

Change the placement of two functions.

Right now, the order is as follows:
`pop_front()`
`push_front()`
`push_back()`
`pop_back()`

`swap_remove_back()`
`swap_remove_front()`

I believe it would be more natural, and easier to follow, if we place `pop_back()` right after the `pop_front()`, and `swap_remove_back()` after the `swap_remove_front()` like this:
`pop_front()`
`pop_back()`
`push_front()`
`push_back()`

`swap_remove_front()`
`swap_remove_back()`

The rest of the documentation (at least in this module) adheres to the same logic, where the 'front' function always precedes its 'back' equivalent.

4 years agoPre intern the `Self` parameter type
Matthew Jasper [Mon, 12 Aug 2019 21:15:12 +0000 (22:15 +0100)]
Pre intern the `Self` parameter type

Use this to simplify the object safety code a bit.

4 years agoAuto merge of #63659 - gilescope:async-in-closure, r=Centril
bors [Sun, 18 Aug 2019 18:23:28 +0000 (18:23 +0000)]
Auto merge of #63659 - gilescope:async-in-closure, r=Centril

Improved error message for break in async block

Fixes #63391

4 years agoAuto merge of #63635 - oli-obk:default-slice-dangles, r=eddyb
bors [Sun, 18 Aug 2019 13:22:38 +0000 (13:22 +0000)]
Auto merge of #63635 - oli-obk:default-slice-dangles, r=eddyb

Do not generate allocations for zero sized allocations

Alternative to https://github.com/rust-lang/rust/issues/62487

r? @eddyb

There are other places where we could do this, too, but that would cause `static FOO: () = ();` to not have a unique address

4 years agoBetter error message for break in async blocks.
Giles Cope [Sat, 17 Aug 2019 11:17:02 +0000 (12:17 +0100)]
Better error message for break in async blocks.

4 years agoAuto merge of #63269 - Aaron1011:feature/proc-macro-data, r=eddyb,petrochenkov
bors [Sun, 18 Aug 2019 08:15:38 +0000 (08:15 +0000)]
Auto merge of #63269 - Aaron1011:feature/proc-macro-data, r=eddyb,petrochenkov

Serialize additional data for procedural macros

Split off from #62855

This PR serializes the declaration `Span` and attributes for all
procedural macros. This allows Rustdoc to properly render doc comments
and source links when performing inlinig procedural macros across crates

4 years agoAuto merge of #62948 - matklad:failable-file-loading, r=petrochenkov
bors [Sun, 18 Aug 2019 04:37:01 +0000 (04:37 +0000)]
Auto merge of #62948 - matklad:failable-file-loading, r=petrochenkov

Normalize newlines when loading files

Fixes #62865

4 years agoAuto merge of #61708 - dlrobertson:or-patterns-0, r=centril
bors [Sun, 18 Aug 2019 01:02:20 +0000 (01:02 +0000)]
Auto merge of #61708 - dlrobertson:or-patterns-0, r=centril

Initial implementation of or-patterns

An incomplete implementation of or-patterns (e.g. `Some(0 | 1)` as a pattern). This patch set aims to implement initial parsing of `or-patterns`.

Related to: #54883

CC @alexreg @varkor
r? @Centril

4 years agoAuto merge of #63671 - Centril:rollup-zufavt5, r=Centril
bors [Sat, 17 Aug 2019 21:30:10 +0000 (21:30 +0000)]
Auto merge of #63671 - Centril:rollup-zufavt5, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62451 (Add APIs for uninitialized Box, Rc, and Arc. (Plus get_mut_unchecked))
 - #63487 (Remove meaningless comments in src/test)
 - #63657 (Crank up invalid value lint)
 - #63667 (resolve: Properly integrate derives and `macro_rules` scopes)
 - #63669 (fix typos in mir/interpret)

Failed merges:

r? @ghost

4 years agoRollup merge of #63669 - Dante-Broggi:patch-1, r=jonas-schievink
Mazdak Farrokhzad [Sat, 17 Aug 2019 20:57:35 +0000 (22:57 +0200)]
Rollup merge of #63669 - Dante-Broggi:patch-1, r=jonas-schievink

fix typos in mir/interpret

4 years agoRollup merge of #63667 - petrochenkov:deriveholders, r=matthewjasper
Mazdak Farrokhzad [Sat, 17 Aug 2019 20:57:34 +0000 (22:57 +0200)]
Rollup merge of #63667 - petrochenkov:deriveholders, r=matthewjasper

resolve: Properly integrate derives and `macro_rules` scopes

So,
```rust
#[derive(A, B)]
struct S;

m!();
```
turns into something like
```rust
struct S;

A_placeholder!( struct S; );

B_placeholder!( struct S; );

m!();
```
during expansion.

And for `m!()` its "`macro_rules` scope" (aka "legacy scope") should point to the `B_placeholder` call rather than to the derive container `#[derive(A, B)]`.

`fn build_reduced_graph` now makes sure the legacy scope points to the right thing.
(It's still a mystery for me why this worked before https://github.com/rust-lang/rust/pull/63535.)

Unfortunately, placeholders from derives are currently treated separately from placeholders from other macros and need to be passed as `extra_placeholders` rather than a part of the AST fragment.
That's fixable, but I wanted to keep this PR more minimal to close the regression faster.

Fixes https://github.com/rust-lang/rust/issues/63651
r? @matthewjasper

4 years agoRollup merge of #63657 - RalfJung:invalid_value, r=Centril
Mazdak Farrokhzad [Sat, 17 Aug 2019 20:57:32 +0000 (22:57 +0200)]
Rollup merge of #63657 - RalfJung:invalid_value, r=Centril

Crank up invalid value lint

* Warn against uninit `bool` and `char`.
* Warn against 0-init `NonNull` and friends
* Detect transmute-from-0 as zero-initialization ([seen in the wild](https://github.com/glium/glium/issues/1775#issuecomment-522144636))

4 years agoRollup merge of #63487 - sd234678:remove-meaningless-comments-in-src/test-2, r=Centril
Mazdak Farrokhzad [Sat, 17 Aug 2019 20:57:30 +0000 (22:57 +0200)]
Rollup merge of #63487 - sd234678:remove-meaningless-comments-in-src/test-2, r=Centril

Remove meaningless comments in src/test

Moved from #63411

4 years agoRollup merge of #62451 - SimonSapin:new_uninit, r=RalfJung
Mazdak Farrokhzad [Sat, 17 Aug 2019 20:57:29 +0000 (22:57 +0200)]
Rollup merge of #62451 - SimonSapin:new_uninit, r=RalfJung

Add APIs for uninitialized Box, Rc, and Arc. (Plus get_mut_unchecked)

Assigning `MaybeUninit::<Foo>::uninit()` to a local variable is usually free, even when `size_of::<Foo>()` is large. However, passing it for example to `Arc::new` [causes at least one copy](https://youtu.be/F1AquroPfcI?t=4116) (from the stack to the newly allocated heap memory) even though there is no meaningful data. It is theoretically possible that a Sufficiently Advanced Compiler could optimize this copy away, but this is [reportedly unlikely to happen soon in LLVM](https://youtu.be/F1AquroPfcI?t=5431).

This PR proposes two sets of features:

* Constructors for containers (`Box`, `Rc`, `Arc`) of `MaybeUninit<T>` or `[MaybeUninit<T>]` that do not initialized the data, and unsafe conversions to the known-initialized types (without `MaybeUninit`). The constructors are guaranteed not to make unnecessary copies.

* On `Rc` and `Arc`, an unsafe `get_mut_unchecked` method that provides `&mut T` access without checking the reference count. `Arc::get_mut` involves multiple atomic operations whose cost can be non-trivial. `Rc::get_mut` is less costly, but we add `Rc::get_mut_unchecked` anyway for symmetry with `Arc`.

  These can be useful independently, but they will presumably be typical when the new constructors of `Rc` and `Arc` are used.

  An alternative with a safe API would be to introduce `UniqueRc` and `UniqueArc` types that have the same memory layout as `Rc` and `Arc` (and so zero-cost conversion to them) but are guaranteed to have only one reference. But introducing entire new types feels “heavier” than new constructors on existing types, and initialization of `MaybeUninit<T>` typically requires unsafe code anyway.

Summary of new APIs (all unstable in this PR):

```rust
impl<T> Box<T> { pub fn new_uninit() -> Box<MaybeUninit<T>> {…} }
impl<T> Box<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Box<T> {…} }
impl<T> Box<[T]> { pub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} }
impl<T> Box<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Box<[T]> {…} }

impl<T> Rc<T> { pub fn new_uninit() -> Rc<MaybeUninit<T>> {…} }
impl<T> Rc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Rc<T> {…} }
impl<T> Rc<[T]> { pub fn new_uninit_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} }
impl<T> Rc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Rc<[T]> {…} }

impl<T> Arc<T> { pub fn new_uninit() -> Arc<MaybeUninit<T>> {…} }
impl<T> Arc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Arc<T> {…} }
impl<T> Arc<[T]> { pub fn new_uninit_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} }
impl<T> Arc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Arc<[T]> {…} }

impl<T: ?Sized> Rc<T> { pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {…} }
impl<T: ?Sized> Arc<T> { pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {…} }
```

4 years agotest in a way that works even with musl
Ralf Jung [Sat, 17 Aug 2019 20:11:43 +0000 (22:11 +0200)]
test in a way that works even with musl

4 years agosize has a zero
Dante-Broggi [Sat, 17 Aug 2019 20:09:49 +0000 (16:09 -0400)]
size has a zero

4 years agoDoc nit
Simon Sapin [Sat, 17 Aug 2019 19:40:35 +0000 (21:40 +0200)]
Doc nit

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agofix typos
Dante-Broggi [Sat, 17 Aug 2019 19:33:44 +0000 (15:33 -0400)]
fix typos

4 years agoresolve/expand: Rename some things for clarity
Vadim Petrochenkov [Sat, 17 Aug 2019 17:49:00 +0000 (20:49 +0300)]
resolve/expand: Rename some things for clarity

4 years agoAuto merge of #63658 - RalfJung:miri-op, r=oli-obk
bors [Sat, 17 Aug 2019 17:53:31 +0000 (17:53 +0000)]
Auto merge of #63658 - RalfJung:miri-op, r=oli-obk

Refactor Miri ops (unary, binary) to have more types

This is the part of https://github.com/rust-lang/rust/pull/63448 that is just a refactoring. It helps that PR by making it easier to perform machine arithmetic.

r? @oli-obk @eddyb

4 years agoresolve: Properly integrate derives and `macro_rules` scopes
Vadim Petrochenkov [Sat, 17 Aug 2019 16:32:52 +0000 (19:32 +0300)]
resolve: Properly integrate derives and `macro_rules` scopes

4 years agoSerialize additional data for procedural macros
Aaron Hill [Sun, 4 Aug 2019 20:41:01 +0000 (16:41 -0400)]
Serialize additional data for procedural macros

Split off from #62855

This PR deerializes the declaration `Span` and attributes for all
procedural macros from their underlying function definitions.
This allows Rustdoc to properly render doc comments
and source links when inlining procedural macros across crates

4 years agoinitial implementation of or-pattern parsing
Dan Robertson [Sun, 14 Jul 2019 01:05:52 +0000 (01:05 +0000)]
initial implementation of or-pattern parsing

Initial implementation of parsing or-patterns e.g., `Some(Foo | Bar)`.
This is a partial implementation of RFC 2535.

4 years agoInitial implementation of or patterns
varkor [Fri, 19 Oct 2018 14:40:07 +0000 (15:40 +0100)]
Initial implementation of or patterns

4 years agoRename private helper method allocate_for_unsized to allocate_for_layout
Simon Sapin [Sat, 17 Aug 2019 13:39:21 +0000 (15:39 +0200)]
Rename private helper method allocate_for_unsized to allocate_for_layout

4 years agoless &
Ralf Jung [Sat, 17 Aug 2019 14:48:08 +0000 (16:48 +0200)]
less &

4 years agoDoc nits
Simon Sapin [Sat, 17 Aug 2019 13:15:17 +0000 (15:15 +0200)]
Doc nits

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoAuto merge of #63462 - matthewjasper:hygienic-builtin-derives, r=petrochenkov
bors [Sat, 17 Aug 2019 12:53:53 +0000 (12:53 +0000)]
Auto merge of #63462 - matthewjasper:hygienic-builtin-derives, r=petrochenkov

Opaque builtin derive macros

* Buiilt-in derives are now opaque macros
    * This required limiting the visibility of some previously unexposed functions in `core`.
    * This also required the change to `Ident` serialization.
* All gensyms are replaced with hygienic identifiers
* Use hygiene to avoid most other name-resolution issues with buiilt-in derives.
    *  As far as I know the only remaining case that breaks is an ADT that has the same name as one of its parameters. Fixing this completely seemed to be more effort than it's worth.
* Remove gensym in `Ident::decode`, which lead to linker errors due to `inline` being gensymmed.
    * `Ident`now panics if incremental compilation tries to serialize it (it currently doesn't).
    * `Ident` no longer uses `gensym` to emulate cross-crate hygiene. It only applied to reexports.
    * `SyntaxContext` is no longer serializable.
    * The long-term fix for this is to properly implement cross-crate hygiene, but this seemed to be acceptable for now.
* Move type/const parameter shadowing checks to `resolve`
    * This was previously split between resolve and type checking. The type checking pass compared `InternedString`s, not Identifiers.
* Removed the `SyntaxContext` from `{ast, hir}::{InlineAsm, GlobalAsm}`

cc #60869
r? @petrochenkov

4 years agodrift leftward
Ralf Jung [Sat, 17 Aug 2019 11:49:27 +0000 (13:49 +0200)]
drift leftward

4 years agofix tests
Ralf Jung [Sat, 17 Aug 2019 11:45:11 +0000 (13:45 +0200)]
fix tests

4 years agoFull stop
Ralf Jung [Sat, 17 Aug 2019 11:42:03 +0000 (13:42 +0200)]
Full stop

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agouse ImmTy::from_uint in a few more spots
Ralf Jung [Sat, 10 Aug 2019 18:49:55 +0000 (20:49 +0200)]
use ImmTy::from_uint in a few more spots

4 years agomake both unary_op and binary_op fully typed, including a return type
Ralf Jung [Sat, 10 Aug 2019 17:40:56 +0000 (19:40 +0200)]
make both unary_op and binary_op fully typed, including a return type

4 years agoAdd ImmTy::from_uint
Ralf Jung [Sat, 17 Aug 2019 10:06:05 +0000 (12:06 +0200)]
Add ImmTy::from_uint

4 years agoinvalid_value: also detect transmute-from-0 (seen in the wild)
Ralf Jung [Sat, 17 Aug 2019 09:48:30 +0000 (11:48 +0200)]
invalid_value: also detect transmute-from-0 (seen in the wild)

4 years agomulti-variant enums are tricky
Ralf Jung [Sat, 17 Aug 2019 08:20:18 +0000 (10:20 +0200)]
multi-variant enums are tricky

4 years agoinvalid_value: warn for types with custom valid range
Ralf Jung [Sat, 17 Aug 2019 08:13:47 +0000 (10:13 +0200)]
invalid_value: warn for types with custom valid range

4 years agowarn about uninit bools and chars
Ralf Jung [Sat, 17 Aug 2019 07:39:25 +0000 (09:39 +0200)]
warn about uninit bools and chars

4 years agoinvalid_value: factor finding dangerous inits into separate function
Ralf Jung [Sat, 17 Aug 2019 06:39:20 +0000 (08:39 +0200)]
invalid_value: factor finding dangerous inits into separate function

4 years agoAdd tests
Oliver Scherer [Sat, 17 Aug 2019 09:31:09 +0000 (11:31 +0200)]
Add tests

4 years agoCast only where necessary
Oliver Scherer [Sat, 17 Aug 2019 09:29:17 +0000 (11:29 +0200)]
Cast only where necessary

4 years agoAuto merge of #63655 - Centril:rollup-ty1ot40, r=Centril
bors [Sat, 17 Aug 2019 09:14:37 +0000 (09:14 +0000)]
Auto merge of #63655 - Centril:rollup-ty1ot40, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #62737 (Override Cycle::try_fold)
 - #63505 (Hash the remapped sysroot instead of the original.)
 - #63559 (rustc_codegen_utils: account for 1-indexed anonymous lifetimes in v0 mangling.)
 - #63621 (Modify librustc_llvm to pass -DNDEBUG while compiling.)

Failed merges:

r? @ghost

4 years agoRollup merge of #63621 - jgalenson:dndebug, r=alexcrichton
Mazdak Farrokhzad [Sat, 17 Aug 2019 09:13:47 +0000 (11:13 +0200)]
Rollup merge of #63621 - jgalenson:dndebug, r=alexcrichton

Modify librustc_llvm to pass -DNDEBUG while compiling.

Currently, librustc_llvm builds are not reproducible because the LLVM files it compiles use the debug version of llvm_unreachable, which uses __FILE__.  To fix this, we propagate NDEBUG from bootstrap if applicable and use it when compiling librustc_llvm.

r? @alexcrichton

4 years agoRollup merge of #63559 - eddyb:v0-mangling-off-by-1, r=estebank
Mazdak Farrokhzad [Sat, 17 Aug 2019 09:13:45 +0000 (11:13 +0200)]
Rollup merge of #63559 - eddyb:v0-mangling-off-by-1, r=estebank

rustc_codegen_utils: account for 1-indexed anonymous lifetimes in v0 mangling.

I don't really understand why `anonymize_late_bound_regions` starts with `BrAnon(1)` instead of `BrAnon(0)`, but it does (maybe @nikomatsakis knows?): https://github.com/rust-lang/rust/blob/c43d03a19f326f4a323569328cc501e86eb6d22e/src/librustc/ty/fold.rs#L696-L712

Thankfully, the mangling format and demangler implementations are fine, and I just needed to offset the anonymized lifetime indices by `1` to get the correct mangling.

cc @alexcrichton @michaelwoerister

4 years agoRollup merge of #63505 - jgalenson:sysroot-hash, r=alexcrichton
Mazdak Farrokhzad [Sat, 17 Aug 2019 09:13:44 +0000 (11:13 +0200)]
Rollup merge of #63505 - jgalenson:sysroot-hash, r=alexcrichton

Hash the remapped sysroot instead of the original.

One of the reasons that rustc builds are not reproducible is because the --sysroot path is dependent on the current directory.  We can fix this by hashing the remapped sysroot instead of the original when applicable.

Note that with this patch, the hash will stay the same if both the sysroot and the remapped path change.  However, given that if the contents of the sysroot change the hash will also stay the same, this might be acceptable.  I would appreciate feedback on the best way to do this.

This helps #34902, although it does not fix it by itself.

4 years agoRollup merge of #62737 - timvermeulen:cycle_try_fold, r=scottmcm
Mazdak Farrokhzad [Sat, 17 Aug 2019 09:13:42 +0000 (11:13 +0200)]
Rollup merge of #62737 - timvermeulen:cycle_try_fold, r=scottmcm

Override Cycle::try_fold

It's not very pretty, but I believe this is the simplest way to correctly implement `Cycle::try_fold`. The following may seem correct:
```rust
loop {
    acc = self.iter.try_fold(acc, &mut f)?;
    self.iter = self.orig.clone();
}
```
...but this loops infinitely in case `self.orig` is empty, as opposed to returning `acc`. So we first have to fully iterate `self.orig` to check whether it is empty or not, and before _that_, we have to iterate the remaining elements of `self.iter`.

This should always call `self.orig.clone()` the same amount of times as repeated `next()` calls would.

r? @scottmcm

4 years agoRemove unused `SyntaxContext` serialization impls
Matthew Jasper [Tue, 13 Aug 2019 18:19:31 +0000 (19:19 +0100)]
Remove unused `SyntaxContext` serialization impls

The implementations were wrong and unused.

4 years agoRemove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}
Matthew Jasper [Mon, 12 Aug 2019 21:12:53 +0000 (22:12 +0100)]
Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}

We now store it in the `Span` of the expression or item.

4 years agoMove type parameter shadowing errors to resolve
Matthew Jasper [Sun, 11 Aug 2019 17:09:50 +0000 (18:09 +0100)]
Move type parameter shadowing errors to resolve

For some reason type checking did this. Further it didn't consider
hygiene.

4 years agoRemove gensyms from built-in derives
Matthew Jasper [Sun, 11 Aug 2019 13:16:12 +0000 (14:16 +0100)]
Remove gensyms from built-in derives

Also make them generally more hygienic with name resolution.

4 years agoMake fmt-internal functions private
Matthew Jasper [Sun, 11 Aug 2019 12:31:11 +0000 (13:31 +0100)]
Make fmt-internal functions private

4 years agoMake built-in derives opaque macros
Matthew Jasper [Fri, 9 Aug 2019 20:15:00 +0000 (21:15 +0100)]
Make built-in derives opaque macros

4 years agoStop emulating cross-crate hygiene with gensyms
Matthew Jasper [Sun, 11 Aug 2019 10:48:22 +0000 (11:48 +0100)]
Stop emulating cross-crate hygiene with gensyms

Most `Ident`s are serialized as `InternedString`s the exceptions are:

* Reexports
* Attributes
* Idents in macro definitions

Using gensyms helped reexports emulate hygiene. However, the actual item
wouldn't have a gensymmed name so would be usable cross-crate. So
removing this case until we have proper cross-crate hygiene seems
sensible.

Codegen attributes (`inline`, `export_name`) are resolved by their
`Symbol`. This meant that opaque macro-expanded codegen attributes could
cause linker errors. This prevented making built-in derives hygienic.

4 years agoAuto merge of #63491 - Xanewok:update-rls, r=Mark-Simulacrum
bors [Sat, 17 Aug 2019 04:47:20 +0000 (04:47 +0000)]
Auto merge of #63491 - Xanewok:update-rls, r=Mark-Simulacrum

Update RLS

This fixes handling default configuration for the `crate_blacklist`
RLS configuration.

Technically this isn't needed, as the VS Code extension can be
configured to accept a predefined blacklist that's equal to the default
one but it's best that it also lands so that we don't need to work
around that.

Without this, manually passing a `null` value as the configuration
unfortunately crashes the RLS. This is the last fix related to configuration.

cc https://github.com/rust-lang/rust/pull/63472

r? @Mark-Simulacrum

4 years agoAuto merge of #63648 - Centril:rollup-2kpdrj1, r=Centril
bors [Sat, 17 Aug 2019 01:04:36 +0000 (01:04 +0000)]
Auto merge of #63648 - Centril:rollup-2kpdrj1, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #63149 (resolve: Populate external modules in more automatic and lazy way)
 - #63545 (Feature gate 'yield $expr?' pre-expansion)
 - #63548 (Update rustc-demangle to 0.1.16.)
 - #63558 (Remap paths for proc-macro crates.)
 - #63641 (add git keyword to submodule comments in config.example.toml)
 - #63642 (Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.)

Failed merges:

r? @ghost

4 years agoRollup merge of #63642 - eddyb:wrap-it-up, r=rkruppe,Mark-Simulacrum
Mazdak Farrokhzad [Sat, 17 Aug 2019 01:03:02 +0000 (03:03 +0200)]
Rollup merge of #63642 - eddyb:wrap-it-up, r=rkruppe,Mark-Simulacrum

Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.

These confused @Gankra, and then, also me, especially since `overflowing_*` *methods* also exist, but they map to `*_with_overflow` intrinsics!

r? @oli-obk / @nikomatsakis cc @Mark-Simulacrum (on the rustbuild workaround)

4 years agoRollup merge of #63641 - DieracDelta:master, r=eddyb
Mazdak Farrokhzad [Sat, 17 Aug 2019 01:03:01 +0000 (03:03 +0200)]
Rollup merge of #63641 - DieracDelta:master, r=eddyb

add git keyword to submodule comments in config.example.toml

I searched over config.example.toml file looking for a place to disable git submodules from being updated, and missed the two options related to this because they did not include the keyword git. This pr simply adds git to the relevant comments so hopefully others won't also miss that these options exist.

4 years agoRollup merge of #63558 - jgalenson:move-remap, r=alexcrichton
Mazdak Farrokhzad [Sat, 17 Aug 2019 01:02:59 +0000 (03:02 +0200)]
Rollup merge of #63558 - jgalenson:move-remap, r=alexcrichton

Remap paths for proc-macro crates.

The remap-debuginfo config option remaps paths in most crates, but it does not apply to proc-macros, so they are still non-reproducible.  This patch fixes that.

I'm not completely sure if this is the best way to do this, but to get reproducible builds we need librustc_macros to be built with --remap-path-prefix.  I was previously modifying Cargo to pass that argument to all child crates, so this seems simpler and more correct.

I did not add a test since there do not seem to be any existing tests for RUSTC_DEBUGINFO_MAP.

r? @alexcrichton

4 years agoRollup merge of #63548 - eddyb:unicode-demangling, r=alexcrichton
Mazdak Farrokhzad [Sat, 17 Aug 2019 01:02:57 +0000 (03:02 +0200)]
Rollup merge of #63548 - eddyb:unicode-demangling, r=alexcrichton

Update rustc-demangle to 0.1.16.

Includes https://github.com/alexcrichton/rustc-demangle/pull/29 and https://github.com/alexcrichton/rustc-demangle/pull/30.
You can see the effects of the former in the testcase changes.

r? @alexcrichton cc @davidtwco @michaelwoerister

4 years agoRollup merge of #63545 - Centril:gate-yield-preexp, r=oli-obk
Mazdak Farrokhzad [Sat, 17 Aug 2019 01:02:56 +0000 (03:02 +0200)]
Rollup merge of #63545 - Centril:gate-yield-preexp, r=oli-obk

Feature gate 'yield $expr?' pre-expansion

Also improve the overall ergonomics of pre-expansion gating in general.

r? @Zoxc

4 years agoRollup merge of #63149 - petrochenkov:lazypop2, r=eddyb
Mazdak Farrokhzad [Sat, 17 Aug 2019 01:02:54 +0000 (03:02 +0200)]
Rollup merge of #63149 - petrochenkov:lazypop2, r=eddyb

resolve: Populate external modules in more automatic and lazy way

So, resolve had this function `populate_module_if_necessary` for loading module children from other crates from metadata.
I never really understood when it should've been called and when not.
This PR removes the function and loads the module children automatically on the first access instead.

r? @eddyb

4 years agoAuto merge of #63640 - Centril:rollup-yeb8o66, r=Centril
bors [Fri, 16 Aug 2019 18:35:17 +0000 (18:35 +0000)]
Auto merge of #63640 - Centril:rollup-yeb8o66, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #60492 (Add custom nth_back for Chain)
 - #61780 (Finalize the error type for `try_reserve`)
 - #63495 ( Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`.)
 - #63525 (Make sure that all file loading happens via SourceMap)
 - #63595 (add sparc64-unknown-openbsd target)
 - #63604 (Some update for vxWorks)
 - #63613 (Hygienize use of built-in macros in the standard library)
 - #63632 (A couple of comment fixes.)
 - #63634 (ci: properly set the job name in CPU stats)
 - #63636 (ci: move linkcheck from mingw-2 to mingw-1)

Failed merges:

r? @ghost

4 years agoFix rebase
Vadim Petrochenkov [Fri, 16 Aug 2019 18:19:43 +0000 (21:19 +0300)]
Fix rebase

Move some code into `build_reduced_graph.rs` to keep `BuildReducedGraphVisitor` it private
Also move the def collector call to `build_reduced_graph.rs`, it belongs there.

4 years agoresolve: Move some code around
Vadim Petrochenkov [Thu, 15 Aug 2019 22:18:14 +0000 (01:18 +0300)]
resolve: Move some code around

4 years agoresolve: Populate external traits lazily as well
Vadim Petrochenkov [Thu, 15 Aug 2019 22:15:36 +0000 (01:15 +0300)]
resolve: Populate external traits lazily as well

4 years agoresolve: Populate external modules in more automatic and lazy way
Vadim Petrochenkov [Mon, 29 Jul 2019 18:19:50 +0000 (21:19 +0300)]
resolve: Populate external modules in more automatic and lazy way

The modules are now populated implicitly on the first access

4 years agoSimplify pre-expansion gating in general.
Mazdak Farrokhzad [Wed, 14 Aug 2019 04:09:11 +0000 (06:09 +0200)]
Simplify pre-expansion gating in general.

4 years agoFeature gate 'yield ?' pre-expansion.
Mazdak Farrokhzad [Wed, 14 Aug 2019 03:44:32 +0000 (05:44 +0200)]
Feature gate 'yield ?' pre-expansion.

4 years agorustbuild: work around the stdarch cfg(bootstrap) bug.
Eduard-Mihai Burtescu [Fri, 16 Aug 2019 17:12:10 +0000 (20:12 +0300)]
rustbuild: work around the stdarch cfg(bootstrap) bug.

4 years agoRename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.
Eduard-Mihai Burtescu [Fri, 16 Aug 2019 17:02:31 +0000 (20:02 +0300)]
Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.

4 years agoadd git keyword to submodule option
Justin Restivo [Fri, 16 Aug 2019 16:39:45 +0000 (12:39 -0400)]
add git keyword to submodule option

4 years agoRollup merge of #63636 - pietroalbini:ci-mingw, r=alexcrichton
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:34 +0000 (18:22 +0200)]
Rollup merge of #63636 - pietroalbini:ci-mingw, r=alexcrichton

ci: move linkcheck from mingw-2 to mingw-1

Running UI tests now takes a huge amount of time on mingw builders
(between 40 and 50 minutes), with mingw-1 builders taking even an hour
less to finish than mingw-2. This PR moves linkcheck from mingw-2 to
mingw-1, removing between 10 and 20 minutes of runtime on the -2
builders.

r? @alexcrichton

4 years agoRollup merge of #63634 - pietroalbini:cpu-stats-name, r=alexcrichton
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:33 +0000 (18:22 +0200)]
Rollup merge of #63634 - pietroalbini:cpu-stats-name, r=alexcrichton

ci: properly set the job name in CPU stats

r? @alexcrichton

4 years agoRollup merge of #63632 - vext01:vext01-comment-fixes, r=eddyb
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:31 +0000 (18:22 +0200)]
Rollup merge of #63632 - vext01:vext01-comment-fixes, r=eddyb

A couple of comment fixes.

This change fixes a couple of comments in the compiler code.

The first change was discussed with @eddyb. This one confused me because I thought only *public* defs were in the table (not so).

The second was a typo I noticed yesterday.

OK to go in?

4 years agoRollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichton
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:30 +0000 (18:22 +0200)]
Rollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichton

Hygienize use of built-in macros in the standard library

Same as https://github.com/rust-lang/rust/pull/61629, but for built-in macros.

Closes https://github.com/rust-lang/rust/issues/48781
r? @alexcrichton

4 years agoRollup merge of #63604 - Wind-River:master, r=alexcrichton
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:28 +0000 (18:22 +0200)]
Rollup merge of #63604 - Wind-River:master, r=alexcrichton

Some update for vxWorks

1. support crt-static
2. change armv7_wrs_vxworks to armv7_wrs_vxworks_eabihf.
3. change vx-cxx to wr-c++,  vx-ar to wr-ar and vx-run to wr-run.
4. code cleanup

r? @alexcrichton

4 years agoRollup merge of #63595 - semarie:openbsd-sparc64, r=alexcrichton
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:26 +0000 (18:22 +0200)]
Rollup merge of #63595 - semarie:openbsd-sparc64, r=alexcrichton

add sparc64-unknown-openbsd target

on OpenBSD, some architectures relies on libc++ (from LLVM) and some
others on libestdc++ (particular version of libstdc++ from GCC).

sparc64-unknown-openbsd needs libestdc++ and libgcc (as x86_64 some
years ago). Reintroduce the support of them for openbsd, only for
sparc64 arch. Some others architectures on OpenBSD could use them too.

4 years agoRollup merge of #63525 - matklad:centraliza-file-loading, r=petrochenkov
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:24 +0000 (18:22 +0200)]
Rollup merge of #63525 - matklad:centraliza-file-loading, r=petrochenkov

Make sure that all file loading happens via SourceMap

That way, callers don't need to repeat "let's add this to sm manually
for tracking dependencies" trick.

It should make it easier to switch to using `FileLoader` for binary
files in the future as well

cc #62948

r? @petrochenkov

4 years agoRollup merge of #63495 - eddyb:mir-constant-ty, r=oli-obk
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:23 +0000 (18:22 +0200)]
Rollup merge of #63495 - eddyb:mir-constant-ty, r=oli-obk

 Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`.

Fixes #56137.

As a side-effect, associated const literals have the correct type now, which should make things easier for #61041.

r? @oli-obk / @matthewjasper cc @davidtwco @varkor

4 years agoRollup merge of #61780 - SimonSapin:container-error, r=Amanieu
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:21 +0000 (18:22 +0200)]
Rollup merge of #61780 - SimonSapin:container-error, r=Amanieu

Finalize the error type for `try_reserve`

See tracking issue comments from https://github.com/rust-lang/rust/issues/48043#issuecomment-500828346.

It is now:

```rust
/// The error type for `try_reserve` methods.
#[derive(Clone, PartialEq, Eq, Debug)]
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub enum TryReserveError {
    /// Error due to the computed capacity exceeding the collection's maximum
    /// (usually `isize::MAX` bytes).
    CapacityOverflow,

    /// The memory allocator returned an error
    AllocError {
        /// The layout of allocation request that failed
        layout: Layout,

        #[doc(hidden)]
        #[unstable(feature = "container_error_extra", issue = "0", reason = "\
            Enable exposing the allocator’s custom error value \
            if an associated type is added in the future: \
            https://github.com/rust-lang/wg-allocators/issues/23")]
        non_exhaustive: (),
    },
}

#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
impl From<LayoutErr> for TryReserveError {
    #[inline]
    fn from(_: LayoutErr) -> Self {
        TryReserveError::CapacityOverflow
    }
}
```

Changes:

* A `Layout` is included. Firefox wants to log the size of failed allocations. If this were not part of the return value of e.g. `HashMap::try_reserve`, users would only be able to estimate based on `HashMap::capacity` and assumptions about the allocation strategy of `HashMap`.

* There’s a dummy field that can stay unstable when `try_reserve` and the rest of this enum are stabilized. This forces non-exhaustive matching ~(https://github.com/rust-lang/rust/issues/44109 is not implemented yet for variants)~ and allows adding another field in the future if we want to expose custom error values from the allocator. See https://github.com/rust-lang/wg-allocators/issues/23.

  - If the `Alloc` trait is stabilized without an associated error type and with a zero-size `AllocErr` type, we can simply remove this dummy field.
  - If an associated type is added, we can add a default type parameter to `ContainerError` and a generic field to the `AllocError` variant.

* ~Moved from the `collections` module to the `alloc` module, and replaced `Collection` in the enum name with `Container`. The wold collection implies a multiplicity of items which is not relevant to this type. For example we may want to use this error type in a future `Box::try_new` method.~

  - Renamed to `TryReserveError`, after the methods that involve this type: https://github.com/rust-lang/rust/pull/61780#issuecomment-501392487

* Replaced `Err` with `Error` in the enum and variant names. There is more precedent for this in https://doc.rust-lang.org/std/error/trait.Error.html#implementors, `AllocErr` and `LayoutErr` are the odd ones.

* ~Dropped `Alloc` in the enum name. `ContainerAllocError` with a mouthful, and being in the `alloc` module already provides the same indication.~

4 years agoRollup merge of #60492 - acrrd:issues/54054_chain, r=SimonSapin
Mazdak Farrokhzad [Fri, 16 Aug 2019 16:22:20 +0000 (18:22 +0200)]
Rollup merge of #60492 - acrrd:issues/54054_chain, r=SimonSapin

Add custom nth_back for Chain

Implementation of nth_back for Chain.
Part of #54054

4 years agoAdd the Layout of the failed allocation to TryReserveError::AllocError
Simon Sapin [Wed, 12 Jun 2019 16:47:58 +0000 (18:47 +0200)]
Add the Layout of the failed allocation to TryReserveError::AllocError

… and add a separately-unstable field to force non-exhaustive matching
(`#[non_exhaustive]` is no implemented yet on enum variants)
so that we have the option to later expose the allocator’s error value.

CC https://github.com/rust-lang/wg-allocators/issues/23

4 years agoUpdate hashbrown to 0.5.0
Simon Sapin [Wed, 12 Jun 2019 16:31:32 +0000 (18:31 +0200)]
Update hashbrown to 0.5.0

4 years agoRename CollectionAllocError to TryReserveError
Simon Sapin [Wed, 12 Jun 2019 18:02:01 +0000 (20:02 +0200)]
Rename CollectionAllocError to TryReserveError

4 years agoRelax the safety condition for get_mut_unchecked
Simon Sapin [Fri, 16 Aug 2019 15:45:44 +0000 (17:45 +0200)]
Relax the safety condition for get_mut_unchecked

4 years agoReuse more internal Rc and Arc methods
Simon Sapin [Fri, 16 Aug 2019 15:44:24 +0000 (17:44 +0200)]
Reuse more internal Rc and Arc methods

4 years agoAdd a comment on the usage of Layout::new::<RcBox<()>>()
Simon Sapin [Mon, 5 Aug 2019 15:50:44 +0000 (17:50 +0200)]
Add a comment on the usage of Layout::new::<RcBox<()>>()

4 years agoAdd tracking issue numbers
Simon Sapin [Mon, 5 Aug 2019 15:45:30 +0000 (17:45 +0200)]
Add tracking issue numbers

4 years agoUse ManuallyDrop instead of mem::forget
Simon Sapin [Tue, 16 Jul 2019 07:17:35 +0000 (09:17 +0200)]
Use ManuallyDrop instead of mem::forget

Per https://github.com/rust-lang/rust/pull/62451#discussion_r303197278

4 years agoUse `alloc::Global` in `Box::new_uninit`
Simon Sapin [Tue, 16 Jul 2019 07:02:36 +0000 (09:02 +0200)]
Use `alloc::Global` in `Box::new_uninit`

4 years agoFix intra-rustdoc links
Simon Sapin [Sat, 6 Jul 2019 21:30:32 +0000 (23:30 +0200)]
Fix intra-rustdoc links

4 years agoMove constructors of boxed/rc’ed slices to matching `impl` blocks
Simon Sapin [Sat, 6 Jul 2019 19:52:15 +0000 (21:52 +0200)]
Move constructors of boxed/rc’ed slices to matching `impl` blocks

4 years agoAdd new_uninit_slice and assume_init on Box, Rc, and Arc of [T]
Simon Sapin [Sat, 6 Jul 2019 19:27:55 +0000 (21:27 +0200)]
Add new_uninit_slice and assume_init on Box, Rc, and Arc of [T]

4 years agoAdd new_uninit and assume_init on Box, Rc, and Arc
Simon Sapin [Sat, 6 Jul 2019 15:19:58 +0000 (17:19 +0200)]
Add new_uninit and assume_init on Box, Rc, and Arc

4 years agoAdd Rc::get_mut_unchecked, Arc::get_mut_unchecked
Simon Sapin [Sat, 6 Jul 2019 16:17:24 +0000 (18:17 +0200)]
Add Rc::get_mut_unchecked, Arc::get_mut_unchecked

4 years agoci: move linkcheck from mingw-2 to mingw-1
Pietro Albini [Fri, 16 Aug 2019 15:02:01 +0000 (17:02 +0200)]
ci: move linkcheck from mingw-2 to mingw-1

Running UI tests now takes a huge amount of time on mingw builders
(between 40 and 50 minutes), with mingw-1 builders taking even an hour
less to finish than mingw-2. This PR moves linkcheck from mingw-2 to
mingw-1, removing between 10 and 20 minutes of runtime on the -2
builders.