]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoRollup merge of #105359 - flba-eb:thread_local_key_sentinel_value, r=m-ou-se
Matthias Krüger [Wed, 28 Dec 2022 21:22:18 +0000 (22:22 +0100)]
Rollup merge of #105359 - flba-eb:thread_local_key_sentinel_value, r=m-ou-se

Make sentinel value configurable in `library/std/src/sys_common/thread_local_key.rs`

This is an excerpt of a changeset for the QNX/Neutrino OS. To make the patch for QNX smaller and easier to review, I've extracted this change (which is OS independent). I would be surprised if no other OS is also affected.

All this patch does is to define a `const` for a sentinel value instead of using it directly at several places.

There are OSs that always return the lowest free value. The algorithm in `lazy_init` always avoids keys with the sentinel value.
In affected OSs, this means that each call to `lazy_init` will always request two keys from the OS and returns/frees the first one (with sentinel value) immediately afterwards.

By making the sentinel value configurable, affected OSs can use a different value than zero to prevent this performance issue.

On QNX/Neutrino, it is planned to use a different sentinel value:
```rust
// Define a sentinel value that is unlikely to be returned
// as a TLS key (but it may be returned).
#[cfg(not(target_os = "nto"))]
const KEY_SENTVAL: usize = 0;
// On QNX/Neutrino, 0 is always returned when currently not in use.
// Using 0 would mean to always create two keys and remote the first
// one (with value of 0) immediately afterwards.
#[cfg(target_os = "nto")]
const KEY_SENTVAL: usize = libc::PTHREAD_KEYS_MAX + 1;
```

It seems like no other OS defines `PTHREAD_KEYS_MAX` in Rusts libc, but `limits.h` on unix systems does.

17 months agoRollup merge of #104493 - adamncasey:cgroupzeroperiod, r=m-ou-se
Matthias Krüger [Wed, 28 Dec 2022 21:22:18 +0000 (22:22 +0100)]
Rollup merge of #104493 - adamncasey:cgroupzeroperiod, r=m-ou-se

available_parallelism: Gracefully handle zero value cfs_period_us

There seem to be some scenarios where the cgroup cpu quota field `cpu.cfs_period_us` can contain `0`. This field is used to determine the "amount" of parallelism suggested by the function `std::thread::available_parallelism`

A zero value of this field cause a panic when `available_parallelism()` is invoked. This issue was detected by the call from binaries built by `cargo test`. I really don't feel like `0` is a good value for `cpu.cfs_period_us`, but I also don't think applications should panic if this value is seen.

This panic started happening with rust 1.64.0.

