Commit graph

128749 commits

Author SHA1 Message Date
Dylan MacKenzie
938d8fd805 Move MirSource to rustc_middle 2020-10-04 11:01:13 -07:00
Dylan MacKenzie
141a977edf Miscellaneous import formatting 2020-10-04 10:59:55 -07:00
bors
a835b483fe Auto merge of #77527 - jonas-schievink:rollup-szgq5he, r=jonas-schievink
Rollup of 8 pull requests

Successful merges:

 - #77072 (Minor `hash_map` doc adjustments + item attribute orderings)
 - #77368 (Backport LLVM apfloat commit to rustc_apfloat)
 - #77445 (BTreeMap: complete the compile-time test_variance test case)
 - #77504 (Support vectors with fewer than 8 elements for simd_select_bitmask)
 - #77513 (Change DocFragments from enum variant fields to structs with a nested enum)
 - #77518 (Only use Fira Sans for the first `td` in item lists)
 - #77521 (Move target feature whitelist from cg_llvm to cg_ssa)
 - #77525 (Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2)

Failed merges:

r? `@ghost`
2020-10-04 13:49:36 +00:00
Jonas Schievink
fa200cec88
Rollup merge of #77525 - tmiasko:nrvo-2, r=jonas-schievink
Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2

The destination propagation as currently implemented does not supersede the NRVO, e.g., the destination propagation never applies if either local has an address taken, while NRVO might.

Additionally, the issue with failing assertions had been already resolved.

Continue running both optimizations at mir-opt-level >= 2.
2020-10-04 15:45:50 +02:00
Jonas Schievink
5889cf3146
Rollup merge of #77521 - bjorn3:target_feature_whitelist, r=lcnr
Move target feature whitelist from cg_llvm to cg_ssa

These target features have to be supported or at least emulated by alternative codegen backends anyway as they are used by common crates. By moving this list to cg_ssa, other codegen backends don't have to copy
this code.
2020-10-04 15:45:48 +02:00
Jonas Schievink
ec9b4d5e6c
Rollup merge of #77518 - camelid:rustdoc-use-correct-link-font, r=GuillaumeGomez
Only use Fira Sans for the first `td` in item lists

Fixes #77516.

Fixes an issue where links in the one-line version of an item's docs
would be in Fira Sans, while the rest would be in a serifed font.
2020-10-04 15:45:46 +02:00
Jonas Schievink
94bd3c9816
Rollup merge of #77513 - jyn514:refactor-doc-fragments, r=GuillaumeGomez
Change DocFragments from enum variant fields to structs with a nested enum

This makes the code a lot easier to work with. It also makes it easier
to add new fields without updating each variant and `match`
individually.

- Name the `Kind` variant after `DocFragmentKind` from `collapse_docs`
- Remove unneeded impls

Progress towards https://github.com/rust-lang/rust/issues/77254.
r? @GuillaumeGomez
2020-10-04 15:45:44 +02:00
Jonas Schievink
5bd9ce5cd4
Rollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse
Support vectors with fewer than 8 elements for simd_select_bitmask

Resolves the issue raised here: https://github.com/rust-lang/stdarch/issues/310#issuecomment-693730094
2020-10-04 15:45:43 +02:00
Jonas Schievink
80953177ed
Rollup merge of #77445 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
BTreeMap: complete the compile-time test_variance test case

Some of the items added to the new `test_sync` belonged in the old `test_variance` as well. And fixed inconsistent paths to nearby modules.
r? @Mark-Simulacrum
2020-10-04 15:45:41 +02:00
Jonas Schievink
9ea462fd70
Rollup merge of #77368 - est31:apfloat_fix, r=varkor
Backport LLVM apfloat commit to rustc_apfloat

Backports LLVM commit: e34bd1e0b0

Fixes #69532
2020-10-04 15:45:39 +02:00
Jonas Schievink
4ae7710e1d
Rollup merge of #77072 - sharnoff:hash-docs, r=LukasKalbertodt
Minor `hash_map` doc adjustments + item attribute orderings

This PR is really a couple visual changes glued together:
1. Some of the doc comments for items in `std::collections::hash_map` referenced the names of types without escaping their formatting (e.g. using "VacantEntry" instead of "`VacantEntry`") - the ones I could find were changed to the latter
2. The vast majority of pre-item attributes seem to place doc comments as the first attribute (instead of things like `#[feature(...)]`), so the few that had the other order were changed.
3. Also ordering related: the general trend seems to be that `#[feature]` attributes follow `#[inline]`, so I swapped the two lines in places where that ordering was reversed. This is primarily a change based on stylistic continuity and aesthetics - I'm not sure how important that actually is / should be.

