]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #77517 - JohnTitor:rollup-msbd49e, r=JohnTitor
bors [Sun, 4 Oct 2020 04:33:28 +0000 (04:33 +0000)]
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`

3 years agoRollup merge of #77508 - camelid:patch-8, r=jonas-schievink
Yuki Okushi [Sun, 4 Oct 2020 02:45:11 +0000 (11:45 +0900)]
Rollup merge of #77508 - camelid:patch-8, r=jonas-schievink

Fix capitalization in blog post name

3 years agoRollup merge of #77473 - Mark-Simulacrum:check-limited, r=ecstatic-morse
Yuki Okushi [Sun, 4 Oct 2020 02:45:10 +0000 (11:45 +0900)]
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

3 years agoRollup merge of #77469 - camelid:rustdoc-better-failed-res-error, r=jyn514
Yuki Okushi [Sun, 4 Oct 2020 02:45:08 +0000 (11:45 +0900)]
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

3 years agoRollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC
Yuki Okushi [Sun, 4 Oct 2020 02:45:06 +0000 (11:45 +0900)]
Rollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC

Fix test name

Remove trailing `-`.

3 years agoRollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Oct 2020 02:45:04 +0000 (11:45 +0900)]
Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum

BTreeMap: document DrainFilterInner better

r? @Mark-Simulacrum

3 years agoRollup merge of #77419 - GuillaumeGomez:create-e0777, r=jyn514
Yuki Okushi [Sun, 4 Oct 2020 02:45:03 +0000 (11:45 +0900)]
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).

3 years agoRollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC
Yuki Okushi [Sun, 4 Oct 2020 02:45:01 +0000 (11:45 +0900)]
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.

3 years agoRollup merge of #77190 - jakevossen5:master, r=eddyb
Yuki Okushi [Sun, 4 Oct 2020 02:44:59 +0000 (11:44 +0900)]
Rollup merge of #77190 - jakevossen5:master, r=eddyb

updated p! macro to accept literals

Closes #70948

Huge thanks @eddyb for helping me out!

3 years agoRollup merge of #76768 - workingjubilee:reject-oob-shuffles, r=ralfjung
Yuki Okushi [Sun, 4 Oct 2020 02:44:57 +0000 (11:44 +0900)]
Rollup merge of #76768 - workingjubilee:reject-oob-shuffles, r=ralfjung

Test and reject out-of-bounds shuffle vectors

Fixes #73542.

3 years agoRollup merge of #75699 - notriddle:drop-bounds-lint, r=petrochenkov
Yuki Okushi [Sun, 4 Oct 2020 02:44:55 +0000 (11:44 +0900)]
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.

3 years agoRollup merge of #75143 - oli-obk:tracing, r=RalfJung
Yuki Okushi [Sun, 4 Oct 2020 02:44:49 +0000 (11:44 +0900)]
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

3 years agoAuto merge of #76017 - JulianKnodt:fmt_fast, r=nagisa
bors [Sun, 4 Oct 2020 02:24:20 +0000 (02:24 +0000)]
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`

3 years agoAuto merge of #77434 - jonas-schievink:ret-in-reg-2-electric-boogalo, r=nagisa
bors [Sat, 3 Oct 2020 22:13:01 +0000 (22:13 +0000)]
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™

3 years agoFix capitalization in blog post name
Camelid [Sat, 3 Oct 2020 20:30:37 +0000 (13:30 -0700)]
Fix capitalization in blog post name

3 years agoFlatten arrows with further comment
Jubilee Young [Sat, 3 Oct 2020 19:14:22 +0000 (12:14 -0700)]
Flatten arrows with further comment

3 years agofixed going over 100 chars in line
Jake Vossen [Sat, 3 Oct 2020 19:12:08 +0000 (13:12 -0600)]
fixed going over 100 chars in line

3 years agoAuto merge of #77500 - RalfJung:miri, r=RalfJung
bors [Sat, 3 Oct 2020 18:36:32 +0000 (18:36 +0000)]
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`

3 years agoupdate Miri
Ralf Jung [Sat, 3 Oct 2020 17:47:58 +0000 (19:47 +0200)]
update Miri

3 years agoAdd quotes around command in CHANGELOG
ecstatic-morse [Sat, 3 Oct 2020 16:29:50 +0000 (09:29 -0700)]
Add quotes around command in CHANGELOG

3 years agoAuto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung
bors [Sat, 3 Oct 2020 14:18:26 +0000 (14:18 +0000)]
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!

3 years agoCheck all Cargo targets on CI
Mark Rousskov [Fri, 2 Oct 2020 23:53:05 +0000 (19:53 -0400)]
Check all Cargo targets on CI

3 years agoPlace all-targets checking behind a flag
Mark Rousskov [Fri, 2 Oct 2020 23:51:36 +0000 (19:51 -0400)]
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).

3 years agogrammar nit
Ralf Jung [Sat, 3 Oct 2020 10:15:26 +0000 (12:15 +0200)]
grammar nit

3 years agoAuto merge of #77347 - jyn514:dox, r=Amanieu
bors [Sat, 3 Oct 2020 07:23:02 +0000 (07:23 +0000)]
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` :)

