bors [Thu, 5 May 2022 02:49:16 +0000 (02:49 +0000)]
Auto merge of #96720 - JohnTitor:rollup-9jaaekr, r=JohnTitor
Rollup of 7 pull requests
Successful merges:
- #96603 (Enable full revision in const generics ui tests)
- #96616 (Relax memory ordering used in `min_stack`)
- #96619 (Relax memory ordering used in SameMutexCheck)
- #96628 (Stabilize `bool::then_some`)
- #96658 (Move callback to the () => {} syntax.)
- #96677 (Add more tests for label-break-value)
- #96697 (Enable tracing for all queries)
the regex `.*` in the key name are because the key is a debug printed DefId, so you'd get all kinds of things like hashes in there. The tracing logs will show you the key, so you can restrict it further if you want.
Yuki Okushi [Thu, 5 May 2022 01:20:37 +0000 (10:20 +0900)]
Rollup merge of #96677 - jyn514:label-break-value-tests, r=petrochenkov
Add more tests for label-break-value
Helps with https://github.com/rust-lang/rust/issues/48594. The tests are adapted from https://github.com/rust-lang/rust/issues/48594#issuecomment-421625182.
Yuki Okushi [Thu, 5 May 2022 01:20:34 +0000 (10:20 +0900)]
Rollup merge of #96619 - akiekintveld:same_mutex_check_relaxed_ordering, r=m-ou-se
Relax memory ordering used in SameMutexCheck
`SameMutexCheck` only requires atomicity for `self.addr`, but does not need ordering of other memory accesses in either the success or failure case. Using `Relaxed`, the code still correctly handles the case when two threads race to store an address.
Yuki Okushi [Thu, 5 May 2022 01:20:33 +0000 (10:20 +0900)]
Rollup merge of #96616 - akiekintveld:min_stack_relaxed_ordering, r=joshtriplett
Relax memory ordering used in `min_stack`
`min_stack` does not provide any synchronization guarantees to its callers, and only requires atomicity for `MIN` itself, so relaxed memory ordering is sufficient.
bors [Thu, 5 May 2022 00:24:48 +0000 (00:24 +0000)]
Auto merge of #96593 - jackh726:issue-93262, r=compiler-errors
Revert "Prefer projection candidates instead of param_env candidates for Sized predicates"
Fixes #93262
Reopens #89352
This was a hack that seemed to have no negative side-effects at the time. Given that the latter has a workaround and likely less common than the former, it makes sense to revert this change.
bors [Wed, 4 May 2022 21:16:28 +0000 (21:16 +0000)]
Auto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkov
Overhaul `MacArgs`
Motivation:
- Clarify some code that I found hard to understand.
- Eliminate one use of three places where `TokenKind::Interpolated` values are created.
The value in `MacArgs::Eq` is currently represented as a `Token`.
Because of `TokenKind::Interpolated`, `Token` can be either a token or
an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a
literal or macro call AST fragment, and then is later lowered to a
literal token. But this is very non-obvious. `Token` is a much more
general type than what is needed.
This commit restricts things, by introducing a new type `MacArgsEqKind`
that is either an AST expression (pre-lowering) or an AST literal
(post-lowering). The downside is that the code is a bit more verbose in
a few places. The benefit is that makes it much clearer what the
possibilities are (though also shorter in some other places). Also, it
removes one use of `TokenKind::Interpolated`, taking us a step closer to
removing that variant, which will let us make `Token` impl `Copy` and
remove many "handle Interpolated" code paths in the parser.
Things to note:
- Error messages have improved. Messages like this:
```
unexpected token: `"bug" + "found"`
```
now say "unexpected expression", which makes more sense. Although
arbitrary expressions can exist within tokens thanks to
`TokenKind::Interpolated`, that's not obvious to anyone who doesn't
know compiler internals.
- In `parse_mac_args_common`, we no longer need to collect tokens for
the value expression.
bors [Wed, 4 May 2022 09:55:51 +0000 (09:55 +0000)]
Auto merge of #96695 - JohnTitor:rollup-oo4fc1h, r=JohnTitor
Rollup of 6 pull requests
Successful merges:
- #96597 (openbsd: unbreak build on native platform)
- #96662 (Fix typo in lint levels doc)
- #96668 (Fix flaky rustdoc-ui test because it did not replace time result)
- #96679 (Quick fix for #96223.)
- #96684 (Update `ProjectionElem::Downcast` documentation)
- #96686 (Add some TAIT-related tests)
--- stderr
error: `-Csplit-debuginfo` is unstable on this platform
command did not execute successfully: "/data/semarie/build-rust/install_dir/beta/bin/cargo.bin" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path"
```
I am suspecting that all unix might be affected, but I am unsure about the right conditional to use. so I only added "openbsd" target inside it as I am able to test it.
rustc nightly built correctly with this PR on openbsd.
bors [Wed, 4 May 2022 05:01:47 +0000 (05:01 +0000)]
Auto merge of #96447 - petrochenkov:docregr, r=GuillaumeGomez
rustdoc: Resolve doc links on fields during early resolution
Another subset of https://github.com/rust-lang/rust/pull/94857 which fixes https://github.com/rust-lang/rust/issues/96429.
This case regressed in https://github.com/rust-lang/rust/pull/96135 when `may_have_doc_links`-based filtering was introduced.
Before that filtering structs could collect traits in scope for their fields, but after the filtering structs won't collect anything if they don't have doc comments on them, so we have to visit fields too.
bors [Wed, 4 May 2022 01:58:23 +0000 (01:58 +0000)]
Auto merge of #96353 - estebank:issue-95413, r=compiler-errors
When suggesting to import an item, also suggest changing the path if appropriate
When we don't find an item we search all of them for an appropriate
import and suggest `use`ing it. This is sometimes done for expressions
that have paths with more than one segment. We now also suggest changing
that path to work with the `use`.
bors [Tue, 3 May 2022 22:29:58 +0000 (22:29 +0000)]
Auto merge of #95380 - compiler-errors:unit-destructure-assign, r=nikomatsakis
Fix unit struct/enum variant in destructuring assignment
See https://github.com/rust-lang/rfcs/blob/master/text/2909-destructuring-assignment.md#guide-level-explanation, "including **unit** and tuple structs"
Remove unnecessary `NtIdent` in `Token::is_whole_expr`.
The comment on this function explains that it's a specialized version of
`maybe_whole_expr`. But `maybe_whole_expr` doesn't do anything with
`NtIdent`, so `is_whole_expr` also doesn't need to.
bors [Tue, 3 May 2022 17:22:58 +0000 (17:22 +0000)]
Auto merge of #96280 - lygstate:ffi-fixes, r=joshtriplett
library/core: Fixes implement of c_uint, c_long, c_ulong
Fixes: aa670166243 ("make memcmp return a value of c_int_width instead of i32")
Introduce c_num_definition to getting the cfg_if logic easier to maintain
Add newlines for easier code reading
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
bors [Tue, 3 May 2022 12:16:00 +0000 (12:16 +0000)]
Auto merge of #96601 - tmiasko:ssa-rpo, r=davidtwco
Use reverse postorder in `non_ssa_locals`
The reverse postorder, unlike preorder, is now cached inside the MIR
body. Code generation uses reverse postorder anyway, so it might be
a small perf improvement to use it here as well.
bors [Tue, 3 May 2022 06:09:57 +0000 (06:09 +0000)]
Auto merge of #96663 - JohnTitor:rollup-lthuzdq, r=JohnTitor
Rollup of 8 pull requests
Successful merges:
- #93097 (Switch settings menu to full js)
- #96587 (Refactor the WriteBackendMethods and ExtraBackendMethods traits)
- #96589 (Use source callsite in check_argument_types suggestion)
- #96599 (Update `RValue::Discriminant` documentation)
- #96614 (Add a regression test for #92305)
- #96629 (Fix invalid keyword order for function declarations)
- #96641 (Use a yes/no enum instead of a bool.)
- #96646 (Mitigate impact of subtle invalid call suggestion logic)
Yuki Okushi [Tue, 3 May 2022 05:59:03 +0000 (14:59 +0900)]
Rollup merge of #96646 - estebank:issue-96638, r=jackh726
Mitigate impact of subtle invalid call suggestion logic
There's some subtle interaction between inferred expressions being
passed as an argument to fn calls with fewer than expected arguments. To
avoid the ICE, I'm changing indexing operations with `.get(idx)`, but
the underlying logic still needs to be audited as it was written with
the assumption that `final_arg_types` and `provided_args` have the right
length.
Yuki Okushi [Tue, 3 May 2022 05:58:59 +0000 (14:58 +0900)]
Rollup merge of #96599 - tmiasko:discriminant-docs, r=estebank
Update `RValue::Discriminant` documentation
`RValue::Discriminant` returns zero for types without discriminant.
This guarantee is already documented for `discriminant_value`
intrinsics which is implemented in terms of `RValue::Discriminant`.
Yuki Okushi [Tue, 3 May 2022 05:58:58 +0000 (14:58 +0900)]
Rollup merge of #96589 - Badel2:source-callsite, r=michaelwoerister
Use source callsite in check_argument_types suggestion
This makes the "remove extra arguement" suggestion valid when the function argument is a macro.
Additionally, this may fix #96225, but the only way I can reproduce that issue is using the playground, so we will need to wait until after this is merged to ensure it's fixed.
Yuki Okushi [Tue, 3 May 2022 05:58:56 +0000 (14:58 +0900)]
Rollup merge of #93097 - GuillaumeGomez:settings-js, r=jsha
Switch settings menu to full js
Since the settings can only be set when the JS is enabled, it's not really a problem. It also fixes a debate we had around the themes not being accessible easily before.
When suggesting to import an item, also suggest changing the path if appropriate
When we don't find an item we search all of them for an appropriate
import and suggest `use`ing it. This is sometimes done for expressions
that have paths with more than one segment. We now also suggest changing
that path to work with the `use`.
bors [Mon, 2 May 2022 21:45:20 +0000 (21:45 +0000)]
Auto merge of #92566 - the8472:inline-tra, r=m-ou-se
Inline `__iterator_get_unchecked` for some iterator adapters.
This aligns the inline attributes of existing `__iterator_get_unchecked` with those of `next()` on adapters that have both.
It improves the performance of iterators using unchecked access when building in incremental mode (due to the larger CGU count?). It might negatively affect incremental compile times for better runtime results, but considering that the equivalent `next()` implementations also are `#[inline]` and usually are more complex this should be ok.
Esteban Kuber [Mon, 2 May 2022 19:11:03 +0000 (19:11 +0000)]
Mitigate impact of subtle invalid call suggestion logic
There's some subtle interaction between inferred expressions being
passed as an argument to fn calls with fewer than expected arguments. To
avoid the ICE, I'm changing indexing operations with `.get(idx)`, but
the underlying logic still needs to be audited as it was written with
the assumption that `final_arg_types` and `provided_args` have the right
length.
bors [Mon, 2 May 2022 18:57:32 +0000 (18:57 +0000)]
Auto merge of #96578 - tmiasko:chunked-bit-set-fmt, r=nnethercote
Fix -Zdump-mir-dataflow by implementing DebugWithContext for ChunkedBitSet
`DebugWithContext` is used to format changes to dataflow state along with MIR
in graphviz dot files. In the case of `ChunkedBitSet` it was left unimplemented,
so attempts to use `-Zdump-mir-dataflow -Zdump-mir=all` resulted in an ICE:
> thread 'rustc' panicked at 'not implemented: implement when/if needed',
The 8472 [Wed, 5 Jan 2022 01:22:39 +0000 (02:22 +0100)]
This aligns the inline attributes of existing `__iterator_get_unchecked` with those of `next()` on adapters that have both.
It improves the performance of iterators using unchecked access when building in incremental mode
(due to the larger CGU count?). It might negatively affect incremental compile times for better runtime results,
but considering that the equivalent `next()` implementations also are `#[inline]` and usually are more complex this
should be ok.
bors [Mon, 2 May 2022 14:03:20 +0000 (14:03 +0000)]
Auto merge of #96431 - petrochenkov:parent, r=cjgillot
rustc: Panic by default in `DefIdTree::parent`
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.
Same applies to `local_parent`/`opt_local_parent`.
bors [Mon, 2 May 2022 09:05:22 +0000 (09:05 +0000)]
Auto merge of #96596 - scottmcm:limited-calloc, r=Mark-Simulacrum
Tweak the vec-calloc runtime check to only apply to shortish-arrays
r? `@Mark-Simulacrum`
`@nbdd0121` pointed out in https://github.com/rust-lang/rust/pull/95362#issuecomment-1114085395 that LLVM currently doesn't constant-fold the `IsZero` check for long arrays, so that seems like a reasonable justification for limiting it.
It appears that it's based on length, not byte size, (https://godbolt.org/z/4s48Y81dP), so that's what I used in the PR. Maybe it's a ["the number of inlining shall be three"](https://youtu.be/s4wnuiCwTGU?t=320) sort of situation.
Certainly there's more that could be done here -- that generated code that checks long arrays byte-by-byte is highly suboptimal, for example -- but this is an easy, low-risk tweak.
bors [Mon, 2 May 2022 03:28:14 +0000 (03:28 +0000)]
Auto merge of #96622 - JohnTitor:rollup-8hckgaj, r=JohnTitor
Rollup of 7 pull requests
Successful merges:
- #94126 (Classify BinaryHeap & LinkedList unit tests as such)
- #96222 (Clarify docs for `from_raw_parts` on `Vec` and `String`)
- #96499 (Make it possible to write doctests for bootstrap)
- #96567 (Fix docs for u32 and i32 logs func)
- #96568 (std::fmt: Various fixes and improvements to documentation)
- #96571 (Add a bathroom stall to weird expressions test)
- #96610 (Update browser-ui-test version to 0.9.0)
Yuki Okushi [Mon, 2 May 2022 01:41:58 +0000 (10:41 +0900)]
Rollup merge of #96568 - EliasHolzmann:fmt_doc_fixes, r=joshtriplett
std::fmt: Various fixes and improvements to documentation
This PR contains the following changes:
- **Added argument index comments to examples for specifying precision**
The examples for specifying the precision have comments explaining which
argument the specifier is referring to. However, for implicit positional
arguments, the examples simply refer to "next arg". To simplify following the
comments, "next arg" was supplemented with the actual resulting argument index.
- **Fixed documentation for specifying precision via `.*`**
The documentation stated that in case of the syntax `{<arg>:<spec>.*}`, "the
`<arg>` part refers to the value to print, and the precision must come in the
input preceding `<arg>`". This is not correct: the <arg> part does indeed refer
to the value to print, but the precision does not come in the input preciding
arg, but in the next implicit input (as if specified with {}).
Fixes #96413.
- **Fix the grammar documentation**
According to the grammar documented, the format specifier `{: }` should not be
legal because of the whitespace it contains. However, in reality, this is
perfectly fine because the actual implementation allows spaces before the
closing brace. Fixes #71088.
Also, the exact meaning of most of the terminal symbols was not specified, for
example the meaning of `identifier`.
- **Removed reference to Formatter::buf and other private fields**
Formatter::buf is not a public field and therefore isn't very helpful in user-
facing documentation. Also, the other public fields of Formatter were removed
during stabilization of std::fmt (4af3494bb0) and can only be accessed via
getters.
- **Improved list of formatting macros**
Two improvements:
1. write! can not only receive a `io::Write`, but also a `fmt::Write` as first argument.
2. The description texts now contain links to the actual macros for easier
navigation.
Yuki Okushi [Mon, 2 May 2022 01:41:56 +0000 (10:41 +0900)]
Rollup merge of #96499 - jyn514:bootstrap-doctests, r=Mark-Simulacrum
Make it possible to write doctests for bootstrap
This probably isn't super useful in practice, but it was easy to fix
and avoids confusing errors about mismatched versions between beta and the default toolchain.
Yuki Okushi [Mon, 2 May 2022 01:41:54 +0000 (10:41 +0900)]
Rollup merge of #94126 - ssomers:alloc_prep_1, r=Mark-Simulacrum
Classify BinaryHeap & LinkedList unit tests as such
All but one of these so-called integration test case are unit tests, just like btree's were (#75531). In addition, reunite the unit tests of linked_list that were split off during #23104 because they needed to remain unit tests (they were later moved to the separate file they are in during #63207). The two sets could remain separate files, but I opted to merge them back together, more or less in the order they used to be, apart from one duplicate name `test_split_off` and one duplicate tiny function `list_from`.
`SameMutexCheck` only requires atomicity for `self.addr`, but does not need ordering of other memory accesses in either the success or failure case. Using `Relaxed`, the code still correctly handles the case when two threads race to store an address.
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.
Same applies to `local_parent`/`opt_local_parent`.
bors [Sun, 1 May 2022 22:56:11 +0000 (22:56 +0000)]
Auto merge of #96517 - ferrocene:pa-files-related-to-test, r=Mark-Simulacrum
[compiletest] Extract code to detect files related to a test into a different function
In the code that checks whether a test needs to be re-executed, compiletest checks the modification date of all the files related to the test. I need the list of files related to the test for other purposes inside compiletest, and while I could copy/paste the code `is_up_to_date` runs, that would produce incomplete results if more related files are added in the future.
This PR extracts the code to detect related files into a separate function, allowing the rest of compiletest to access the same data.
`min_stack` does not provide any synchronization guarantees to its callers, and only requires atomicity for `MIN` itself, so relaxed memory ordering is sufficient.
bors [Sun, 1 May 2022 20:28:10 +0000 (20:28 +0000)]
Auto merge of #96521 - petrochenkov:docrules, r=notriddle,GuillaumeGomez
rustdoc: Resolve doc links referring to `macro_rules` items
cc https://github.com/rust-lang/rust/issues/81633
UPD: the fallback to considering *all* `macro_rules` in the crate for unresolved names is not removed in this PR, it will be removed separately and will be run through crater.
Guillaume Gomez [Sun, 1 May 2022 19:22:38 +0000 (21:22 +0200)]
* Add documentation for settings page rendering functions.
* Improve code.
* Fix some documentation argument types.
* Make settings order the same as before this PR.
* Change timeout to 0 so that browser will render it as fast as possible.