]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoChange error in `fn_queries` to `delay_span_bug`
Dylan MacKenzie [Fri, 25 Sep 2020 21:08:44 +0000 (14:08 -0700)]
Change error in `fn_queries` to `delay_span_bug`

This should be caught by the new check in `rustc_passes`. At some point,
this function will be removed entirely.

3 years agoCheck for missing const-stability attributes in `stability`
Dylan MacKenzie [Fri, 25 Sep 2020 20:48:48 +0000 (13:48 -0700)]
Check for missing const-stability attributes in `stability`

This used to happen as a side-effect of `is_min_const_fn`, which was
subtle.

3 years agoAuto merge of #77198 - jonas-schievink:rollup-i59i41h, r=jonas-schievink
bors [Fri, 25 Sep 2020 19:35:33 +0000 (19:35 +0000)]
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`

3 years agoAdd missing code examples on slice iter types
Guillaume Gomez [Tue, 22 Sep 2020 20:27:18 +0000 (22:27 +0200)]
Add missing code examples on slice iter types

3 years agoRename Iterator::get_unchecked
Matthew Jasper [Fri, 25 Sep 2020 18:48:24 +0000 (19:48 +0100)]
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.

3 years agoImprove <vec::IntoIter>::get_unchecked` safety comment
Matthew Jasper [Fri, 25 Sep 2020 18:46:06 +0000 (19:46 +0100)]
Improve <vec::IntoIter>::get_unchecked` safety comment

3 years agoRollup merge of #77189 - pickfire:patch-5, r=Mark-Simulacrum
Jonas Schievink [Fri, 25 Sep 2020 17:42:54 +0000 (19:42 +0200)]
Rollup merge of #77189 - pickfire:patch-5, r=Mark-Simulacrum

Remove extra space from vec drawing

3 years agoRollup merge of #77183 - bugadani:issue-77088, r=varkor
Jonas Schievink [Fri, 25 Sep 2020 17:42:52 +0000 (19:42 +0200)]
Rollup merge of #77183 - bugadani:issue-77088, r=varkor

Allow multiple allow_internal_unstable attributes

Fixes #77088

3 years agoRollup merge of #77176 - austinkeeley:intrinsics-documentatation-error, r=jyn514
Jonas Schievink [Fri, 25 Sep 2020 17:42:50 +0000 (19:42 +0200)]
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.

3 years agoRollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morse
Jonas Schievink [Fri, 25 Sep 2020 17:42:48 +0000 (19:42 +0200)]
Rollup merge of #77155 - lcnr:ImplSource, r=ecstatic-morse

remove enum name from ImplSource variants

This is quite a lot cleaner in my opinion.

3 years agoRollup merge of #77146 - Mark-Simulacrum:xpyinstall, r=alexcrichton
Jonas Schievink [Fri, 25 Sep 2020 17:42:46 +0000 (19:42 +0200)]
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

3 years agoRollup merge of #77126 - Mark-Simulacrum:llvm-less-often, r=alexcrichton
Jonas Schievink [Fri, 25 Sep 2020 17:42:44 +0000 (19:42 +0200)]
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

3 years agoRollup merge of #77120 - ecstatic-morse:keep-stage-std, r=Mark-Simulacrum
Jonas Schievink [Fri, 25 Sep 2020 17:42:43 +0000 (19:42 +0200)]
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.

3 years agoRollup merge of #77106 - matthiaskrgr:changelog_seen, r=Mark-Simulacrum
Jonas Schievink [Fri, 25 Sep 2020 17:42:41 +0000 (19:42 +0200)]
Rollup merge of #77106 - matthiaskrgr:changelog_seen, r=Mark-Simulacrum

clarify that `changelog-seen = 1` goes to the beginning of config.toml

Fixes #77105

3 years agoRollup merge of #77097 - fusion-engineering-forks:slice-ptr-range-const-fn, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 17:42:39 +0000 (19:42 +0200)]
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`.