3 years agoImprove error messages
Camelid [Sat, 3 Oct 2020 02:53:09 +0000 (19:53 -0700)]
Improve error messages

3 years agoMacro-expand test to cover all possible lanes
Jubilee Young [Sat, 3 Oct 2020 02:23:33 +0000 (19:23 -0700)]
Macro-expand test to cover all possible lanes

3 years agoAuto merge of #77451 - Mark-Simulacrum:bump-version, r=pietroalbini
bors [Sat, 3 Oct 2020 02:10:42 +0000 (02:10 +0000)]
Auto merge of #77451 - Mark-Simulacrum:bump-version, r=pietroalbini

Bump version to 1.49.0

r? `@pietroalbini`

3 years agoUse old error when there's partial resolution
Camelid [Sat, 3 Oct 2020 01:00:57 +0000 (18:00 -0700)]
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.

3 years agoAuto merge of #77470 - jonas-schievink:rollup-9a2hulp, r=jonas-schievink
bors [Fri, 2 Oct 2020 22:47:35 +0000 (22:47 +0000)]
Auto merge of #77470 - jonas-schievink:rollup-9a2hulp, r=jonas-schievink

Rollup of 8 pull requests

Successful merges:

 - #75377 (Fix Debug implementations of some of the HashMap and BTreeMap iterator types)
 - #76107 (Write manifest for MAJOR.MINOR channel to enable rustup convenience)
 - #76745 (Move Wrapping<T> ui tests into library)
 - #77182 (Add missing examples for Fd traits)
 - #77251 (Bypass const_item_mutation if const's type has Drop impl)
 - #77264 (Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used. )
 - #77421 (Revert "resolve: Avoid "self-confirming" import resolutions in one more case")
 - #77452 (Permit ty::Bool in const generics for v0 mangling)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77452 - Mark-Simulacrum:fix-symbol-v0, r=eddyb
Jonas Schievink [Fri, 2 Oct 2020 22:31:17 +0000 (00:31 +0200)]
Rollup merge of #77452 - Mark-Simulacrum:fix-symbol-v0, r=eddyb

Permit ty::Bool in const generics for v0 mangling

This should unbreak using new-symbol-mangling = true in config.toml (once it lands in beta anyway).

Fixes #76365 (well, it will, but seems fine to close as soon as we have support)

r? @eddyb (for mangling) but I'm okay with some other reviewer too :)

3 years agoRollup merge of #77421 - petrochenkov:globtravel, r=nagisa
Jonas Schievink [Fri, 2 Oct 2020 22:31:16 +0000 (00:31 +0200)]
Rollup merge of #77421 - petrochenkov:globtravel, r=nagisa

Revert "resolve: Avoid "self-confirming" import resolutions in one more case"

And remove the assert that https://github.com/rust-lang/rust/pull/70236 tried to avoid instead.

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

3 years agoRollup merge of #77264 - fusion-engineering-forks:skip-local-stdio, r=dtolnay
Jonas Schievink [Fri, 2 Oct 2020 22:31:14 +0000 (00:31 +0200)]
Rollup merge of #77264 - fusion-engineering-forks:skip-local-stdio, r=dtolnay

Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used.

The thread local `LOCAL_STDOUT` and `LOCAL_STDERR` are only used by the `test` crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing.

This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive.

This change keeps a global flag (`LOCAL_STREAMS`) which will be set to `true` when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered.

---

Together with https://github.com/rust-lang/rust/pull/77154, this should make output a little bit more efficient.

3 years agoRollup merge of #77251 - dtolnay:drop, r=Aaron1011
Jonas Schievink [Fri, 2 Oct 2020 22:31:12 +0000 (00:31 +0200)]
Rollup merge of #77251 - dtolnay:drop, r=Aaron1011

Bypass const_item_mutation if const's type has Drop impl

Follow-up to #75573. This PR disables the const_item_mutation lint in cases that the const has a Drop impl which observes the mutation.

```rust
struct Log { msg: &'static str }
const LOG: Log = Log { msg: "" };
impl Drop for Log {
    fn drop(&mut self) { println!("{}", self.msg); }
}

LOG.msg = "wow";  // prints "wow"
```

r? @Aaron1011

3 years agoRollup merge of #77182 - GuillaumeGomez:missing-examples-fd-traits, r=pickfire
Jonas Schievink [Fri, 2 Oct 2020 22:31:10 +0000 (00:31 +0200)]
Rollup merge of #77182 - GuillaumeGomez:missing-examples-fd-traits, r=pickfire

Add missing examples for Fd traits

Not sure what happened here... This is a reopening of #77142

r? @Dylan-DPC

3 years agoRollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matklad
Jonas Schievink [Fri, 2 Oct 2020 22:31:08 +0000 (00:31 +0200)]
Rollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matklad

