]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #61014 - jsgf:emit-artifact-type, r=alexcrichton
Mazdak Farrokhzad [Thu, 23 May 2019 06:37:12 +0000 (08:37 +0200)]
Rollup merge of #61014 - jsgf:emit-artifact-type, r=alexcrichton

Make -Zemit-artifact-notifications also emit the artifact type

This is easier for tooling to handle than trying to reverse-engineer the type from the filename extension. The field name and value is intended to reflect the `--emit` command-line option.

Related issues https://github.com/rust-lang/rust/issues/60988 https://github.com/rust-lang/rust/issues/58465
cc @alexcrichton

5 years agoRollup merge of #60981 - alexcrichton:update-compiler-builtins, r=cuviper
Mazdak Farrokhzad [Thu, 23 May 2019 06:37:11 +0000 (08:37 +0200)]
Rollup merge of #60981 - alexcrichton:update-compiler-builtins, r=cuviper

Bump compiler-builtins to 0.1.15

This commit bumps the `compiler-builtins` dependency to 0.1.15 which
expects to have the source for `compiler-rt` provided externally if the
`c` feature is enabled. This then plumbs through the necessary support
in the build system to ensure that if the `llvm-project` directory is
checked out and present that we enable the `c` feature of
`compiler-builtins` and compile in all the C intrinsics.

5 years agoAuto merge of #60740 - petrochenkov:kw, r=nnethercote
bors [Thu, 23 May 2019 01:50:55 +0000 (01:50 +0000)]
Auto merge of #60740 - petrochenkov:kw, r=nnethercote

Simplify use of keyword symbols

They mirror non-keyword symbols now (see https://github.com/rust-lang/rust/pull/60630).

`keywords::MyKeyword.name()` -> `kw::MyKeyword`
`keywords::MyKeyword.ident()` -> `Ident::with_empty_ctxt(kw::MyKeyword)` (not common)
`keywords::Invalid.ident()` -> `Ident::invalid()` (more common)

Keywords are simply `Symbol` constants now, the `Keyword` struct is eliminated.
This means `kw::MyKeyword` can now be used in `match` in particular.

5 years agoAuto merge of #61044 - Centril:rollup-ztsgb9p, r=Centril
bors [Wed, 22 May 2019 22:57:48 +0000 (22:57 +0000)]
Auto merge of #61044 - Centril:rollup-ztsgb9p, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #60300 (Allow null-pointer-optimized enums in FFI if their underlying representation is FFI safe)
 - #60773 (Always try to project predicates when finding auto traits in rustdoc)
 - #60809 (Add FAQ for NLL migration)
 - #61023 (Migrate from recursion to iterate on qualify consts visitor impl)
 - #61029 (Simplify RefCell minimum_spanning_tree example)
 - #61030 (Make maybe_codegen_consume_direct iterate instead of doing recursion)
 - #61034 (rustc_metadata: parametrize schema::CrateRoot by 'tcx and rip out old unused incremental infra.)
 - #61037 (Update clippy submodule)

Failed merges:

r? @ghost

5 years agoRestore the old behavior of the rustdoc keyword check + Fix rebase
Vadim Petrochenkov [Mon, 13 May 2019 19:46:20 +0000 (22:46 +0300)]
Restore the old behavior of the rustdoc keyword check + Fix rebase

5 years agoEliminate unnecessary `Ident::with_empty_ctxt`s
Vadim Petrochenkov [Sat, 11 May 2019 16:08:09 +0000 (19:08 +0300)]
Eliminate unnecessary `Ident::with_empty_ctxt`s

5 years agoSimplify use of keyword symbols
Vadim Petrochenkov [Sat, 11 May 2019 14:41:37 +0000 (17:41 +0300)]
Simplify use of keyword symbols

5 years agoRollup merge of #61037 - oli-obk:clippy, r=Manishearth
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:26 +0000 (18:08 +0200)]
Rollup merge of #61037 - oli-obk:clippy, r=Manishearth

Update clippy submodule

r? @Manishearth

If anyone is wondering where the odd old commits are coming from, we merged all beta backport commits and so into master in order to make sure we don't need to keep those branches around.

5 years agoRollup merge of #61034 - eddyb:soa-metadata-prereq, r=michaelwoerister
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:24 +0000 (18:08 +0200)]
Rollup merge of #61034 - eddyb:soa-metadata-prereq, r=michaelwoerister

rustc_metadata: parametrize schema::CrateRoot by 'tcx and rip out old unused incremental infra.

These are the first two commits of #59953, already reviewed and approved by @michaelwoerister.

r? @michaelwoerister

5 years agoRollup merge of #61030 - spastorino:make-operand-iterate, r=oli-obk
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:22 +0000 (18:08 +0200)]
Rollup merge of #61030 - spastorino:make-operand-iterate, r=oli-obk

Make maybe_codegen_consume_direct iterate instead of doing recursion

r? @oli-obk

5 years agoRollup merge of #61029 - blkerby:minimum_spanning_tree, r=alexcrichton
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:21 +0000 (18:08 +0200)]
Rollup merge of #61029 - blkerby:minimum_spanning_tree, r=alexcrichton

Simplify RefCell minimum_spanning_tree example

This simplifies the implementation of the `minimum_spanning_tree` example of `RefCell` in the `cell` module-level docs, avoiding an unnecessary recursive call. This also eliminates the need for a block to contain the scope of the borrow in this example. But since that use of a block served an important didactic purpose, we make up for this by instead introducing a block in the initial, simpler example of `RefCell`, where the point will hopefully be conveyed to the reader more easily.

