fee1-dead [Wed, 28 Dec 2022 07:51:43 +0000 (15:51 +0800)]
Rollup merge of #106205 - compiler-errors:oopsy, r=fee1-dead
Remove some totally duplicated files in `rustc_infer`
I have no idea why or how I duplicated these files from `compiler/rustc_infer/src/infer/error_reporting/note.rs`, but I did by accident, and nothing caught it :facepalm:
```
error[E0308]: `match` arms have incompatible types
--> f53.rs:2:52
|
2 | let _ = match Some(42) { Some(x) => x, None => "" };
| -------------- - ^^ expected integer, found `&str`
| | |
| | this is found to be of type `{integer}`
| `match` arms have incompatible types
```
fee1-dead [Wed, 28 Dec 2022 07:51:40 +0000 (15:51 +0800)]
Rollup merge of #104708 - jonasspinner:fix-backoff-doc-to-match-implementation, r=compiler-errors
Fix backoff doc to match implementation
The commit 8dddb2294310ad3e8ce0b2af735a702ad72a9a99 in the crossbeam-channel PR (#93563) changed the backoff strategy to be quadratic instead of exponential. This updates the doc to prevent confusion.
```
error[E0308]: `match` arms have incompatible types
--> f53.rs:2:52
|
2 | let _ = match Some(42) { Some(x) => x, None => "" };
| -------------- - ^^ expected integer, found `&str`
| | |
| | this is found to be of type `{integer}`
| `match` arms have incompatible types
```
bors [Tue, 27 Dec 2022 20:54:06 +0000 (20:54 +0000)]
Auto merge of #106193 - compiler-errors:rollup-0l54wka, r=compiler-errors
Rollup of 9 pull requests
Successful merges:
- #103718 (More inference-friendly API for lazy)
- #105765 (Detect likely `.` -> `..` typo in method calls)
- #105852 (Suggest rewriting a malformed hex literal if we expect a float)
- #105965 (Provide local extern function arg names)
- #106064 (Partially fix `explicit_outlives_requirements` lint in macros)
- #106179 (Fix a formatting error in Iterator::for_each docs)
- #106181 (Fix doc comment parsing description in book)
- #106187 (Update the documentation of `Vec` to use `extend(array)` instead of `extend(array.iter().copied())`)
- #106189 (Fix UnsafeCell Documentation Spelling Error)
Michael Goulet [Tue, 27 Dec 2022 20:33:38 +0000 (12:33 -0800)]
Rollup merge of #106189 - alexhrao:master, r=Nilstrieb
Fix UnsafeCell Documentation Spelling Error
This fixes the spelling of "deallocated" (instead of the original "deallocted") In the `cell.rs` source file. Honestly probably not worth the time to evaluate, but since it doesn't involve any code change, I figure why not?
Michael Goulet [Tue, 27 Dec 2022 20:33:36 +0000 (12:33 -0800)]
Rollup merge of #106179 - RetroSeven:typo_fix, r=compiler-errors
Fix a formatting error in Iterator::for_each docs
There is a formatting error (extra space in an assignment) in the documentation of `core::iter::Iterator::for_each`, which I have fixed in this pull request.
Michael Goulet [Tue, 27 Dec 2022 20:33:33 +0000 (12:33 -0800)]
Rollup merge of #103718 - matklad:infer-lazy, r=dtolnay
More inference-friendly API for lazy
The signature for new was
```
fn new<F>(f: F) -> Lazy<T, F>
```
Notably, with `F` unconstrained, `T` can be literally anything, and just `let _ = Lazy::new(|| 92)` would not typecheck.
This historiacally was a necessity -- `new` is a `const` function, it couldn't have any bounds. Today though, we can move `new` under the `F: FnOnce() -> T` bound, which gives the compiler enough data to infer the type of T from closure.
bors [Tue, 27 Dec 2022 15:44:53 +0000 (15:44 +0000)]
Auto merge of #106183 - matthiaskrgr:rollup-ww6yzhi, r=matthiaskrgr
Rollup of 3 pull requests
Successful merges:
- #105817 (Remove unreasonable help message for auto trait)
- #105994 (Add regression test for #99647)
- #106066 (Always suggest as `MachineApplicable` in `recover_intersection_pat`)
Matthias Krüger [Tue, 27 Dec 2022 15:37:48 +0000 (16:37 +0100)]
Rollup merge of #106066 - JohnTitor:rm-bindings-after-at-fixme, r=compiler-errors
Always suggest as `MachineApplicable` in `recover_intersection_pat`
This resolves one FIXME in `recover_intersection_pat` by always applying `MachineApplicable` when suggesting, as `bindings_after_at` is now stable.
This also separates a test to apply `// run-rustfix`.
bors [Tue, 27 Dec 2022 13:04:08 +0000 (13:04 +0000)]
Auto merge of #106168 - jyn514:clean-crates, r=Mark-Simulacrum
Allow cleaning individual crates
As a bonus, this stops special casing `clean` in `Builder`.
## Motivation
Cleaning artifacts isn't strictly necessary to get cargo to rebuild; `touch compiler/rustc_driver/src/lib.rs` (for example) will also work. There's two reasons I thought making this part of bootstrap proper was a better approach:
1. `touch` does not *remove* artifacts, it just causes a rebuild. This is unhelpful for when you want to measure how long the compiler itself takes to build (e.g. for https://github.com/rust-lang/rust/issues/65031).
2. It seems a little more discoverable; and I want to extend it in the future to things like `x clean --stage 1 rustc`, which makes it easier to work around https://github.com/rust-lang/rust/issues/76720 without having to completely wipe all the stage 0 artifacts, or having to be intimately familiar with which directories to remove.
bors [Tue, 27 Dec 2022 10:23:32 +0000 (10:23 +0000)]
Auto merge of #106177 - matthiaskrgr:rollup-oe7z8ix, r=matthiaskrgr
Rollup of 4 pull requests
Successful merges:
- #105515 (Account for macros in const generics)
- #106146 (Readme: update section on how to run `x.py`)
- #106150 (Detect when method call on LHS might be shadowed)
- #106174 (Remove unused empty CSS rules in ayu theme)
close https://github.com/rust-lang/rust/issues/42200
Add env variables and cwd to the shell-like debug output.
Also use the alternate syntax to display a more verbose display, while not showing internal fields and hiding fields when they have their default value.
Matthias Krüger [Tue, 27 Dec 2022 07:57:46 +0000 (08:57 +0100)]
Rollup merge of #106146 - kadiwa4:readme-x-py, r=jyn514
Readme: update section on how to run `x.py`
`./x.py` currently looks for `python3` (not `python`) in the `PATH`. I updated that in the readme and also mentioned a convenient way to run `x.py` on Windows. The PowerShell script is actually quite inconvenient to use (and not really necessary on the `cmd.exe` prompt) so I left it out.
In addition I adapted `./x` in one of the CI scripts.
bors [Mon, 26 Dec 2022 15:46:53 +0000 (15:46 +0000)]
Auto merge of #106149 - notriddle:notriddle/src-sidebar-toggle-pos, r=GuillaumeGomez
rustdoc: clean up src sidebar toggle position CSS
This PR makes the `464px` version of `#src-sidebar-toggle` the same as the `700px` version, with the button lower on the page so that it doesn't cover up the search form, and removes the left margin to make space for it.
bors [Mon, 26 Dec 2022 12:03:47 +0000 (12:03 +0000)]
Auto merge of #103828 - cassaundra:fix-format-args-span2, r=cjgillot
Fix incorrect span when using byte-escaped rbrace
Fix #103826, a format args span issue introduced in #102214.
The current solution for tracking skipped characters made it so that certain situations were ambiguous enough that the original span couldn't be worked out later. This PR improves on the original solution by keeping track of groups of skipped characters using a map, and fixes the previous bug. See an example of this ambiguity in the [previous PR's discussion](https://github.com/rust-lang/rust/pull/102214#issuecomment-1258711015).
bors [Mon, 26 Dec 2022 09:06:51 +0000 (09:06 +0000)]
Auto merge of #105605 - inquisitivecrystal:attr-validation, r=cjgillot
Don't perform invalid checks in `codegen_attrs`
The attributes `#[track_caller]` and `#[cmse_nonsecure_entry]` are only valid on functions. When validating one of these attributes, codegen_attrs previously called `fn_sig`, [which can only be used on functions](https://github.com/rust-lang/rust/pull/105201), on the item the attribute was attached to, assuming that the item was a function without checking. This led to [ICEs in situations where the attribute was incorrectly used on non-functions](https://github.com/rust-lang/rust/issues/105594).
With this change, we skip calling `fn_sig` if the item the attribute is attached to must be a function but isn't, because `check_attr` will reject such cases without codegen_attrs's intervention.
As a side note, some of the attributes in codegen_attrs are only valid on functions, but that property isn't actually checked. I'm planning to fix that in a follow up PR since it's a behavior change that will need to be validated rather than an obvious bugfix. Thankfully, all the attributes like that I've found so far are unstable.
Michael Howell [Mon, 26 Dec 2022 05:35:34 +0000 (22:35 -0700)]
rustdoc: clean up src sidebar toggle position CSS
This PR makes the `464px` version of `#src-sidebar-toggle` the same as the
`700px` version, with the button lower on the page so that it doesn't cover
up the search form, and removes the left margin to make space for it.
bors [Sun, 25 Dec 2022 20:51:37 +0000 (20:51 +0000)]
Auto merge of #105997 - RalfJung:immediate-abort, r=eholk
abort immediately on bad mem::zeroed/uninit
Now that we have non-unwinding panics, let's use them for these assertions. This re-establishes the property that `mem::uninitialized` and `mem::zeroed` will never unwind -- the earlier approach of causing panics here sometimes led to hard-to-debug segfaults when the surrounding code was not able to cope with the unexpected unwinding.
Cc `@bjorn3` I did not touch cranelift but I assume it needs a similar patch. However it has a `codegen_panic` abstraction that I did not want to touch since I didn't know how else it is used.
bors [Sat, 24 Dec 2022 17:14:26 +0000 (17:14 +0000)]
Auto merge of #104977 - RalfJung:ptr-from-ref, r=dtolnay
add ptr::from_{ref,mut}
We have methods to avoid almost all `as` casts around raw pointer handling, except for the initial cast from reference to raw pointer. These new methods close that gap.
(I also moved `null_mut` next to `null` to keep the file consistently organized.)