Commit graph

129620 commits

Author SHA1 Message Date
Yuki Okushi 001fcd96d5
Rollup merge of #78013 - GuillaumeGomez:fix-sidebar-scroll-mobile-devices, r=jyn514
Fix sidebar scroll on mobile devices

Fixes #77942.

The issue was coming from the appearance/disappearance of the "wrapper" on the mobile devices web browsers, which triggers the "resize" event, calling the `hideSidebar` function is the JS code.

r? @jyn514
2020-10-17 05:36:54 +09:00
Yuki Okushi d334059696
Rollup merge of #77992 - nagisa:thaw-coverage-instrumentation, r=wesleywiser
instrument-coverage: try our best to not ICE

instrument-coverage was ICEing for me on some code, in particular code
that had devirtualized paths from standard library. Instrument coverage
probably has no bussiness dictating which paths are valid and which
aren't so just feed it everything and whatever and let tooling deal with
other stuff.

For example, with this commit we can generate coverage hitpoints for
these interesting paths:

* `/rustc/.../library/core/lib.rs` – non-devirtualized path for libcore
* `/home/.../src/library/core/lib.rs` – devirtualized version of above
* `<inline asm>`, `<anon>` and many similar synthetic paths

Even if those paths somehow get to the instrumentation pass, I'd much
rather get hits for these weird paths and hope some of them work (as
would be the case for devirtualized path to libcore), rather than have
compilation fail entirely.
2020-10-17 05:36:52 +09:00
Yuki Okushi b4282b37f1
Rollup merge of #77991 - Aaron1011:bump-backtrace-again, r=Mark-Simulacrum
Bump backtrace-rs

This pulls in https://github.com/rust-lang/backtrace-rs/pull/376, which
fixes Miri support for `std::backtrace::Backtrace`.
2020-10-17 05:36:50 +09:00
Yuki Okushi 050eb4d7e4
Rollup merge of #77971 - jyn514:broken-intra-doc-links, r=mark-simulacrum
Deny broken intra-doc links in linkchecker

Since rustdoc isn't warning about these links, check for them manually.

This also fixes the broken links that popped up from the lint.
2020-10-17 05:36:49 +09:00
Yuki Okushi 9600fda7ba
Rollup merge of #77925 - JohnTitor:sugg-min-features, r=davidtwco,oli-obk
Suggest minimal subset features in `incomplete_features` lint

This tells users that we have a minimal subset feature of it and they can fix the lint warning without allowing it.
The wording improvement is helpful :)

Fixes #77913
2020-10-17 05:36:47 +09:00
Yuki Okushi 9abf81afa8
Rollup merge of #77900 - Thomasdezeeuw:fdatasync, r=dtolnay
Use fdatasync for File::sync_data on more OSes

Add support for the following OSes:
 * Android
 * FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=fdatasync&sektion=2
 * OpenBSD: https://man.openbsd.org/OpenBSD-5.8/fsync.2
 * NetBSD: https://man.netbsd.org/fdatasync.2
 * illumos: https://illumos.org/man/3c/fdatasync
2020-10-17 05:36:45 +09:00
Yuki Okushi 75ef735d4a
Rollup merge of #77855 - davidtwco:pr-77341-follow-up-non-constructable-variants, r=estebank
resolve: further improvements to "try using the enum's variant" diagnostic

Follow-up on https://github.com/rust-lang/rust/pull/77341#issuecomment-702738281.

This PR improves the diagnostic modified in #77341 to suggest not only those variants which do not have fields, but those with fields (by suggesting with placeholders). In addition, the wording of the tuple-variant-only case is improved slightly.

