Commit Graph

213414 Commits

Author SHA1 Message Date
Matthias Krüger
87a4694825
Rollup merge of #105879 - Nilstrieb:revert-hir-arena, r=oli-obk
Revert "Introduce lowering_arena to avoid creating AST nodes on the fly"

This reverts commit d9a1faaa9c (#101499).

This was originally part of #101345 which has now been closed as a different approach is taken now.

r? `@oli-obk`

cc `@spastorino`
2022-12-18 23:03:08 +01:00
Matthias Krüger
ebe3563764
Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=Nilstrieb
use &str / String literals instead of format!()
2022-12-18 23:03:07 +01:00
Matthias Krüger
221e71e7a1
Rollup merge of #105869 - matthiaskrgr:clone_on_copy, r=compiler-errors
don't clone Copy types
2022-12-18 23:03:07 +01:00
Matthias Krüger
e96166eb42
Rollup merge of #105867 - matthiaskrgr:rec_param, r=compiler-errors
remove redundant fn params that were only "used" in recursion
2022-12-18 23:03:06 +01:00
Matthias Krüger
be48d21938
Rollup merge of #105863 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version to reduce GUI tests flakyness

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

r? `@notriddle`
2022-12-18 23:03:06 +01:00
Matthias Krüger
f5656ad3c7
Rollup merge of #105842 - compiler-errors:arg-name-sugg, r=petrochenkov
print argument name in arg mismatch if possible

A bit more contextual than just `/* value */`, at least when the argument is named something related to its context.

The UI test cases are... not super convincing, but also they're minimized tests.
2022-12-18 23:03:05 +01:00
Matthias Krüger
e8fdd6912f
Rollup merge of #105447 - TaKO8Ki:add-test-for-103095, r=petrochenkov
Add a test for #103095

closes #103095
2022-12-18 23:03:05 +01:00
Matthias Krüger
1ca43d4b3d
Rollup merge of #105419 - YC:issue-41731, r=petrochenkov
Add tests for #41731

Closes #41731
2022-12-18 23:03:04 +01:00
bors
2b094b1ede Auto merge of #105446 - erikdesjardins:vt-size, r=nikic
Add 0..=isize::MAX range metadata to size loads from vtables

This is the (much belated) size counterpart to #91569.

Inspired by https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/Range.20metadata.20for.20.60size_of_val.60.20and.20other.20isize.3A.3AMAX.20limits. This could help optimize layout computations based on the size of a dyn trait. Though, admittedly, adding this to vtables wouldn't be as beneficial as adding it to slice len, which is used much more often.

Miri detects this UB already: b7cc99142a/compiler/rustc_const_eval/src/interpret/traits.rs (L119-L121)
(In fact Miri goes further, [assuming a 48-bit address space on 64-bit platforms](9db224fc90/compiler/rustc_abi/src/lib.rs (L312-L331)), but I don't think we can assume that in an optimization.)
2022-12-18 22:01:39 +00:00
Michael Goulet
dd8897eb63 Don't ICE in closure arg borrow suggestion 2022-12-18 21:41:29 +00:00
Nilstrieb
8bfd6450c7 A few small cleanups for newtype_index
Remove the `..` from the body, only a few invocations used it and it's
inconsistent with rust syntax.

Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18 21:47:28 +01:00
Nilstrieb
d679764fb6 Make #[debug_format] an attribute in newtype_index
This removes the `custom` format functionality as its only user was
trivially migrated to using a normal format.

If a new use case for a custom formatting impl pops up, you can add it
back.
2022-12-18 21:37:38 +01:00
Nilstrieb
91c3c2040c Make #[max] an attribute in newtype_index 2022-12-18 21:22:14 +01:00
Nilstrieb
93429948cf Make #[no_ord_impl] an attribute in newtype_index 2022-12-18 21:06:44 +01:00
Nilstrieb
88d5f7f4ce Make #[custom_encodable] an attribute for newtype_index
Makes the syntax a little more rusty.
2022-12-18 21:02:14 +01:00
Ezra Shaw
540c3f434f
docs: add long-form error-code docs for E0457 2022-12-19 08:55:08 +13:00
Ezra Shaw
7e66d451ad
docs: add long-form error-code docs for E0460 2022-12-19 08:55:08 +13:00
Nilstrieb
b4d739ef12 Use #[derive] instead of custom syntax in all newtype_index 2022-12-18 20:53:08 +01:00
Nilstrieb
d59a2ac2bc Revert "Introduce lowering_arena to avoid creating AST nodes on the fly"
This reverts commit d9a1faaa9c.

This was originally part of a larger PR that has now been closed as a
different approach is taken now.
2022-12-18 20:28:59 +01:00
bors
d0dc9efff1 Auto merge of #105876 - matthiaskrgr:rollup-a9dgzjt, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #96584 (Fix `x setup -h -v` should work)
 - #105420 (Remove dead code after destination propagation)
 - #105844 (Make the x tool use the x and x.ps1 scripts)
 - #105854 (remove redundant clone)
 - #105858 (Another `as_chunks` example)
 - #105870 (avoid .into() conversion to identical types)
 - #105875 (don't destuct references just to reborrow)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-18 18:44:37 +00:00
Matthias Krüger
22379779b5
Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obk
don't destuct references just to reborrow
2022-12-18 18:57:05 +01:00
Matthias Krüger
8892698903
Rollup merge of #105870 - matthiaskrgr:useless_conv, r=oli-obk
avoid .into() conversion to identical types
2022-12-18 18:57:05 +01:00
Matthias Krüger
63fdc9a857
Rollup merge of #105858 - scottmcm:extra-as-chunks-example, r=the8472
Another `as_chunks` example

I really liked this structure that dtolney brought up in #105316, so wanted to put it in the docs to help others use it.
2022-12-18 18:57:04 +01:00
Matthias Krüger
08ecb91db5
Rollup merge of #105854 - matthiaskrgr:rmclone, r=compiler-errors
remove redundant clone
2022-12-18 18:57:03 +01:00
Matthias Krüger
c16b969f1d
Rollup merge of #105844 - albertlarsan68:x-rewrite, r=jyn514
Make the x tool use the x and x.ps1 scripts

This removes another python search from bootstrap.

r? `@jyn514`
2022-12-18 18:57:03 +01:00
Matthias Krüger
f2f297a4f8
Rollup merge of #105420 - tmiasko:dest-prop-dead-code, r=JakobDegen
Remove dead code after destination propagation

Fixes #105428.

cc `@JakobDegen`
2022-12-18 18:57:03 +01:00
Matthias Krüger
3fb5d8e5dd
Rollup merge of #96584 - bentongxyz:x-setup-h-v-should-work, r=jyn514
Fix `x setup -h -v` should work

r? `@jyn514`

I have to convert profile to path and back in order to remove special-casing in bootstrap. I also check for `dry_run` so that `config.toml` and/ or `.git/hooks/pre-push` will not be created if `--dry-run` is specified.

Please help me see if this is ok, thanks alot!
2022-12-18 18:57:02 +01:00
Guillaume Gomez
0c029ab07c Update browser-ui-test version to reduce GUI tests flakyness 2022-12-18 18:14:12 +01:00
Albert Larsan
8348e05644
Make x use the x and x.ps1 scripts
This removes another python search from bootstrap.
2022-12-18 18:07:48 +01:00
Matthias Krüger
a108d55ce6 don't restuct references just to reborrow 2022-12-18 17:04:32 +01:00
bors
37efc81072 Auto merge of #105714 - jyn514:tidy-first, r=Mark-Simulacrum
Run `x test tidy` sooner in mingw-check

It takes less time to run than the other tests and is more likely to fail. `expand-yaml-anchors` is still run first to make sure the CI files are internally consistent.

Note that changing to `--stage 0` doesn't actually do anything since bootstrap tools are always built with the bootstrap compiler, this just makes it less confusing.

cc 83bab41b5b
2022-12-18 16:03:46 +00:00
Matthias Krüger
0aa4cde747 avoid .into() conversion to identical types 2022-12-18 16:20:32 +01:00
Matthias Krüger
3af7df91fc use &str / String literals instead of format!() 2022-12-18 16:17:46 +01:00
Matthias Krüger
6e52a0f421 remove redundant fn params that were only "used" in recursion 2022-12-18 14:27:07 +01:00
Matthias Krüger
fec9e9ecf1 don't clone Copy types 2022-12-18 14:25:55 +01:00
bors
35a99eef32 Auto merge of #104417 - mejrs:mir_build, r=davidtwco
Migrate rustc_mir_build diagnostics

Rebases https://github.com/rust-lang/rust/pull/100854

~~The remaining issue is how to better resolve 72bea68af4~~

~~The diagnostic macros seems to generate a broken diagnostic, and I couldn't figure out how to manually format the fluent message, so I hardcoded the format string for now. I'd like pointers to a better fix for this.~~

Also, I'm not 100% sure I didn't mess up a rebase somewhere 🙂

r? `@davidtwco`
2022-12-18 08:53:49 +00:00
bors
48b3c46126 Auto merge of #105638 - tavianator:fix-50619-again, r=Mark-Simulacrum
fs: Fix #50619 (again) and add a regression test

Bug #50619 was fixed by adding an end_of_stream flag in #50630.
Unfortunately, that fix only applied to the readdir_r() path.  When I
switched Linux to use readdir() in #92778, I inadvertently reintroduced
the bug on that platform.  Other platforms that had always used
readdir() were presumably never fixed.

This patch enables end_of_stream for all platforms, and adds a
Linux-specific regression test that should hopefully prevent the bug
from being reintroduced again.
2022-12-18 05:04:04 +00:00
Scott McMurray
a37d42133c Another as_chunks example
I really liked this structure that dtolney brought up in #105316, so wanted to put it in the docs to help others use it.
2022-12-17 18:41:14 -08:00
bors
ff016a55c2 Auto merge of #105617 - bjorn3:update_crossbeam, r=Mark-Simulacrum
Update crossbeam

This fixes builds for Gentoo

This should fix https://github.com/rust-lang/rust/issues/104866 (cc `@stefson)`
2022-12-18 02:17:54 +00:00
Matthias Krüger
1ade25491e remove redundant clone 2022-12-18 00:29:25 +01:00
bors
24368ecdc4 Auto merge of #105849 - matthiaskrgr:rollup-ya4s1n2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104854 (Symlink `build/host` -> `build/$HOST_TRIPLE`)
 - #105458 (Allow blocking `Command::output`)
 - #105559 (bootstrap: Allow installing `llvm-tools`)
 - #105789 (rustdoc: clean up margin CSS for scraped examples)
 - #105792 (docs: add long error explanation for error E0320)
 - #105814 (Support call and drop terminators in custom mir)
 - #105829 (Speed up tidy)
 - #105836 (std::fmt: Use args directly in example code)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-17 23:27:53 +00:00
Joshua Nelson
c754d057a6 Make the pre-push script work on directories with spaces
As a secondary benefit, it's also a lot simpler.
2022-12-17 17:18:53 -06:00
Benjamin Tong
fca829075f Remove special cases for setup subcommand
- Remove setup special-casing in Flags::parse
2022-12-17 16:59:03 -06:00
Matthias Krüger
8fc1a72e56
Rollup merge of #105836 - evanj:fmt-doc-use-variables, r=Mark-Simulacrum
std::fmt: Use args directly in example code

The lint "clippy::uninlined_format_args" recommends inline variables in format strings. Fix two places in the docs that do not do this. I noticed this because I copy/pasted one example in to my project, then noticed this lint error. This fixes:

```
error: variables can be used directly in the `format!` string
  --> src/main.rs:30:22
   |
30 |         let string = format!("{:.*}", decimals, magnitude);
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: variables can be used directly in the `format!` string
  --> src/main.rs:39:2
   |
39 |  write!(&mut io::stdout(), "{}", args).unwrap();
```
2022-12-17 23:44:29 +01:00
Matthias Krüger
cf08eda0b3
Rollup merge of #105829 - the8472:tidy-style, r=jyn514
Speed up tidy

This can be reviewed commit by commit since they contain separate optimizations.

```
# master
$ taskset -c 0-5 hyperfine './x test tidy'
Benchmark #1: ./x test tidy
  Time (mean ± σ):      4.857 s ±  0.064 s    [User: 12.967 s, System: 2.014 s]
  Range (min … max):    4.779 s …  4.997 s    10 runs

# PR
$ taskset -c 0-5 hyperfine './x test tidy'
Benchmark #1: ./x test tidy
  Time (mean ± σ):      3.672 s ±  0.035 s    [User: 10.524 s, System: 2.029 s]
  Range (min … max):    3.610 s …  3.725 s    10 runs
```
2022-12-17 23:44:29 +01:00
Matthias Krüger
eaf2f26ecc
Rollup merge of #105814 - JakobDegen:custom-mir-terms, r=oli-obk
Support call and drop terminators in custom mir

The only caveat with this change is that cleanup blocks are not supported. I would like to add them, but it's not quite clear to me what the best way to do that is, so I'll have to think about it some more.

r? ``@oli-obk``
2022-12-17 23:44:28 +01:00
Matthias Krüger
a8ad7f64a1
Rollup merge of #105792 - Ezrashaw:add-e0320-long-docs, r=GuillaumeGomez
docs: add long error explanation for error E0320

Continuation of #105791

r? ``@GuillaumeGomez``
2022-12-17 23:44:28 +01:00
Matthias Krüger
2835b668d9
Rollup merge of #105789 - notriddle:notriddle/examples-margin, r=GuillaumeGomez
rustdoc: clean up margin CSS for scraped examples

* This stops applying a margin to the additional example links. Because these links are `display: inline`, it doesn't actually do anything.
* This switches from using a margin-bottom with a special exception for the examples themselves, plus an additional margin on the hide button, to instead using just margin-top on the examples, with an exception for the first one.

No user-visible changes should result from this.
2022-12-17 23:44:27 +01:00
Matthias Krüger
c6be9a705f
Rollup merge of #105559 - mkroening:install-llvm-tools, r=Mark-Simulacrum
bootstrap: Allow installing `llvm-tools`

This PR allows installing the `llvm-tools` dist tarball using `./x.py install`.
2022-12-17 23:44:26 +01:00
Matthias Krüger
6d1cdcaee5
Rollup merge of #105458 - Ayush1325:blocking_spawn, r=Mark-Simulacrum
Allow blocking `Command::output`

### Problem
Currently, `Command::output` is internally implemented using `Command::spawn`. This is problematic because some targets (like UEFI) do not actually support multitasking and thus block while the program is executing. This coupling does not make much sense as `Command::output` is supposed to block until the execution is complete anyway and thus does not need to rely on a non-blocking `Child` or any other intermediate.

### Solution
This PR moves the implementation of `Command::output` to `std::sys`. This means targets can choose to implement only `Command::output` without having to implement `Command::spawn`.

### Additional Information

This was originally conceived when working on https://github.com/rust-lang/rust/pull/100316. Currently, the only target I know about that will benefit from this change is UEFI.

This PR can also be used to implement more efficient `Command::output` since the intermediate `Process` is not actually needed anymore, but that is outside the scope of this PR.

Since this is not a public API change, I'm not sure if an RFC is needed or not.
2022-12-17 23:44:26 +01:00