Commit graph

93484 commits

Author SHA1 Message Date
Ralf Jung
a2168b0259 update doc comment 2019-05-21 17:14:09 +02:00
Ralf Jung
5ea5fe3072 static_assert: make use of anonymous constants 2019-05-21 09:10:24 +02: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
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
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
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
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
Ralf Jung
4bf500fea7 elliminate mem::uninitialize from docs in libcore 2019-05-20 10:44:02 +02:00
Ralf Jung
11fba52c07 add out-pointer example 2019-05-20 10:44:02 +02:00
Ralf Jung
30a43326d0 apply feedback 2019-05-20 10:44:02 +02:00
Ralf Jung
b7afe777f7 stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the future
Also expand the documentation a bit
2019-05-20 10:44:02 +02:00
Michael Woerister
a79c06a9ce Document requirements for HashStable implementations better. 2019-05-20 10:36:31 +02:00
bors
589beb979c 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
2019-05-20 08:30:17 +00:00
Ralf Jung
b9be68ce2e remove confusing remarks about mixed volatile and non-volatile accesses 2019-05-20 09:50:37 +02:00
bors
caef1e833f 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
2019-05-20 03:36:43 +00:00
bors
128b4c8035 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
2019-05-20 00:37:48 +00:00
Nicholas Nethercote
c06cdbeac5 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.
2019-05-20 09:17:02 +10:00
Nicholas Nethercote
257eaf523f Introduce InternedString::intern.
`InternedString::intern(x)` is preferable to
`Symbol::intern(x).as_interned_str()`, because the former involves one
call to `with_interner` while the latter involves two.

The case within InternedString::decode() is particularly hot, and this
change reduces the number of `with_interner` calls by up to 13%.
2019-05-20 09:17:00 +10:00
Nicholas Nethercote
b96be5b188 Avoid as_str() in ParamTy::is_self.
It's a hot function, and a direct `Symbol` comparison is faster.

The patch also converts some `&InternedString`s to `InternedString`.
2019-05-20 09:16:26 +10:00
Mazdak Farrokhzad
614ffe56c6
Rollup merge of #60962 - VeryTastyTomato:patch-1, r=jonas-schievink
Fix data types indication

Fix the data types indication in basic examples of the Trait std::fmt::LowerExp and std::fmt::UpperExp.
Since there aren’t any type annotation on the let statement using the number 42.0, they are of type f64 according to The Book:
https://doc.rust-lang.org/book/ch03-02-data-types.html#floating-point-types
2019-05-20 01:01:44 +02:00
Mazdak Farrokhzad
787d49e4cb
Rollup merge of #60960 - matthewjasper:remove-lowering-gensym, r=petrochenkov
Stop using gensyms in HIR lowering

These names aren't ever handled by resolve, so there's no reason to
make them gensyms.

Diagnostics wanting to behave differently for these variables should
inspect either the `MatchSource`/`LocalSource` or the `Span`. All
current diagnostics appear to do this.

r? @petrochenkov
2019-05-20 01:01:42 +02:00
Mazdak Farrokhzad
986aa36ed1
Rollup merge of #60908 - GuillaumeGomez:errors, r=oli-obk
Fix lints handling in rustdoc

Part of #60664: now lints are handled just like any other lints you would setup in rustc. Still remains to handle `missing code examples` and `missing_docs` as part of the same group.

r? @oli-obk
2019-05-20 01:01:41 +02:00
Mazdak Farrokhzad
815d3ba883
Rollup merge of #60895 - chandde:master, r=alexcrichton
Enable thumbv7a-pc-windows-msvc target build end to end in rust/master

With this PR, plus another commit cf98161da7, I'm able to build the target thumbv7a-pc-windows-msvc successfully, and I'm able to use the stage2 artifacts to build arm32 projects. The commit in compiler_builtins is in release 0.1.14, the current cargo.lock in rust master still uses 0.1.12, so I bumped the compiler_builtins version in cargo.lock to 0.1.15

The command I used to build rust
```
c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc --verbose
```

**Changes**
1. update cargolock to use compiler_builtins 0.1.15
2. handle libunwind in libtest for thumv7a the same as what we have for aarch64
3. in llvm codegen add a field in CodegenContext to carry the arch, so later in create_msvc_imps function, the arch can be used to check against "x86", instead of 32 pointer width. Apparently Thumv7a is handled differently than x86.

**Background**
I'm from Microsoft working on enabling Azure IoTEdge on ARM32 Windows IoTCore, Azure IoTEdge has a component called IoTEdged written in rust as a NT service running on Windows, so we need to enable rust on thumbv7a in order to have full IoTEdge. My colleague had made some heavy lifting and we've been using our private toolchain to build IoTEdged in our devops pipeline, because at that time we cannot build thumbv7a target end to end successfully. This change is a followup to enable the end to end build for thumbv7a-pc-windows-msvc target.