I've not made further changes to the tuple-variant-only case (e.g. to only suggest variants with the correct number of fields) because I don't think I have enough information to do so reliably (e.g. in the case where there is an attempt to construct a tuple variant, I have no information on how many fields were provided; and in the case of pattern matching, I only have a slice of spans and would need to check for things like `..` in those spans, which doesn't seem worth it).

r? @estebank
2020-10-17 05:36:43 +09:00
Yuki Okushi 8c4d8555f3
Rollup merge of #77827 - jyn514:stable-primitives, r=GuillaumeGomez
Don't link to nightly primitives on stable channel

I am not sure how to test this.

Closes https://github.com/rust-lang/rust/issues/77775

r? @GuillaumeGomez
2020-10-17 05:36:41 +09:00
Yuki Okushi 3356ad7c26
Rollup merge of #77547 - RalfJung:stable-union-drop, r=matthewjasper
stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union'

As [discussed by @SimonSapin and @withoutboats](https://github.com/rust-lang/rust/issues/55149#issuecomment-634692020), this PR proposes to stabilize parts of the `untagged_union` feature gate:

* It will be possible to have a union with field type `ManuallyDrop<T>` for any `T`.
* While at it I propose we also stabilize `impl Drop for Union`; to my knowledge, there are no open concerns around this feature.

In the RFC discussion, we also talked about allowing `&mut T` as another non-`Copy` non-dropping type, but that felt to me like an overly specific exception so I figured we'd wait if there is actually any use for such a special case.

Some things remain unstable and still require the `untagged_union` feature gate:
* Union with fields that do not drop, are not `Copy`, and are not `ManuallyDrop<_>`. The reason to not stabilize this is to avoid semver concerns around libraries adding `Drop` implementations later. (This is already not fully semver compatible as, to my knowledge, the borrow checker will exploit the non-dropping nature of any type, but it seems prudent to avoid further increasing the amount of trouble adding an `impl Drop` can cause.)

Due to this, quite a few tests still need the `untagged_union` feature, but I think the ones where I could remove the feature flag provide good test coverage for the stable part.

Cc @rust-lang/lang
2020-10-17 05:36:38 +09:00
Yuki Okushi 7581bb7c02
Rollup merge of #75209 - Hirrolot:suggest-macro-imports, r=estebank
Suggest imports of unresolved macros

Closes https://github.com/rust-lang/rust/issues/75191.
2020-10-17 05:36:32 +09:00
Simonas Kazlauskas 8436cfe71d instrument-coverage: try our best to not ICE
instrument-coverage was ICEing for me on some code, in particular code
that had devirtualized paths from standard library. Instrument coverage
probably has no bussiness dictating which paths are valid and which
aren't so just feed it everything and whatever and let tooling deal with
other stuff.

For example, with this commit we can generate coverage hitpoints for
these interesting paths:

* `/rustc/.../library/core/lib.rs` – non-devirtualized path for libcore
* `/home/.../src/library/core/lib.rs` – devirtualized version of above
* `<inline asm>`, `<anon>` and many similar synthetic paths

Even if those paths somehow get to the instrumentation pass, I'd much
rather get hits for these weird paths and hope some of them work (as
would be the case for devirtualized path to libcore), rather than have
compilation fail entirely.
2020-10-16 21:46:41 +03:00
bors 5a51185fd4 Auto merge of #78023 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/77988
Cc `@rust-lang/miri` r? `@ghost`
2020-10-16 17:26:35 +00:00
Ralf Jung c0a4bd0a5c update miri 2020-10-16 19:11:36 +02:00
Yuki Okushi f7150be674 Suggest minimal subset features in incomplete_features lint 2020-10-17 02:01:08 +09:00
bors a78a62fc99 Auto merge of #77972 - Mark-Simulacrum:side-effect-loop, r=nagisa
Prevent miscompilation in trivial loop {}

Ideally, we would want to handle a broader set of cases to fully fix the
underlying bug here. That is currently relatively expensive at compile and
runtime, so we don't do that for now.

Performance results indicate this is not a major regression, if at all, so it should be safe to land.

cc #28728
2020-10-16 14:06:37 +00:00
Guillaume Gomez a577942a8f Fix sidebar scroll on mobile devices 2020-10-16 15:01:17 +02:00
bors 8850893d96 Auto merge of #77850 - kornelski:resizedefault, r=dtolnay
Remove deprecated unstable Vec::resize_default

It's [been deprecated](https://github.com/rust-lang/rust/pull/57656) for 15 releases.
2020-10-16 12:11:32 +00:00
bors 6999ff33c9 Auto merge of #77809 - nasso:master, r=jyn514,guillaumegomez
Add settings to rustdoc to use the system theme

This PR adds new settings to `rustdoc` to use the operating system color scheme.

![click](https://user-images.githubusercontent.com/11479594/95668052-bf604e80-0b6e-11eb-8a17-473aaae510c9.gif)

`rustdoc` actually had [basic support for this](b1af43bc63/src/librustdoc/html/static/storage.js (L121)), but the setting wasn't visible and couldn't be set back once the theme was explicitly set by the user. It also didn't update if the operating system theme preference changed while viewing a page.

I'm using [this method](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Testing_media_queries#Receiving_query_notifications) to query and listen to changes to the `(prefers-color-scheme: dark)` media query. I kept the old method (based on `getComputedStyle`) as a fallback in case the user-agent doesn't support `window.matchMedia` (so like... [pretty much nobody](https://caniuse.com/?search=matchMedia)).

Since there's now more than one official ""dark"" theme in `rustdoc` (and also to support custom/third-party themes), the preferred dark and light themes can be configured in the settings page (the defaults are just "dark" and "light").

This is also my very first "proper" PR to Rust! Please let me know if I did anything wrong :).
2020-10-16 09:58:45 +00:00
Ralf Jung defcd7ff47 stop relying on feature(untagged_unions) in stdlib 2020-10-16 11:33:35 +02:00
Ralf Jung 6a32e794c2 stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union' 2020-10-16 11:33:33 +02:00
bors 95b4a4f0ee Auto merge of #77666 - fusion-engineering-forks:vxworks-cleanup, r=dtolnay
Vxworks / Unix deduplication

`sys/vxworks` was almost entirely an (outdated) copy of `sys/unix`. I went through every file to check the differences and tried to figure out if they were simply outdated or intentional differences between `unix` and `vxworks`. Most of them did not have any `vxworks`-specific changes, so are deleted. I've added some minor `cfg(target_os = "vxworks")`-specific things to `sys/unix` to allow for deduplication.

Before this change, the vxworks target didn't compile because its outdated process implementation did not match the expected interface anymore. This also fixes that: `std` compiles again for `x86_64-wrs-vxworks`.

It's probably good to merge `sys/vxworks` entirely into `sys/unix`, but it might be better to to that in a follow-up PR.

`@rustbot` modify labels: +T-libs +C-cleanup
2020-10-16 07:44:35 +00:00
bors 8e6f69afc9 Auto merge of #77962 - bugadani:arena2, r=Mark-Simulacrum
Remove arena's dependency on `rustc_data_structures`

`rustc_arena` currently has a dependency on `rustc_data_structures` because of a trivial "don't inline me" function. This PR copies that function and removes the dependency.
2020-10-16 04:40:53 +00:00
Mara Bos 0f0257be10 Take some of sys/vxworks/process/* from sys/unix instead. 2020-10-16 06:22:05 +02:00
Mara Bos 408db0da85 Take sys/vxworks/{os,path,pipe} from sys/unix instead. 2020-10-16 06:22:00 +02:00
Mara Bos 71bb1dc2a0 Take sys/vxworks/{fd,fs,io} from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos 3f196dc137 Take sys/vxworks/cmath from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos ba483c51df Take sys/vxworks/args from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos 08bcaac091 Take sys/vxworks/memchar from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos dce405ae3d Take sys/vxworks/net from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos a489c33beb Take sys/vxworks/ext/* from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos c909ff9577 Add weak macro to vxworks. 2020-10-16 06:19:00 +02:00
Mara Bos 66c9b04e94 Take sys/vxworks/alloc from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos 678d078950 Take sys/vxworks/thread_local_key from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos 4853a6e78e Take sys/vxworks/stdio from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos 5d526f6eee Take sys/vxworks/thread from sys/unix instead. 2020-10-16 06:19:00 +02:00
Mara Bos c8628f43bf Take sys/vxworks/stack_overflow from sys/unix instead. 2020-10-16 06:18:59 +02:00
Mara Bos d1947628b5 Take sys/vxworks/time from sys/unix instead. 2020-10-16 06:18:59 +02:00
Mara Bos f875c8be5d Take sys/vxworks/rwlock from sys/unix instead. 2020-10-16 06:18:59 +02:00
Mara Bos f3f30c7132 Take sys/vxworks/condvar from sys/unix instead. 2020-10-16 06:18:59 +02:00
Mara Bos b8dcd2fbce Take sys/vxworks/mutex from sys/unix instead. 2020-10-16 06:18:59 +02:00
bors 9bd740a8f1 Auto merge of #77947 - tmiasko:promoted-scope, r=oli-obk
Create a single source scope for promoteds

A promoted inherits all scopes from the parent body.  At the same time,
almost all statements and terminators inside the promoted body so far
refer only to one of those scopes: the outermost one.

Instead of inheriting all scopes, inherit only a single scope
corresponding to the location of the promoted, making sure that there
are no references to other scopes.
2020-10-16 02:27:49 +00:00
Joshua Nelson b221819ff7 Update submodules for link fixes
- [rust-embedded](79ab777692...ca8169e69b)
- [cargo](12db56cded...79b397d72c)
2020-10-15 20:30:25 -04:00
Joshua Nelson 65835d1059 Deny broken intra-doc links in linkchecker
Since rustdoc isn't warning about these links, check for them manually.
2020-10-15 20:22:16 -04:00
bors b6e2dc6cde Auto merge of #78001 - Dylan-DPC:rollup-zq3kxth, r=Dylan-DPC
Rollup of 14 pull requests

Successful merges:

 - #75023 (ensure arguments are included in count mismatch span)
 - #75265 (Add `str::{Split,RSplit,SplitN,RSplitN,SplitTerminator,RSplitTerminator,SplitInclusive}::as_str` methods)
 - #75675 (mangling: mangle impl params w/ v0 scheme)
 - #76084 (Refactor io/buffered.rs into submodules)
 - #76119 (Stabilize move_ref_pattern)
 - #77493 (ICEs should always print the top of the query stack)
 - #77619 (Use futex-based thread-parker for Wasm32.)
 - #77646 (For backtrace, use StaticMutex instead of a raw sys Mutex.)
 - #77648 (Static mutex is static)
 - #77657 (Cleanup cloudabi mutexes and condvars)
 - #77672 (Simplify doc-cfg rendering based on the current context)
 - #77780 (rustc_parse: fix spans on cast and range exprs with attrs)
 - #77935 (BTreeMap: make PartialCmp/PartialEq explicit and tested)
 - #77980 (Fix intra doc link for needs_drop)

Failed merges:

r? `@ghost`
2020-10-16 00:18:13 +00:00
Dylan DPC e688b4d51c
Rollup merge of #77980 - Manishearth:needs-drop-intra, r=jyn514
Fix intra doc link for needs_drop

It currently links to itself. Oops.

r? @jyn514
2020-10-16 02:10:25 +02:00
Dylan DPC b64b5fac40
Rollup merge of #77935 - ssomers:btree_cleanup_1, r=Mark-Simulacrum
BTreeMap: make PartialCmp/PartialEq explicit and tested

Follow-up on a topic raised in #77612

r? @Mark-Simulacrum
2020-10-16 02:10:24 +02:00
Dylan DPC 9d8bf44409
Rollup merge of #77780 - calebcartwright:cast-expr-attr-span, r=oli-obk
rustc_parse: fix spans on cast and range exprs with attrs

Currently the span for cast and range expressions does not include the span of attributes associated to the lhs which is causing some issues for us in rustfmt.

```rust
fn foo() -> i64 {
    #[attr]
    1u64 as i64
}

fn bar() -> Range<i32> {
    #[attr]
    1..2
}
```

This corrects the span for cast and range expressions to fully include the span of child nodes
2020-10-16 02:10:22 +02:00
Dylan DPC 71b0ea6235
Rollup merge of #77672 - Nemo157:simplify-cfg, r=jyn514
Simplify doc-cfg rendering based on the current context

For sub-items on a page don't show cfg that has already been rendered on
a parent item. At its simplest this means not showing anything that is
shown in the portability message at the top of the page, but also for
things like fields of an enum variant if that variant itself is
cfg-gated then don't repeat those cfg on each field of the variant.

This does not touch trait implementation rendering, as that is more
complex and there are existing issues around how it deals with doc-cfg
that need to be fixed first.

### Screenshots, left is current, right is new:

![image](https://user-images.githubusercontent.com/81079/95387261-c2e6a200-08f0-11eb-90d4-0a9734acd922.png)

![image](https://user-images.githubusercontent.com/81079/95387458-06411080-08f1-11eb-81f7-5dd7f37695dd.png)

![image](https://user-images.githubusercontent.com/81079/95387702-6637b700-08f1-11eb-82f4-46b6cd9b24f2.png)

![image](https://user-images.githubusercontent.com/81079/95387905-b9aa0500-08f1-11eb-8d95-8b618d31d419.png)

![image](https://user-images.githubusercontent.com/81079/95388300-5bc9ed00-08f2-11eb-9ac9-b92cbdb60b89.png)

cc #43781
2020-10-16 02:10:19 +02:00
Dylan DPC 9b8c0eb107
Rollup merge of #77657 - fusion-engineering-forks:cleanup-cloudabi-sync, r=dtolnay
Cleanup cloudabi mutexes and condvars

This gets rid of lots of unnecessary unsafety.

All the AtomicU32s were wrapped in UnsafeCell or UnsafeCell<MaybeUninit>, and raw pointers were used to get to the AtomicU32 inside. This change cleans that up by using AtomicU32 directly.

Also replaces a UnsafeCell<u32> by a safer Cell<u32>.

@rustbot modify labels: +C-cleanup
2020-10-16 02:10:17 +02:00
Dylan DPC b183ef2068
Rollup merge of #77648 - fusion-engineering-forks:static-mutex, r=dtolnay
Static mutex is static

StaticMutex is only ever used with as a static (as the name already suggests). So it doesn't have to be generic over a lifetime, but can simply assume 'static.

This 'static lifetime guarantees the object is never moved, so this is no longer a manually checked requirement for unsafe calls to lock().

@rustbot modify labels: +T-libs +A-concurrency +C-cleanup
2020-10-16 02:10:15 +02:00