Move Wrapping<T> ui tests into library

Part of #76268
r? @matklad

3 years agoRollup merge of #76107 - integer32llc:manifest-alias, r=pietroalbini
Jonas Schievink [Fri, 2 Oct 2020 22:31:06 +0000 (00:31 +0200)]
Rollup merge of #76107 - integer32llc:manifest-alias, r=pietroalbini

Write manifest for MAJOR.MINOR channel to enable rustup convenience

This connects to https://github.com/rust-lang/rustup/issues/794.

It's hard to remember if there have been patch releases for old versions
when you'd like to install the latest in a MAJOR.MINOR series.

When we're doing a stable release, we write duplicate manifests to
`stable`. With this change, only when we're doing a stable release, also
write duplicate manifests to `MAJOR.MINOR` to eventually enable rustup
(and any other tooling that builds Rust release URLs) to request, say,
`1.45` and get `1.45.2` (assuming `1.45.2` is the latest available
`1.45` and assuming that we never publish patch releases out of order).

I tested the best I could; it's a bit hard to get everything set up right
to be able to run the build-manifest tool. But I was able to run it with
a release of "1.45.2" and in addition to the files like `channel-rust-1.45.2.toml`
and `channel-rust-stable.toml` (and other manifests) that I got before this
change, I now get `channel-rust-1.45.toml`.

I believe this change to be safe to deploy as it does not change or remove
anything about manifests, just adds more. The actions in rust-central-station
that interact with manifests appear to use wildcards in such a way that it will
pick up these files without any problems.

There will need to be changes to `rustup` before `rustup install 1.45` will work,
but we can wait for a stable release and stable patch releases to happen with this
change before making the `rustup` changes, so that we're not committing to anything
before we know it works.

3 years agoRollup merge of #75377 - canova:map_debug_impl, r=dtolnay
Jonas Schievink [Fri, 2 Oct 2020 22:31:04 +0000 (00:31 +0200)]
Rollup merge of #75377 - canova:map_debug_impl, r=dtolnay

Fix Debug implementations of some of the HashMap and BTreeMap iterator types

HashMap's `ValuesMut`, BTreeMaps `ValuesMut`, IntoValues and `IntoKeys` structs were printing both keys and values on their Debug implementations. But they are iterators over either keys or values. Irrelevant values should not be visible. With this PR, they only show relevant fields.
This fixes #75297.