5 years agoRollup merge of #61023 - spastorino:use-iterate-qualify-consts, r=oli-obk
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:19 +0000 (18:08 +0200)]
Rollup merge of #61023 - spastorino:use-iterate-qualify-consts, r=oli-obk

Migrate from recursion to iterate on qualify consts visitor impl

r? @oli-obk

5 years agoRollup merge of #60809 - jethrogb:jb/nll-faq, r=pnkfelix
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:17 +0000 (18:08 +0200)]
Rollup merge of #60809 - jethrogb:jb/nll-faq, r=pnkfelix

Add FAQ for NLL migration

r? @pnkfelix

cc @oli-obk @davidtwco @Centril Since you've provided feedback on the warning wording before.

5 years agoRollup merge of #60773 - Aaron1011:fix/rustdoc-project-all, r=eddyb
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:14 +0000 (18:08 +0200)]
Rollup merge of #60773 - Aaron1011:fix/rustdoc-project-all, r=eddyb

Always try to project predicates when finding auto traits in rustdoc

Fixes #60726

Previous, AutoTraitFinder would only try to project predicates when the
predicate type contained an inference variable. When finding auto
traits, we only project to try to unify inference variables - we don't
otherwise learn any new information about the required bounds.

However, this lead to failing to properly generate a negative auto trait
impl (indicating that a type never implements a certain auto trait) in
the following unusual scenario:

In almost all cases, a type has an (implicit) negative impl of an auto
trait due some other type having an explicit *negative* impl of that
auto trait. For example:

struct MyType<T> {
    field: *const T
}

has an implicit 'impl<T> !Send for MyType<T>', due to the explicit
negative impl (in libcore) 'impl<T: ?Sized> !Send for *const T'.

However, as exposed by the 'abi_stable' crate, this isn't always the
case. This minimzed example shows how a type can never implement
'Send', due to a projection error:

```
pub struct True;
pub struct False;

pub trait MyTrait {
    type Project;
}

pub struct MyStruct<T> {
    field: T
}

impl MyTrait for u8 {
    type Project = False;
}

unsafe impl<T> Send for MyStruct<T>
    where T: MyTrait<Project=True> {}

pub struct Wrapper {
    inner: MyStruct<u8>
}
```

In this example, `<u8 as MyTrait>::Project == True'
must hold for 'MyStruct<u8>: Send' to hold.
However, '<u8 as MyTrait>::Project == False' holds instead

To properly account for this unusual case, we need to call
'poly_project_and_unify' on *all* predicates, not just those with
inference variables. This ensures that we catch the projection error
that occurs above, and don't incorrectly determine that 'Wrapper: Send'
holds.

5 years agoRollup merge of #60300 - mjbshaw:ffi_types, r=rkruppe
Mazdak Farrokhzad [Wed, 22 May 2019 16:08:13 +0000 (18:08 +0200)]
Rollup merge of #60300 - mjbshaw:ffi_types, r=rkruppe

Allow null-pointer-optimized enums in FFI if their underlying representation is FFI safe

I'm not sure if this requires an RFC. I attempted to start [a discussion on internals.rust-lang.org](https://internals.rust-lang.org/t/options-ffi-safety-and-guarantees-for-abi-compatibility-with-nonnull-optimizations/9784) and when no one really objected I figured I'd go ahead and try implementing this.

This allows types like `Option<NonZeroU8>` to be used in FFI without triggering the `improper_ctypes` lint. This works by changing the `is_repr_nullable_ptr` function to consider an enum `E` to be FFI-safe if:

- `E` has no explicit `#[repr(...)]`.
- It only has two variants.
- One of those variants is empty (meaning it has no fields).
- The other variant has only one field.
- That field is one of the following:
  - `&T`
  - `&mut T`
  - `extern "C" fn`
  - `core::num::NonZero*`
  - `core::ptr::NonNull<T>`
  - `#[repr(transparent)] struct` wrapper around one of the types in this list.
- The size of `E` and its field are both known and are both the same size (implying `E` is participating in the nonnull optimization).

