Commit graph

128836 commits

Author SHA1 Message Date
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
varkor 6647eeefb9 Add const_generics test for impl-trait-with-const-arguments 2020-10-03 18:48:56 +01:00
Ralf Jung 9f1861e0f8 update Miri 2020-10-03 19:47:58 +02:00
varkor 702906581e Move tests 2020-10-03 18:01:11 +01:00
ecstatic-morse eaa0186662
Add quotes around command in CHANGELOG 2020-10-03 09:29:50 -07:00
varkor 3631d29287 Add tests for const_generics 2020-10-03 17:00:18 +01: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
varkor 96eb68b121 Add FIXME for const generic defaults 2020-10-03 14:28:55 +01:00
varkor 488b759d5c Replace "non trivial" with "non-trivial" 2020-10-03 14:28:54 +01: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
Valerii Lashmanov d1d2184db4 SsoHashSet/Map - genericiy over Q removed
Due to performance regression, see SsoHashMap comment.
2020-10-02 20:13:23 -05: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
Stein Somers d71d13e82d BTreeMap: refactoring around edges, missed spots 2020-10-03 01:06:55 +02:00
bors 6ebad43c25 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`
2020-10-02 22:47:35 +00:00
Jonas Schievink eff6398014
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 :)
2020-10-03 00:31:17 +02:00
Jonas Schievink 23408de992
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.
2020-10-03 00:31:16 +02:00
Jonas Schievink 01ca8299d4
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.
2020-10-03 00:31:14 +02:00
Jonas Schievink 6522868664
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
2020-10-03 00:31:12 +02:00
Jonas Schievink ccc020ab42
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
2020-10-03 00:31:10 +02:00
Jonas Schievink 389f7cf7d6
Rollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matklad
Move Wrapping<T> ui tests into library

Part of #76268
r? @matklad
2020-10-03 00:31:08 +02:00
Jonas Schievink ca0ff934e9
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.
2020-10-03 00:31:06 +02:00
Jonas Schievink 1118ab9930
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
2020-10-03 00:31:04 +02:00
Camelid 0193a8871c Remove unhelpful help message 2020-10-02 14:47:41 -07:00
Camelid 87f3f81451 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.
2020-10-02 14:36:34 -07:00
Camelid 4c9bcf3b39 Fix test name
Remove trailing `-`.
2020-10-02 14:33:23 -07:00
Jake Vossen 3ea96b86ab made multiline macro calls into single line 2020-10-02 15:08:01 -06:00
bors 8876ffc923 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`
2020-10-02 19:42:07 +00:00
Jubilee Young 4e973966b9 Remove unnecessary mod-cfg 2020-10-02 11:40:57 -07:00
Michael Howell dceb81af1e Deprecate clippy lint 2020-10-02 11:34:14 -07:00
Jonas Schievink 0c5f0b1c69
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
2020-10-02 20:27:18 +02:00
Jonas Schievink de8d7aa400
Rollup merge of #77444 - estebank:pat-field-label, r=davidtwco
Fix span for incorrect pattern field and add label

Address #73750.
2020-10-02 20:27:16 +02:00
Jonas Schievink 14d8ee3465
Rollup merge of #77442 - pickfire:patch-7, r=scottmcm
Clean up on example doc fixes for ptr::copy

Follow up of #77385

r? @scottmcm
2020-10-02 20:27:14 +02:00
Jonas Schievink edae965048
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.
2020-10-02 20:27:13 +02:00
Jonas Schievink 72d275d844
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.
2020-10-02 20:27:11 +02:00
Jonas Schievink 1e3c7e214a
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
2020-10-02 20:27:09 +02:00
Jonas Schievink cac5352e33
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
2020-10-02 20:27:08 +02:00
Jonas Schievink 18ac26d1c5
Rollup merge of #77409 - pickfire:patch-6, r=GuillaumeGomez
Add example for iter chain struct

r? @GuillaumeGomez
2020-10-02 20:27:06 +02:00
Jonas Schievink 2a09c184c0
Rollup merge of #77405 - timvermeulen:iter_advance_by_tracking_issue, r=scottmcm
Add tracking issue of iter_advance_by feature
2020-10-02 20:27:04 +02:00
Jonas Schievink c7c2418227
Rollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, r=oli-obk,ollie27
Doc alias name restriction

Fixes #76705.
2020-10-02 20:27:03 +02:00
Jonas Schievink c8eb2059da
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
2020-10-02 20:26:55 +02:00
Jonas Schievink 17c9b710b5
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
2020-10-02 20:26:54 +02:00
Guillaume Gomez 4427b2d52c Update doc alias documentation 2020-10-02 19:26:59 +02:00
Guillaume Gomez 414aecb13e Update tests 2020-10-02 19:26:59 +02:00
Guillaume Gomez fe415ff412 Remove unneeded replace 2020-10-02 19:26:59 +02:00