Commit Graph

93522 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
c99090761c rustc_metadata: parametrize schema::CrateRoot by 'tcx. 2019-05-22 11:52:30 +03:00
bors
1cc822c261 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
2019-05-22 04:42:20 +00:00
bors
dbfe70dfcd 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
2019-05-22 01:51:31 +00:00
Mazdak Farrokhzad
2551a54af1
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.
2019-05-22 03:47:43 +02:00
Mazdak Farrokhzad
44cb86bdc8
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
2019-05-22 03:47:41 +02:00
Mazdak Farrokhzad
98172092cf
Rollup merge of #60998 - RalfJung:static_assert, r=Centril
static_assert: make use of anonymous constants
2019-05-22 03:47:40 +02:00
Mazdak Farrokhzad
3c9ac30dd9
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).
2019-05-22 03:47:38 +02:00
Mazdak Farrokhzad
705b040ea5
Rollup merge of #60991 - spastorino:local-decls-push, r=oli-obk
LocalDecl push returns Local len

r? @oli-obk
2019-05-22 03:47:37 +02:00
Mazdak Farrokhzad
30760cde69
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.
2019-05-22 03:47:35 +02:00
Mazdak Farrokhzad
1c4582c1ff
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
2019-05-22 03:47:34 +02:00
Mazdak Farrokhzad
40a18a1df5
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`.
2019-05-22 03:47:32 +02:00
Mazdak Farrokhzad
d69ef04af5
Rollup merge of #60581 - hellow554:fix_60580, r=alexcrichton
convert custom try macro to `?`

resolves #60580

r? @frewsxcv
2019-05-22 03:47:31 +02:00
Mazdak Farrokhzad
a8d1b81ba4
Rollup merge of #59742 - Zoxc:edition-cleanup, r=petrochenkov
Move `edition` outside the hygiene lock and avoid accessing it

r? @petrochenkov
2019-05-22 03:47:29 +02:00
bors
119bbc2056 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
2019-05-21 21:37:41 +00:00
John Kåre Alsaker
0b37900b40 Specify the edition for the rustdoc thread-pool 2019-05-21 18:17:06 +02:00
John Kåre Alsaker
a1f2dceaeb Move edition outside the hygiene lock and avoid accessing it 2019-05-21 18:17:05 +02:00
Ralf Jung
a2168b0259 update doc comment 2019-05-21 17:14:09 +02:00
topecongiro
1f1a9176e7 Fix tidy: remove a trailing whitespace 2019-05-21 23:17:59 +09:00
topecongiro
b07dbe1d44 Add doc comment 2019-05-21 22:57:34 +09:00
Michael Woerister
46e3d04b2b 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.
2019-05-21 13:48:29 +02:00
Ralf Jung
61735abc06 adjust deprecation date of mem::uninitialized 2019-05-21 13:10:28 +02:00
Nicholas Nethercote
b557567c35 Remove impls for InternedString/string equality.
`Symbol` received the same treatment in #60630.

Also, we can derive `PartialEq` for `InternedString`.
2019-05-21 20:08:33 +10:00
Ralf Jung
5ea5fe3072 static_assert: make use of anonymous constants 2019-05-21 09:10:24 +02:00
bors
50a0defd5a 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
2019-05-21 06:37:03 +00:00
topecongiro
e186d3f3e0 Add stream_to_parser_with_base_dir 2019-05-21 13:18:20 +09:00
bors
46ad3e1882 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
2019-05-21 03:44:09 +00:00
Brent Kerby
4e37785c7d Create and reference Memory Layout section of boxed docs 2019-05-20 21:03:40 -06:00
bors
b7f6b8a56b 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!
2019-05-21 00:50:12 +00:00
Santiago Pastorino
419ca9d640
LocalDecl push returns Local len 2019-05-20 20:13:58 -03:00
bors
09189591c4 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
2019-05-20 21:38:19 +00:00
Mazdak Farrokhzad
0c97800f93
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.
2019-05-20 23:03:10 +02:00
Mazdak Farrokhzad
44b5d4deb6
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 911d35f0bf 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
2019-05-20 23:03:08 +02:00
Mazdak Farrokhzad
581cf70367
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]`
```
2019-05-20 23:03:07 +02:00
Mazdak Farrokhzad
864e7a9251
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.
2019-05-20 23:03:06 +02:00
Mazdak Farrokhzad
65cec43ce1
Rollup merge of #60942 - bjorn3:metadata_loader_refactor, r=michaelwoerister
Misc changes to rustc_metadata
2019-05-20 23:03:03 +02:00
Mazdak Farrokhzad
3f86faddaf
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.
2019-05-20 23:03:02 +02:00
Mazdak Farrokhzad
36b5724e0d
Rollup merge of #60823 - oli-obk:used_unused_no_mangle, r=michaelwoerister
Fix incremental compilation of cdylib emitting spurious unused_attributes lint

fixes #60050
2019-05-20 23:03:00 +02:00
Mazdak Farrokhzad
a34dae3587
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
2019-05-20 23:02:59 +02:00
Mazdak Farrokhzad
bf54251f90
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
2019-05-20 23:02:57 +02:00
Mazdak Farrokhzad
5a08ca38de
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.
2019-05-20 23:02:55 +02:00
Mazdak Farrokhzad
daf8aca0e3
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">
2019-05-20 23:02:52 +02:00
William D. Jones
a775d11fff Fix MSP430 AsmPrinter and assembler syntax mismatch. 2019-05-20 16:50:00 -04:00
Petr Hosek
d8f764bbbf 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.
2019-05-20 12:29:58 -07:00
Esteban Küber
d320c7ceab Do not fail on child without DefId 2019-05-20 11:46:44 -07:00
bors
d35181ad87 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.
2019-05-20 15:05:04 +00:00
Brent Kerby
178b753a4a Remove trailing whitespaces to satisfy tidy 2019-05-20 08:14:06 -06:00
Brent Kerby
a7e1431941 Update boxed::Box docs on memory layout 2019-05-20 08:14:06 -06:00
Nicholas Nethercote
c5d9401756 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.
2019-05-20 18:56:53 +10:00
Ralf Jung
1916391ea8 update miri 2019-05-20 10:54:36 +02:00
Peter Todd
2a15dec5a2 Document layout guarantee of MaybeUninit 2019-05-20 10:44:02 +02:00