This case is gracefully handled by other projects which read this information: [num_cpus](https://github.com/seanmonstar/num_cpus/blob/e437b9d9083d717692e35d917de8674a7987dd06/src/linux.rs#L207-L210), [ninja](https://github.com/ninja-build/ninja/pull/2174/files), [dotnet](https://github.com/dotnet/runtime/blob/c4341d45acca3ea662cd8d71e7d71094450dd045/src/coreclr/pal/src/misc/cgroup.cpp#L481-L483)

Before this change, running `cargo test` in environments configured as described above would trigger this panic:
```
$ RUST_BACKTRACE=1 cargo test
    Finished test [unoptimized + debuginfo] target(s) in 3.55s
     Running unittests src/main.rs (target/debug/deps/x-9a42e145aca2934d)
thread 'main' panicked at 'attempt to divide by zero', library/std/src/sys/unix/thread.rs:546:70
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: std::sys::unix::thread::cgroups::quota
   4: std::sys::unix::thread::available_parallelism
   5: std::thread::available_parallelism
   6: test::helpers::concurrency::get_concurrency
   7: test::console::run_tests_console
   8: test::test_main
   9: test::test_main_static
  10: x::main
             at ./src/main.rs:1:1
  11: core::ops::function::FnOnce::call_once
             at /tmp/rust-1.64-1.64.0-1/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: test failed, to rerun pass '--bin x'
```

I've tested this change in an environment which has the bad (questionable?) setup and rebuilding the test executable against a fixed std library fixes the panic.

17 months agoRollup merge of #104402 - joboet:sync_remutex, r=m-ou-se
Matthias Krüger [Wed, 28 Dec 2022 21:22:17 +0000 (22:22 +0100)]
Rollup merge of #104402 - joboet:sync_remutex, r=m-ou-se

Move `ReentrantMutex` to `std::sync`

If I understand #84187 correctly, `sys_common` should not contain platform-independent code, even if it is private.

17 months agoAuto merge of #106215 - matthiaskrgr:rollup-53r89ww, r=matthiaskrgr
bors [Wed, 28 Dec 2022 17:00:00 +0000 (17:00 +0000)]
Auto merge of #106215 - matthiaskrgr:rollup-53r89ww, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #106028 (docs/test: add UI test and long-form error docs for `E0461`)
 - #106172 (Suggest `impl Iterator` when possible for `_` return type)
 - #106173 (Deduplicate `op` methods)
 - #106176 (Recover `fn` keyword as `Fn` trait in bounds)
 - #106194 (rustdoc: combine common sidebar background color CSS rules)
 - #106199 (Silence knock-down errors on `[type error]` bindings)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106199 - estebank:quiet-type-err-in-binding, r=compiler-errors
Matthias Krüger [Wed, 28 Dec 2022 13:40:03 +0000 (14:40 +0100)]
Rollup merge of #106199 - estebank:quiet-type-err-in-binding, r=compiler-errors

Silence knock-down errors on `[type error]` bindings

Fix #56036, fix #76589.

17 months agoRollup merge of #106194 - notriddle:notriddle/sidebar-background, r=GuillaumeGomez
Matthias Krüger [Wed, 28 Dec 2022 13:40:02 +0000 (14:40 +0100)]
Rollup merge of #106194 - notriddle:notriddle/sidebar-background, r=GuillaumeGomez

rustdoc: combine common sidebar background color CSS rules

17 months agoRollup merge of #106176 - compiler-errors:fn-kw-as-fn-trait, r=estebank
Matthias Krüger [Wed, 28 Dec 2022 13:40:01 +0000 (14:40 +0100)]
Rollup merge of #106176 - compiler-errors:fn-kw-as-fn-trait, r=estebank

Recover `fn` keyword as `Fn` trait in bounds

`impl fn()` -> `impl Fn()`

Fixes #82515

17 months agoRollup merge of #106173 - compiler-errors:deduplicate-op-methods, r=jackh726
Matthias Krüger [Wed, 28 Dec 2022 13:40:01 +0000 (14:40 +0100)]
Rollup merge of #106173 - compiler-errors:deduplicate-op-methods, r=jackh726

Deduplicate `op` methods

There are some operator-checking flavored methods in `FnCtxt` that can be deduplicated.

17 months agoRollup merge of #106172 - estebank:suggest-impl-trait, r=compiler-errors
Matthias Krüger [Wed, 28 Dec 2022 13:40:00 +0000 (14:40 +0100)]
Rollup merge of #106172 - estebank:suggest-impl-trait, r=compiler-errors

Suggest `impl Iterator` when possible for `_` return type

Address #106096.

17 months agoRollup merge of #106028 - Ezrashaw:add-docs+test-e0461, r=GuillaumeGomez
Matthias Krüger [Wed, 28 Dec 2022 13:40:00 +0000 (14:40 +0100)]
Rollup merge of #106028 - Ezrashaw:add-docs+test-e0461, r=GuillaumeGomez

docs/test: add UI test and long-form error docs for `E0461`

Might take a couple of tries to pass CI. The UI test is x86-linux only; I'm not sure how to generalize it to other architectures.

r? ``@GuillaumeGomez``

17 months agoAuto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwU
bors [Wed, 28 Dec 2022 13:07:30 +0000 (13:07 +0000)]
Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwU

Some `compare_method` tweaks

1. Make some of the comparison functions' names more regular
2. Reduce pub scope of some of the things in `compare_method`
~3. Remove some unnecessary opaque type handling code -- `InferCtxt` already is in a mode that doesn't define opaque types~
  * moved to a different PR
4. Bubble up `ErrorGuaranteed` for region constraint errors in `compare_method` - Improves a redundant error message in one unit test.
5. Move the `compare_method` module to have a more general name, since it's more like `compare_impl_item` :)
6. Rename `collect_trait_impl_trait_tys`

17 months agoAuto merge of #106209 - fee1-dead-contrib:rollup-47ysdcu, r=fee1-dead
bors [Wed, 28 Dec 2022 10:10:09 +0000 (10:10 +0000)]
Auto merge of #106209 - fee1-dead-contrib:rollup-47ysdcu, r=fee1-dead

Rollup of 9 pull requests

Successful merges:

 - #94145 (Test leaking of BinaryHeap Drain iterators)
 - #103945 (Remove `iter::Empty` hack)
 - #104024 (Fix `unused_must_use` warning for `Box::from_raw`)
 - #104708 (Fix backoff doc to match implementation)
 - #105347 (Account for `match` expr in single line)
 - #105484 (Implement allow-by-default `multiple_supertrait_upcastable` lint)
 - #106184 (Fix `core::any` docs)
 - #106201 (Emit fewer errors on invalid `#[repr(transparent)]` on `enum`)
 - #106205 (Remove some totally duplicated files in `rustc_infer`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106205 - compiler-errors:oopsy, r=fee1-dead
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:

17 months agoRollup merge of #106201 - estebank:verbose-transparent, r=compiler-errors
fee1-dead [Wed, 28 Dec 2022 07:51:42 +0000 (15:51 +0800)]
Rollup merge of #106201 - estebank:verbose-transparent, r=compiler-errors

Emit fewer errors on invalid `#[repr(transparent)]` on `enum`

Fix #68420.

17 months agoRollup merge of #106184 - albertlarsan68:docs-106154, r=Nilstrieb
fee1-dead [Wed, 28 Dec 2022 07:51:42 +0000 (15:51 +0800)]
Rollup merge of #106184 - albertlarsan68:docs-106154, r=Nilstrieb

Fix `core::any` docs

Thanks to ``@pbevin`` in #106154

Closes #106154

``@rustbot`` labels +A-docs

17 months agoRollup merge of #105484 - nbdd0121:upcast, r=compiler-errors
fee1-dead [Wed, 28 Dec 2022 07:51:41 +0000 (15:51 +0800)]
Rollup merge of #105484 - nbdd0121:upcast, r=compiler-errors

Implement allow-by-default `multiple_supertrait_upcastable` lint

The lint detects when an object-safe trait has multiple supertraits.

Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them.

r? `@nikomatsakis`

17 months agoRollup merge of #105347 - estebank:single-line-match, r=compiler-errors
fee1-dead [Wed, 28 Dec 2022 07:51:40 +0000 (15:51 +0800)]
Rollup merge of #105347 - estebank:single-line-match, r=compiler-errors

Account for `match` expr in single line

When encountering `match Some(42) { Some(x) => x, None => "" };`, output

```
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
  ```

17 months agoRollup merge of #104708 - jonasspinner:fix-backoff-doc-to-match-implementation, r...
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.

17 months agoRollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
fee1-dead [Wed, 28 Dec 2022 07:51:39 +0000 (15:51 +0800)]
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors

Fix `unused_must_use` warning for `Box::from_raw`

17 months agoRollup merge of #103945 - H4x5:remove-iter-empty-hack, r=compiler-errors
fee1-dead [Wed, 28 Dec 2022 07:51:38 +0000 (15:51 +0800)]
Rollup merge of #103945 - H4x5:remove-iter-empty-hack, r=compiler-errors

Remove `iter::Empty` hack

`iter::Empty` uses a newtype to work around `#![feature(const_fn_fn_ptr_basics)]`, which has been stable since 1.61.0.

17 months agoRollup merge of #94145 - ssomers:binary_heap_tests, r=jyn514
fee1-dead [Wed, 28 Dec 2022 07:51:37 +0000 (15:51 +0800)]
Rollup merge of #94145 - ssomers:binary_heap_tests, r=jyn514

Test leaking of BinaryHeap Drain iterators

Add test cases about forgetting the `BinaryHeap::Drain` iterator, and slightly fortifies some other test cases.

Consists of separate commits that I don't think are relevant on their own (but I'll happily turn these into more PRs if desired).