This logic seems consistent with [the Rust nomicon](https://doc.rust-lang.org/nomicon/repr-rust.html).

5 years agoBump compiler-builtins to 0.1.15
Alex Crichton [Mon, 20 May 2019 18:00:34 +0000 (11:00 -0700)]
Bump compiler-builtins to 0.1.15

This commit bumps the `compiler-builtins` dependency to 0.1.15 which
expects to have the source for `compiler-rt` provided externally if the
`c` feature is enabled. This then plumbs through the necessary support
in the build system to ensure that if the `llvm-project` directory is
checked out and present that we enable the `c` feature of
`compiler-builtins` and compile in all the C intrinsics.

5 years agoAllow null-pointer-optimized enums in FFI if their underlying representation is FFI...
Michael Bradshaw [Wed, 22 May 2019 13:49:43 +0000 (06:49 -0700)]
Allow null-pointer-optimized enums in FFI if their underlying representation is FFI safe

This allows types like Option<NonZeroU8> to be used in FFI without triggering the improper_ctypes lint. This works by changing the is_repr_nullable_ptr function to consider an enum E to be FFI-safe if:

- E has no explicit #[repr(...)].
- It only has two variants.
- One of those variants is empty (meaning it has no fields).
- The other variant has only one field.
- That field is one of the following:
  - &T
  - &mut T
  - extern "C" fn
  - core::num::NonZero*
  - core::ptr::NonNull<T>
  - #[repr(transparent)] struct wrapper around one of the types in this list.
- The size of E and its field are both known and are both the same size (implying E is participating in the nonnull optimization).

5 years agoMake maybe_codegen_consume_direct iterate instead of doing recursion
Santiago Pastorino [Wed, 22 May 2019 03:51:50 +0000 (05:51 +0200)]
Make maybe_codegen_consume_direct iterate instead of doing recursion

5 years agoUpdate clippy submodule
Oliver Scherer [Wed, 22 May 2019 11:12:37 +0000 (13:12 +0200)]
Update clippy submodule

5 years agorustc_metadata: rip out unused incremental infrastructure.
Eduard-Mihai Burtescu [Wed, 22 May 2019 09:16:48 +0000 (12:16 +0300)]
rustc_metadata: rip out unused incremental infrastructure.

5 years agorustc_metadata: parametrize schema::CrateRoot by 'tcx.
Eduard-Mihai Burtescu [Thu, 11 Apr 2019 07:22:02 +0000 (10:22 +0300)]
rustc_metadata: parametrize schema::CrateRoot by 'tcx.

5 years agoAuto merge of #59445 - alexreg:ban-multi-trait-objects-via-aliases, r=oli-obk
bors [Wed, 22 May 2019 08:22:17 +0000 (08:22 +0000)]
Auto merge of #59445 - alexreg:ban-multi-trait-objects-via-aliases, r=oli-obk

Ban multi-trait objects via trait aliases

Obviously, multi-trait objects are not normally supported, so they should not be supported via trait aliases.

This has been factored out from the previous PR https://github.com/rust-lang/rust/pull/55994 (see point 1).

r? @Centril

CC @nikomatsakis

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

### RELNOTES:

We now allow `dyn Send + fmt::Debug` with equivalent semantics to `dyn fmt::Debug + Send`.
That is, the order of the mentioned traits does not matter wrt. principal/not-principal traits.
This is a small change that might deserve a mention in the blog post because it is a language change but most likely not.

See https://github.com/rust-lang/rust/blob/ce2ee305f9165c037ecddddb5792588a15ff6c37/src/test/ui/traits/wf-trait-object-reverse-order.rs.

// @Centril

5 years agoAuto merge of #60840 - tmandry:preserve-scope-in-generator-mir, r=cramertj
bors [Wed, 22 May 2019 04:42:20 +0000 (04:42 +0000)]
Auto merge of #60840 - tmandry:preserve-scope-in-generator-mir, r=cramertj

Preserve local scopes in generator MIR

Part of #52924, depended upon by the generator layout optimization #60187.

This PR adds `StorageDead` statements in more places in generators, so we can see when non-`Drop` locals have gone out of scope and recover their storage.

The reason this is only done for generators is compiler performance. See https://github.com/rust-lang/rust/pull/60187#issuecomment-485637811 for what happens when we do this for all functions.

For `Drop` locals, we modify the `MaybeStorageLive` analysis to use `drop` to indicate that storage is no longer live for the local. Once `drop` returns or unwinds to our function, we implicitly assume that the local is `StorageDead`.

Instead of using `drop`, it is possible to emit more `StorageDead` statements in the MIR for `Drop` locals so we can handle all locals the same. I am fine with doing it that way, but this was the simplest approach for my purposes. It is also likely to be more performant.

r? @Zoxc (feel free to reassign)
cc @cramertj @eddyb @RalfJung @rust-lang/wg-async-await

5 years agoMigrate from recursion to iterate on qualify consts visitor impl
Santiago Pastorino [Tue, 21 May 2019 23:17:16 +0000 (01:17 +0200)]
Migrate from recursion to iterate on qualify consts visitor impl

5 years agoSimplify RefCell minimum_spanning_tree example
Brent Kerby [Wed, 22 May 2019 03:52:21 +0000 (21:52 -0600)]
Simplify RefCell minimum_spanning_tree example

5 years agoAuto merge of #61027 - Centril:rollup-oewauf1, r=Centril
bors [Wed, 22 May 2019 01:51:31 +0000 (01:51 +0000)]
Auto merge of #61027 - Centril:rollup-oewauf1, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #59742 (Move `edition` outside the hygiene lock and avoid accessing it)
 - #60581 (convert custom try macro to `?`)
 - #60963 (Update boxed::Box docs on memory layout)
 - #60973 (Avoid symbol interning in `file_metadata`.)
 - #60982 (Do not fail on child without DefId)
 - #60991 (LocalDecl push returns Local len)
 - #60995 (Add stream_to_parser_with_base_dir)
 - #60998 (static_assert: make use of anonymous constants)
 - #61003 (Remove impls for `InternedString`/string equality.)
 - #61006 (adjust deprecation date of mem::uninitialized)

Failed merges:

r? @ghost

5 years agoRollup merge of #61006 - RalfJung:maybe-uninit, r=Centril
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:43 +0000 (03:47 +0200)]
Rollup merge of #61006 - RalfJung:maybe-uninit, r=Centril

adjust deprecation date of mem::uninitialized

In https://github.com/rust-lang/rust/pull/60445 we [decided](https://github.com/rust-lang/rust/pull/60445#issuecomment-488626308) that we'd deprecate for 1.38 instead of 1.40, but I forgot to adjust for that.

