Commit Graph

167414 Commits

Author SHA1 Message Date
Joshua Nelson
cd63b22e80 Add more tests for label-break-value 2022-05-03 14:09:52 -05:00
Guillaume Gomez
56c2769de3 Fix flaky rustdoc-ui test because it did not replace time result 2022-05-03 20:46:02 +02:00
ridwanabdillahi
175a4eab84 Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB.
Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries.

Merge the queries for debugger visualizers into a single query.

Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`.

Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate.

Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature.

Respond to PR comments and minor cleanups.
2022-05-03 10:53:54 -07:00
bors
086bf7a8ff Auto merge of #96280 - lygstate:ffi-fixes, r=joshtriplett
library/core: Fixes implement of c_uint, c_long, c_ulong

Fixes: aa67016624 ("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>
2022-05-03 17:22:58 +00:00
Yoshiki Matsuda
4698a3fb8a ignore the doctest for map 2022-05-04 00:53:46 +09:00
bors
e1df625306 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.
2022-05-03 12:16:00 +00:00
Yoshiki Matsuda
3d12fd0faf ignore a doctest for the non-exported macro 2022-05-03 18:33:56 +09:00
bors
ea5fa17998 Auto merge of #96666 - lnicola:rust-analyzer-2022-05-03, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-05-03 09:27:59 +00:00
bjorn3
d33140d2dc Make rustc_parse_format compile on stable
This allows it to be used by lightweight formatting systems and may
allow it to be used by rust-analyzer.
2022-05-03 11:26:58 +02:00
Laurențiu Nicola
2535893594 ⬆️ rust-analyzer 2022-05-03 12:13:22 +03:00
bors
468492c2af 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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-03 06:09:57 +00:00
Yuki Okushi
279d80127a
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.

Address #96638.
2022-05-03 14:59:03 +09:00
Yuki Okushi
1e6b880b84
Rollup merge of #96641 - oli-obk:bool_args, r=wesleywiser
Use a yes/no enum instead of a bool.

The bool's meaning wasn't obvious to me at some call sites.
2022-05-03 14:59:01 +09:00
Yuki Okushi
0340703b78
Rollup merge of #96629 - ken-matsui:fix-invalid-keyword-order-for-function-declarations, r=davidtwco
Fix invalid keyword order for function declarations

Closes: https://github.com/rust-lang/rust/issues/94879
2022-05-03 14:59:01 +09:00
Yuki Okushi
492d403f55
Rollup merge of #96614 - JohnTitor:test-92305, r=oli-obk
Add a regression test for #92305

Closes #92305
r? ``@oli-obk`` as per https://github.com/rust-lang/rust/issues/92305#issuecomment-1114043188
2022-05-03 14:59:00 +09:00
Yuki Okushi
61c687a0db
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`.
2022-05-03 14:58:59 +09:00
Yuki Okushi
a58703677b
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.
2022-05-03 14:58:58 +09:00
Yuki Okushi
329a73dbd6
Rollup merge of #96587 - bjorn3:refactor_backend_write, r=michaelwoerister
Refactor the WriteBackendMethods and ExtraBackendMethods traits

The new interface is slightly less confusing and is easier to implement for non-LLVM backends.
2022-05-03 14:58:57 +09:00
Yuki Okushi
27d7615bb4
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.