[Here's an example code.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0c79356ed860e347a0c1a205616f93b7) This prints this on nightly:
```
ValuesMut { inner: IterMut { range: [(1, "hello"), (2, "goodbye")], length: 2 } }
IntoKeys { inner: [(1, "hello"), (2, "goodbye")] }
IntoValues { inner: [(1, "hello"), (2, "goodbye")] }
[(2, "goodbye"), (1, "hello")]
```

After the patch this example prints these instead:
```
["hello", "goodbye"]
["hello", "goodbye"]
[1, 2]
["hello", "goodbye"]
```

I didn't add test cases for them, since I couldn't see any tests for Debug implementations anywhere. But please let me know if I should add it to a specific place.

r? @dtolnay

3 years agoRemove unhelpful help message
Camelid [Fri, 2 Oct 2020 21:47:41 +0000 (14:47 -0700)]
Remove unhelpful help message

3 years agoImprove rustdoc error for failed intra-doc link resolution
Camelid [Fri, 2 Oct 2020 21:32:14 +0000 (14:32 -0700)]
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.

3 years agoFix test name
Camelid [Fri, 2 Oct 2020 21:33:23 +0000 (14:33 -0700)]
Fix test name

Remove trailing `-`.

3 years agomade multiline macro calls into single line
Jake Vossen [Fri, 2 Oct 2020 21:08:01 +0000 (15:08 -0600)]
made multiline macro calls into single line

3 years agoAuto merge of #77462 - jonas-schievink:rollup-m0rqdh5, r=jonas-schievink
bors [Fri, 2 Oct 2020 19:42:07 +0000 (19:42 +0000)]
Auto merge of #77462 - jonas-schievink:rollup-m0rqdh5, r=jonas-schievink

Rollup of 12 pull requests

Successful merges:

 - #76101 (Update RELEASES.md for 1.47.0)
 - #76739 (resolve: prohibit anon const non-static lifetimes)
 - #76811 (Doc alias name restriction)
 - #77405 (Add tracking issue of iter_advance_by feature)
 - #77409 (Add example for iter chain struct)
 - #77415 (Better error message for `async` blocks in a const-context)
 - #77423 (Add `-Zprecise-enum-drop-elaboration`)
 - #77432 (Use posix_spawn on musl targets)
 - #77441 (Fix AVR stack corruption bug)
 - #77442 (Clean up on example doc fixes for ptr::copy)
 - #77444 (Fix span for incorrect pattern field and add label)
 - #77453 (Stop running macOS builds on Azure Pipelines)

Failed merges:

r? `@ghost`

3 years agoRemove unnecessary mod-cfg
Jubilee Young [Fri, 2 Oct 2020 18:40:57 +0000 (11:40 -0700)]
Remove unnecessary mod-cfg

3 years agoDeprecate clippy lint
Michael Howell [Fri, 2 Oct 2020 18:34:14 +0000 (11:34 -0700)]
Deprecate clippy lint

3 years agoRollup merge of #77453 - pietroalbini:ci-no-more-azure, r=Mark-Simulacrum
Jonas Schievink [Fri, 2 Oct 2020 18:27:18 +0000 (20:27 +0200)]
Rollup merge of #77453 - pietroalbini:ci-no-more-azure, r=Mark-Simulacrum

Stop running macOS builds on Azure Pipelines

The Infrastructure Team agreed to migrate macOS builds to GitHub Actions, so this commit stops running those builders on Azure Pipelines. The GitHub Actions runners are already configured to upload to the production bucket.

We can't still fully remove the Azure Pipelines configuration, as we still need to have that available until no stable releases run any of their builds on Azure Pipelines anymore. I'll open an issue to track fully removing our Azure Pipelines setup once the PR is merged.

r? @Mark-Simulacrum

3 years agoRollup merge of #77444 - estebank:pat-field-label, r=davidtwco
Jonas Schievink [Fri, 2 Oct 2020 18:27:16 +0000 (20:27 +0200)]
Rollup merge of #77444 - estebank:pat-field-label, r=davidtwco

Fix span for incorrect pattern field and add label

Address #73750.

3 years agoRollup merge of #77442 - pickfire:patch-7, r=scottmcm
Jonas Schievink [Fri, 2 Oct 2020 18:27:14 +0000 (20:27 +0200)]
Rollup merge of #77442 - pickfire:patch-7, r=scottmcm

Clean up on example doc fixes for ptr::copy

Follow up of #77385

r? @scottmcm

3 years agoRollup merge of #77441 - couchand:2020-10/fix-75504, r=jonas-schievink
Jonas Schievink [Fri, 2 Oct 2020 18:27:13 +0000 (20:27 +0200)]
Rollup merge of #77441 - couchand:2020-10/fix-75504, r=jonas-schievink

Fix AVR stack corruption bug

Updates the Rust LLVM fork to pull in a fix for a stack corruption bug in AVR platform interrupt code lowering.

Fixes #75504

----

It looks like this is also pulling in a register selection fix by @Amanieu and @tambry that hasn't merged yet; I don't see an open PR for that update.

3 years agoRollup merge of #77432 - tmiasko:posix-spawn-musl, r=cuviper
Jonas Schievink [Fri, 2 Oct 2020 18:27:11 +0000 (20:27 +0200)]
Rollup merge of #77432 - tmiasko:posix-spawn-musl, r=cuviper

Use posix_spawn on musl targets

The posix_spawn had been available in a form suitable for use in a
Command implementation since musl 0.9.12. Use it in a preference to a
fork when possible, to benefit from CLONE_VM|CLONE_VFORK used there.

3 years agoRollup merge of #77423 - ecstatic-morse:discriminant-switch-effect-config, r=pnkfelix
Jonas Schievink [Fri, 2 Oct 2020 18:27:09 +0000 (20:27 +0200)]
Rollup merge of #77423 - ecstatic-morse:discriminant-switch-effect-config, r=pnkfelix

Add `-Zprecise-enum-drop-elaboration`

Its purpose is to assist in debugging #77382 and #74551. Passing `-Zprecise-enum-drop-elaboration=no` will turn off the added precision that seems to be causing issues on some platforms. This assumes that we can reproduce #77382 on the latest master. I should have done this earlier. Oh well.

cc @cuviper
r? @pnkfelix

3 years agoRollup merge of #77415 - ecstatic-morse:const-checking-async-block, r=oli-obk
Jonas Schievink [Fri, 2 Oct 2020 18:27:08 +0000 (20:27 +0200)]
Rollup merge of #77415 - ecstatic-morse:const-checking-async-block, r=oli-obk

Better error message for `async` blocks in a const-context

Improves the error message for the case in #77361.

r? @oli-obk

3 years agoRollup merge of #77409 - pickfire:patch-6, r=GuillaumeGomez
Jonas Schievink [Fri, 2 Oct 2020 18:27:06 +0000 (20:27 +0200)]
Rollup merge of #77409 - pickfire:patch-6, r=GuillaumeGomez

Add example for iter chain struct

r? @GuillaumeGomez

3 years agoRollup merge of #77405 - timvermeulen:iter_advance_by_tracking_issue, r=scottmcm
Jonas Schievink [Fri, 2 Oct 2020 18:27:04 +0000 (20:27 +0200)]
Rollup merge of #77405 - timvermeulen:iter_advance_by_tracking_issue, r=scottmcm

Add tracking issue of iter_advance_by feature

3 years agoRollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, r=oli-obk,ollie27
Jonas Schievink [Fri, 2 Oct 2020 18:27:03 +0000 (20:27 +0200)]
Rollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, r=oli-obk,ollie27

Doc alias name restriction

Fixes #76705.

3 years agoRollup merge of #76739 - davidtwco:issue-75323-non-static-lifetime-in-anonconst,...
Jonas Schievink [Fri, 2 Oct 2020 18:26:55 +0000 (20:26 +0200)]
Rollup merge of #76739 - davidtwco:issue-75323-non-static-lifetime-in-anonconst, r=varkor

resolve: prohibit anon const non-static lifetimes

Fixes #75323, fixes #74447 and fixes #73375.

This PR prohibits non-static lifetimes in anonymous constants when only the `min_const_generics` feature is enabled. ~~To do so, `to_region_vid`'s `bug!` had to be changed into a delayed bug, which unfortunately required providing it a `TyCtxt`.~~

---
~~While I am happy with how the implementation of the error turned out in `rustc_passes::check_const`,  emitting an error wasn't sufficient to avoid hitting the ICE later. I also tried implementing the error in `rustc_mir::transform::check_consts::validation` and that worked, but it didn't silence the ICE either. To silence the ICE, I changed it to a delayed bug which worked but was more invasive that I would have liked, and required I return an incorrect lifetime. It's possible that this check should be implemented earlier in the compiler to make the invasive changes unnecessary, but I wasn't sure where that would be and wanted to get some feedback first.~~
The approach taken by this PR has been changed to implement the error in name resolution, which ended up being much simpler.

cc @rust-lang/wg-const-eval
r? @lcnr

3 years agoRollup merge of #76101 - XAMPPRocky:relnotes-.1.47.0, r=Mark-Simulacrum
Jonas Schievink [Fri, 2 Oct 2020 18:26:54 +0000 (20:26 +0200)]
Rollup merge of #76101 - XAMPPRocky:relnotes-.1.47.0, r=Mark-Simulacrum

Update RELEASES.md for 1.47.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-.1.47.0/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release

3 years agoUpdate doc alias documentation
Guillaume Gomez [Wed, 16 Sep 2020 14:43:22 +0000 (16:43 +0200)]
Update doc alias documentation

3 years agoUpdate tests
Guillaume Gomez [Wed, 16 Sep 2020 14:42:06 +0000 (16:42 +0200)]
Update tests

3 years agoRemove unneeded replace
Guillaume Gomez [Wed, 16 Sep 2020 22:20:14 +0000 (00:20 +0200)]
Remove unneeded replace

3 years agoForbid some characters to be used as doc alias
Guillaume Gomez [Wed, 16 Sep 2020 14:41:45 +0000 (16:41 +0200)]
Forbid some characters to be used as doc alias

3 years agoUpdate RELEASES.md for 1.47.0
Erin Power [Sun, 30 Aug 2020 08:49:59 +0000 (10:49 +0200)]
Update RELEASES.md for 1.47.0

3 years agoAuto merge of #77369 - jonas-schievink:validate-storage-liveness, r=wesleywiser
bors [Fri, 2 Oct 2020 17:20:13 +0000 (17:20 +0000)]
Auto merge of #77369 - jonas-schievink:validate-storage-liveness, r=wesleywiser

-Zvalidate-mir: Assert that storage is allocated on local use

This extends the MIR validator to check that locals are only used when their backing storage is currently allocated via `StorageLive`.

The result of this is that miscompilations such as https://github.com/rust-lang/rust/issues/77359 are caught and turned into ICEs.

The PR currently fails tests because miscompilations such as https://github.com/rust-lang/rust/issues/77359 are caught and turned into ICEs.

I have confirmed that tests pass (even with `-Zvalidate-mir`) once `SimplifyArmIdentity` is turned into a no-op (except mir-opt tests, of course).

3 years agoIgnore now-broken mir-opt test
Jonas Schievink [Fri, 2 Oct 2020 14:50:45 +0000 (16:50 +0200)]
Ignore now-broken mir-opt test

3 years agovalidate: skip debuginfo
Jonas Schievink [Fri, 2 Oct 2020 14:50:29 +0000 (16:50 +0200)]
validate: skip debuginfo

3 years agoSimplify fd examples
Guillaume Gomez [Fri, 2 Oct 2020 14:38:15 +0000 (16:38 +0200)]
Simplify fd examples

3 years agoImprove E0777 help message
Guillaume Gomez [Fri, 2 Oct 2020 11:52:03 +0000 (13:52 +0200)]
Improve E0777 help message

3 years agoci: stop running macOS builds on Azure Pipelines
Pietro Albini [Fri, 2 Oct 2020 14:15:05 +0000 (16:15 +0200)]
ci: stop running macOS builds on Azure Pipelines

3 years agovalidate: storage must be allocated on local use
Jonas Schievink [Wed, 30 Sep 2020 16:56:10 +0000 (18:56 +0200)]
validate: storage must be allocated on local use

3 years agoPermit ty::Bool in const generics for v0 mangling
Mark Rousskov [Fri, 2 Oct 2020 13:28:05 +0000 (09:28 -0400)]
Permit ty::Bool in const generics for v0 mangling

3 years agoAuto merge of #77418 - pietroalbini:ci-environment-files, r=Mark-Simulacrum
bors [Fri, 2 Oct 2020 13:22:26 +0000 (13:22 +0000)]
Auto merge of #77418 - pietroalbini:ci-environment-files, r=Mark-Simulacrum

Switch to environment files to change the environment on GHA

This PR switches our CI to use GitHub's new [environment files](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files) to set environment variables and add items to `$PATH`, as GitHub [plans to disable the old `::set-env` and `::add-path` log commands](https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/) due to a [security issue](https://github.com/actions/toolkit/security/advisories/GHSA-mfwh-5m23-j46w).

Our self-hosted runners are on version 2.273.4, so they already have support for this.

r? `@Mark-Simulacrum`

3 years agoresolve: prohibit anon const non-static lifetimes
David Wood [Tue, 15 Sep 2020 13:38:41 +0000 (14:38 +0100)]
resolve: prohibit anon const non-static lifetimes

This commit modifies name resolution to emit an error when non-static
lifetimes are used in anonymous constants when the `min_const_generics`
feature is enabled.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoBump version to 1.49.0
Mark Rousskov [Fri, 2 Oct 2020 12:34:20 +0000 (08:34 -0400)]
Bump version to 1.49.0

3 years agoBTreeMap: document DrainFilterInner better
Stein Somers [Sat, 26 Sep 2020 23:10:30 +0000 (01:10 +0200)]
BTreeMap: document DrainFilterInner better

3 years agoAuto merge of #77396 - wesleywiser:disable-simplifyarmidentity, r=oli-obk
bors [Fri, 2 Oct 2020 10:04:46 +0000 (10:04 +0000)]
Auto merge of #77396 - wesleywiser:disable-simplifyarmidentity, r=oli-obk

Disable the SimplifyArmIdentity mir-opt

The optimization still has some bugs that need to be worked out
such as #77359.

We can try re-enabling this again after the known issues are resolved.

r? `@oli-obk`

3 years agoAuto merge of #77029 - ehuss:command-access, r=dtolnay
bors [Fri, 2 Oct 2020 07:51:24 +0000 (07:51 +0000)]
Auto merge of #77029 - ehuss:command-access, r=dtolnay

Add accessors to Command.

This adds some accessor methods to `Command` to provide a way to access the values set when building the `Command`. An example where this can be useful is to display the command to be executed. This is roughly based on the [`ProcessBuilder`](https://github.com/rust-lang/cargo/blob/13b73cdaf76b2d9182515c9cf26a8f68342d08ef/src/cargo/util/process_builder.rs#L105-L134) in Cargo.

Possible concerns about the API:
- Values with NULs on Unix will be returned as `"<string-with-nul>"`. I don't think it is practical to avoid this, since otherwise a whole separate copy of all the values would need to be kept in `Command`.
- Does not handle `arg0` on Unix. This can be awkward to support in `get_args` and is rarely used. I figure if someone really wants it, it can be added to `CommandExt` as a separate method.
- Does not offer a way to detect `env_clear`. I'm uncertain if it would be useful for anyone.
- Does not offer a way to get an environment variable by name (`get_env`). I figure this can be added later if anyone really wants it. I think the motivation for this is weak, though. Also, the API could be a little awkward (return a `Option<Option<&OsStr>>`?).
- `get_envs` could skip "cleared" entries and just return `&OsStr` values instead of `Option<&OsStr>`. I'm on the fence here. My use case is to display a shell command, and I only intend it to be roughly equivalent to the actual execution, and I probably won't display `None` entries. I erred on the side of providing extra information, but I suspect many situations will just filter out the `None`s.
- Could implement more iterator stuff (like `DoubleEndedIterator`).

I have not implemented new std items before, so I'm uncertain if the existing issue should be reused, or if a new tracking issue is needed.

cc #44434

3 years agoFix span for incorrect pattern field and add label
Esteban Küber [Fri, 2 Oct 2020 07:44:16 +0000 (00:44 -0700)]
Fix span for incorrect pattern field and add label

3 years agoClean up on example doc fixes for ptr::copy
Ivan Tham [Fri, 2 Oct 2020 06:44:01 +0000 (14:44 +0800)]
Clean up on example doc fixes for ptr::copy

Follow up of #77385

3 years agoFix AVR stack corruption bug
Andrew Dona-Couch [Fri, 2 Oct 2020 04:07:00 +0000 (04:07 +0000)]
Fix AVR stack corruption bug

Updates the Rust LLVM fork to pull in a fix for a stack corruption
bug in AVR platform interrupt code lowering.

Fixes #75504

3 years agoAuto merge of #77436 - JohnTitor:rollup-65dh7rp, r=JohnTitor
bors [Fri, 2 Oct 2020 00:48:41 +0000 (00:48 +0000)]
Auto merge of #77436 - JohnTitor:rollup-65dh7rp, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #76851 (Fix 'FIXME' about using NonZeroU32 instead of u32.)
 - #76979 (Improve std::sys::windows::compat)
 - #77111 (Stabilize slice_ptr_range.)
 - #77147 (Split sys_common::Mutex in StaticMutex and MovableMutex.)
 - #77312 (Remove outdated line from `publish_toolstate` hook)
 - #77362 (Fix is_absolute on WASI)
 - #77375 (rustc_metadata: Do not forget to encode inherent impls for foreign types)
 - #77385 (Improve the example for ptr::copy)
 - #77389 (Fix some clippy lints)
 - #77399 (BTreeMap: use Unique::from to avoid a cast where type information exists)
 - #77429 (Link `new` method in `DefautHasher`s doc)

Failed merges:

r? `@ghost`

3 years agoDisable the SimplifyArmIdentity mir-opt
Wesley Wiser [Thu, 1 Oct 2020 00:04:19 +0000 (20:04 -0400)]
Disable the SimplifyArmIdentity mir-opt

The optimization still has some bugs that need to be worked out
such as #77359.

We can try re-enabling this again after the known issues are resolved.

3 years agoRollup merge of #77429 - WaffleLapkin:doc_link_default_hasher_new, r=jyn514
Yuki Okushi [Thu, 1 Oct 2020 23:25:27 +0000 (08:25 +0900)]
Rollup merge of #77429 - WaffleLapkin:doc_link_default_hasher_new, r=jyn514

Link `new` method in `DefautHasher`s doc

FIXME referenced #56922 which was resolved

r? @jyn514

3 years agoRollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Oct 2020 23:25:25 +0000 (08:25 +0900)]
Rollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

BTreeMap: use Unique::from to avoid a cast where type information exists

r? @Mark-Simulacrum

3 years agoRollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Oct 2020 23:25:24 +0000 (08:25 +0900)]
Rollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum

