Commit Graph

151339 Commits

Author SHA1 Message Date
Yuki Okushi
e457c2739b
Upgrade cc crate to 1.0.69 2021-07-13 17:58:50 +09:00
bors
1f0db5e0a3 Auto merge of #86665 - FabianWolff:layout-field-thir-unsafeck, r=oli-obk
Implement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeck

Since nobody has so far claimed Mutation- and BorrowOfLayoutConstrainedField in rust-lang/project-thir-unsafeck#7, I have taken the liberty of implementing them in thir-unsafeck.

r? `@LeSeulArtichaut`
2021-07-13 04:38:39 +00:00
bors
14c0c3e55d Auto merge of #87095 - JohnTitor:rollup-mn7ggy2, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #86344 (Split MaybeUninit::write into new feature gate and stabilize it)
 - #86811 (Remove unstable `io::Cursor::remaining`)
 - #86846 (stdio_locked: add tracking issue)
 - #86887 (rustdoc: remove dead code in `clean`)
 - #87007 (Fix rust-analyzer install when not available.)
 - #87035 (Fix implementors display)
 - #87065 (Fix ICE with unsized type in const pattern)
 - #87070 (Simplify future incompatible reporting.)
 - #87077 (⬆️ rust-analyzer)
 - #87078 (Rustdoc: suggest removing disambiguator if linking to field)
 - #87089 (CTFE engine: small cleanups)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-13 01:52:49 +00:00
Yuki Okushi
e46b790b9d
Rollup merge of #87089 - RalfJung:ctfe-memory-cleanup, r=oli-obk
CTFE engine: small cleanups

I noticed these while preparing a large PR, and figured I'd better send them ahead to not muddy the diff unnecessarily.

