Commit Graph

128311 Commits

Author SHA1 Message Date
bors c6e4db620a Auto merge of #77198 - jonas-schievink:rollup-i59i41h, r=jonas-schievink
Rollup of 15 pull requests

Successful merges:

 - #76932 (Relax promises about condition variable.)
 - #76973 (Unstably allow assume intrinsic in const contexts)
 - #77005 (BtreeMap: refactoring around edges)
 - #77066 (Fix dest prop miscompilation around references)
 - #77073 (dead_code: look at trait impls even if they don't contain items)
 - #77086 (Include libunwind in the rust-src component.)
 - #77097 (Make [].as_[mut_]ptr_range() (unstably) const.)
 - #77106 (clarify that `changelog-seen = 1` goes to the beginning of config.toml)
 - #77120 (Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts)
 - #77126 (Invalidate local LLVM cache less often)
 - #77146 (Install std for non-host targets)
 - #77155 (remove enum name from ImplSource variants)
 - #77176 (Removing erroneous semicolon in transmute documentation)
 - #77183 (Allow multiple allow_internal_unstable attributes)
 - #77189 (Remove extra space from vec drawing)

Failed merges:

r? `@ghost`
2020-09-25 19:35:33 +00:00
Guillaume Gomez 187162e991 Add missing code examples on slice iter types 2020-09-25 21:17:22 +02:00
Matthew Jasper 04a0b1d087 Rename Iterator::get_unchecked
It's possible for method resolution to pick this method over a lower
priority stable method,  causing compilation errors. Since this method
is permanently unstable, give it a name that is very unlikely to be used
in user code.
2020-09-25 19:52:01 +01:00
Matthew Jasper 323a27967a Improve <vec::IntoIter>::get_unchecked` safety comment 2020-09-25 19:46:06 +01:00
Jonas Schievink d72b7cc329
Rollup merge of #77189 - pickfire:patch-5, r=Mark-Simulacrum
Remove extra space from vec drawing
2020-09-25 19:42:54 +02:00
Jonas Schievink 12b8d8943d
Rollup merge of #77183 - bugadani:issue-77088, r=varkor
Allow multiple allow_internal_unstable attributes

Fixes #77088
2020-09-25 19:42:52 +02:00
Jonas Schievink a7bdf851cf
Rollup merge of #77176 - austinkeeley:intrinsics-documentatation-error, r=jyn514
Removing erroneous semicolon in transmute documentation

There is a semicolon in the example code that causes the expected value to not be returned.
2020-09-25 19:42:50 +02:00
Jonas Schievink e739468f97
Rollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morse
remove enum name from ImplSource variants

This is quite a lot cleaner in my opinion.
2020-09-25 19:42:48 +02:00
Jonas Schievink ba3e25f992
Rollup merge of #77146 - Mark-Simulacrum:xpyinstall, r=alexcrichton
Install std for non-host targets

It seems reasonable that when configuring various targets you'd expect all of them to get std installed, even if you're not building compiler toolchains for each of those.

cc #76990

r? @alexcrichton
2020-09-25 19:42:46 +02:00
Jonas Schievink 61dc57c85a
Rollup merge of #77126 - Mark-Simulacrum:llvm-less-often, r=alexcrichton
Invalidate local LLVM cache less often

This avoids a download of LLVM after every rebase. The downside to this is that if we land some patch affecting LLVM built in CI that breaks this option, but that PR does not update the LLVM submodule, we'll likely not notice until the next update -- but this seems unlikely to happen in practice and I am not personally worried about it.

r? @alexcrichton
2020-09-25 19:42:44 +02:00
Jonas Schievink 0a3cf02fd7
Rollup merge of #77120 - ecstatic-morse:keep-stage-std, r=Mark-Simulacrum
Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts

Unlike `--keep-stage 0`, `--keep-stage-std 0` will allow the stage 0 compiler artifacts (i.e., stage1/bin/rustc) to be rebuilt if it has changed. This allows contributors to iterate on later stages of the compiler in tandem with the standard library without needing to to rebuild the entire compiler. I often run into this when working on const-checking, since I may need to add a feature gate or make a small tweak to the standard library.
2020-09-25 19:42:43 +02:00
Jonas Schievink 8621ef1159
Rollup merge of #77106 - matthiaskrgr:changelog_seen, r=Mark-Simulacrum
clarify that `changelog-seen = 1` goes to the beginning of config.toml

Fixes #77105
2020-09-25 19:42:41 +02:00
Jonas Schievink 1149b308cd
Rollup merge of #77097 - fusion-engineering-forks:slice-ptr-range-const-fn, r=oli-obk
Make [].as_[mut_]ptr_range() (unstably) const.

Gated behind `const_ptr_offset`, as suggested by https://github.com/rust-lang/rust/issues/65807#issuecomment-697229404

This also marks `[].as_mut_ptr()` as const, because it's used by `as_mut_ptr_range`. I gated it behind the same feature, because I figured it's not worth adding a separate tracking issue for const `as_mut_ptr`.
2020-09-25 19:42:39 +02:00
Jonas Schievink b49990cede
Rollup merge of #77086 - ehuss:src-libunwind, r=Mark-Simulacrum
Include libunwind in the rust-src component.

Some targets, such as musl, need the libunwind source to build the unwind crate (referenced [here](0da5800745/library/unwind/build.rs (L142))).

Fixes rust-lang/wg-cargo-std-aware#59
2020-09-25 19:42:37 +02:00
Jonas Schievink ba44e9fe34
Rollup merge of #77073 - lcnr:ty-trait-param, r=matthewjasper
dead_code: look at trait impls even if they don't contain items

fixes #70225
2020-09-25 19:42:35 +02:00
Jonas Schievink 452aa759b7
Rollup merge of #77066 - jonas-schievink:dest-prop-borrow, r=oli-obk
Fix dest prop miscompilation around references

Closes https://github.com/rust-lang/rust/issues/77002
2020-09-25 19:42:33 +02:00
Jonas Schievink e8dc07c242
Rollup merge of #77005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BtreeMap: refactoring around edges

Parts chipped off a more daring effort, that the btree benchmarks judge to be performance-neutral.

r? @Mark-Simulacrum
2020-09-25 19:42:31 +02:00
Jonas Schievink 1b8c939a8d
Rollup merge of #76973 - lzutao:unstably-const-assume, r=oli-obk
Unstably allow assume intrinsic in const contexts

Not sure much about this usage because there are concerns
about [blocking  optimization][1] and [slowing down LLVM][2] when using `assme` intrinsic
in inline functions.
But since Oli suggested in https://github.com/rust-lang/rust/issues/76960#issuecomment-695772221,
here we are.

[1]: https://github.com/rust-lang/rust/pull/54995#issuecomment-429302709
[2]: https://github.com/rust-lang/rust/issues/49572#issuecomment-589615423
2020-09-25 19:42:29 +02:00
Jonas Schievink a835af174c
Rollup merge of #76932 - fusion-engineering-forks:condvar-promise, r=sfackler
Relax promises about condition variable.

For quite a while now, there have been plans to at some point use parking_lot or some other more efficient implementation of mutexes and condition variables. Right now, Mutex and CondVar both Box the 'real' mutex/condvar inside, to give it a stable address. This was done because implementations like pthread and Windows critical sections may not be moved. More efficient implementations based on futexes, WaitOnAddress, Windows SRW locks, parking_lot, etc. may be moved (while not borrowed), so wouldn't need boxing.

However, not boxing them (which would be great goal to achieve), breaks a promise std currently makes about CondVar. CondVar promises to panic when used with different mutexes, to ensure consistent behaviour on all platforms. To this check, a mutex is considered 'the same' if the address of the 'real mutex' in the Box is the same. This address doesn't change when moving a `std::mutex::Mutex` object, effectively giving it an identity that survives moves of the Mutex object. If we ever switch to a non-boxed version, they no longer carry such an identity, and this check can no longer be made.

Four options:
1. Always box mutexes.
2. Add a `MutexId` similar to `ThreadId`. Making mutexes bigger, and making it hard to ever have a `const fn new` for them.
3. Making the requirement of CondVar stricter: panic if the Mutex object itself moved.
4. Making the promise of CondVar weaker: don't promise to panic.

1, 2, and 3 seem like bad options. This PR updates the documentation for 4.
2020-09-25 19:42:28 +02:00
Dylan MacKenzie 659028f48b Use proper issue for `const_fn_floating_point_arithmetic` 2020-09-25 10:39:11 -07:00
Dylan MacKenzie 4cac90c968 Move const fn floating point test out of `min_const_fn` 2020-09-25 10:39:09 -07:00
Dylan MacKenzie b428f287c3 Bless tests 2020-09-25 10:38:23 -07:00
Dylan MacKenzie 6a52c09440 Add new feature gate to standard library 2020-09-25 10:38:21 -07:00
Dylan MacKenzie 2049052cb9 Put floating point arithmetic behind its own feature gate
This refactors handling of `Rvalue::{Unary,Binary}Op` in the
const-checker. Now we `span_bug` if there's an unexpected type in a
primitive operation. This also allows unary negation on
`char` values through the const-checker because it makes the code a bit
cleaner. `char` does not actually support these operations, and if it
did, we could evaluate them at compile-time.
2020-09-25 10:37:52 -07:00
Dylan MacKenzie 0d2521aaf7 Add `const_fn_floating_point_arithmetic` 2020-09-25 10:37:52 -07:00
bors 10ef7f9ebf Auto merge of #77157 - tmiasko:simplify-cfg-dup, r=jonas-schievink
Remove duplicated SimplifyCfg pass
2020-09-25 17:27:52 +00:00
Ivan Tham 606ed2a076
Remove extra space from vec drawing 2020-09-25 23:20:22 +08:00
bors 5b9e886403 Auto merge of #73453 - erikdesjardins:tuplayout, r=eddyb
Ignore ZST offsets when deciding whether to use Scalar/ScalarPair layout

This is important because Scalar/ScalarPair layout previously would not be used if any ZST had nonzero offset.
For example, before this change, only `((), u128)` would be laid out like `u128`, not `(u128, ())`.

Fixes #63244
2020-09-25 14:42:20 +00:00
Ivan Tham 939fd37643
Rust vec bench import specific rand::RngCore 2020-09-25 22:19:28 +08:00
Dániel Buga 54c9c949a1 Allow multiple allow_internal_unstable attributes
Co-authored-by: varkor <github@varkor.com>
2020-09-25 15:19:46 +02:00
bors b984ef6797 Auto merge of #77152 - vandenheuvel:update_chalk_further, r=jackh726
Update chalk to 0.28.0
2020-09-25 12:22:05 +00:00
Mateusz Mikuła bfdb7903c9 Link dynamic and static late_link_args before generic ones 2020-09-25 13:35:49 +02:00
bors 521d8d8a22 Auto merge of #77041 - lcnr:const-eval-perf, r=ecstatic-morse
perf: move cold path of `process_obligations` into a separate function

cc #76575

This probably won't matter too much in the long run once #69218 is merged so we may not want to merge this.

r? `@ecstatic-morse`
2020-09-25 10:14:47 +00:00
Stein Somers 55fa8afe94 BTreeMap: various tweaks 2020-09-25 11:29:39 +02:00
Stein Somers 3965524570 BTreeMap: introduce edge methods similar to those of keys and values 2020-09-25 11:29:38 +02:00
Stein Somers 1e64d98761 BTreeMap: refactor correct_childrens_parent_links 2020-09-25 11:29:38 +02:00
bors fadf025723 Auto merge of #77144 - flip1995:clippyup, r=Manishearth
Update Clippy

Bi-weekly Clippy update.

This includes a `Cargo.lock` update (d445493479), so probably needs `rollup=never`.

r? `@Manishearth`
2020-09-25 06:23:55 +00:00
bors 9d74efe32e Auto merge of #76844 - simonvandel:fix-76803, r=wesleywiser
Fix #76803 miscompilation

Fixes #76803
Seems like it was an oversight that the discriminant value being set was not compared to the target value from the SwitchInt, as a comment says this is a requirement for the optimization to be sound.

r? `@wesleywiser` since you are probably familiar with the optimization and made #76837 to workaround the bug
2020-09-25 04:17:03 +00:00
Austin Keeley 1d3717d17c Removing erroneous semicolon 2020-09-25 00:03:59 -04:00
bors 5bfeee5fe0 Auto merge of #77172 - jonas-schievink:rollup-a041rou, r=jonas-schievink
Rollup of 15 pull requests

Successful merges:

 - #75438 (Use adaptive SVG favicon for rustdoc like other rust sites)
 - #76304 (Make delegation methods of `std::net::IpAddr` unstably const)
 - #76724 (Allow a unique name to be assigned to dataflow graphviz output)
 - #76978 (Documented From impls in std/sync/mpsc/mod.rs)
 - #77044 (Liballoc bench vec use mem take not replace)
 - #77050 (Typo fix: "satsify" -> "satisfy")
 - #77074 (add array::from_ref)
 - #77078 (Don't use an if guard to check equality with a constant)
 - #77079 (Use `Self` in docs when possible)
 - #77081 (Merge two almost identical match arms)
 - #77121 (Updated html_root_url for compiler crates)
 - #77136 (Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`)
 - #77160 (Suggest `const_fn_transmute`, not `const_fn`)
 - #77164 (Remove workaround for deref issue that no longer exists.)
 - #77165 (Followup to #76673)