Fix some clippy lints

Found while working on https://github.com/rust-lang/rust/pull/77351;
these are just the ones that could be fixed automatically.

3 years agoRollup merge of #77385 - scottmcm:fix-77220, r=jyn514
Yuki Okushi [Thu, 1 Oct 2020 23:25:22 +0000 (08:25 +0900)]
Rollup merge of #77385 - scottmcm:fix-77220, r=jyn514

Improve the example for ptr::copy

Fixes #77220

3 years agoRollup merge of #77375 - petrochenkov:inherext, r=oli-obk
Yuki Okushi [Thu, 1 Oct 2020 23:25:20 +0000 (08:25 +0900)]
Rollup merge of #77375 - petrochenkov:inherext, r=oli-obk

rustc_metadata: Do not forget to encode inherent impls for foreign types

So I tried to move FFI interface for LLVM from `rustc_codegen_llvm` to `rustc_llvm` and immediately encountered this fascinating issue.

Fixes https://github.com/rust-lang/rust/issues/46665.

3 years agoRollup merge of #77362 - RReverser:patch-1, r=dtolnay
Yuki Okushi [Thu, 1 Oct 2020 23:25:19 +0000 (08:25 +0900)]
Rollup merge of #77362 - RReverser:patch-1, r=dtolnay