I figured this would be pretty uncontroversial, but some of these might have been intentional for reasons I don't know about - if so, I'd be happy to remove the relevant changes. Of these, the final set of changes is probably the most unnecessary, so it also might be better to leave those out (in favor of reducing code churn).
2020-10-04 15:45:33 +02:00
bors
0644cc1242 Auto merge of #76610 - hch12907:master, r=LukasKalbertodt
Implement as_ne_bytes() for integers and floats

This is related to issue #64464.

I am pretty sure that these functions are actually const-ify-able, and technically as_bits() can also be implemented for floats, but I might need some comments on both.
2020-10-04 11:48:50 +00:00
bjorn3
17d1cbbbe0 Move target feature whitelist from cg_llvm to cg_ssa
These target features have to be supported or at least emulated by
alternative codegen backends anyway as they are used by common crates.
By moving this list to cg_ssa, other codegen backends don't have to copy
this code.
2020-10-04 11:49:00 +02:00
bors
0d37dca25a Auto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieu
Implement Make `handle_alloc_error` default to panic (for no_std + liballoc)

Related: https://github.com/rust-lang/rust/issues/66741

Guarded with `#![feature(default_alloc_error_handler)]` a default
`alloc_error_handler` is called, if a custom allocator is used and no
other custom `#[alloc_error_handler]` is defined.
2020-10-04 08:56:05 +00:00
bors
32cbc65e6b Auto merge of #77380 - fusion-engineering-forks:unbox-the-mutex, r=dtolnay
Unbox mutexes and condvars on some platforms

Both mutexes and condition variables contained a Box containing the actual os-specific object. This was done because moving these objects may cause undefined behaviour on some platforms.

However, this is not needed on Windows[1], Wasm[2], cloudabi[2], and 'unsupported'[3], were the box was only needlessly making them less efficient.

This change gets rid of the box on those platforms.

On those platforms, `Condvar` can no longer verify it is only used with one `Mutex`, as mutexes no longer have a stable address. This was addressed and considered acceptable in #76932.

[1]\: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initializesrwlock
[2]\: These are just a single atomic integer together with futex wait/wake calls/instructions.
[3]\: The `unsupported` platform doesn't support multiple threads at all.
2020-10-04 06:48:17 +00:00
bors
2251766944 Auto merge of #77517 - JohnTitor:rollup-msbd49e, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #75143 (Use `tracing` spans to trace the entire MIR interp stack)
 - #75699 (Uplift drop-bounds lint from clippy)
 - #76768 (Test and reject out-of-bounds shuffle vectors)
 - #77190 (updated p! macro to accept literals)
 - #77388 (Add some regression tests)
 - #77419 (Create E0777 error code for invalid argument in derive)
 - #77447 (BTreeMap: document DrainFilterInner better)
 - #77468 (Fix test name)
 - #77469 (Improve rustdoc error for failed intra-doc link resolution)
 - #77473 (Make --all-targets in x.py check opt-in)
 - #77508 (Fix capitalization in blog post name)

Failed merges:

r? `@ghost`
2020-10-04 04:33:28 +00:00
Camelid
adfba2b694 Only use Fira Sans for the first td in item lists
Fixes an issue where links in the one-line version of an item's docs
would be in Fira Sans, while the rest would be in a serifed font.
2020-10-03 19:52:35 -07:00
Yuki Okushi
f5db166397
Rollup merge of #77508 - camelid:patch-8, r=jonas-schievink
Fix capitalization in blog post name
2020-10-04 11:45:11 +09:00
Yuki Okushi
69f2cf5ad9
Rollup merge of #77473 - Mark-Simulacrum:check-limited, r=ecstatic-morse
Make --all-targets in x.py check opt-in

In particular due to #76822, making this the default is currently suboptimal.

r? @ecstatic-morse
2020-10-04 11:45:10 +09:00
Yuki Okushi
0ed4849a3e
Rollup merge of #77469 - camelid:rustdoc-better-failed-res-error, r=jyn514
Improve rustdoc error for failed intra-doc link resolution

The previous error was confusing since it made it sound like you can't
link to items that are defined outside the current module.

Also suggested importing the item.

r? @jyn514
2020-10-04 11:45:08 +09:00
Yuki Okushi
9db26b7562
Rollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC
Fix test name

Remove trailing `-`.
2020-10-04 11:45:06 +09:00
Yuki Okushi
25d0650d0f
Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeMap: document DrainFilterInner better