17 months agoAuto merge of #103881 - ChayimFriedman2:patch-2, r=compiler-errors
bors [Wed, 28 Dec 2022 06:56:02 +0000 (06:56 +0000)]
Auto merge of #103881 - ChayimFriedman2:patch-2, r=compiler-errors

Clarify docs of `RefCell`

Comparison operators only panic if the `RefCell` is mutably borrowed, and `RefCell::swap()` can also panic if swapping a `RefCell` with itself.

17 months agoRemove some totally duplicated files
Michael Goulet [Wed, 28 Dec 2022 05:45:12 +0000 (05:45 +0000)]
Remove some totally duplicated files

17 months agobetter names and a comment
Michael Goulet [Wed, 28 Dec 2022 04:16:36 +0000 (04:16 +0000)]
better names and a comment

17 months agoRename module compare_method -> compare_impl_item
Michael Goulet [Sat, 24 Dec 2022 21:36:07 +0000 (21:36 +0000)]
Rename module compare_method -> compare_impl_item

17 months agomake some things less pub
Michael Goulet [Sat, 24 Dec 2022 21:35:11 +0000 (21:35 +0000)]
make some things less pub

17 months agoAuto merge of #100539 - joboet:horizon_timeout_clock, r=thomcc
bors [Wed, 28 Dec 2022 03:56:46 +0000 (03:56 +0000)]
Auto merge of #100539 - joboet:horizon_timeout_clock, r=thomcc