Fix is_absolute on WASI

WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes.

Without this change, `is_absolute` for any paths, including `/some/path`, was returning `false`on a WASI target, which is obviously not true and undesirable.

3 years agoRollup merge of #77312 - LeSeulArtichaut:toolstate-msg, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Oct 2020 23:25:17 +0000 (08:25 +0900)]
Rollup merge of #77312 - LeSeulArtichaut:toolstate-msg, r=Mark-Simulacrum

Remove outdated line from `publish_toolstate` hook

We no longer add `I-nominated` to toolstate failure issues since T-compiler changed its meeting preparation workflow.

3 years agoRollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dtolnay
Yuki Okushi [Thu, 1 Oct 2020 23:25:15 +0000 (08:25 +0900)]
Rollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dtolnay

Split sys_common::Mutex in StaticMutex and MovableMutex.

The (unsafe) `Mutex` from `sys_common` had a rather complicated interface. You were supposed to call `init()` manually, unless you could guarantee it was neither moved nor used reentrantly.

Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if `destroy()` should only be called when `init()` was called.

This allowed for a number of interesting (confusing?) different ways to use this `Mutex`, all captured in a single type.

In practice, this type was only ever used in two ways:

1. As a static variable. In this case, neither `init()` nor `destroy()` are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the `LockGuard`, never with `raw_lock`.