5 years agoRollup merge of #61003 - nnethercote:rm-InternedString-PartialEq-impls, r=petrochenkov
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:41 +0000 (03:47 +0200)]
Rollup merge of #61003 - nnethercote:rm-InternedString-PartialEq-impls, r=petrochenkov

Remove impls for `InternedString`/string equality.

`Symbol` received the same treatment in #60630.

Also, we can derive `PartialEq` for `InternedString`.

r? @petrochenkov

5 years agoRollup merge of #60998 - RalfJung:static_assert, r=Centril
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:40 +0000 (03:47 +0200)]
Rollup merge of #60998 - RalfJung:static_assert, r=Centril

static_assert: make use of anonymous constants

5 years agoRollup merge of #60995 - topecongiro:parser-from-stream-and-base-dir, r=michaelwoerister
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:38 +0000 (03:47 +0200)]
Rollup merge of #60995 - topecongiro:parser-from-stream-and-base-dir, r=michaelwoerister

Add stream_to_parser_with_base_dir

This PR adds `stream_to_parser_with_base_dir`, which creates a parser from a token stream and a base directory.

Context: I would like to parse `cfg_if!` macro and get a list of modules defined inside it from rustfmt so that rustfmt can format those modules (cc https://github.com/rust-lang/rustfmt/issues/3253). To do so, I need to create a parser from `TokenStream` and set the directory of `Parser` to the same directory as the parent directory of a file which contains `cfg_if!` invocation. AFAIK there is no way to achieve this, and hence this PR.

Alternatively, I could change the visibility of `Parser.directory` from `crate` to `pub` so that the value can be modified after initializing a parser. I don't have a preference over either approach (or others, as long as it works).

5 years agoRollup merge of #60991 - spastorino:local-decls-push, r=oli-obk
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:37 +0000 (03:47 +0200)]
Rollup merge of #60991 - spastorino:local-decls-push, r=oli-obk

LocalDecl push returns Local len

r? @oli-obk

5 years agoRollup merge of #60982 - estebank:fix-60976, r=petrochenkov
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:35 +0000 (03:47 +0200)]
Rollup merge of #60982 - estebank:fix-60976, r=petrochenkov

Do not fail on child without DefId

Addresses https://github.com/rust-lang/rust/issues/60976, leaving open to come up with a repro case.

5 years agoRollup merge of #60973 - nnethercote:fix-file_metadata-more, r=michaelwoerister
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:34 +0000 (03:47 +0200)]
Rollup merge of #60973 - nnethercote:fix-file_metadata-more, r=michaelwoerister

Avoid symbol interning in `file_metadata`.

This commit changes `created_files` so it uses strings directly as keys,
rather than symbols derived from the strings. This avoids the cost of
having to do the hash table lookups to produce the symbols from the
strings.

The commit also uses `entry` to avoid doing a repeated hash table lookup
(`get` + `insert`).

Note that PR #60467 improved this code somewhat; this is a further
improvement.

r? @davidtwco

5 years agoRollup merge of #60963 - blkerby:boxed_docs, r=alexcrichton
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:32 +0000 (03:47 +0200)]
Rollup merge of #60963 - blkerby:boxed_docs, r=alexcrichton

Update boxed::Box docs on memory layout

The existing docs for the `Box` type state that "the way `Box` allocates and releases memory is unspecified", and that therefore the only valid pointer to pass to `Box::from_raw` is one obtained from `Box::into_raw`. This is inconsistent with the module-level docs which specify,

> It is valid to convert both ways between a Box and a raw pointer allocated with the Global allocator, given that the Layout used with the allocator is correct for the type. More precisely, a value: *mut T that has been allocated with the Global allocator with Layout::for_value(&*value) may be converted into a box using Box::<T>::from_raw(value). Conversely, the memory backing a value: *mut T obtained from Box::<T>::into_raw may be deallocated using the Global allocator with Layout::for_value(&*value).

This pull request updates the docs for `Box` to make them consistent with the module-level docs and adds some examples of how to use the global allocator in conjunction with `Box::from_raw` and `Box::into_raw`.

5 years agoRollup merge of #60581 - hellow554:fix_60580, r=alexcrichton
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:31 +0000 (03:47 +0200)]
Rollup merge of #60581 - hellow554:fix_60580, r=alexcrichton

convert custom try macro to `?`

resolves #60580

r? @frewsxcv

5 years agoRollup merge of #59742 - Zoxc:edition-cleanup, r=petrochenkov
Mazdak Farrokhzad [Wed, 22 May 2019 01:47:29 +0000 (03:47 +0200)]
Rollup merge of #59742 - Zoxc:edition-cleanup, r=petrochenkov

Move `edition` outside the hygiene lock and avoid accessing it

r? @petrochenkov

5 years agoAuto merge of #61007 - michaelwoerister:limited-debuginfo, r=alexcrichton
bors [Tue, 21 May 2019 21:37:41 +0000 (21:37 +0000)]
Auto merge of #61007 - michaelwoerister:limited-debuginfo, r=alexcrichton

debuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1

https://github.com/rust-lang/rust/commit/cff075009 made LLVM emit less debuginfo when compiling with "line-tables-only". The change was essentially correct but the reduced amount of debuginfo broke
a number of tools.

This commit reverts the change so we get back the old behavior, until we figure out how to do this properly and give external tools to adapt to the new format.