**Next step**
I'll submit more changes to have this target built nightly in rust/master, to achieve the same availability for aarch64-pc-windows-msvc, indexed here https://rust-lang.github.io/rustup-components-history/aarch64-pc-windows-msvc.html and can be manually installed. **Please do share what takes to make this happen, is there a formal process I need to follow\?**
2019-05-20 01:01:39 +02:00
Mazdak Farrokhzad
5c84d779b2
Rollup merge of #60745 - wesleywiser:const_prop_into_terminators, r=oli-obk
Perform constant propagation into terminators

Perform constant propagation into MIR `Assert` and `SwitchInt` `Terminator`s which in some cases allows them to be removed by the branch simplification pass.

r? @oli-obk
2019-05-20 01:01:38 +02:00
Mazdak Farrokhzad
f9d65c000d
Rollup merge of #60590 - petertodd:2018-test-union-nonzero, r=nikomatsakis,Centril
Test interaction of unions with non-zero/niche-filling optimization

Notably this nails down part of the behavior that MaybeUninit assumes, e.g. that a Option<MaybeUninit<&u8>> does not take advantage of non-zero optimization, and thus is a safe construct.

It also verifies the status quo: that even unions that could theoretically take advantage of niches don't. (relevant: https://github.com/rust-lang/rust/issues/36394)
2019-05-20 01:01:37 +02:00
bors
a5000c5098 Auto merge of #60272 - Jakst:patch-1, r=Manishearth
Explicitly set height on rust logo <img> element in docs

The layout of the left side menu in docs reflows when navigating between pages because of missing height on the <img> element of rust logo.

Setting height='100' tells the browser to reserve that vertical space, leading to a less janky experience.
2019-05-19 21:36:15 +00:00
Wesley Wiser
ec853ba026 [const-prop] Don't const-prop into terminators unless mir-opt-level >= 2 2019-05-19 16:47:03 -04:00
Wesley Wiser
2baab0eaaa [const-prop] Remove catch all match and add FIXME 2019-05-19 16:47:03 -04:00
Wesley Wiser
3f5c743b53 [const-prop] Support propagating into SwitchInt's discr Operand 2019-05-19 16:46:51 -04:00
Wesley Wiser
8e99c76089 [const-prop] Support propagating into Assert's cond Operand 2019-05-19 16:13:08 -04:00
bors
6afcb56285 Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27
rustdoc: set the default edition when pre-parsing a doctest

Fixes https://github.com/rust-lang/rust/issues/59313 (possibly more? i think we've had issues with parsing edition-specific syntax in doctests at some point)

When handling a doctest, rustdoc needs to parse it beforehand, so that it can see whether it declares a `fn main` or `extern crate my_crate` explicitly. However, while doing this, rustdoc doesn't set the "default edition" used by the parser like the regular compilation runs do. This caused a problem when parsing a doctest with an `async move` block in it, since it was expecting the `move` keyword to start a closure, not a block.

This PR changes the `rustdoc::test::make_test` function to set the parser's default edition while looking for a main function and `extern crate` statement. However, to do this, `make_test` needs to know what edition to set. Since this is also used during the HTML rendering process (to make playground URLs), now the HTML renderer needs to know about the default edition. Upshot: rendering standalone markdown files can now accept a "default edition" for their doctests with the `--edition` flag! (I'm pretty sure i waffled around how to set that a long time ago when we first added the `--edition` flag... `>_>`)

I'm posting this before i stop for the night so that i can write this description while it's still in my head, but before this merges i want to make sure that (1) the `rustdoc-ui/failed-doctest-output` test still works (i expect it doesn't), and (2) i add a test with the sample from the linked issue.
2019-05-19 16:48:12 +00:00
VeryTastyTomato
a759565763
Fix data types indication
Fix the data types indication in basic examples of the Trait std::fmt::LowerExp and std::fmt::UpperExp.
Since there aren’t any type annotation on the let statement using the number 42.0, they are of type f64 according to The Book:
https://doc.rust-lang.org/book/ch03-02-data-types.html#floating-point-types
2019-05-19 13:51:46 +00:00
Taiki Endo
3e73ca6e33 Move run-pass/self/* to ui/self 2019-05-19 22:17:12 +09:00
Matthew Jasper
6bb3980e7a Stop using gensyms in HIR lowering
These names aren't ever handled by resolve, so there's no reason to
make them gensyms.
2019-05-19 13:00:28 +01:00
bors
e7591c1ae5 Auto merge of #60946 - Xanewok:update-rls, r=oli-obk
Update RLS

Includes a fix (https://github.com/rust-lang/rls/pull/1462) for breakage due to Cargo update PR (https://github.com/rust-lang/rust/pull/60874)

r? @Manishearth @oli-obk @ehuss
2019-05-19 11:51:34 +00:00
Vadim Petrochenkov
88fa5c6a45 Improve type size assertions
Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier
2019-05-19 13:59:44 +03:00