]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 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

3 years agoSuggest `const_mut_refs` for mutable references in const fn
Dylan MacKenzie [Thu, 24 Sep 2020 04:04:07 +0000 (21:04 -0700)]
Suggest `const_mut_refs` for mutable references in const fn

3 years agoAuto merge of #74430 - Manishearth:stabilize-intra-doc, r=Manishearth
bors [Thu, 24 Sep 2020 03:42:53 +0000 (03:42 +0000)]
Auto merge of #74430 - Manishearth:stabilize-intra-doc, r=Manishearth

Stabilize intra-doc links

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

Thanks to the great work of `@jyn514` in getting the [cross-crate reexport issue](https://github.com/rust-lang/rust/issues/65983) in intra-rustdoc links fixed, I think we're now in a position to stabilize this feature.

The tracking issue currently has two unresolved issues:

 - <s>behavior around doc(hidden): This is fixed in https://github.com/rust-lang/rust/pull/73365, which is just waiting for CI and should land tomorrow. It's also a pretty niche bug so while I expect it to land soon I don't think we need to block stabilization on it anyway.</s>
 - Non-identifier primitive types like slices: This was not a part of the original RFC anyway, and is a pretty niche use case

The feature itself, sans https://github.com/rust-lang/rust/issues/65983, has been shipped on nightly for three years now, with people using it on docs.rs. https://github.com/rust-lang/rust/issues/65983 itself is not an overwhelmingly central bit of functionality; the reason we elected to block stabilization on it was that back in 2017 it was not possible to fix the issue without some major refactorings of resolve, and we did not want to stabilize something that had such a potentially unfixable bug.

Given that we've fixed it, I see no reason to delay stabilization on this long awaited feature. It's possible that the latest patches have problems, however we _have_ done crater runs of some of the crucial parts. Furthermore, that's what the release trains are for, we will have a solid three months to let it ride the trains before it actually hits the stable compiler.

r? `@rust-lang/rustdoc`

3 years agoUse theme-adaptive SVG favicon from other Rust sites
Jarek Samic [Thu, 24 Sep 2020 01:31:27 +0000 (21:31 -0400)]
Use theme-adaptive SVG favicon from other Rust sites

3 years agoAuto merge of #77083 - KodrAus:revert/const-type-id, r=RalfJung
bors [Thu, 24 Sep 2020 00:43:09 +0000 (00:43 +0000)]
Auto merge of #77083 - KodrAus:revert/const-type-id, r=RalfJung

revert const_type_id stabilization

This reverts #72488, which is currently on beta and scheduled to stabilize in `1.47.0`, based on https://github.com/rust-lang/rust/pull/75923#issuecomment-696676511

It turns out we might not be quite ready to stabilize `TypeId` in const contexts before having a chance to rework its internals. Since `TypeId` is a bit of an oddity we want to be careful about how those internals are currently being relied on while making changes. That will be easier to do without having to also consider compile-time contexts.

r? `@eddyb`

3 years agoupdate tracking issue for const_type_id
Ashley Mannix [Wed, 23 Sep 2020 23:00:04 +0000 (09:00 +1000)]
update tracking issue for const_type_id

3 years agoAuto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPC
bors [Wed, 23 Sep 2020 22:34:44 +0000 (22:34 +0000)]
Auto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #76898 (Record `tcx.def_span` instead of `item.span` in crate metadata)
 - #76939 (emit errors during AbstractConst building)
 - #76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.)
 - #76993 (Changing the alloc() to accept &self instead of &mut self)
 - #76994 (fix small typo in docs and comments)
 - #77017 (Add missing examples on Vec iter types)
 - #77042 (Improve documentation for ToSocketAddrs)
 - #77047 (Miri: more informative deallocation error messages)
 - #77055 (Add #[track_caller] to more panicking Cell functions)

Failed merges:

r? `@ghost`

3 years agoAuto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk
bors [Wed, 23 Sep 2020 20:13:47 +0000 (20:13 +0000)]
Auto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk

MIR pass to remove unneeded drops on types not needing drop

This is heavily dependent on MIR inlining running to actually see the drop statement.

Do we want to special case replacing a call to std::mem::drop with a goto aswell?

3 years agotidy
Erik Hofmayer [Wed, 23 Sep 2020 20:08:30 +0000 (22:08 +0200)]
tidy

3 years agouse array::from_ref for slices
Bastian Kauschke [Wed, 23 Sep 2020 19:33:45 +0000 (21:33 +0200)]
use array::from_ref for slices

3 years ago/nightly/nightly-rustc
Erik Hofmayer [Wed, 23 Sep 2020 19:51:56 +0000 (21:51 +0200)]
/nightly/nightly-rustc

3 years agoMake delegation methods of `std::net::IpAddr` unstable const
Christiaan Dirkx [Mon, 7 Sep 2020 15:43:48 +0000 (17:43 +0200)]
Make delegation methods of `std::net::IpAddr` unstable 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, and the recent stabilization of const control flow.

Part of #76205

3 years agoUpdated html_root_url for compiler crates
Erik Hofmayer [Wed, 23 Sep 2020 19:14:43 +0000 (21:14 +0200)]
Updated html_root_url for compiler crates

3 years agoAuto merge of #6044 - rschoon:rc-buffer, r=yaahc
bors [Wed, 23 Sep 2020 18:35:08 +0000 (18:35 +0000)]
Auto merge of #6044 - rschoon:rc-buffer, r=yaahc

Add `rc_buffer` lint for checking Rc<String> and friends

Fixes #2623

This is a bit different from the original PR attempting to implement this type of lint.   Rather than linting against converting into the unwanted types, this PR lints against declaring the unwanted type in a struct or function definition.

I'm reasonably happy with what I have here, although I used the fully qualified type names for the Path and OsString suggestions, and I'm not sure if I should have just used the short versions instead, even if they might not have been declared via use.

Also, I don't know if "buffer type" is the best way to put it or not.  Alternatively I could call it a "growable type" or "growable buffer type", but I was thinking of PathBuf when I started making the lint.

changelog: Add `rc_buffer` lint

3 years agoIgnore test on wasm as it does not unwind
Simon Vandel Sillesen [Wed, 23 Sep 2020 16:25:55 +0000 (18:25 +0200)]
Ignore test on wasm as it does not unwind

3 years agoAuto merge of #77090 - rust-lang:revert-76110-convert-openoptions-cint, r=dtolnay
bors [Wed, 23 Sep 2020 13:19:18 +0000 (13:19 +0000)]
Auto merge of #77090 - rust-lang:revert-76110-convert-openoptions-cint, r=dtolnay

Revert "Function to convert OpenOptions to c_int"

Reverts rust-lang/rust#76110. This broke Rust's stability guarantees.

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

r? `@joshtriplett`

3 years agoRollup merge of #77055 - est31:more_track_caller, r=Mark-Simulacrum
Dylan DPC [Wed, 23 Sep 2020 12:54:15 +0000 (14:54 +0200)]
Rollup merge of #77055 - est31:more_track_caller, r=Mark-Simulacrum

Add #[track_caller] to more panicking Cell functions

Continuation of #74526

Adds the #[track_caller] attribute to almost all panicking Cell
functions. The ones that borrow two Cells in their function
body are spared, because the panic location helps pinpoint
which of the two borrows failed. You'd need to have
full debuginfo and backtraces enabled together with column
info in order to be able to discern the cases.
Column info in debuginfo is only available on non-Windows platforms.

3 years agoRollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obk
Dylan DPC [Wed, 23 Sep 2020 12:54:13 +0000 (14:54 +0200)]
Rollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obk

Miri: more informative deallocation error messages

Make sure we show the affected AllocId.

r? @oli-obk

3 years agoRollup merge of #77042 - imbolc:patch-2, r=kennytm
Dylan DPC [Wed, 23 Sep 2020 12:54:11 +0000 (14:54 +0200)]
Rollup merge of #77042 - imbolc:patch-2, r=kennytm

Improve documentation for ToSocketAddrs

I little clarification

3 years agoRollup merge of #77017 - GuillaumeGomez:vec-missing-examples-iter, r=Dylan-DPC
Dylan DPC [Wed, 23 Sep 2020 12:54:10 +0000 (14:54 +0200)]
Rollup merge of #77017 - GuillaumeGomez:vec-missing-examples-iter, r=Dylan-DPC

Add missing examples on Vec iter types

r? @Dylan-DPC

3 years agoRollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank
Dylan DPC [Wed, 23 Sep 2020 12:54:07 +0000 (14:54 +0200)]
Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank

fix small typo in docs and comments

Fixed `the the` to `the`, as far as I found.

3 years agoRollup merge of #76993 - blitzerr:alloc-ref, r=Amanieu
Dylan DPC [Wed, 23 Sep 2020 12:54:06 +0000 (14:54 +0200)]
Rollup merge of #76993 - blitzerr:alloc-ref, r=Amanieu

Changing the alloc() to accept &self instead of &mut self

Fixes: [#55](https://github.com/rust-lang/wg-allocators/issues/55)
This is the first cut. It only makes the change for `alloc` method.

3 years agoRollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=Amanieu
Dylan DPC [Wed, 23 Sep 2020 12:54:04 +0000 (14:54 +0200)]
Rollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=Amanieu

Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s.

r? @RalfJung

3 years agoRollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk
Dylan DPC [Wed, 23 Sep 2020 12:54:02 +0000 (14:54 +0200)]
Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk

emit errors during AbstractConst building

There changes are currently still untested, so I don't expect this to pass CI :laughing:

It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.

r? @oli-obk

3 years agoRollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk
Dylan DPC [Wed, 23 Sep 2020 12:54:00 +0000 (14:54 +0200)]
Rollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk

Record `tcx.def_span` instead of `item.span` in crate metadata

This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.

3 years agoadd tracking issue
Bastian Kauschke [Wed, 23 Sep 2020 11:48:21 +0000 (13:48 +0200)]
add tracking issue

3 years agoAuto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrum
bors [Wed, 23 Sep 2020 10:38:18 +0000 (10:38 +0000)]
Auto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrum

Don't download/sync llvm-project submodule if download-ci-llvm is set

llvm-project takes > 1GB storage space and a long time to download.
It's better to not download it unless needed.

3 years agoAuto merge of #76659 - simonvandel:76432, r=oli-obk
bors [Wed, 23 Sep 2020 08:23:00 +0000 (08:23 +0000)]
Auto merge of #76659 - simonvandel:76432, r=oli-obk

SimplifyComparisonIntegral: fix miscompilation

Fixes #76432
Only insert StorageDeads if we actually removed one.
Fixes an issue where we added StorageDead to a place with no StorageLive

r? `@oli-obk`

3 years agoMove MiniSet to data_structures
Andreas Jonson [Wed, 23 Sep 2020 06:09:16 +0000 (08:09 +0200)]
Move MiniSet to data_structures

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

3 years agoAuto merge of #76850 - ecstatic-morse:const-checking-refactor, r=oli-obk
bors [Wed, 23 Sep 2020 05:40:35 +0000 (05:40 +0000)]
Auto merge of #76850 - ecstatic-morse:const-checking-refactor, r=oli-obk

Remove `qualify_min_const_fn`

~~Blocked on #76807 (the first six commits).~~

With this PR, all checks in `qualify_min_const_fn` are replicated in `check_consts`, and the former is no longer invoked. My goal was to have as few changes to test output as possible, since making sweeping changes to the code *while* doing big batches of diagnostics updates turned out to be a headache. To this end, there's a few `HACK`s in `check_consts` to achieve parity with `qualify_min_const_fn`.

The new system that replaces `is_min_const_fn` is referred to as "const-stability"  My end goal for the const-stability rules is this:
* Const-stability is only applicable to functions defined in `staged_api` crates.
* All functions not marked `rustc_const_unstable` are considered "const-stable".
    - NB. This is currently not implemented. `#[unstable]` functions are also const-unstable. This causes problems when searching for feature gates.
    - All "const-unstable" functions have an associated feature gate
* const-stable functions can only call other const-stable functions
     - `allow_internal_unstable` can be used to circumvent this.
* All const-stable functions are subject to some additional checks (the ones that were unique to `qualify_min_const_fn`)

The plan is to remove each `HACK` individually in subsequent PRs. That way, changes to error message output can be reviewed in isolation.

3 years agoa few more &mut self -> self changes
blitzerr [Wed, 23 Sep 2020 04:04:31 +0000 (21:04 -0700)]
a few more &mut self -> self changes

3 years agofixing the test failure
blitzerr [Wed, 23 Sep 2020 03:16:13 +0000 (20:16 -0700)]
fixing the test failure

3 years agoRevert "Function to convert OpenOptions to c_int"
Joshua Nelson [Wed, 23 Sep 2020 03:07:30 +0000 (23:07 -0400)]
Revert "Function to convert OpenOptions to c_int"

3 years agoSatisfy rc_buffer lint in Constant::Binary byte string by copying data
Robin Schoonover [Wed, 23 Sep 2020 02:34:38 +0000 (20:34 -0600)]
Satisfy rc_buffer lint in Constant::Binary byte string by copying data

We can avoid the data copy again by fixing rustc_ast::ast::LitKind
later.

3 years agoAuto merge of #77063 - cuviper:llvm-11.0.0-rc3, r=nikic
bors [Wed, 23 Sep 2020 02:15:38 +0000 (02:15 +0000)]
Auto merge of #77063 - cuviper:llvm-11.0.0-rc3, r=nikic

Rebase LLVM onto 11.0.0-rc3

r? `@nikic`

3 years agorevert const_type_id stabilization
Ashley Mannix [Tue, 22 Sep 2020 22:39:19 +0000 (08:39 +1000)]
revert const_type_id stabilization

This reverts commit e3856616ee2a894c7811a7017d98fafa7ba84dd8.

3 years agoMerge two almost identical match arms
LingMan [Tue, 22 Sep 2020 23:09:24 +0000 (01:09 +0200)]
Merge two almost identical match arms

3 years agoAuto merge of #76928 - lcnr:opaque-types-cache, r=tmandry
bors [Tue, 22 Sep 2020 22:52:07 +0000 (22:52 +0000)]
Auto merge of #76928 - lcnr:opaque-types-cache, r=tmandry

cache types during normalization

partially fixes #75992

reduces the following test from 14 to 3 seconds locally.

cc `@Mark-Simulacrum` would it make sense to add that test to `perf`?
```rust
#![recursion_limit="2048"]
#![type_length_limit="112457564"]

pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) }
pub async fn h1(v: &String, x: &u64) { h0(v, x).await }
pub async fn h2(v: &String, x: &u64) { h1(v, x).await }
pub async fn h3(v: &String, x: &u64) { h2(v, x).await }
pub async fn h4(v: &String, x: &u64) { h3(v, x).await }
pub async fn h5(v: &String, x: &u64) { h4(v, x).await }
pub async fn h6(v: &String, x: &u64) { h5(v, x).await }
pub async fn h7(v: &String, x: &u64) { h6(v, x).await }
pub async fn h8(v: &String, x: &u64) { h7(v, x).await }
pub async fn h9(v: &String, x: &u64) { h8(v, x).await }

pub async fn h10(v: &String, x: &u64) { h9(v, x).await }
pub async fn h11(v: &String, x: &u64) { h10(v, x).await }
pub async fn h12(v: &String, x: &u64) { h11(v, x).await }
pub async fn h13(v: &String, x: &u64) { h12(v, x).await }
pub async fn h14(v: &String, x: &u64) { h13(v, x).await }
pub async fn h15(v: &String, x: &u64) { h14(v, x).await }
pub async fn h16(v: &String, x: &u64) { h15(v, x).await }
pub async fn h17(v: &String, x: &u64) { h16(v, x).await }
pub async fn h18(v: &String, x: &u64) { h17(v, x).await }
pub async fn h19(v: &String, x: &u64) { h18(v, x).await }

macro_rules! async_recursive {
    (29, $inner:expr) => { async { async_recursive!(28, $inner) }.await };
    (28, $inner:expr) => { async { async_recursive!(27, $inner) }.await };
    (27, $inner:expr) => { async { async_recursive!(26, $inner) }.await };
    (26, $inner:expr) => { async { async_recursive!(25, $inner) }.await };
    (25, $inner:expr) => { async { async_recursive!(24, $inner) }.await };
    (24, $inner:expr) => { async { async_recursive!(23, $inner) }.await };
    (23, $inner:expr) => { async { async_recursive!(22, $inner) }.await };
    (22, $inner:expr) => { async { async_recursive!(21, $inner) }.await };
    (21, $inner:expr) => { async { async_recursive!(20, $inner) }.await };
    (20, $inner:expr) => { async { async_recursive!(19, $inner) }.await };

    (19, $inner:expr) => { async { async_recursive!(18, $inner) }.await };
    (18, $inner:expr) => { async { async_recursive!(17, $inner) }.await };
    (17, $inner:expr) => { async { async_recursive!(16, $inner) }.await };
    (16, $inner:expr) => { async { async_recursive!(15, $inner) }.await };
    (15, $inner:expr) => { async { async_recursive!(14, $inner) }.await };
    (14, $inner:expr) => { async { async_recursive!(13, $inner) }.await };
    (13, $inner:expr) => { async { async_recursive!(12, $inner) }.await };
    (12, $inner:expr) => { async { async_recursive!(11, $inner) }.await };
    (11, $inner:expr) => { async { async_recursive!(10, $inner) }.await };
    (10, $inner:expr) => { async { async_recursive!(9, $inner) }.await };

    (9, $inner:expr) => { async { async_recursive!(8, $inner) }.await };
    (8, $inner:expr) => { async { async_recursive!(7, $inner) }.await };
    (7, $inner:expr) => { async { async_recursive!(6, $inner) }.await };
    (6, $inner:expr) => { async { async_recursive!(5, $inner) }.await };
    (5, $inner:expr) => { async { async_recursive!(4, $inner) }.await };
    (4, $inner:expr) => { async { async_recursive!(3, $inner) }.await };
    (3, $inner:expr) => { async { async_recursive!(2, $inner) }.await };
    (2, $inner:expr) => { async { async_recursive!(1, $inner) }.await };
    (1, $inner:expr) => { async { async_recursive!(0, $inner) }.await };
    (0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await };
}

async fn f() {
    async_recursive!(14, println!("hello"));
}

fn main() {
    let _ = f();
}
```
r? `@eddyb` requires a perf run.

3 years agoUse Self in alloc
Alexis Bourget [Tue, 22 Sep 2020 22:31:37 +0000 (00:31 +0200)]
Use Self in alloc

3 years agoDon't use an if guard to check equality with a constant
LingMan [Tue, 22 Sep 2020 22:29:56 +0000 (00:29 +0200)]
Don't use an if guard to check equality with a constant

Match on it directly instead

3 years agoUse Self more in core in doc when possible
Alexis Bourget [Tue, 22 Sep 2020 22:16:16 +0000 (00:16 +0200)]
Use Self more in core in doc when possible

3 years agoUse Self more in core/src/cmp.rs
Alexis Bourget [Tue, 22 Sep 2020 21:36:08 +0000 (23:36 +0200)]
Use Self more in core/src/cmp.rs

3 years agorebless after rebase
Simon Vandel Sillesen [Mon, 21 Sep 2020 20:06:54 +0000 (22:06 +0200)]
rebless after rebase

3 years agocleanup cfg after optimization
Simon Vandel Sillesen [Sat, 19 Sep 2020 13:21:39 +0000 (15:21 +0200)]
cleanup cfg after optimization

3 years agoThe optimization should also apply for DropAndReplace
Simon Vandel Sillesen [Sat, 19 Sep 2020 12:25:53 +0000 (14:25 +0200)]
The optimization should also apply for DropAndReplace

3 years agoGet LocalDefId from source instead of passing in
Simon Vandel Sillesen [Sat, 19 Sep 2020 11:52:55 +0000 (13:52 +0200)]
Get LocalDefId from source instead of passing in

3 years agoSuggestion from review
Simon Vandel Sillesen [Mon, 14 Sep 2020 20:56:39 +0000 (22:56 +0200)]
Suggestion from review

Co-authored-by: Andreas Jonson <andjo403@users.noreply.github.com>
3 years agoMIR pass to remove unneeded drops on types not needing drop
Simon Vandel Sillesen [Sun, 13 Sep 2020 14:04:45 +0000 (16:04 +0200)]
MIR pass to remove unneeded drops on types not needing drop

This is heavily dependent on MIR inlining running to actually see the drop statement

3 years agoAuto merge of #76810 - Mark-Simulacrum:fix-lld-macos, r=alexcrichton
bors [Tue, 22 Sep 2020 20:35:45 +0000 (20:35 +0000)]
Auto merge of #76810 - Mark-Simulacrum:fix-lld-macos, r=alexcrichton

Don't dynamically link LLVM tools unless rustc is too

This PR initially tried to support link-shared on all of our target platforms (other than Windows), but ran into a number of difficulties:
 * LLVM doesn't really support a shared link on macOS (llvm-config runs into problems with the version suffix)
 * LLVM doesn't seem to support a shared link when cross-compiling (the libLLVM.so ends up empty and symbols are not found)

So, this PR has now been revised such that we don't attempt to dynamically link LLVM tools (even if that would, otherwise, be supported) on targets where LLVM is statically linked to rustc. Currently that's basically everything except for x86_64-unknown-linux-gnu (where we dynamically link to avoid rerunning ThinLTO in each stage).

Follow-up to #76708.
Fixes #76698.

3 years agoadd array from_ref
Bastian Kauschke [Tue, 22 Sep 2020 19:35:43 +0000 (21:35 +0200)]
add array from_ref

3 years agoUse correct feature gate for unsizing casts
Dylan MacKenzie [Tue, 22 Sep 2020 17:21:58 +0000 (10:21 -0700)]
Use correct feature gate for unsizing casts