See https://github.com/rust-lang/rust/issues/60020 for more info.

r? @cuviper
cc @jrmuizel & @froydnj

5 years agoMake -Zemit-artifact-notifications also emit the artifact type
Jeremy Fitzhardinge [Tue, 21 May 2019 19:38:46 +0000 (12:38 -0700)]
Make -Zemit-artifact-notifications also emit the artifact type

This is easier for tooling to handle than trying to reverse-engineer it from the filename extension.

5 years agoAdd FAQ for NLL migration
Jethro Beekman [Tue, 14 May 2019 00:09:30 +0000 (17:09 -0700)]
Add FAQ for NLL migration

5 years agoSpecify the edition for the rustdoc thread-pool
John Kåre Alsaker [Mon, 20 May 2019 01:39:48 +0000 (03:39 +0200)]
Specify the edition for the rustdoc thread-pool

5 years agoMove `edition` outside the hygiene lock and avoid accessing it
John Kåre Alsaker [Fri, 5 Apr 2019 22:15:49 +0000 (00:15 +0200)]
Move `edition` outside the hygiene lock and avoid accessing it

5 years agoupdate doc comment
Ralf Jung [Tue, 21 May 2019 15:14:09 +0000 (17:14 +0200)]
update doc comment

5 years agoFix tidy: remove a trailing whitespace
topecongiro [Tue, 21 May 2019 14:17:59 +0000 (23:17 +0900)]
Fix tidy: remove a trailing whitespace

5 years agoAdd doc comment
topecongiro [Tue, 21 May 2019 13:57:34 +0000 (22:57 +0900)]
Add doc comment

5 years agodebuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1.
Michael Woerister [Tue, 21 May 2019 11:41:44 +0000 (13:41 +0200)]
debuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1.

https://github.com/rust-lang/rust/commit/cff075009 made LLVM emit
less debuginfo when compiling with "line-tables-only". The change
was essentially correct but the reduced amount of debuginfo broke
a number of tools.

This commit reverts the change so we get back the old behavior,
until we figure out how to do this properly and give external
tools to adapt to the new format.

See https://github.com/rust-lang/rust/issues/60020 for more info.

5 years agoadjust deprecation date of mem::uninitialized
Ralf Jung [Tue, 21 May 2019 11:10:28 +0000 (13:10 +0200)]
adjust deprecation date of mem::uninitialized

5 years agoRemove impls for `InternedString`/string equality.
Nicholas Nethercote [Tue, 14 May 2019 20:32:44 +0000 (06:32 +1000)]
Remove impls for `InternedString`/string equality.

`Symbol` received the same treatment in #60630.

Also, we can derive `PartialEq` for `InternedString`.

5 years agostatic_assert: make use of anonymous constants
Ralf Jung [Tue, 21 May 2019 06:51:18 +0000 (08:51 +0200)]
static_assert: make use of anonymous constants

5 years agoAuto merge of #60903 - nnethercote:mv-gensyms-from-Symbol-to-Ident, r=petrochenkov
bors [Tue, 21 May 2019 06:37:03 +0000 (06:37 +0000)]
Auto merge of #60903 - nnethercote:mv-gensyms-from-Symbol-to-Ident, r=petrochenkov

Move gensym operations from `Symbol` to `Ident`

Gensyms are always at the `Ident` level, and long-term we probably want to record gensym-ness in hygiene data.

r? @petrochenkov

5 years agoAdd stream_to_parser_with_base_dir
topecongiro [Tue, 21 May 2019 04:18:20 +0000 (13:18 +0900)]
Add stream_to_parser_with_base_dir

5 years agoAuto merge of #60950 - taiki-e:arbitrary_self_types-tests, r=Centril
bors [Tue, 21 May 2019 03:44:09 +0000 (03:44 +0000)]
Auto merge of #60950 - taiki-e:arbitrary_self_types-tests, r=Centril

Move arbitrary self types's tests into ui/self

https://github.com/rust-lang/rust/pull/60944#discussion_r285362006

r? @Centril

5 years agoCreate and reference Memory Layout section of boxed docs
Brent Kerby [Tue, 21 May 2019 03:03:40 +0000 (21:03 -0600)]
Create and reference Memory Layout section of boxed docs

5 years agoAuto merge of #60985 - cr1901:msp430-fix, r=alexcrichton
bors [Tue, 21 May 2019 00:50:12 +0000 (00:50 +0000)]
Auto merge of #60985 - cr1901:msp430-fix, r=alexcrichton

Bump LLVM submodule to fix MSP430 AsmPrinter and assembler syntax mismatch.

