]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMove `qualify_min_const_fn` out of rustc into clippy
Oliver Scherer [Sat, 26 Sep 2020 14:08:24 +0000 (16:08 +0200)]
Move `qualify_min_const_fn` out of rustc into clippy

3 years agoAuto merge of #76485 - estebank:format_arg_capture_spans, r=davidtwco
bors [Sat, 26 Sep 2020 10:05:49 +0000 (10:05 +0000)]
Auto merge of #76485 - estebank:format_arg_capture_spans, r=davidtwco

Point at named argument not found when using `format_args_capture` instead of whole format string

3 years agoAuto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddyb
bors [Sat, 26 Sep 2020 06:44:28 +0000 (06:44 +0000)]
Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddyb

Fully destructure constants into patterns

r? `@varkor`

as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924

we should probably crater it once reviewed

3 years agoAuto merge of #74225 - poliorcetics:std-thread-unsafe-op-in-unsafe-fn, r=joshtriplett
bors [Sat, 26 Sep 2020 03:54:00 +0000 (03:54 +0000)]
Auto merge of #74225 - poliorcetics:std-thread-unsafe-op-in-unsafe-fn, r=joshtriplett

Std/thread: deny unsafe op in unsafe fn

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/thread`.
`@rustbot` modify labels: F-unsafe-block-in-unsafe-fn

3 years agoAuto merge of #76176 - marmeladema:fix-closure-path-printing, r=eddyb
bors [Sat, 26 Sep 2020 01:36:50 +0000 (01:36 +0000)]
Auto merge of #76176 - marmeladema:fix-closure-path-printing, r=eddyb

Move from {{closure}}#0 syntax to {closure#0} for (def) path components

Part of #70334

I followed the approach described by `@eddyb` and introduced a `DefPathDataName` enum.
To preserve compatibility, in various places, I had to rely on formatting manually by calling `format!("{{{{{}}}}}", namespace)`.

My questions are:
* Do we want to convert for places to use the new naming scheme? Or shall I re-add `DefPathData::as_symbol` but renamed as `DefPathData::as_legacy_symbol` to avoid manually allocating the legacy symbols?
* Do we want to `impl Display for DisambiguatedDefPathData` to avoid manually calling `write!(s, "{{{}#{}}}", namespace, component.disambiguator)`?
* We might also want to improve naming for `DefPathDataName` and `DefPathData::get_name`

r? `@eddyb`

3 years agoMove `is_raw_guess` check in `ty::print::pretty`
marmeladema [Thu, 24 Sep 2020 09:23:01 +0000 (10:23 +0100)]
Move `is_raw_guess` check in `ty::print::pretty`

3 years agoAddress review comment
marmeladema [Wed, 23 Sep 2020 22:38:38 +0000 (23:38 +0100)]
Address review comment

3 years agoFix tests
marmeladema [Mon, 21 Sep 2020 21:19:44 +0000 (22:19 +0100)]
Fix tests

3 years agoRemove now unused `double_braced_*` symbols
marmeladema [Tue, 1 Sep 2020 18:37:12 +0000 (19:37 +0100)]
Remove now unused `double_braced_*` symbols

3 years agoFix profiling query key creation
marmeladema [Tue, 1 Sep 2020 18:34:46 +0000 (19:34 +0100)]
Fix profiling query key creation

3 years agoSimplify some match statements on `DefPathDataName'
marmeladema [Tue, 1 Sep 2020 12:11:28 +0000 (13:11 +0100)]
Simplify some match statements on `DefPathDataName'

3 years agoAvoid calling `Symbol::interner` in `compute_codegen_unit_name`
marmeladema [Tue, 1 Sep 2020 08:31:02 +0000 (09:31 +0100)]
Avoid calling `Symbol::interner` in `compute_codegen_unit_name`

3 years agoRename `DefPathData::get_name()` to `DefPathData::name()`
marmeladema [Mon, 31 Aug 2020 23:42:30 +0000 (00:42 +0100)]
Rename `DefPathData::get_name()` to `DefPathData::name()`

3 years agoFix pretty-printing of `DisambiguatedDefPathData`
marmeladema [Mon, 31 Aug 2020 22:26:15 +0000 (23:26 +0100)]
Fix pretty-printing of `DisambiguatedDefPathData`

3 years agoImplement `Display` for `DisambiguatedDefPathData` and `DefPathData`
marmeladema [Mon, 31 Aug 2020 21:57:48 +0000 (22:57 +0100)]
Implement `Display` for `DisambiguatedDefPathData` and `DefPathData`

3 years agoMove from {{closure}}#0 syntax to {closure#0} for (def) path components
marmeladema [Mon, 31 Aug 2020 17:11:44 +0000 (18:11 +0100)]
Move from {{closure}}#0 syntax to {closure#0} for (def) path components

3 years agoAuto merge of #77201 - matthewjasper:rename-get-unchecked, r=spastorino
bors [Fri, 25 Sep 2020 21:44:26 +0000 (21:44 +0000)]
Auto merge of #77201 - matthewjasper:rename-get-unchecked, r=spastorino

Rename Iterator::get_unchecked

Closes #76479

r? `@pnkfelix`

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 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 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 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 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 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 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 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 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 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 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

3 years agofmt, use IndexSet directly instead of UniquePredicates
Bastian Kauschke [Tue, 22 Sep 2020 07:48:20 +0000 (09:48 +0200)]
fmt, use IndexSet directly instead of UniquePredicates

3 years agoconst_evaluatable_checked: collect predicates from fn_sig
Bastian Kauschke [Tue, 22 Sep 2020 07:42:29 +0000 (09:42 +0200)]
const_evaluatable_checked: collect predicates from fn_sig

3 years agoAuto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasper
bors [Thu, 24 Sep 2020 05:57:06 +0000 (05:57 +0000)]
Auto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasper

Fix underflow when calculating the number of no-op jumps folded

When removing unwinds to no-op blocks and folding jumps to no-op blocks,
remove the unwind target first. Otherwise we cannot determine if target
has been already folded or not.

Previous implementation incorrectly assumed that all resume targets had
been folded already, occasionally resulting in an underflow:

```
remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads
```

3 years agoBless tests
Dylan MacKenzie [Thu, 24 Sep 2020 04:05:59 +0000 (21:05 -0700)]
Bless tests