2. As a `Box`ed variable. In this case, both `init()` and `destroy()` are called, it will be moved and possibly used reentrantly.

No other combinations are used anywhere in `std`.

This change simplifies things by splitting this `Mutex` type into two types matching the two use cases: `StaticMutex` and `MovableMutex`.

The interface of both new types is now both safer and simpler. The first one does not call nor expose `init`/`destroy`, and the second one calls those automatically in its `new()` and `Drop` functions. Also, the locking functions of `MovableMutex` are no longer unsafe.

---

This will also make it easier to conditionally box mutexes later, by moving that decision into sys/sys_common. Some of the mutex implementations (at least those of Wasm and 'sys/unsupported') are safe to move, so wouldn't need a box. ~~(But that's blocked on  #76932 for now.)~~ (See #77380.)

3 years agoRollup merge of #77111 - fusion-engineering-forks:stabilize-slice-ptr-range, r=dtolnay
Yuki Okushi [Thu, 1 Oct 2020 23:25:13 +0000 (08:25 +0900)]
Rollup merge of #77111 - fusion-engineering-forks:stabilize-slice-ptr-range, r=dtolnay

Stabilize slice_ptr_range.

This has been unstable for almost a year now. Time to stabilize?

Closes #65807.

@rustbot modify labels: +T-libs +A-raw-pointers +A-slice +needs-fcp