Moving on to steps 9 and 10 of the llvm bugfix [guide](https://rust-lang.github.io/rustc-guide/codegen/updating-llvm.html#bugfix-updates), now that Rust's copy of LLVM was [updated](https://github.com/rust-lang/llvm-project/pull/13).

This PR closes issue #59077. Nightlies following this PR should have working msp430 codegen again :D.

Thanks for the prompt response even though it took me a while to get this "simple" PR done!

5 years agoLocalDecl push returns Local len
Santiago Pastorino [Mon, 20 May 2019 23:13:58 +0000 (20:13 -0300)]
LocalDecl push returns Local len

5 years agoAuto merge of #60986 - Centril:rollup-nhpgrfb, r=Centril
bors [Mon, 20 May 2019 21:38:19 +0000 (21:38 +0000)]
Auto merge of #60986 - Centril:rollup-nhpgrfb, r=Centril

Rollup of 11 pull requests

Successful merges:

 - #60383 (Fix position source code files toggle)
 - #60453 (Fall back to `/dev/urandom` on `EPERM` for `getrandom`)
 - #60487 (Fix search sidebar width when no crate select is present)
 - #60511 (Fix intra-doc link resolution failure on re-exporting libstd)
 - #60823 (Fix incremental compilation of cdylib emitting spurious unused_attributes lint)
 - #60915 (stable hashing: Remove unused field and add documentation.)
 - #60942 (Misc changes to rustc_metadata)
 - #60952 (Document BinaryHeap time complexity)
 - #60959 (rustc: Improve type size assertions)
 - #60972 (remove confusing remarks about mixed volatile and non-volatile accesses)
 - #60983 (Set -funwind-tables and -fno-exceptions unconditionally for LLVM's libunwind)

Failed merges:

r? @ghost

5 years agoRollup merge of #60983 - petrhosek:libunwind-no-exceptions, r=alexcrichton
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:10 +0000 (23:03 +0200)]
Rollup merge of #60983 - petrhosek:libunwind-no-exceptions, r=alexcrichton

Set -funwind-tables and -fno-exceptions unconditionally for LLVM's libunwind

These are required otherwise libunwind will end up with undefined
references to __gxx_personality_v0 which is provided by C++ ABI
library and that's undesirable.

5 years agoRollup merge of #60972 - RalfJung:volatile, r=alexcrichton
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:08 +0000 (23:03 +0200)]
Rollup merge of #60972 - RalfJung:volatile, r=alexcrichton

remove confusing remarks about mixed volatile and non-volatile accesses

These comments were originally added by @ecstatic-morse in https://github.com/rust-lang/rust/commit/911d35f0bfd207112806eaec2763201dad06d1c7 and then later edited by me. The intention, I think, was to make sure people do both their reads and writes with these methods if the affected memory really is used for communication with external devices.

However, [people read this as saying that mixed volatile/non-volatile accesses are UB](https://github.com/rust-lang/rust/issues/58599#issuecomment-493791130), which -- to my knowledge -- they are not. So better remove this.

Cc @rkruppe @rust-lang/wg-unsafe-code-guidelines

5 years agoRollup merge of #60959 - petrochenkov:sassert, r=estebank
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:07 +0000 (23:03 +0200)]
Rollup merge of #60959 - petrochenkov:sassert, r=estebank

rustc: Improve type size assertions

Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier

```
   ::: src\libsyntax\parse\token.rs:223:1
    |
223 |    static_assert_size!(Token, 123);
    |    -------------------------------- in this macro invocation
    |
    = note: expected type `[(); 123]`
               found type `[(); 16]`
```

5 years agoRollup merge of #60952 - dtolnay:heap, r=Amanieu
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:06 +0000 (23:03 +0200)]
Rollup merge of #60952 - dtolnay:heap, r=Amanieu

Document BinaryHeap time complexity

I went into some detail on the time complexity of `push` because it is relevant for using BinaryHeap efficiently -- specifically that you should avoid pushing many elements in ascending order when possible.

r? @Amanieu
Closes #47976. Closes #59698.

5 years agoRollup merge of #60942 - bjorn3:metadata_loader_refactor, r=michaelwoerister
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:03 +0000 (23:03 +0200)]
Rollup merge of #60942 - bjorn3:metadata_loader_refactor, r=michaelwoerister

Misc changes to rustc_metadata

5 years agoRollup merge of #60915 - michaelwoerister:hashstablestuff, r=estebank
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:02 +0000 (23:03 +0200)]
Rollup merge of #60915 - michaelwoerister:hashstablestuff, r=estebank

stable hashing: Remove unused field and add documentation.

This PR removes the `bytes_hashed` field from `StableHasher` which in the past has been used for collecting some statistics but has gone unused for quite a while (months at least) now.

The PR also tries to document some requirements for `HashStable` implementations that haven't been written down explicitly anywhere.

5 years agoRollup merge of #60823 - oli-obk:used_unused_no_mangle, r=michaelwoerister
Mazdak Farrokhzad [Mon, 20 May 2019 21:03:00 +0000 (23:03 +0200)]
Rollup merge of #60823 - oli-obk:used_unused_no_mangle, r=michaelwoerister

Fix incremental compilation of cdylib emitting spurious unused_attributes lint

fixes #60050

5 years agoRollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPC
Mazdak Farrokhzad [Mon, 20 May 2019 21:02:59 +0000 (23:02 +0200)]
Rollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPC

Fix intra-doc link resolution failure on re-exporting libstd