![Screenshot from 2022-01-19 23-06-59](https://user-images.githubusercontent.com/3050060/150221936-fd1a1e76-06b6-4416-a653-dbae111979ed.png)

You can test it [here](https://rustdoc.crud.net/imperio/settings-js/doc/foo/index.html).

r? ``@jsha``
2022-05-03 14:58:56 +09:00
Rock Boynton
77390a152f Fix typo in lint levels doc 2022-05-02 22:33:28 -07:00
Yonggang Luo
2e69549043
Update library/core/src/ffi/mod.rs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-05-03 10:42:46 +08:00
Esteban Kuber
4934a9e643 Tweak wording 2022-05-03 02:07:47 +00:00
Esteban Küber
57967269e9 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`.

Fix #95413
2022-05-03 02:00:38 +00:00
bors
c110cfa161 Auto merge of #96580 - CAD97:E0705-no-ignore, r=michaelwoerister
Remove `ignore` from E0705 test

Spotted this, and I think this can be made to test now.
2022-05-03 00:45:18 +00:00
bors
3d0ac7ea23 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.

```
./x.py bench library/core -i --stage 0 --test-args bench_trusted_random_access

OLD: 119,172 ns/iter
NEW:  17,714 ns/iter
```
2022-05-02 21:45:20 +00:00
Esteban Kuber
7790b6e1c0 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.

Address 96638.
2022-05-02 19:24:56 +00:00
bors
bed05e996e 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',

Provide the missing implementation.

r? `@nnethercote`
2022-05-02 18:57:32 +00:00
The 8472
a68a5d219d 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.

```
./x.py bench library/core -i --stage 0 --test-args bench_trusted_random_access

OLD: 119,172 ns/iter
NEW:  17,714 ns/iter
```
2022-05-02 20:54:46 +02:00
The 8472
e3db41bf97 add benchmark 2022-05-02 20:54:46 +02:00
bors
24c8985043 Auto merge of #96436 - petrochenkov:nowhole2, r=wesleywiser
linker: Stop using whole-archive on dependencies of dylibs

https://github.com/rust-lang/rust/pull/95604 implemented a better and more fine-grained way of keeping exported symbols alive.

Addresses the second question from https://github.com/rust-lang/rust/pull/93901#issuecomment-1041325522.
r? `@wesleywiser`
2022-05-02 16:28:47 +00:00
Oli Scherer
0349f8bd79 Use a yes/no enum instead of a bool.
The bool's meaning wasn't obvious to me at some call sites.
2022-05-02 15:39:13 +00:00
bors
879fb42596 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`.
2022-05-02 14:03:20 +00:00
bors
5428983286 Auto merge of #96310 - bertptrs:remove-debugger-bootstrap, r=Mark-Simulacrum
Remove DebbugerScripts from bootstrap CLI

This PR implements #95992 and removes the debugger scripts from the bootstrap CLI.

I could not find a lot of documentation on the bootstrap binary so perhaps there's still some documentation to be updated.
2022-05-02 11:22:29 +00:00
Yoshiki Matsuda
6d8b56972c remove the special case for nonexported macro_rules! macros 2022-05-02 18:50:54 +09:00
Ken Matsui
6c7f4dee8f
Fix invalid keyword order for function declarations 2022-05-02 18:14:43 +09:00
bors
6b6c1ffacc 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.
2022-05-02 09:05:22 +00:00
Thom Chiovoloni
0812759840
Avoid use of rand::thread_rng in stdlib benchmarks 2022-05-02 00:08:21 -07:00
Bert Peters
02d41b8f0d Remove DebbugerScripts from bootstrap CLI 2022-05-02 08:03:48 +02:00
bors
905fd73154 Auto merge of #96600 - c410-f3r:z-errors, r=petrochenkov
Move some tests to more reasonable places

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`

16602 -> `codegen` because of https://github.com/rust-lang/rust/issues/16602#issuecomment-53806665
2022-05-02 05:52:01 +00:00
Scott McMurray
2830dbd64f Tweak the calloc optimization to only apply to shortish-arrays 2022-05-01 22:28:11 -07:00
Sébastien Marie
6d865f80f8 openbsd: unbreak build on native platform
after #95612, only linux and windows target are build with -Zunstable-options, 
but others platforms might use -Csplit-debuginfo

add "openbsd" target in the list of platforms using it.
2022-05-02 04:55:04 +00:00
bors
f6cbc92e2a 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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-02 03:28:14 +00:00
Austin Kiekintveld
55a7d18189 Add comment 2022-05-01 19:07:36 -07:00
Austin Kiekintveld
a05df2ea19 Fix formatting 2022-05-01 19:02:28 -07:00
Yuki Okushi
5750e33055
Rollup merge of #96610 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version to 0.9.0

It adds the command `screenshot` and disables the screenshot comparison by default.

r? `@notriddle`
2022-05-02 10:41:59 +09:00
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