Use correct clock in `park_timeout` on Horizon

Horizon does not support using `CLOCK_MONOTONIC` with condition variables, so use the system time instead.

17 months agoEmit fewer errors on invalid `#[repr(transparent)]` on `enum`
Esteban Küber [Wed, 28 Dec 2022 02:28:02 +0000 (18:28 -0800)]
Emit fewer errors on invalid `#[repr(transparent)]` on `enum`

Fix #68420.

17 months agoSilence knock-down errors on `[type error]` bindings
Esteban Küber [Wed, 28 Dec 2022 01:57:39 +0000 (17:57 -0800)]
Silence knock-down errors on `[type error]` bindings

Fix #56036, fix #76589.

17 months agoAccount for `match` expr in single line
Esteban Küber [Tue, 6 Dec 2022 03:42:21 +0000 (19:42 -0800)]
Account for `match` expr in single line

When encountering `match Some(42) { Some(x) => x, None => "" };`, output

```
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
  ```

17 months agoShorten type in note
Esteban Küber [Tue, 27 Dec 2022 22:11:41 +0000 (14:11 -0800)]
Shorten type in note

17 months agoreview comments
Esteban Küber [Tue, 27 Dec 2022 21:44:39 +0000 (13:44 -0800)]
review comments

17 months agorustdoc: combine common sidebar background color CSS rules
Michael Howell [Tue, 27 Dec 2022 20:59:00 +0000 (13:59 -0700)]
rustdoc: combine common sidebar background color CSS rules

17 months agoAuto merge of #106193 - compiler-errors:rollup-0l54wka, r=compiler-errors
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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoFix `core::any` mod-level docs
Albert Larsan [Tue, 27 Dec 2022 15:16:22 +0000 (16:16 +0100)]
Fix `core::any` mod-level docs

17 months agoRollup merge of #106189 - alexhrao:master, r=Nilstrieb
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?

17 months agoRollup merge of #106187 - ChayimFriedman2:patch-4, r=compiler-errors
Michael Goulet [Tue, 27 Dec 2022 20:33:37 +0000 (12:33 -0800)]
Rollup merge of #106187 - ChayimFriedman2:patch-4, r=compiler-errors

Update the documentation of `Vec` to use `extend(array)` instead of `extend(array.iter().copied())`

Another option is to use `extend_from_slice()` (that may be faster), but I find this approach cleaner.

17 months agoRollup merge of #106181 - kraktus:fix_doc_parsing, r=notriddle
Michael Goulet [Tue, 27 Dec 2022 20:33:37 +0000 (12:33 -0800)]
Rollup merge of #106181 - kraktus:fix_doc_parsing, r=notriddle