r? @Mark-Simulacrum
2020-10-04 11:45:04 +09:00
Yuki Okushi
830d1a0e32
Rollup merge of #77419 - GuillaumeGomez:create-e0777, r=jyn514
Create E0777 error code for invalid argument in derive

The second commit is to fix a nit reported by @jyn514 [here](https://github.com/rust-lang/rust/pull/76406/files#r485186592).
2020-10-04 11:45:03 +09:00
Yuki Okushi
f09c962a84
Rollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC
Add some regression tests

Closes #66501
Closes #68951
Closes #72565
Closes #74244
Closes #75299

The first issue is fixed in 1.43.0, other issues are fixed in the recent nightly.
2020-10-04 11:45:01 +09:00
Yuki Okushi
44ce38ac9b
Rollup merge of #77190 - jakevossen5:master, r=eddyb
updated p! macro to accept literals

Closes #70948

Huge thanks @eddyb for helping me out!
2020-10-04 11:44:59 +09:00
Yuki Okushi
65e448885b
Rollup merge of #76768 - workingjubilee:reject-oob-shuffles, r=ralfjung
Test and reject out-of-bounds shuffle vectors

Fixes #73542.
2020-10-04 11:44:57 +09:00
Yuki Okushi
b654555a32
Rollup merge of #75699 - notriddle:drop-bounds-lint, r=petrochenkov
Uplift drop-bounds lint from clippy

Bounds on `T: Drop` do nothing, so they should warn.
2020-10-04 11:44:55 +09:00
Yuki Okushi
6e25418474
Rollup merge of #75143 - oli-obk:tracing, r=RalfJung
Use `tracing` spans to trace the entire MIR interp stack

r? @RalfJung

While being very verbose, this allows really good tracking of what's going on. While I considered schemes like the previous indenter that we had (which we could get by using the `tracing-tree` crate), this will break down horribly with things like multithreaded rustc. Instead, we can now use `RUSTC_LOG` to restrict the things being traced. You could specify a filter in a way that only shows the logging of a specific frame.

![screenshot of command line output of the new formatting](https://user-images.githubusercontent.com/332036/89291343-aa40de00-d65a-11ea-9f6c-ea06c1806327.png)

If we lower the span's level to `debug`, then in `info` level logging we'd not see the frames, but in `debug` level we would see them. The filtering rules in `tracing` are super powerful, but  I'm not sure if we can specify a filter so we do see `debug` level events, but *not* the `frame` spans. The documentation at https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/struct.EnvFilter.html makes me think that we can only turn on things, not turn off things at a more precise level.

cc @hawkw
2020-10-04 11:44:49 +09:00
bors
4cf3dc19a1 Auto merge of #76017 - JulianKnodt:fmt_fast, r=nagisa
Use less divisions in display u128/i128

This PR is an absolute mess, and I need to test if it improves the speed of fmt::Display for u128/i128, but I think it's correct.
It hopefully is more efficient by cutting u128 into at most 2 u64s, and also chunks by 1e16 instead of just 1e4.

Also I specialized the implementations for uints to always be non-false because it bothered me that it was checked at all

Do not merge until I benchmark it and also clean up the god awful mess of spaghetti.
Based on prior work in #44583

cc: `@Dylan-DPC`

Due to work on `itoa` and suggestion in original issue:
r? `@dtolnay`
2020-10-04 02:24:20 +00:00
est31
d010809c8c Backport another LLVM commit to rustc_apfloat
Backports LLVM commit:

    [APFloat] convert SNaN to QNaN in convert() and raise Invalid signal

149f5b573c

SNaN to QNaN conversion also matches what my Intel x86_64 hardware does.
2020-10-04 02:02:25 +02:00
Tomasz Miąsko
59c243331d Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2
The destination propagation as currently implemented does not supersede
the NRVO, e.g., the destination propagation never applies if either
local has an address taken, while NRVO might.

Additionally, the issue with failing assertions had been already
resolved.

Continue running both optimizations at mir-opt-level >= 2.
2020-10-04 00:00:00 +00:00
Joshua Nelson
5f76b95e9b Change DocFragments from enum variant fields to structs with a nested enum
This makes the code a lot easier to work with. It also makes it easier
to add new fields without updating each variant and `match`
individually.

- Name the `Kind` variant after `DocFragmentKind` from `collapse_docs`
- Remove unneeded impls
2020-10-03 19:21:56 -04:00
Stein Somers
a58089e097 BTreeMap/Set: complete the compile-time test cases 2020-10-04 01:04:29 +02:00
bors
bad9ad06c0 Auto merge of #77434 - jonas-schievink:ret-in-reg-2-electric-boogalo, r=nagisa
Returns values up to 2*usize by value

Addresses https://github.com/rust-lang/rust/pull/76986#discussion_r498306837 and https://github.com/rust-lang/rust/pull/76986#issuecomment-696415287 by doing the optimization on all targets.

This matches what we do for functions returning `&[T]` and other fat pointers, so it should be Harmless™
2020-10-03 22:13:01 +00:00
Camelid
250b4adc15
Fix capitalization in blog post name 2020-10-03 13:30:37 -07:00
Amanieu d'Antras
e41a14412e Support vectors with fewer than 8 elements for simd_select_bitmask 2020-10-03 20:35:59 +01:00
Jubilee Young
2fcd1838ed Flatten arrows with further comment 2020-10-03 12:14:22 -07:00
Jake Vossen
018d587bc1 fixed going over 100 chars in line 2020-10-03 13:12:08 -06:00
bors
25c8c53dd9 Auto merge of #77500 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/77406
r? `@ghost` Cc `@rust-lang/miri`
2020-10-03 18:36:32 +00:00
Ralf Jung
9f1861e0f8 update Miri 2020-10-03 19:47:58 +02:00
ecstatic-morse
eaa0186662
Add quotes around command in CHANGELOG 2020-10-03 09:29:50 -07:00
bors
738d4a7a36 Auto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung
Allow Weak::as_ptr and friends for unsized T

Relaxes `impl<T> Weak<T>` to `impl<T: ?Sized> Weak<T>` for the methods `rc::Weak::as_ptr`, `into_raw`, and `from_raw`.

Follow-up to #73845, which did most of the impl work to make these functions work for `T: ?Sized`.

We still have to adjust the implementation of `Weak::from_raw` here, however, because I missed a use of `ptr.is_null()` previously. This check was necessary when `into`/`from_raw` were first implemented, as `into_raw` returned `ptr::null()` for dangling weak. However, we now just (wrapping) offset dangling weaks' pointers the same as nondangling weak, so the null check is no longer necessary (or even hit). (I can submit just 17a928f as a separate PR if desired.)

As a nice side effect, moves the `fn is_dangling` definition closer to `Weak::new`, which creates the dangling weak.

This technically stabilizes that "something like `align_of_val_raw`" is possible to do. However, I believe the part of the functionality required by these methods here -- specifically, getting the alignment of a pointee from a pointer where it may be dangling iff the pointee is `Sized` -- is uncontroversial enough to stabilize these methods without a way to implement them on stable Rust.

r? `@RalfJung,` who reviewed #73845.

ATTN: This changes (relaxes) the (input) generic bounds on stable fn!
2020-10-03 14:18:26 +00:00
Mark Rousskov
bcab97c12e Check all Cargo targets on CI 2020-10-03 09:53:13 -04:00
Mark Rousskov
f2961638c8 Place all-targets checking behind a flag
This matches Cargo behavior and avoids the (somewhat expensive) double checking,
as well as the unfortunate duplicate error messages (#76822,
rust-lang/cargo#5128).
2020-10-03 09:53:13 -04:00
Ralf Jung
e27ef130c1
grammar nit 2020-10-03 12:15:26 +02:00
bors
6f56fbdc1c Auto merge of #77347 - jyn514:dox, r=Amanieu
Remove --cfg dox from rustdoc.rs

This was added in https://github.com/rust-lang/rust/pull/53076 because
several dependencies were using `cfg(dox)` instead of `cfg(rustdoc)` (now `cfg(doc)`).
I ran `rg 'cfg\(dox\)'` on the source tree with no matches, so I think
this is now safe to remove.

r? `@Mark-Simulacrum`
cc `@QuietMisdreavus` :)
2020-10-03 07:23:02 +00:00
Camelid
aa9b718cf0 Improve error messages 2020-10-02 19:53:09 -07:00
Jubilee Young
c47caeaaa9 Macro-expand test to cover all possible lanes 2020-10-02 19:38:56 -07:00
bors
8c54cf67c1 Auto merge of #77451 - Mark-Simulacrum:bump-version, r=pietroalbini
Bump version to 1.49.0

r? `@pietroalbini`
2020-10-03 02:10:42 +00:00
Camelid
21fb9dfa8d Use old error when there's partial resolution
The new error was confusing when there was partial resolution (something
like `std::io::nonexistent`); the old one is better for those cases.
2020-10-02 18:00:57 -07:00