3 years agoRollup merge of #77086 - ehuss:src-libunwind, r=Mark-Simulacrum
Jonas Schievink [Fri, 25 Sep 2020 17:42:37 +0000 (19:42 +0200)]
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](https://github.com/rust-lang/rust/blob/0da58007451a154da2480160429e1604a1f5f0ec/library/unwind/build.rs#L142)).

Fixes rust-lang/wg-cargo-std-aware#59

3 years agoRollup merge of #77073 - lcnr:ty-trait-param, r=matthewjasper
Jonas Schievink [Fri, 25 Sep 2020 17:42:35 +0000 (19:42 +0200)]
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

3 years agoRollup merge of #77066 - jonas-schievink:dest-prop-borrow, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 17:42:33 +0000 (19:42 +0200)]
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

3 years agoRollup merge of #77005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
Jonas Schievink [Fri, 25 Sep 2020 17:42:31 +0000 (19:42 +0200)]
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

3 years agoRollup merge of #76973 - lzutao:unstably-const-assume, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 17:42:29 +0000 (19:42 +0200)]
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

3 years agoRollup merge of #76932 - fusion-engineering-forks:condvar-promise, r=sfackler
Jonas Schievink [Fri, 25 Sep 2020 17:42:28 +0000 (19:42 +0200)]
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.

3 years agoUse proper issue for `const_fn_floating_point_arithmetic`
Dylan MacKenzie [Wed, 23 Sep 2020 20:08:20 +0000 (13:08 -0700)]
Use proper issue for `const_fn_floating_point_arithmetic`

3 years agoMove const fn floating point test out of `min_const_fn`
Dylan MacKenzie [Wed, 23 Sep 2020 19:38:21 +0000 (12:38 -0700)]
Move const fn floating point test out of `min_const_fn`

3 years agoBless tests
Dylan MacKenzie [Wed, 23 Sep 2020 18:58:41 +0000 (11:58 -0700)]
Bless tests

3 years agoAdd new feature gate to standard library
Dylan MacKenzie [Wed, 23 Sep 2020 18:58:22 +0000 (11:58 -0700)]
Add new feature gate to standard library

3 years agoPut floating point arithmetic behind its own feature gate
Dylan MacKenzie [Wed, 23 Sep 2020 18:54:11 +0000 (11:54 -0700)]
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.

3 years agoAdd `const_fn_floating_point_arithmetic`
Dylan MacKenzie [Wed, 23 Sep 2020 18:53:58 +0000 (11:53 -0700)]
Add `const_fn_floating_point_arithmetic`

3 years agoAuto merge of #77157 - tmiasko:simplify-cfg-dup, r=jonas-schievink
bors [Fri, 25 Sep 2020 17:27:52 +0000 (17:27 +0000)]
Auto merge of #77157 - tmiasko:simplify-cfg-dup, r=jonas-schievink

Remove duplicated SimplifyCfg pass

3 years agoRemove extra space from vec drawing
Ivan Tham [Fri, 25 Sep 2020 15:20:22 +0000 (23:20 +0800)]
Remove extra space from vec drawing

3 years agoAuto merge of #73453 - erikdesjardins:tuplayout, r=eddyb
bors [Fri, 25 Sep 2020 14:42:20 +0000 (14:42 +0000)]
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

3 years agoRust vec bench import specific rand::RngCore
Ivan Tham [Fri, 25 Sep 2020 14:19:28 +0000 (22:19 +0800)]
Rust vec bench import specific rand::RngCore

3 years agoAllow multiple allow_internal_unstable attributes
Dániel Buga [Fri, 25 Sep 2020 12:40:16 +0000 (14:40 +0200)]
Allow multiple allow_internal_unstable attributes

Co-authored-by: varkor <github@varkor.com>
3 years agoAuto merge of #77152 - vandenheuvel:update_chalk_further, r=jackh726
bors [Fri, 25 Sep 2020 12:22:05 +0000 (12:22 +0000)]
Auto merge of #77152 - vandenheuvel:update_chalk_further, r=jackh726

Update chalk to 0.28.0

3 years agoLink dynamic and static late_link_args before generic ones
Mateusz Mikuła [Fri, 25 Sep 2020 11:33:25 +0000 (13:33 +0200)]
Link dynamic and static late_link_args before generic ones

3 years agoAuto merge of #77041 - lcnr:const-eval-perf, r=ecstatic-morse
bors [Fri, 25 Sep 2020 10:14:47 +0000 (10:14 +0000)]
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`

3 years agoBTreeMap: various tweaks
Stein Somers [Sun, 9 Aug 2020 10:25:20 +0000 (12:25 +0200)]
BTreeMap: various tweaks

3 years agoBTreeMap: introduce edge methods similar to those of keys and values
Stein Somers [Sun, 9 Aug 2020 10:25:20 +0000 (12:25 +0200)]
BTreeMap: introduce edge methods similar to those of keys and values

3 years agoBTreeMap: refactor correct_childrens_parent_links
Stein Somers [Sun, 9 Aug 2020 10:25:20 +0000 (12:25 +0200)]
BTreeMap: refactor correct_childrens_parent_links

3 years agoAuto merge of #77144 - flip1995:clippyup, r=Manishearth
bors [Fri, 25 Sep 2020 06:23:55 +0000 (06:23 +0000)]
Auto merge of #77144 - flip1995:clippyup, r=Manishearth

Update Clippy

Bi-weekly Clippy update.

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

r? `@Manishearth`

3 years agoAuto merge of #76844 - simonvandel:fix-76803, r=wesleywiser
bors [Fri, 25 Sep 2020 04:17:03 +0000 (04:17 +0000)]
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

3 years agoRemoving erroneous semicolon
Austin Keeley [Fri, 25 Sep 2020 04:03:59 +0000 (00:03 -0400)]
Removing erroneous semicolon

3 years agoAuto merge of #77172 - jonas-schievink:rollup-a041rou, r=jonas-schievink
bors [Fri, 25 Sep 2020 01:56:06 +0000 (01:56 +0000)]
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`

3 years agoRollup merge of #77165 - simonvandel:do-not-fire-on-drop-and-replace, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 00:29:52 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77164 - fusion-engineering-forks:no-more-funny-underscores, r=Mark...
Jonas Schievink [Fri, 25 Sep 2020 00:29:51 +0000 (02:29 +0200)]
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.

3 years agoRollup merge of #77160 - ecstatic-morse:const-fn-transmute-suggestion, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 00:29:49 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77136 - ecstatic-morse:issue-77134, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 00:29:47 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77121 - duckymirror:html-root-url, r=jyn514
Jonas Schievink [Fri, 25 Sep 2020 00:29:45 +0000 (02:29 +0200)]
Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514

Updated html_root_url for compiler crates

Closes #77103

r? @jyn514

3 years agoRollup merge of #77081 - LingMan:patch-1, r=jonas-schievink
Jonas Schievink [Fri, 25 Sep 2020 00:29:44 +0000 (02:29 +0200)]
Rollup merge of #77081 - LingMan:patch-1, r=jonas-schievink

Merge two almost identical match arms

3 years agoRollup merge of #77079 - poliorcetics:more-self-in-docs, r=jyn514
Jonas Schievink [Fri, 25 Sep 2020 00:29:42 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77078 - LingMan:patch-2, r=jonas-schievink
Jonas Schievink [Fri, 25 Sep 2020 00:29:40 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77074 - lcnr:array-from-ref, r=SimonSapin
Jonas Schievink [Fri, 25 Sep 2020 00:29:39 +0000 (02:29 +0200)]
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.

3 years agoRollup merge of #77050 - follower:patch-1, r=oli-obk
Jonas Schievink [Fri, 25 Sep 2020 00:29:37 +0000 (02:29 +0200)]
Rollup merge of #77050 - follower:patch-1, r=oli-obk

Typo fix: "satsify" -> "satisfy"

3 years agoRollup merge of #77044 - pickfire:patch-4, r=jyn514
Jonas Schievink [Fri, 25 Sep 2020 00:29:35 +0000 (02:29 +0200)]
Rollup merge of #77044 - pickfire:patch-4, r=jyn514

Liballoc bench vec use mem take not replace

3 years agoRollup merge of #76978 - duckymirror:mpsc-from-doc, r=jyn514
Jonas Schievink [Fri, 25 Sep 2020 00:29:34 +0000 (02:29 +0200)]
Rollup merge of #76978 - duckymirror:mpsc-from-doc, r=jyn514

Documented From impls in std/sync/mpsc/mod.rs

This is for #51430.

r? @steveklabnik

3 years agoRollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr
Jonas Schievink [Fri, 25 Sep 2020 00:29:31 +0000 (02:29 +0200)]
Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr

Allow a unique name to be assigned to dataflow graphviz output

Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.

3 years agoRollup merge of #76304 - CDirkx:const-ip, r=ecstatic-morse
Jonas Schievink [Fri, 25 Sep 2020 00:29:30 +0000 (02:29 +0200)]
Rollup merge of #76304 - CDirkx:const-ip, r=ecstatic-morse

Make delegation methods of `std::net::IpAddr` unstably const

Make the following methods of `std::net::IpAddr` unstable const under the `const_ip` feature:
 - `is_unspecified`
 - `is_loopback`
 - `is_global`
 - `is_multicast`

Also adds a test for these methods in a const context.

Possible because these methods delegate to the inner `Ipv4Addr` or `Ipv6Addr`, which were made const ([PR#76205](https://github.com/rust-lang/rust/pull/76142) and [PR#76206](https://github.com/rust-lang/rust/pull/76206)), and the recent stabilization of const control flow.

Part of #76205

r? @ecstatic-morse

3 years agoRollup merge of #75438 - Cldfire:rustdoc/use-adaptive-svg-favicon, r=GuillaumeGomez
Jonas Schievink [Fri, 25 Sep 2020 00:29:22 +0000 (02:29 +0200)]
Rollup merge of #75438 - Cldfire:rustdoc/use-adaptive-svg-favicon, r=GuillaumeGomez

Use adaptive SVG favicon for rustdoc like other rust sites

Use the theme-adaptive SVG favicon that was recently introduced [for the Rust site](https://github.com/rust-lang/www.rust-lang.org/pull/1185) (and others).

(This PR is simply copied from the PR linked above, so see that for rationale.)

Closes #72165.

Before, Firefox on Linux:

![image](https://user-images.githubusercontent.com/13814214/89971811-34c0a900-dc2a-11ea-9aa6-a4aa9d66bed4.png)

After, Firefox on Linux (`prefers-color-scheme` set to `dark` by setting `ui.systemUsesDarkTheme` to a number value of `1` in `about:config`):

![image](https://user-images.githubusercontent.com/13814214/89971842-515ce100-dc2a-11ea-92e8-c374aaaf6031.png)

3 years agoAuto merge of #77014 - tmiasko:arena, r=Mark-Simulacrum
bors [Thu, 24 Sep 2020 23:51:45 +0000 (23:51 +0000)]
Auto merge of #77014 - tmiasko:arena, r=Mark-Simulacrum

DroplessArena: Allocate objects from the end of memory chunk

Allocating from the end of memory chunk simplifies the alignment code
and reduces the number of checked arithmetic operations.

3 years agoFix FIXME in core::num test: Check sign of zero in min/max tests.
Mara Bos [Thu, 24 Sep 2020 20:29:32 +0000 (22:29 +0200)]
Fix FIXME in core::num test: Check sign of zero in min/max tests.

3 years agoperf: split progress_obligations with inline(never)
Bastian Kauschke [Thu, 24 Sep 2020 17:52:49 +0000 (19:52 +0200)]
perf: split progress_obligations with inline(never)

3 years agonit
Bastian Kauschke [Thu, 24 Sep 2020 20:03:39 +0000 (22:03 +0200)]
nit

3 years agothe two hardest things in programming, names and...
Bastian Kauschke [Thu, 24 Sep 2020 20:01:46 +0000 (22:01 +0200)]
the two hardest things in programming, names and...

3 years agoupdate Miri
Ralf Jung [Thu, 24 Sep 2020 19:53:07 +0000 (21:53 +0200)]
update Miri

3 years agoBless tests
Dylan MacKenzie [Thu, 24 Sep 2020 18:12:28 +0000 (11:12 -0700)]
Bless tests

3 years agoSuggest `const_fn_transmute` instead of `const_fn`
Dylan MacKenzie [Thu, 24 Sep 2020 18:11:53 +0000 (11:11 -0700)]
Suggest `const_fn_transmute` instead of `const_fn`

3 years agoResolve https://github.com/rust-lang/rust/pull/76673#discussion_r494426303
Simon Vandel Sillesen [Thu, 24 Sep 2020 19:02:53 +0000 (21:02 +0200)]
Resolve https://github.com/rust-lang/rust/pull/76673#discussion_r494426303

3 years agoUpgrade chalk to 0.28.0
Bram van den Heuvel [Thu, 24 Sep 2020 15:37:55 +0000 (17:37 +0200)]
Upgrade chalk to 0.28.0

3 years agoRemove workaround for deref issue that no longer exists.
Mara Bos [Thu, 24 Sep 2020 18:50:09 +0000 (20:50 +0200)]
Remove workaround for deref issue that no longer exists.

The double underscores were used to work around issue #12808, which was
solved in 2016.

3 years agoCall ReentrantMutex::init() in stdout().
Mara Bos [Thu, 24 Sep 2020 17:25:21 +0000 (19:25 +0200)]
Call ReentrantMutex::init() in stdout().

3 years agoAuto merge of #76918 - ishitatsuyuki:match-fastpath, r=oli-obk
bors [Thu, 24 Sep 2020 17:22:56 +0000 (17:22 +0000)]
Auto merge of #76918 - ishitatsuyuki:match-fastpath, r=oli-obk

Add fast path for match checking

This adds a fast path that would reduce the complexity to linear on matches consisting of only variant patterns (i.e. enum matches). (Also see: #7462) Unfortunately, I was too lazy to add a similar fast path for constants (mostly for integer matches), ideally that could be added another day.

TBH, I'm not confident with the performance claims due to the fact that enums tends to be small and FxHashMap could add a lot of overhead.

r? `@Mark-Simulacrum`

needs perf

3 years agoremove enum name from ImplSource variants
Bastian Kauschke [Thu, 24 Sep 2020 17:22:36 +0000 (19:22 +0200)]
remove enum name from ImplSource variants

3 years agoRemove TrustedLen requirement from BuilderMethods::switch
est31 [Thu, 24 Sep 2020 17:10:34 +0000 (19:10 +0200)]
Remove TrustedLen requirement from BuilderMethods::switch

The main use case of TrustedLen is allowing APIs to specialize on it,
but no use of it uses that specialization. Instead, only the .len()
function provided by ExactSizeIterator is used, which is already
required to be accurate.

Thus, the TrustedLen requirement on BuilderMethods::switch is redundant.

3 years agoUpdate chalk to 0.27.0
Bram van den Heuvel [Thu, 24 Sep 2020 14:59:21 +0000 (16:59 +0200)]
Update chalk to 0.27.0

3 years agoUpdate chalk to 0.26.0
Bram van den Heuvel [Thu, 24 Sep 2020 14:49:02 +0000 (16:49 +0200)]
Update chalk to 0.26.0

3 years agoUpdate chalk to 0.25.0
Bram van den Heuvel [Thu, 24 Sep 2020 14:09:39 +0000 (16:09 +0200)]
Update chalk to 0.25.0

3 years agoUpdate chalk to 0.24.0
Bram van den Heuvel [Thu, 24 Sep 2020 14:02:31 +0000 (16:02 +0200)]
Update chalk to 0.24.0

3 years agoUpdate chalk to 0.23.0
Bram van den Heuvel [Thu, 24 Sep 2020 13:21:46 +0000 (15:21 +0200)]
Update chalk to 0.23.0

3 years agoUpdate chalk to 0.22.0
Bram van den Heuvel [Thu, 24 Sep 2020 12:43:41 +0000 (14:43 +0200)]
Update chalk to 0.22.0

3 years agoDrop use of Arc from Stdin and Stdout.
Mara Bos [Thu, 24 Sep 2020 17:09:33 +0000 (19:09 +0200)]
Drop use of Arc from Stdin and Stdout.

3 years agoAdd test to check stdout flushing during shutdown.
Mara Bos [Thu, 24 Sep 2020 16:10:26 +0000 (18:10 +0200)]
Add test to check stdout flushing during shutdown.

3 years agoRemove std::io::lazy::Lazy in favour of SyncOnceCell
Mara Bos [Thu, 24 Sep 2020 15:45:50 +0000 (17:45 +0200)]
Remove std::io::lazy::Lazy in favour of SyncOnceCell

The (internal) std::io::lazy::Lazy was used to lazily initialize the
stdout and stdin buffers (and mutexes). It uses atexit() to register a
destructor to flush the streams on exit, and mark the streams as
'closed'. Using the stream afterwards would result in a panic.

Stdout uses a LineWriter which contains a BufWriter that will flush the
buffer on drop. This one is important to be executed during shutdown,
to make sure no buffered output is lost. It also forbids access to
stdout afterwards, since the buffer is already flushed and gone.

Stdin uses a BufReader, which does not implement Drop. It simply forgets
any previously read data that was not read from the buffer yet. This
means that in the case of stdin, the atexit() function's only effect is
making stdin inaccessible to the program, such that later accesses
result in a panic. This is uncessary, as it'd have been safe to access
stdin during shutdown of the program.

---

This change removes the entire io::lazy module in favour of
SyncOnceCell. SyncOnceCell's fast path is much faster (a single atomic
operation) than locking a sys_common::Mutex on every access like Lazy
did.

However, SyncOnceCell does not use atexit() to drop the contained object
during shutdown.

As noted above, this is not a problem for stdin. It simply means stdin
is now usable during shutdown.

The atexit() call for stdout is moved to the stdio module. Unlike the
now-removed Lazy struct, SyncOnceCell does not have a 'gone and
unusable' state that panics. Instead of adding this again, this simply
replaces the buffer with one with zero capacity. This effectively
flushes the old buffer *and* makes any writes afterwards pass through
directly without touching a buffer, making print!() available during
shutdown without panicking.

3 years agoAuto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrum
bors [Thu, 24 Sep 2020 15:12:17 +0000 (15:12 +0000)]
Auto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrum

Cache `eval_to_allocation_raw` on disk

https://github.com/rust-lang/rust/pull/74949#issuecomment-695833161 regressed the performance on these queries, this PR gets the perf back.

3 years agoRevert a test change to make sure it's still testing the original issue
Oliver Scherer [Thu, 24 Sep 2020 15:11:47 +0000 (17:11 +0200)]
Revert a test change to make sure it's still testing the original issue

3 years agoAlways cache const eval queries
Oliver Scherer [Thu, 24 Sep 2020 15:09:09 +0000 (17:09 +0200)]
Always cache const eval queries

3 years agoDocument `FallbackToConstRef` and make sure we don't accidentally use it
Oliver Scherer [Thu, 24 Sep 2020 15:01:03 +0000 (17:01 +0200)]
Document `FallbackToConstRef` and make sure we don't accidentally use it

3 years agomove test to intergrated test in library/core
Lzu Tao [Thu, 24 Sep 2020 14:41:40 +0000 (14:41 +0000)]
move test to intergrated test in library/core

3 years agoAdd `x.py setup`
Joshua Nelson [Sat, 12 Sep 2020 06:32:43 +0000 (02:32 -0400)]
Add `x.py setup`

- Suggest `x.py setup` if config.toml doesn't exist yet (twice, once
before and once after the build)
- Prompt for a profile if not given on the command line
- Print the configuration file that will be used
- Print helpful starting commands after setup
- Link to the dev-guide after finishing
- Note that distro maintainers will see the changelog warning

3 years agoInstall std for non-host targets
Mark Rousskov [Thu, 24 Sep 2020 13:37:23 +0000 (09:37 -0400)]
Install std for non-host targets

3 years agoAuto merge of #76820 - jyn514:query-comments, r=davidtwco
bors [Thu, 24 Sep 2020 13:01:46 +0000 (13:01 +0000)]
Auto merge of #76820 - jyn514:query-comments, r=davidtwco

Preserve doc-comments when generating queries

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

3 years agoUpdate Cargo.lock
flip1995 [Thu, 24 Sep 2020 12:51:13 +0000 (14:51 +0200)]
Update Cargo.lock

3 years agoMerge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup
flip1995 [Thu, 24 Sep 2020 12:49:22 +0000 (14:49 +0200)]
Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup

3 years agoAuto merge of #77049 - lcnr:const-eval-function-signature, r=oli-obk
bors [Thu, 24 Sep 2020 10:29:14 +0000 (10:29 +0000)]
Auto merge of #77049 - lcnr:const-eval-function-signature, r=oli-obk

const_evaluatable_checked: extend predicate collection

We now walk the hir instead of using `ty` so that we get better spans here, While I am still not completely sure if that's
what we want in the end, it does seem a lot closer to the final goal than the previous version.

We also look into type aliases (and use a `TypeVisitor` here), about which I am not completely sure, but we will see how well this works.

We also look into fn decls, so the following should work now.
```rust
fn test<T>() -> [u8; std::mem::size_of::<T>()] {
    [0; std::mem::size_of::<T>()]
}
```
Additionally, we visit the optional trait and self type of impls.

r? `@oli-obk`

3 years agoDeduplicate the "needs partialeq derive" message creation sites
Oliver Scherer [Thu, 24 Sep 2020 08:18:51 +0000 (10:18 +0200)]
Deduplicate the "needs partialeq derive" message creation sites

3 years agoAuto merge of #77028 - andjo403:mini, r=matthewjasper
bors [Thu, 24 Sep 2020 08:14:30 +0000 (08:14 +0000)]
Auto merge of #77028 - andjo403:mini, r=matthewjasper

Move MiniSet to data_structures

remove the need for T to be copy from MiniSet as was done for MiniMap

MiniMap and MiniSet was added by https://github.com/rust-lang/rust/pull/72412

think that this can be used in https://github.com/rust-lang/rust/pull/68828

3 years agoUse correct type in diagnostics again
Oliver Scherer [Thu, 24 Sep 2020 08:06:07 +0000 (10:06 +0200)]
Use correct type in diagnostics again

3 years agoDon't talk about determinism
Oliver Scherer [Thu, 24 Sep 2020 07:43:10 +0000 (09:43 +0200)]
Don't talk about determinism

3 years agoupdate tests
Bastian Kauschke [Tue, 22 Sep 2020 16:00:32 +0000 (18:00 +0200)]
update tests

3 years agovisit impl self ty + trait
Bastian Kauschke [Tue, 22 Sep 2020 09:55:03 +0000 (11:55 +0200)]
visit impl self ty + trait

3 years agoassign the correct `DefId` in `nominal_obligations`
Bastian Kauschke [Tue, 22 Sep 2020 09:36:54 +0000 (11:36 +0200)]
assign the correct `DefId` in `nominal_obligations`

3 years agowalk hir to get const evaluatable predicates
Bastian Kauschke [Tue, 22 Sep 2020 08:54:09 +0000 (10:54 +0200)]
walk hir to get const evaluatable predicates