Fix doc comment parsing description in book

This can actually make a difference for the user if they rely on unicode formating.

Prompted by https://github.com/dtolnay/syn/issues/771

17 months agoRollup merge of #106179 - RetroSeven:typo_fix, r=compiler-errors
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.

17 months agoRollup merge of #106064 - lukas-code:outlives-macro, r=cjgillot
Michael Goulet [Tue, 27 Dec 2022 20:33:35 +0000 (12:33 -0800)]
Rollup merge of #106064 - lukas-code:outlives-macro, r=cjgillot

Partially fix `explicit_outlives_requirements` lint in macros

Show the suggestion if and only if the bounds are from the same source context.

fixes https://github.com/rust-lang/rust/issues/106044
fixes https://github.com/rust-lang/rust/issues/106063

17 months agoRollup merge of #105965 - compiler-errors:issue-105896, r=cjgillot
Michael Goulet [Tue, 27 Dec 2022 20:33:35 +0000 (12:33 -0800)]
Rollup merge of #105965 - compiler-errors:issue-105896, r=cjgillot

Provide local extern function arg names

Fixes #105896

17 months agoRollup merge of #105852 - compiler-errors:hex-float-lit, r=cjgillot
Michael Goulet [Tue, 27 Dec 2022 20:33:34 +0000 (12:33 -0800)]
Rollup merge of #105852 - compiler-errors:hex-float-lit, r=cjgillot

Suggest rewriting a malformed hex literal if we expect a float

Fixes #104706

17 months agoRollup merge of #105765 - estebank:range-typo, r=compiler-errors
Michael Goulet [Tue, 27 Dec 2022 20:33:34 +0000 (12:33 -0800)]
Rollup merge of #105765 - estebank:range-typo, r=compiler-errors

Detect likely `.` -> `..` typo in method calls

Fix #65015.

17 months agoRollup merge of #103718 - matklad:infer-lazy, r=dtolnay
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.

17 months agoMake resolve suggestion more generic
Esteban Küber [Tue, 27 Dec 2022 20:16:25 +0000 (12:16 -0800)]
Make resolve suggestion more generic

17 months agoFix UnsafeCell Documentation Spelling Error
Alex Rao [Tue, 27 Dec 2022 18:17:56 +0000 (12:17 -0600)]
Fix UnsafeCell Documentation Spelling Error

This fixes the spelling of "deallocated" (instead of the original "deallocted") In the `cell.rs` source file

17 months agoAuto merge of #97176 - kraktus:cmd_debug, r=the8472
bors [Tue, 27 Dec 2022 18:13:23 +0000 (18:13 +0000)]
Auto merge of #97176 - kraktus:cmd_debug, r=the8472

More verbose `Debug` implementation of `std::process:Command`

Mainly based on commit: https://github.com/zackmdavis/rust/commit/ccc019aabfdd550944c049625e66c92c815ea1d0 from https://github.com/zackmdavis

close https://github.com/rust-lang/rust/issues/42200