Currently, re-exporting libstd items as below will [occur a lot of failures](https://gist.github.com/taiki-e/e33e0e8631ef47f65a74a3b69f456366).
```rust
pub use std::*;
```

Until the underlying issue (#56922) fixed, we can fix that so they don't propagate to downstream crates.

Related: https://github.com/rust-lang/rust/pull/56941 (That PR fixed failures that occur when re-exporting from libcore to libstd.)

r? @QuietMisdreavus

5 years agoRollup merge of #60487 - GuillaumeGomez:fix-search-sidebar-width-colors, r=Dylan-DPC
Mazdak Farrokhzad [Mon, 20 May 2019 21:02:57 +0000 (23:02 +0200)]
Rollup merge of #60487 - GuillaumeGomez:fix-search-sidebar-width-colors, r=Dylan-DPC

Fix search sidebar width when no crate select is present

Fixes #60480.

I also fixed the box-shadow that seemed to have been kind of removed?

r? @QuietMisdreavus

5 years agoRollup merge of #60453 - tbu-:pr_getrandom_enoperm, r=sfackler
Mazdak Farrokhzad [Mon, 20 May 2019 21:02:55 +0000 (23:02 +0200)]
Rollup merge of #60453 - tbu-:pr_getrandom_enoperm, r=sfackler

Fall back to `/dev/urandom` on `EPERM` for `getrandom`

This can happen because of seccomp or some VMs.

Fixes #52609.

5 years agoRollup merge of #60383 - GuillaumeGomez:fix-position-source-code-files-toggle, r...
Mazdak Farrokhzad [Mon, 20 May 2019 21:02:52 +0000 (23:02 +0200)]
Rollup merge of #60383 - GuillaumeGomez:fix-position-source-code-files-toggle, r=Manishearth

Fix position source code files toggle

Fixes #60381.

The second commit is a big cleanup of the media queries.

r? @rust-lang/rustdoc

cc @Manishearth

screenshot of the fix:

<img width="501" alt="Screenshot 2019-04-29 at 23 42 56" src="https://user-images.githubusercontent.com/3050060/56929111-112b2b00-6ad9-11e9-9a23-e0a8e3641395.png">

5 years agoFix MSP430 AsmPrinter and assembler syntax mismatch.
William D. Jones [Mon, 20 May 2019 19:27:11 +0000 (15:27 -0400)]
Fix MSP430 AsmPrinter and assembler syntax mismatch.

5 years agoSet -funwind-tables and -fno-exceptions unconditionally for LLVM's libunwind
Petr Hosek [Mon, 20 May 2019 19:27:15 +0000 (12:27 -0700)]
Set -funwind-tables and -fno-exceptions unconditionally for LLVM's libunwind

These are required otherwise libunwind will end up with undefined
references to __gxx_personality_v0 which is provided by C++ ABI
library and that's undesirable.

5 years agoDo not fail on child without DefId
Esteban Küber [Mon, 20 May 2019 18:46:44 +0000 (11:46 -0700)]
Do not fail on child without DefId

5 years agoFixed nits raised in review.
Alexander Regueiro [Mon, 20 May 2019 15:19:34 +0000 (16:19 +0100)]
Fixed nits raised in review.

5 years agoReinstated shallow disallowing of maybe bounds in trait objects.
Alexander Regueiro [Sun, 19 May 2019 21:26:42 +0000 (22:26 +0100)]
Reinstated shallow disallowing of maybe bounds in trait objects.

5 years agoAddressed more points raised in review.
Alexander Regueiro [Mon, 13 May 2019 18:51:33 +0000 (19:51 +0100)]
Addressed more points raised in review.

5 years agoAddressed more points raised in review.
Alexander Regueiro [Thu, 2 May 2019 17:03:29 +0000 (18:03 +0100)]
Addressed more points raised in review.

5 years agoAddressed points raised in review.
Alexander Regueiro [Thu, 2 May 2019 01:21:20 +0000 (02:21 +0100)]
Addressed points raised in review.

5 years agoUpdate tests.
Alexander Regueiro [Sat, 30 Mar 2019 22:06:09 +0000 (22:06 +0000)]
Update tests.

5 years agoFixed detection of multiple non-auto traits.
Alexander Regueiro [Mon, 29 Apr 2019 02:58:24 +0000 (03:58 +0100)]
Fixed detection of multiple non-auto traits.

5 years agoFactored out part of `conv_object_ty_poly_trait_ref` method.
Alexander Regueiro [Thu, 28 Mar 2019 01:29:31 +0000 (01:29 +0000)]
Factored out part of `conv_object_ty_poly_trait_ref` method.

5 years agoAddressed review points.
Alexander Regueiro [Wed, 27 Mar 2019 15:14:41 +0000 (15:14 +0000)]
Addressed review points.

5 years agoUpdate tests.
Alexander Regueiro [Tue, 26 Mar 2019 17:23:09 +0000 (17:23 +0000)]
Update tests.

5 years agoBan multi-trait objects via trait aliases.
Alexander Regueiro [Tue, 26 Mar 2019 17:34:32 +0000 (17:34 +0000)]
Ban multi-trait objects via trait aliases.

5 years agoAccumulation of various drive-by cosmetic changes.
Alexander Regueiro [Mon, 29 Apr 2019 02:54:03 +0000 (03:54 +0100)]
Accumulation of various drive-by cosmetic changes.

5 years agoAuto merge of #60445 - RalfJung:maybe-uninit, r=Centril
bors [Mon, 20 May 2019 15:05:04 +0000 (15:05 +0000)]
Auto merge of #60445 - RalfJung:maybe-uninit, r=Centril

stabilize core parts of MaybeUninit

and deprecate mem::uninitialized in the future (1.40.0). This is part of implementing https://github.com/rust-lang/rfcs/pull/1892.

Also expand the documentation a bit.

This type is currently primarily useful when dealing with partially initialized arrays. In libstd, it is used e.g. in `BTreeMap` (with some unstable APIs that however can all be replaced, less ergonomically, by stable ones). What we stabilize should also be enough for `SmallVec` (Cc @bluss).

Making this useful for structs requires https://github.com/rust-lang/rfcs/pull/2582 or a commitment that references to uninitialized data are not insta-UB.

5 years agoRemove trailing whitespaces to satisfy tidy
Brent Kerby [Sun, 19 May 2019 23:47:18 +0000 (17:47 -0600)]
Remove trailing whitespaces to satisfy tidy

5 years agoUpdate boxed::Box docs on memory layout
Brent Kerby [Sun, 19 May 2019 15:21:03 +0000 (09:21 -0600)]
Update boxed::Box docs on memory layout

5 years agoAvoid symbol interning in `file_metadata`.
Nicholas Nethercote [Mon, 6 May 2019 01:47:03 +0000 (11:47 +1000)]
Avoid symbol interning in `file_metadata`.

This commit changes `created_files` so it uses strings directly as keys,
rather than symbols derived from the strings. This avoids the cost of
having to do the hash table lookups to produce the symbols from the
strings.

The commit also uses `entry` to avoid doing a repeated hash table lookup
(`get` + `insert`).

Note that PR #60467 improved this code somewhat; this is a further
improvement.

5 years agoupdate miri
Ralf Jung [Mon, 20 May 2019 08:54:36 +0000 (10:54 +0200)]
update miri

5 years agoDocument layout guarantee of MaybeUninit
Peter Todd [Mon, 6 May 2019 21:39:39 +0000 (17:39 -0400)]
Document layout guarantee of MaybeUninit

5 years agoelliminate mem::uninitialize from docs in libcore
Ralf Jung [Wed, 8 May 2019 12:24:14 +0000 (14:24 +0200)]
elliminate mem::uninitialize from docs in libcore

5 years agoadd out-pointer example
Ralf Jung [Sat, 4 May 2019 09:14:58 +0000 (11:14 +0200)]
add out-pointer example

5 years agoapply feedback
Ralf Jung [Thu, 2 May 2019 14:50:56 +0000 (16:50 +0200)]
apply feedback

5 years agostabilize core parts of MaybeUninit and deprecate mem::uninitialized in the future
Ralf Jung [Wed, 1 May 2019 17:39:52 +0000 (19:39 +0200)]
stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the future

Also expand the documentation a bit

5 years agoDocument requirements for HashStable implementations better.
Michael Woerister [Fri, 17 May 2019 13:28:45 +0000 (15:28 +0200)]
Document requirements for HashStable implementations better.

5 years agoAuto merge of #60921 - cuviper:remove-mpsc_select, r=SimonSapin
bors [Mon, 20 May 2019 08:30:17 +0000 (08:30 +0000)]
Auto merge of #60921 - cuviper:remove-mpsc_select, r=SimonSapin

Remove the unstable and deprecated mpsc_select

This removes macro `select!` and `std::sync::mpsc::{Handle, Select}`,
which were all unstable and have been deprecated since 1.32.

Closes #27800
r? @SimonSapin

5 years agoremove confusing remarks about mixed volatile and non-volatile accesses
Ralf Jung [Mon, 20 May 2019 07:50:37 +0000 (09:50 +0200)]
remove confusing remarks about mixed volatile and non-volatile accesses

5 years agoRemove `Symbol::gensym()`.
Nicholas Nethercote [Fri, 17 May 2019 00:44:51 +0000 (10:44 +1000)]
Remove `Symbol::gensym()`.

5 years agoEliminate `Symbol::gensymed`.
Nicholas Nethercote [Fri, 17 May 2019 00:27:17 +0000 (10:27 +1000)]
Eliminate `Symbol::gensymed`.

5 years agoMove `is_gensymed` from `Symbol` to `Ident`.
Nicholas Nethercote [Thu, 16 May 2019 23:35:26 +0000 (09:35 +1000)]
Move `is_gensymed` from `Symbol` to `Ident`.

Note that the `is_gensymed` call on `primitive_types` is unnecessary
because that table only contains the name of primitive types (e.g.
`i32`) and never contains gensyms.

5 years agoAuto merge of #60815 - nnethercote:use-Symbol-more-2, r=petrochenkov
bors [Mon, 20 May 2019 03:36:43 +0000 (03:36 +0000)]
Auto merge of #60815 - nnethercote:use-Symbol-more-2, r=petrochenkov

Use `Symbol` even more

These patches simplify the code a bit (fewer conversions) and also speed things up a bit (fewer `with_interner` calls).

r? @petrochenkov

5 years agoAuto merge of #60969 - Centril:rollup-3j71mqj, r=Centril
bors [Mon, 20 May 2019 00:37:48 +0000 (00:37 +0000)]
Auto merge of #60969 - Centril:rollup-3j71mqj, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #60590 (Test interaction of unions with non-zero/niche-filling optimization)
 - #60745 (Perform constant propagation into terminators)
 - #60895 (Enable thumbv7a-pc-windows-msvc target build end to end in rust/master)
 - #60908 (Fix lints handling in rustdoc)
 - #60960 (Stop using gensyms in HIR lowering)
 - #60962 (Fix data types indication)

Failed merges:

r? @ghost

5 years agoIntroduce `LocalInternedString::intern`.
Nicholas Nethercote [Tue, 14 May 2019 05:13:42 +0000 (15:13 +1000)]
Introduce `LocalInternedString::intern`.

`LocalInternedString::intern(x)` is preferable to
`Symbol::intern(x).as_str()`, because the former involves one call to
`with_interner` while the latter involves two.