- remove remaining use of Pointer in Allocation API (I missed those in https://github.com/rust-lang/rust/pull/85472)
- remove unnecessary deallocate_local hack (this logic does not seem necessary any more)

r? `@oli-obk`
2021-07-13 08:54:39 +09:00
Yuki Okushi
15af98d070
Rollup merge of #87078 - fee1-dead:rustdoc, r=jyn514
Rustdoc: suggest removing disambiguator if linking to field

This fixes #85615.

`@rustbot` label T-rustdoc
2021-07-13 08:54:38 +09:00
Yuki Okushi
4eba19a813
Rollup merge of #87077 - lnicola:rust-analyzer-2021-07-12, r=lnicola
⬆️ rust-analyzer

`@bors` r+
2021-07-13 08:54:37 +09:00
Yuki Okushi
8d4293c1d4
Rollup merge of #87070 - ehuss:simplify-future-report, r=oli-obk
Simplify future incompatible reporting.

This simplifies the implementation of the future incompatible reporting system. Instead of having a separate field in the future_incompatible definition, this reuses the `FutureIncompatibilityReason` enum. It also drops the "date" field. Cargo does not use the date field, and there isn't much of a need for this to be structured, and I am skeptical that the date can be predicted reliably. The date or release version can be listed in the lint text if desired.
2021-07-13 08:54:36 +09:00
Yuki Okushi
47a418420e
Rollup merge of #87065 - FabianWolff:issue-87046, r=oli-obk
Fix ICE with unsized type in const pattern

Fixes #87046. The `deref_const()` query currently contains the following check:
e9a387d6cf/compiler/rustc_mir/src/const_eval/mod.rs (L191-L204)

i.e. this will cause an ICE for every unsized type except slices. An error is reported with my changes if such a type is used as a const pattern (this should not be a breaking change, since so far, this has caused an ICE).
2021-07-13 08:54:34 +09:00
Yuki Okushi
fab45bf485
Rollup merge of #87035 - GuillaumeGomez:fix-implementors-display, r=notriddle
Fix implementors display

Part of https://github.com/rust-lang/rust/issues/86632.

This PR does a few things:
 * It fixes of the JS rendered implementors.
 * It generates anchors for JS rendered implementors to make it coherent with the others.
 * It adds a test to ensure that we won't have the same issue again.
 * It changes the way we render the rustdoc-gui crates to simplify it a bit and also to allow to have dependencies without going through compiletest.

Before:

![Screenshot from 2021-07-10 13-30-13](https://user-images.githubusercontent.com/3050060/125174172-b4048700-e1c3-11eb-8f0e-c46081371d4f.png)

After:

![Screenshot from 2021-07-10 21-11-15](https://user-images.githubusercontent.com/3050060/125174173-b49d1d80-e1c3-11eb-8740-1dbbff70c2eb.png)

I plan to add the `[src]` links in another PR because this one is already big enough.

cc `@Mark-Simulacrum` (for the bootstrap changes)

r? `@Nemo157`
2021-07-13 08:54:33 +09:00
Yuki Okushi
2d9a0387c1
Rollup merge of #87007 - ehuss:fix-rust-analyzer-install, r=Mark-Simulacrum
Fix rust-analyzer install when not available.

This changes it so that `x.py install` won't fail if rust-analyzer isn't available. This was changed in #86568 to handle the case where installing on stable/beta, and `extended=true`, to skip rust-analyzer. But I neglected to update the install part to also ignore it.

Fixes #86999
2021-07-13 08:54:32 +09:00
Yuki Okushi
a49927350f
Rollup merge of #86887 - jyn514:cleanup-clean, r=CraftSpider
rustdoc: remove dead code in `clean`

Builds on https://github.com/rust-lang/rust/pull/86886 and should not be merged before.
2021-07-13 08:54:31 +09:00
Yuki Okushi
bcacfe7c64
Rollup merge of #86846 - tlyu:stdio-locked-tracking, r=joshtriplett
stdio_locked: add tracking issue

Add the tracking issue number #86845 to the stability attributes for the implementation in #86799.

r? `@joshtriplett`
`@rustbot` label +A-io +C-cleanup +T-libs-api
2021-07-13 08:54:30 +09:00
Yuki Okushi
749a589746
Rollup merge of #86811 - soerenmeier:remove_remaining, r=yaahc
Remove unstable `io::Cursor::remaining`

Adding `io::Cursor::remaining` in #86037 caused a conflict with the implementation of `bytes::Buf` for `io::Cursor`, leading to an error in nightly, see https://github.com/rust-lang/rust/issues/86369#issuecomment-867723485.

This fixes the error by temporarily removing the `remaining` function.

r? `@yaahc`
2021-07-13 08:54:28 +09:00
Yuki Okushi
b507cd1745
Rollup merge of #86344 - est31:maybe-uninit-extra, r=RalfJung
Split MaybeUninit::write into new feature gate and stabilize it

This splits off the `MaybeUninit::write` function from the `maybe_uninit_extra` feature gate into a new `maybe_uninit_write` feature gate and stabilizes it.

Earlier work to improve the documentation of the write function: #86220

Tracking issue: #63567
2021-07-13 08:54:27 +09:00
bors
aa06edb4d5 Auto merge of #87018 - nikic:llvm-12.0.1, r=Mark-Simulacrum
Update to LLVM 12.0.1

LLVM 12.0.1 has been released, rebase our fork on top of it.
2021-07-12 23:24:25 +00:00
bors
955b9c0d4c Auto merge of #86320 - hi-rustin:rustin-patch-fix-span, r=estebank
shrinking the deprecated span

ref: https://github.com/rust-lang/rust/pull/85617#issuecomment-854947988

part of #85403

r? `@estebank`

The reason is that if we use method_span directly, it will cause the in_derive_expansion judgment to fail.
2021-07-12 20:43:28 +00:00
Eric Huss
166c147c27 Provide a better error when x.py install src/doc doesn't work. 2021-07-12 13:29:47 -07:00
est31
848a621591 Use the write function in some more places 2021-07-12 20:32:23 +02:00
Ralf Jung
6b26640583 remove unnecessary deallocate_local hack 2021-07-12 20:09:42 +02:00
Guillaume Gomez
bd819493d7 Add test for implementors 2021-07-12 19:03:59 +02:00
Guillaume Gomez
da6d82e465 Simplify build system for rustdoc-gui test crates 2021-07-12 19:03:59 +02:00
bors
b5a2ccee81 Auto merge of #87087 - fee1-dead:fix-try-2, r=joshtriplett
Remove `multiple-definitions` test

r? `@joshtriplett`

Temporary solution to #87084.
2021-07-12 16:55:44 +00:00
Ralf Jung
c8baac5776 remove remaining use of Pointer in Allocation API 2021-07-12 18:45:26 +02:00
Deadbeef
4adcd600b8
Remove multiple-definitions test 2021-07-13 00:14:28 +08:00
bors
3a24abd22f Auto merge of #86841 - GuillaumeGomez:reexported-macro-2-render, r=Stupremee
Fix rendering of reexported macros 2.0 and fix visibility of reexported items

So, this PR grew a bit out of focus, it does the following things:

* Fixes #86276.
* Fixes visibility display for reexported items: it now takes the visibility of the "use" statement rather than the visibility of the reexported item itself).
* Fixes the display of reexported items if "--document-private-items" option is used. Before, they were simply skipped.
* Fixes inconsistency on typedef items: they didn't display their visibility contrary to other items.

I added tests to check everything listed above.

cc `@camelid` `@ollie27` (in case one of you want to review?)

r? `@jyn514`
2021-07-12 11:52:55 +00:00
Deadbeef
3dab2d210f
suggest removing disambiguator if linking to field 2021-07-12 19:48:07 +08:00
Laurențiu Nicola
5712148e83 ⬆️ rust-analyzer 2021-07-12 09:54:59 +03:00
Nikita Popov
abb1e64f51 Update to LLVM 12.0.1 2021-07-12 08:53:53 +02:00
bors
e97c29bda2 Auto merge of #86815 - FabianWolff:issue-84210, r=varkor
Improve error reporting for modifications behind `&` references

I had a look at #84210 and noticed that #85823 has effectively already fixed #84210.

However, the string matching in #85823 is _very_ crude and already breaks down when a variable name starts with `mut`. I have made this a bit more robust; further improvements could definitely be made but are complicated by the lack of information provided by an earlier pass:
ce331ee6ee/compiler/rustc_mir_build/src/build/matches/mod.rs (L2103-L2107)

I have also fixed a missing comma in the error message.
2021-07-12 01:00:43 +00:00
bors
54aaca8623 Auto merge of #86249 - FabianWolff:issue-86238, r=varkor
Report an error if resolution of closure call functions failed

This pull request fixes #86238. The current implementation seems to assume that resolution of closure call functions (I'm not sure what the proper term is; I mean `call` of `Fn` etc.) can never fail:
60f1a2fc4b/compiler/rustc_typeck/src/check/callee.rs (L590-L595)

But actually, it can, if the `fn`/`fn_mut`/`fn_once` lang items are not defined, or don't have an associated `call`/`call_mut`/`call_once` function, leading to the ICE described in #86238. I have therefore turned the `span_bug!()` into an error message, which prevents the ICE.
2021-07-11 22:39:16 +00:00
Eric Huss
4d1daf8683 Simplify future incompatible reporting. 2021-07-11 13:08:58 -07:00
bors
7a16cfcffc Auto merge of #87068 - JohnTitor:rollup-2xuisfx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #73936 (Rustdoc: Change all 'optflag' arguments to 'optflagmulti')
 - #86926 (Update regex crates)
 - #86951 ([docs] Clarify behaviour of f64 and f32::sqrt when argument is negative zero)
 - #87031 (Update reference.md)
 - #87037 (cleanup(rustdoc): remove unused function getObjectNameById)
 - #87045 (Fix tracking issue for `bool_to_option`)
 - #87049 (Account for `submodules = false` in config.toml when updating LLVM submodule)
 - #87061 (Do not suggest adding a semicolon after `?`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-11 19:34:04 +00:00
Yuki Okushi
5fcefb1d61
Rollup merge of #87061 - FabianWolff:issue-87051, r=oli-obk
Do not suggest adding a semicolon after `?`

Fixes #87051. I have only modified `report_return_mismatched_types()`, i.e. my changes only affect suggestions to add `;` for return type mismatches, but this never makes sense after `?`, because the function cannot return `()` if `?` is used (it has to return a `Result` or an `Option`), and a semicolon won't help if the expected and actual `Err` types differ, even if the expected one is `()`.
2021-07-12 04:32:05 +09:00
Yuki Okushi
f3d5fde070
Rollup merge of #87049 - jyn514:no-submodules, r=Mark-Simulacrum
Account for `submodules = false` in config.toml when updating LLVM submodule

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

r? ``@Mark-Simulacrum`` cc ``@durin42``
2021-07-12 04:32:04 +09:00
Yuki Okushi
76aebb195b
Rollup merge of #87045 - jhpratt:fix-tracking-issue, r=jyn514
Fix tracking issue for `bool_to_option`

The previous tracking issue was closed in favor of the current.
2021-07-12 04:32:03 +09:00
Yuki Okushi
1232df9097
Rollup merge of #87037 - notriddle:notriddle/search-cleanup-getobjectnamefromid, r=GuillaumeGomez
cleanup(rustdoc): remove unused function getObjectNameById

This function was used in an earlier version, when idx's were used to serialize function inputs and outputs. That's not done any more, so removed the JS-side support for it.
2021-07-12 04:32:02 +09:00
Yuki Okushi
a2eebfbec6
Rollup merge of #87031 - ZuseZ4:patch-1, r=GuillaumeGomez
Update reference.md

I ran into a link to the outdated src/doc/reference.md here: https://users.rust-lang.org/t/conditional-compilation-for-debug-release/1098/6
Apparently the Rust reference has moved again, so the link gave a 404 error. This should fix it.
2021-07-12 04:32:01 +09:00
Yuki Okushi
5541d1ac16
Rollup merge of #86951 - cyberia-ng:fp-negative-zero-sqrt-docs, r=Mark-Simulacrum
[docs] Clarify behaviour of f64 and f32::sqrt when argument is negative zero

From IEEE 754 section 6.3:
> Except that squareRoot(−0) shall be −0, every numeric squareRoot result shall have a positive sign.
2021-07-12 04:31:59 +09:00
Yuki Okushi
a4e7a3c29c
Rollup merge of #86926 - bjorn3:update_some_deps, r=Mark-Simulacrum
Update regex crates

This removes two dependencies of rustbuild
2021-07-12 04:31:59 +09:00
Yuki Okushi
25dda3647e
Rollup merge of #73936 - zachlute:rustdoc-optflagmulti, r=jyn514
Rustdoc: Change all 'optflag' arguments to 'optflagmulti'

Because specifying these flags multiple times will never be discernibly different in functionality from specifying them a single time, there is no reason to fail and report an error to the user.

This might be a slightly controversial change. it's tough to say, but it's hard to imagine a case where somebody was depending on this behavior, and doing this seem actively better for the user.

This originally came up in discussion of a fix for  [Cargo #8373](https://github.com/rust-lang/cargo/issues/8373), in [Cargo PR #8422](https://github.com/rust-lang/cargo/pull/8422).

The issue is that Cargo will automatically add things like `--document-private-items` to binaries, because it's the only thing that makes sense there. Then some poor user comes along and adds `--document-private-items` to their `rustdoc` flags for the project and suddenly they're getting errors for specifying a flag twice and need to track down which targets to actually add it to without getting duplicates for reasons they won't understand without deep understanding of Cargo behavior.

We're apparently hesitant to inspect `rustdoc` flags provided by the user directly in Cargo, because they're supposed to be opaque, so looking to see if it's already provided before adding it is evidently a non-starter. In trying to resolve that, one suggestion I came up with was to just change `rustdoc` to support passing the flag multiple times, because the user's intent should be clear and it's not *really* an error, so maybe this is a case of 'be permissive in what you accept'.

This PR is an attempt to do that in a straightforward manner for purposes of discussion.
2021-07-12 04:31:58 +09:00
Fabian Wolff
79f0743b6f Fix ICE with unsized type in const pattern 2021-07-11 19:16:26 +02:00
bors
72568552fd Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011
Reduce the amount of untracked state in TyCtxt -- Take 2

Main part of #85153

The offending line (https://github.com/rust-lang/rust/pull/85153#discussion_r642866298) is replaced by a FIXME until the possible bug and the perf concern are both resolved.

r? `@Aaron1011`
2021-07-11 16:09:17 +00:00
Eric Huss
60ff731110 Add comments why install steps should never fail. 2021-07-11 09:01:31 -07:00
Fabian Wolff
9946ff227d Do not suggest adding a semicolon after ? 2021-07-11 17:22:44 +02:00
bors
e9a387d6cf Auto merge of #87057 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/87030
Cc `@rust-lang/miri` r? `@ghost`
2021-07-11 13:45:37 +00:00
Ralf Jung
48e000c0af update Miri 2021-07-11 14:04:58 +02:00
bors
81053b912f Auto merge of #86995 - sexxi-goose:rewrite, r=nikomatsakis
2229: Rewrite/Refactor Closure Capture Analaysis

While handling all the differnet edge cases the code for the captur analysis got pretty compicated. Looking at the overall picture of the edge cases the rules can still be layed out simply.

Alogithm: https://hackmd.io/D3I_gwvuT-SPnJ22tgJumw

r? `@nikomatsakis`

Closes https://github.com/rust-lang/project-rfc-2229/issues/52
Implementation part of https://github.com/rust-lang/project-rfc-2229/issues/53
2021-07-11 11:25:31 +00:00
bors
4581c4ef6f Auto merge of #87042 - petrochenkov:cleanquotspan, r=Aaron1011
Cleanup span quoting

I finally got to reviewing https://github.com/rust-lang/rust/pull/84278.
See the individual commit messages.
r? `@Aaron1011`
2021-07-11 08:46:43 +00:00
bors
0d76b73745 Auto merge of #83918 - workingjubilee:stable-rangefrom-pat, r=joshtriplett
Stabilize "RangeFrom" patterns in 1.55

Implements a partial stabilization of #67264 and #37854.
Reference PR: https://github.com/rust-lang/reference/pull/900

# Stabilization Report

This stabilizes the `X..` pattern, shown as such, offering an exhaustive match for unsigned integers:
```rust
match x as u32 {
      0 => println!("zero!"),
      1.. => println!("positive number!"),
}
```

Currently if a Rust author wants to write such a match on an integer, they must use `1..={integer}::MAX` . By allowing a "RangeFrom" style pattern, this simplifies the match to not require the MAX path and thus not require specifically repeating the type inside the match, allowing for easier refactoring. This is particularly useful for instances like the above case, where different behavior on "0" vs. "1 or any positive number" is desired, and the actual MAX is unimportant.

Notably, this excepts slice patterns which include half-open ranges from stabilization, as the wisdom of those is still subject to some debate.

## Practical Applications

Instances of this specific usage have appeared in the compiler:
16143d1067/compiler/rustc_middle/src/ty/inhabitedness/mod.rs (L219)
673d0db5e3/compiler/rustc_ty_utils/src/ty.rs (L524)

And I have noticed there are also a handful of "in the wild" users who have deployed it to similar effect, especially in the case of rejecting any value of a certain number or greater. It simply makes it much more ergonomic to write an irrefutable match, as done in Katholieke Universiteit Leuven's [SCALE and MAMBA project](05e5db00d5/WebAssembly/scale_std/src/fixed_point.rs (L685-L695)).

## Tests
There were already many tests in [src/test/ui/half-open-range/patterns](90a2e5e3fe/src/test/ui/half-open-range-patterns), as well as [generic pattern tests that test the `exclusive_range_pattern` feature](673d0db5e3/src/test/ui/pattern/usefulness/integer-ranges/reachability.rs), many dating back to the feature's introduction and remaining standing to this day. However, this stabilization comes with some additional tests to explore the... sometimes interesting behavior of interactions with other patterns. e.g. There is, at least, a mild diagnostic improvement in some edge cases, because before now, the pattern `0..=(5+1)` encounters the `half_open_range_patterns` feature gate and can thus emit the request to enable the feature flag, while also emitting the "inclusive range with no end" diagnostic. There is no intent to allow an `X..=` pattern that I am aware of, so removing the flag request is a strict improvement. The arrival of the `J | K` "or" pattern also enables some odd formations.

Some of the behavior tested for here is derived from experiments in this [Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=58777b3c715c85165ac4a70d93efeefc) example, linked at https://github.com/rust-lang/rust/issues/67264#issuecomment-812770692, which may be useful to reference to observe the current behavior more closely.

In addition tests constituting an explanation of the "slicing range patterns" syntax issue are included in this PR.

## Desiderata

The exclusive range patterns and half-open range patterns are fairly strongly requested by many authors, as they make some patterns much more natural to write, but there is disagreement regarding the "closed" exclusive range pattern or the "RangeTo" pattern, especially where it creates "off by one" gaps in the presence of a "catch-all" wildcard case. Also, there are obviously no range analyses in place that will force diagnostics for e.g. highly overlapping matches. I believe these should be warned on, ideally, and I think it would be reasonable to consider such a blocker to stabilizing this feature, but there is no technical issue with the feature as-is from the purely syntactic perspective as such overlapping or missed matches can already be generated today with such a catch-all case. And part of the "point" of the feature, at least from my view, is to make it easier to omit wildcard matches: a pattern with such an "open" match produces an irrefutable match and does not need the wild card case, making it easier to benefit from exhaustiveness checking.

## History

- Implemented:
  - Partially via exclusive ranges: https://github.com/rust-lang/rust/pull/35712
  - Fully with half-open ranges: https://github.com/rust-lang/rust/pull/67258
- Unresolved Questions:
  - The precedence concerns of https://github.com/rust-lang/rust/pull/48501 were considered as likely requiring adjustment but probably wanting a uniform consistent change across all pattern styles, given https://github.com/rust-lang/rust/issues/67264#issuecomment-720711656, but it is still unknown what changes might be desired
  - How we want to handle slice patterns in ranges seems to be an open question still, as witnessed in the discussion of this PR!

I checked but I couldn't actually find an RFC for this, and given "approved provisionally by lang team without an RFC", I believe this might require an RFC before it can land? Unsure of procedure here, on account of this being stabilizing a subset of a feature of syntax.

r? `@scottmcm`
2021-07-11 06:31:42 +00:00
bors
9f2e753b2f Auto merge of #86965 - sexxi-goose:rfc2229-improve-lint, r=nikomatsakis,lqd
Improves migrations lint for RFC2229

This PR improves the current disjoint capture migration lint by providing more information on why drop order or auto trait implementation for a closure is impacted by the use of the new feature.

The drop order migration lint will now look something like this:
```
error: changes to closure capture in Rust 2021 will affect drop order
  --> $DIR/significant_drop.rs:163:21
   |
LL |             let c = || {
   |                     ^^
...
LL |                 tuple.0;
   |                 ------- in Rust 2018, closure captures all of `tuple`, but in Rust 2021, it only captures `tuple.0`
...
LL |         }
   |         - in Rust 2018, `tuple` would be dropped here, but in Rust 2021, only `tuple.0` would be dropped here alongside the closure
```

The auto trait migration lint will now look something like this:
```
error: changes to closure capture in Rust 2021 will affect `Send` trait implementation for closure
  --> $DIR/auto_traits.rs:14:19
   |
LL |     thread::spawn(move || unsafe {
   |                   ^^^^^^^^^^^^^^ in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
...
LL |         *fptr.0 = 20;
   |         ------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0`
```

r? `@nikomatsakis`

Closes https://github.com/rust-lang/project-rfc-2229/issues/54
2021-07-11 03:50:28 +00:00