Failed merges:

r? `@ghost`
2020-09-25 01:56:06 +00:00
Jonas Schievink 8515efb193
Rollup merge of #77165 - simonvandel:do-not-fire-on-drop-and-replace, r=oli-obk
Followup to #76673

Resolves https://github.com/rust-lang/rust/pull/76673#discussion_r494426303
r? @tmiasko
2020-09-25 02:29:52 +02:00
Jonas Schievink fc4dc5f162
Rollup merge of #77164 - fusion-engineering-forks:no-more-funny-underscores, r=Mark-Simulacrum
Remove workaround for deref issue that no longer exists.

The double underscores were used to work around issue #12808, which was solved in 2016.
2020-09-25 02:29:51 +02:00
Jonas Schievink b8d158b0f8
Rollup merge of #77160 - ecstatic-morse:const-fn-transmute-suggestion, r=oli-obk
Suggest `const_fn_transmute`, not `const_fn`

More fallout from #76850 in the vein of #77134. The fix is the same. I looked through the structured errors file and didn't see any more of this kind of diagnostics bug.

r? @oli-obk
2020-09-25 02:29:49 +02:00
Jonas Schievink 473ae229f0
Rollup merge of #77136 - ecstatic-morse:issue-77134, r=oli-obk
Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`

Resolves #77134.

Prior to #76850, most uses of `&mut` in `const fn` ~~required~~ involved two feature gates, `const_mut_refs` and `const_fn`. The first allowed all mutable borrows of locals. The second allowed only locals, arguments and return values whose types contained `&mut`. I switched the second check to the `const_mut_refs` gate. However, I forgot update the error message with the new suggestion.

Alternatively, we could revert to having two different feature gates for this. OP's code never borrows anything mutably, so it didn't need `const_mut_refs` in the past, only `const_fn`. I'd prefer to keep everything under a single gate, however.

r? @oli-obk
2020-09-25 02:29:47 +02:00
Jonas Schievink 6f3da3d53f
Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514
Updated html_root_url for compiler crates

Closes #77103

r? @jyn514
2020-09-25 02:29:45 +02:00
Jonas Schievink b8ab6eb217
Rollup merge of #77081 - LingMan:patch-1, r=jonas-schievink
Merge two almost identical match arms
2020-09-25 02:29:44 +02:00
Jonas Schievink dc4f39c43f
Rollup merge of #77079 - poliorcetics:more-self-in-docs, r=jyn514
Use `Self` in docs when possible

Fixes #76542.

I used `rg '\s*//[!/]\s+fn [\w_]+\(&?self, ' .` in `library/` to find instances, I found some with that and some by manually checking.

@rustbot modify labels: C-enhancement T-doc
2020-09-25 02:29:42 +02:00
Jonas Schievink 28e0bc997e
Rollup merge of #77078 - LingMan:patch-2, r=jonas-schievink
Don't use an if guard to check equality with a constant

Match on it directly instead
2020-09-25 02:29:40 +02:00
Jonas Schievink 09b0bd6022
Rollup merge of #77074 - lcnr:array-from-ref, r=SimonSapin
add array::from_ref

mirrors the methods in `std::slice` with the same name.

I guess this method previously didn't exist as there was close to no reason to create an array of size `1`.
This will change due to const generics in the near future.
2020-09-25 02:29:39 +02:00
Jonas Schievink 862faea4be
Rollup merge of #77050 - follower:patch-1, r=oli-obk
Typo fix: "satsify" -> "satisfy"
2020-09-25 02:29:37 +02:00