Commit Graph

167419 Commits

Author SHA1 Message Date
Yuki Okushi
f6a89ee628
Rollup merge of #96571 - thomcc:bathroom-stall, r=Mark-Simulacrum
Add a bathroom stall to weird expressions test
2022-05-02 10:41:59 +09:00
Yuki Okushi
ab1ae48cce
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.
2022-05-02 10:41:58 +09:00
Yuki Okushi
f58135449e
Rollup merge of #96567 - alex-semenyuk:fix_docs_for_logs_func, r=Mark-Simulacrum
Fix docs for u32 and i32 logs func

Closes #96545
2022-05-02 10:41:57 +09:00
Yuki Okushi
eacebb4f43
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.
2022-05-02 10:41:56 +09:00
Yuki Okushi
1785f1549c
Rollup merge of #96222 - jmaargh:john-mark/clarify-from-raw-parts-docs, r=JohnTitor
Clarify docs for `from_raw_parts` on `Vec` and `String`

Closes #95427

Original safety explanation for `from_raw_parts` was unclear on safety for consuming a C string. This clarifies when doing so is safe.
2022-05-02 10:41:55 +09:00
Yuki Okushi
ddfc65dae0
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`.
2022-05-02 10:41:54 +09:00
Austin Kiekintveld
df4457e20b
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.
2022-05-01 16:46:19 -07:00
Vadim Petrochenkov
5b5964f569 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`.
2022-05-02 01:56:50 +03:00
bors
4c5efea6fe 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.

r? `@Mark-Simulacrum`
2022-05-01 22:56:11 +00:00
Austin Kiekintveld
63a90efe2f
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.
2022-05-01 15:55:54 -07:00
Yuki Okushi
18b12fa993
Add a regression test for #92305 2022-05-02 06:43:17 +09:00
bors
4dd8b420c0 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.
2022-05-01 20:28:10 +00:00
Guillaume Gomez
68982bcd67 Update browser-ui-test version to 0.9.0 2022-05-01 21:36:19 +02:00
Guillaume Gomez
73688e4021 * 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.
2022-05-01 21:22:38 +02:00
bors
a933de8398 Auto merge of #96582 - petrochenkov:finalize, r=cjgillot
resolve: Cleanup path resolution finalization

Some cleanup after https://github.com/rust-lang/rust/pull/95255 and https://github.com/rust-lang/rust/pull/95405.
r? `@cjgillot`
2022-05-01 18:05:57 +00:00
Alex Macleod
0571157a26 Enable full revision in const generics ui tests 2022-05-01 17:05:21 +01:00
bors
6eda7642bd Auto merge of #96549 - ouz-a:mir-opt, r=oli-obk
Move Derefer before Retag

_Follow up work to #96116 #95857 #95649_

This moves `Derefer` before `Retag` and creates a new `LocalInfo` called `Temp` to avoid retagging created temp values.

Zulip discussion [link](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/deref.20as.20first.20and.20only.20projection)

r? `@oli-obk`
2022-05-01 15:25:16 +00:00
Vadim Petrochenkov
7841247ca9 resolve: Rename unusable_binding to ignore_binding 2022-05-01 18:02:37 +03:00
Vadim Petrochenkov
f0e0434feb resolve: Merge last_import_segment into Finalize 2022-05-01 18:02:35 +03:00
Vadim Petrochenkov
ffedcec4e8 resolve: Pass full Finalize in nearly all cases 2022-05-01 18:02:01 +03:00
Vadim Petrochenkov
900607f49a resolve: Turn enum Finalize into an optional struct 2022-05-01 17:42:22 +03:00
Elias Holzmann
f3b86c37eb std::fmt: 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.
2022-05-01 15:27:41 +02:00
Elias Holzmann
c70f3ab5e5 std::fmt: 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 made
private during stabilization of std::fmt (4af3494bb0) and can now only be read
via accessor methods.
2022-05-01 15:27:41 +02:00
Elias Holzmann
79d9afda13 std::fmt: 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`.
2022-05-01 15:27:41 +02:00
Elias Holzmann
afd80a21b0 std::fmt: 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 talk about "next arg". To make it easier for
readers to follow the comments, "next arg" was supplemented with the actual
resulting argument index.
2022-05-01 15:27:40 +02:00
Elias Holzmann
1288883932 std::fmt: 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.
2022-05-01 15:26:15 +02:00
bors
508e0584e3 Auto merge of #96376 - scottmcm:do-yeet, r=oli-obk
Add `do yeet` expressions to allow experimentation in nightly

Two main goals for this:
- Ensure that trait restructuring in https://github.com/rust-lang/rust/issues/84277#issuecomment-1066120333 doesn't accidentally close us off from the possibility of doing this in future, as sketched in https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#possibilities-for-yeet
- Experiment with the *existence* of syntax for this, to be able to weight the syntax-vs-library tradeoffs better than we can right now.  Notably the syntax (with `do`) and name in this PR are not intended as candidates for stabilization, but they make a good v0 PR for adding this with minimal impact to compiler maintenance or priming one possible name choice over another.

r? `@oli-obk`
The lang `second` for doing this: https://github.com/rust-lang/lang-team/issues/160#issuecomment-1107896716

Tracking issues
- Lang, https://github.com/rust-lang/rust/issues/96373
- Libs-api, https://github.com/rust-lang/rust/issues/96374
2022-05-01 13:10:21 +00:00
Tomasz Miąsko
fa41852c7a 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.
2022-05-01 14:58:29 +02:00
ouz-a
d9ddb6446d re-name stuff 2022-05-01 15:38:22 +03:00
Caio
bff6f6dffb Move some tests to more reasonable places 2022-05-01 08:47:38 -03:00
bors
637b3f6807 Auto merge of #96576 - oli-obk:post_monomorphization_error_backtrace, r=lqd
Also report the call site of PME errors locally.

Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site.

previous work: https://github.com/rust-lang/rust/pull/85633
tracking issue: https://github.com/rust-lang/rust/issues/85155

r? `@lqd`

I figured we could get some improvement for traces in local crates without going into the backtrace hell you landed in last time
2022-05-01 10:29:39 +00:00
Tomasz Miąsko
b37fb23d9f 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`.
2022-05-01 11:49:46 +02:00
bors
f75d884046 Auto merge of #96078 - udoprog:refcounted-str-to-u8, r=dtolnay
Implement str to [u8] conversion for refcounted containers