17 months agoUpdate the documentation of `Vec` to use `extend(array)` instead of `extend(array...
Chayim Refael Friedman [Tue, 27 Dec 2022 17:44:58 +0000 (19:44 +0200)]
Update the documentation of `Vec` to use `extend(array)` instead of `extend(array.iter().copied())`

17 months agoreview comments: make suggestion more accurate
Esteban Küber [Tue, 27 Dec 2022 17:25:00 +0000 (09:25 -0800)]
review comments: make suggestion more accurate

17 months agoProvide local extern function arg names
Michael Goulet [Tue, 27 Dec 2022 17:10:21 +0000 (17:10 +0000)]
Provide local extern function arg names

17 months agoSuggest rewriting a malformed hex literal if we expect a float
Michael Goulet [Sat, 17 Dec 2022 23:20:16 +0000 (23:20 +0000)]
Suggest rewriting a malformed hex literal if we expect a float

17 months agoAuto merge of #106183 - matthiaskrgr:rollup-ww6yzhi, r=matthiaskrgr
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`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106066 - JohnTitor:rm-bindings-after-at-fixme, r=compiler-errors
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`.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
17 months agoRollup merge of #105994 - JohnTitor:issue-99647, r=compiler-errors
Matthias Krüger [Tue, 27 Dec 2022 15:37:47 +0000 (16:37 +0100)]
Rollup merge of #105994 - JohnTitor:issue-99647, r=compiler-errors

Add regression test for #99647

Closes #99647
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
17 months agoRollup merge of #105817 - chenyukang:yukang/fix-105788-sugg-for-auto-trait, r=TaKO8Ki
Matthias Krüger [Tue, 27 Dec 2022 15:37:47 +0000 (16:37 +0100)]
Rollup merge of #105817 - chenyukang:yukang/fix-105788-sugg-for-auto-trait, r=TaKO8Ki

Remove unreasonable help message for auto trait

Fixes #105788

17 months agoAuto merge of #106168 - jyn514:clean-crates, r=Mark-Simulacrum
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.

17 months agoFix doc comment parsing
kraktus [Tue, 27 Dec 2022 12:31:53 +0000 (13:31 +0100)]
Fix doc comment parsing

This can actually make a difference for the user if they rely on unicode formating.

Prompted by https://github.com/dtolnay/syn/issues/771

17 months agoAuto merge of #106177 - matthiaskrgr:rollup-oe7z8ix, r=matthiaskrgr
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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoFix a formatting error
RetroSeven [Tue, 27 Dec 2022 10:07:44 +0000 (11:07 +0100)]
Fix a formatting error

17 months agoMore verbose `Debug` implementation of `std::process:Command`
kraktus [Thu, 19 May 2022 13:50:27 +0000 (15:50 +0200)]
More verbose `Debug` implementation of `std::process:Command`

based on commit: https://github.com/zackmdavis/rust/commit/ccc019aabfdd550944c049625e66c92c815ea1d0 from https://github.com/zackmdavis

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.

17 months agoRollup merge of #106174 - GuillaumeGomez:rm-unused-ayu-css-rules, r=notriddle
Matthias Krüger [Tue, 27 Dec 2022 07:57:48 +0000 (08:57 +0100)]
Rollup merge of #106174 - GuillaumeGomez:rm-unused-ayu-css-rules, r=notriddle

Remove unused empty CSS rules in ayu theme

r? `@notriddle`

17 months agoRollup merge of #106150 - estebank:issue-39232, r=compiler-errors
Matthias Krüger [Tue, 27 Dec 2022 07:57:48 +0000 (08:57 +0100)]
Rollup merge of #106150 - estebank:issue-39232, r=compiler-errors

Detect when method call on LHS might be shadowed

Address #39232.

17 months agoRollup merge of #106146 - kadiwa4:readme-x-py, r=jyn514
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.

17 months agoRollup merge of #105515 - estebank:issue-104141, r=oli-obk
Matthias Krüger [Tue, 27 Dec 2022 07:57:45 +0000 (08:57 +0100)]
Rollup merge of #105515 - estebank:issue-104141, r=oli-obk

Account for macros in const generics

Fix #104141.

17 months agoAuto merge of #106095 - estebank:pin-mut-reborrow, r=compiler-errors
bors [Tue, 27 Dec 2022 07:31:42 +0000 (07:31 +0000)]
Auto merge of #106095 - estebank:pin-mut-reborrow, r=compiler-errors

Suggest `Pin::as_mut` when encountering borrow error

Fix #65409 for `Pin<&mut T>`.

17 months agoRecover `fn` keyword as `Fn` trait in bounds
Michael Goulet [Tue, 27 Dec 2022 06:14:40 +0000 (06:14 +0000)]
Recover `fn` keyword as `Fn` trait in bounds

17 months agofix #105788, Remove unreasonable help message for auto trait
yukang [Sat, 17 Dec 2022 00:20:46 +0000 (08:20 +0800)]
fix #105788, Remove unreasonable help message for auto trait

17 months agoAuto merge of #106166 - jyn514:print-paths, r=Mark-Simulacrum
bors [Tue, 27 Dec 2022 04:44:42 +0000 (04:44 +0000)]
Auto merge of #106166 - jyn514:print-paths, r=Mark-Simulacrum

Fix panic on `x build --help --verbose`

See https://github.com/rust-lang/rust/issues/106165 for a detailed description of what went wrong here.

This also makes the panic message a little more informative in case it happens again.

17 months agodocs: add long-form error docs for `E0461`
Ezra Shaw [Sat, 24 Dec 2022 07:53:40 +0000 (20:53 +1300)]
docs: add long-form error docs for `E0461`

17 months agoRemove unused empty CSS rules in ayu theme
Guillaume Gomez [Tue, 27 Dec 2022 03:57:30 +0000 (04:57 +0100)]
Remove unused empty CSS rules in ayu theme

17 months agoDeduplicate more op-flavored methods
Michael Goulet [Tue, 27 Dec 2022 02:40:56 +0000 (02:40 +0000)]
Deduplicate more op-flavored methods

17 months agoClean up operator type checking
Michael Goulet [Tue, 27 Dec 2022 02:10:54 +0000 (02:10 +0000)]
Clean up operator type checking

17 months agoDetect likely `.` -> `..` typo in method calls
Esteban Küber [Fri, 16 Dec 2022 00:24:42 +0000 (16:24 -0800)]
Detect likely `.` -> `..` typo in method calls

Fix #65015.

17 months agoSuggest `impl Iterator` when possible for `_` return type
Esteban Küber [Tue, 27 Dec 2022 01:44:16 +0000 (17:44 -0800)]
Suggest `impl Iterator` when possible for `_` return type

Address #106096.

17 months agoAllow cleaning individual crates
Joshua Nelson [Tue, 27 Dec 2022 01:00:26 +0000 (19:00 -0600)]
Allow cleaning individual crates

As a bonus, this stops special casing `clean` in `Builder`.

17 months agoFix panic on `x build --help --verbose`
Joshua Nelson [Mon, 26 Dec 2022 23:53:39 +0000 (17:53 -0600)]
Fix panic on `x build --help --verbose`

This also makes the panic message a little more informative in case it
happens again.

17 months agoAuto merge of #103020 - lyming2007:issue-102598-fix, r=jackh726
bors [Mon, 26 Dec 2022 21:50:05 +0000 (21:50 +0000)]
Auto merge of #103020 - lyming2007:issue-102598-fix, r=jackh726

error parsing lifetime following by Sized and message + between them

Fixes #102598

17 months agoreview comments
Esteban Küber [Mon, 26 Dec 2022 21:35:35 +0000 (13:35 -0800)]
review comments

17 months agofix rebase
Esteban Küber [Mon, 26 Dec 2022 20:47:08 +0000 (12:47 -0800)]
fix rebase

17 months agoFix suggestion when there are arguments in the method
Esteban Küber [Mon, 26 Dec 2022 20:29:16 +0000 (12:29 -0800)]
Fix suggestion when there are arguments in the method

17 months agoTweak wording
Esteban Küber [Mon, 26 Dec 2022 20:00:22 +0000 (12:00 -0800)]
Tweak wording

17 months agoDetect when method call on LHS might be shadowed
Esteban Küber [Mon, 26 Dec 2022 05:50:30 +0000 (21:50 -0800)]
Detect when method call on LHS might be shadowed

Address #39232.

17 months agoAuto merge of #106156 - fee1-dead-contrib:rollup-3ir0951, r=fee1-dead
bors [Mon, 26 Dec 2022 18:36:10 +0000 (18:36 +0000)]
Auto merge of #106156 - fee1-dead-contrib:rollup-3ir0951, r=fee1-dead

Rollup of 2 pull requests

Successful merges:

 - #106151 (Remove unused imports)
 - #106153 (Fix missing renaming for #titles into #search-tabs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106153 - GuillaumeGomez:search-tabs-headers, r=notriddle
fee1-dead [Mon, 26 Dec 2022 16:34:53 +0000 (00:34 +0800)]
Rollup merge of #106153 - GuillaumeGomez:search-tabs-headers, r=notriddle

Fix missing renaming for #titles into #search-tabs

We forgot to update this selector in the themes in https://github.com/rust-lang/rust/pull/106069.

r? `@notriddle`

17 months agoRollup merge of #106151 - TaKO8Ki:remove-unused-imports, r=jackh726
fee1-dead [Mon, 26 Dec 2022 16:34:53 +0000 (00:34 +0800)]
Rollup merge of #106151 - TaKO8Ki:remove-unused-imports, r=jackh726

Remove unused imports

17 months agoAuto merge of #106149 - notriddle:notriddle/src-sidebar-toggle-pos, r=GuillaumeGomez
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.

## Before

![image](https://user-images.githubusercontent.com/1593513/209507474-0463e4b2-0bd4-497b-958c-ec4fdbb524fb.png)

## After

![image](https://user-images.githubusercontent.com/1593513/209507499-a32c1728-d4c9-46d9-821d-ba6f8d4d94d4.png)

17 months agoaddress review comments + better tests
Lukas Markeffsky [Sun, 25 Dec 2022 21:16:04 +0000 (22:16 +0100)]
address review comments + better tests

17 months agoAdd GUI test for search tab headers
Guillaume Gomez [Mon, 26 Dec 2022 12:09:40 +0000 (13:09 +0100)]
Add GUI test for search tab headers

17 months agoFix missing renaming for #titles into #search-tabs
Guillaume Gomez [Mon, 26 Dec 2022 12:09:23 +0000 (13:09 +0100)]
Fix missing renaming for #titles into #search-tabs

17 months agoAuto merge of #103828 - cassaundra:fix-format-args-span2, r=cjgillot
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).

17 months agoAuto merge of #105605 - inquisitivecrystal:attr-validation, r=cjgillot
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.

Fixes #105594.

r? `@cjgillot`

17 months agoremove unused imports
Takayuki Maeda [Mon, 26 Dec 2022 06:01:20 +0000 (15:01 +0900)]
remove unused imports

17 months agorustdoc: clean up src sidebar toggle position CSS
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.

17 months agoRemove redundant clone suggestion
Esteban Küber [Mon, 26 Dec 2022 01:16:54 +0000 (17:16 -0800)]
Remove redundant clone suggestion

17 months agoCreate new inference context
Esteban Küber [Mon, 26 Dec 2022 00:51:11 +0000 (16:51 -0800)]
Create new inference context

17 months agoAuto merge of #106143 - matthiaskrgr:rollup-3kpy1dc, r=matthiaskrgr
bors [Sun, 25 Dec 2022 23:47:11 +0000 (23:47 +0000)]
Auto merge of #106143 - matthiaskrgr:rollup-3kpy1dc, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #105375 (Fix an outdated comment mentioning parameter that doesn't exist anymore)
 - #105955 (Remove wrapper functions for some unstable options)
 - #106137 (fix more clippy::style findings)
 - #106140 (Migrate links-color.goml to functions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoreadme: update section on how to run x.py
KaDiWa [Sun, 25 Dec 2022 23:33:32 +0000 (00:33 +0100)]
readme: update section on how to run x.py

17 months agoRollup merge of #106140 - GuillaumeGomez:migrate-links-color, r=notriddle
Matthias Krüger [Sun, 25 Dec 2022 21:15:01 +0000 (22:15 +0100)]
Rollup merge of #106140 - GuillaumeGomez:migrate-links-color, r=notriddle

Migrate links-color.goml to functions

r? `@notriddle`

17 months agoRollup merge of #106137 - matthiaskrgr:clippy_style, r=jyn514
Matthias Krüger [Sun, 25 Dec 2022 21:15:00 +0000 (22:15 +0100)]
Rollup merge of #106137 - matthiaskrgr:clippy_style, r=jyn514

fix more clippy::style findings

match_result_ok
obfuscated_if_else
single_char_add
writeln_empty_string
collapsible_match
iter_cloned_collect
unnecessary_mut_passed

r? `@compiler-errors`

17 months agoRollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses...
Matthias Krüger [Sun, 25 Dec 2022 21:15:00 +0000 (22:15 +0100)]
Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot

Remove wrapper functions for some unstable options

They are trivial and just forward to the option. Like most other options, we can just access it directly.