3 years agoRollup merge of #76979 - fusion-engineering-forks:windows-fallback-check, r=dtolnay
Yuki Okushi [Thu, 1 Oct 2020 23:25:11 +0000 (08:25 +0900)]
Rollup merge of #76979 - fusion-engineering-forks:windows-fallback-check, r=dtolnay

Improve std::sys::windows::compat

Improves the compat_fn macro in sys::windows, which is used for conditionally loading APIs that might not be available.

- The module (dll) name can now be any string, not just an ident. (Not all Windows api modules are valid Rust identifiers. E.g. `WaitOnAddress` comes from `API-MS-Win-Core-Synch-l1-2-0.dll`.)
- Adds `FuncName::is_available()` for checking if a function is really available without having to do a duplicate lookup.
- Add comment explaining the lack of locking.
- Use `$_:block` to simplify the macro_rules.
- Apply `allow(unused_variables)` only to the fallback instead of everything.

---

The second point (`is_available()`) simplifies code that needs to pick an implementation depening on what is available, like `sys/windows/mutex.rs`. Before this change, it'd do its own lookup and keep its own `AtomicUsize` to track the result. Now it can just use `c::AcquireSRWLockExclusive::is_available()` directly.

This will also be useful when park/unpark/CondVar/etc. get improved implementations (e.g. from parking_lot or something else), as the best APIs for those are not available before Windows 8.

3 years agoRollup merge of #76851 - fusion-engineering-forks:fixme-nonzero, r=petrochenkov
Yuki Okushi [Thu, 1 Oct 2020 23:25:10 +0000 (08:25 +0900)]
Rollup merge of #76851 - fusion-engineering-forks:fixme-nonzero, r=petrochenkov

Fix 'FIXME' about using NonZeroU32 instead of u32.

It was blocked by #58732 (const fn NonZeroU32::new), which is fixed now.

3 years agoAuto merge of #77412 - Mark-Simulacrum:rls-fix, r=Xanewok
bors [Thu, 1 Oct 2020 22:37:05 +0000 (22:37 +0000)]
Auto merge of #77412 - Mark-Simulacrum:rls-fix, r=Xanewok

Update rls

Includes https://github.com/rust-lang/rls/pull/1700, just fixing compilation and test failures.

Fixes #77311.

3 years agoReturns values up to 2*usize by value
Jonas Schievink [Thu, 1 Oct 2020 22:23:25 +0000 (00:23 +0200)]
Returns values up to 2*usize by value

3 years agoRevert "resolve: Avoid "self-confirming" import resolutions in one more case"
Vadim Petrochenkov [Thu, 1 Oct 2020 17:47:25 +0000 (20:47 +0300)]
Revert "resolve: Avoid "self-confirming" import resolutions in one more case"

3 years agoLink `new` method in `DefautHasher`s doc
Waffle [Thu, 1 Oct 2020 21:30:19 +0000 (00:30 +0300)]
Link `new` method in `DefautHasher`s doc

3 years agoFixme with link for re-enabling const mutation lint for Drop consts
David Tolnay [Thu, 1 Oct 2020 20:41:29 +0000 (13:41 -0700)]
Fixme with link for re-enabling const mutation lint for Drop consts

3 years agoRemove outdated line from `publish_toolstate` hook
LeSeulArtichaut [Mon, 28 Sep 2020 20:28:47 +0000 (22:28 +0200)]
Remove outdated line from `publish_toolstate` hook

3 years agoUplift drop-bounds lint from clippy
Michael Howell [Wed, 19 Aug 2020 10:05:44 +0000 (03:05 -0700)]
Uplift drop-bounds lint from clippy

3 years agoImport struct_span_err macro instead of prepending it
Guillaume Gomez [Thu, 1 Oct 2020 18:15:01 +0000 (20:15 +0200)]
Import struct_span_err macro instead of prepending it