This seems motivated to complete the APIs for shared containers since we already have similar allocation-free conversions for strings like `From<Box<[u8]>> for Box<str>`.

Insta-stable since it's a new trait impl?
2022-05-01 06:41:59 +00:00
David Tolnay
100006bec9
Bump shared_from_str to Rust 1.62.0 2022-04-30 23:40:35 -07:00
bors
61469b682c Auto merge of #96490 - dtolnay:writetmpbackport, r=Mark-Simulacrum
Make [e]println macros eagerly drop temporaries (for backport)

This PR extracts the subset of #96455 which is only the parts necessary for fixing the 1.61-beta regressions in #96434.

My larger PR #96455 contains a few other changes relative to the pre-#94868 behavior; those are not necessary to backport into 1.61.

argument position | before #94868 | after #94868 | after this PR
--- |:---:|:---:|:---:
`write!($tmp, "…", …)` | 😡 | 😡 | 😡
`write!(…, "…", $tmp)` | 😡 | 😡 | 😡
`writeln!($tmp, "…", …)` | 😡 | 😡 | 😡
`writeln!(…, "…", $tmp)` | 😡 | 😡 | 😡
`print!("…", $tmp)` | 😡 | 😡 | 😡
`println!("…", $tmp)` | 😺 | 😡 | 😺
`eprint!("…", $tmp)` | 😡 | 😡 | 😡
`eprintln!("…", $tmp)` | 😺 | 😡 | 😺
`panic!("…", $tmp)` | 😺 | 😺 | 😺
2022-05-01 03:18:53 +00:00
David Tolnay
e2d4c7b7c8
Revert "Bless coverage-reports after core macro blocks change"
This reverts commit ac5c657a08.
2022-04-30 18:25:17 -07:00
Scott McMurray
b317ec1697 Feature-gate do yeet inside cfgs too 2022-04-30 18:10:01 -07:00
Scott McMurray
9b5766cd24 Bless the UI tests 2022-04-30 18:09:57 -07:00
bors
bf611439e3 Auto merge of #95362 - scottmcm:calloc-arrays, r=Mark-Simulacrum
Support arrays of zeros in Vec's __rust_alloc_zeroed optimization

I happened to notice in https://users.rust-lang.org/t/any-advantage-of-box-u64-16-16-16-over-vec-u64/73500/3?u=scottmcm that the calloc optimization wasn't applying to vectors-of-arrays, so here's the easy fix for that.
2022-05-01 00:50:46 +00:00
Scott McMurray
944ba8c8a7 Fix the rustfmt build 2022-04-30 17:40:29 -07:00
Scott McMurray
a15c3a36d7 Fix the clippy build 2022-04-30 17:40:29 -07:00
Scott McMurray
e094ee5f10 Add do yeet expressions to allow experimentation in nightly
Using an obviously-placeholder syntax.  An RFC would still be needed before this could have any chance at stabilization, and it might be removed at any point.

But I'd really like to have it in nightly at least to ensure it works well with try_trait_v2, especially as we refactor the traits.
2022-04-30 17:40:27 -07:00
bors
2c858a7c3f Auto merge of #93815 - camsteffen:intravisit-docs, r=cjgillot
Update intravisit docs

Follow-up to #90986.

r? `@cjgillot`
2022-04-30 21:24:53 +00:00
Vadim Petrochenkov
6083db7c4e Fix some links in the standard library 2022-05-01 00:02:34 +03:00
Vadim Petrochenkov
8b21421873 rustdoc: Track macro_rules scopes during early doc link resolution
This way links referring to `macro_rules` items are resolved correctly
2022-05-01 00:02:15 +03:00
Badel2
685f66b6b1 Use source callsite in check_argument_types suggestion
This makes the "remove extra arguement" suggestion valid when the
function argument is a macro
2022-04-30 22:44:20 +02:00
Vadim Petrochenkov
044e45c595 rustdoc: Keep full ParentScope during early doc link resolution 2022-04-30 23:06:48 +03:00
Vadim Petrochenkov
921f63fb1f rustdoc: Early-resolve doc links in all requested namespaces 2022-04-30 23:06:48 +03:00
bjorn3
78c65a52db Merge new_metadata into codegen_allocator 2022-04-30 21:20:08 +02:00
bjorn3
fab72301d9 Remove config parameter of optimize_fat and avoid interior mutability for module 2022-04-30 20:58:42 +02:00