Commit Graph

213517 Commits

Author SHA1 Message Date
Markus Everling
ccba6c5151 Add vec_deque::IntoIter benchmarks 2023-01-18 00:33:05 +01:00
Markus Everling
7c13b145f4 Implement more methods for vec_deque::IntoIter 2022-12-29 03:00:11 +01:00
bors
83a28ef095 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`
2022-12-28 13:07:30 +00:00
bors
6a20f7df57 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
2022-12-28 10:10:09 +00:00
fee1-dead
5e9c91c6dd
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 🤦
2022-12-28 15:51:43 +08:00
fee1-dead
f837da736f
Rollup merge of #106201 - estebank:verbose-transparent, r=compiler-errors
Emit fewer errors on invalid `#[repr(transparent)]` on `enum`

Fix #68420.
2022-12-28 15:51:42 +08:00
fee1-dead
45d6f02ea5
Rollup merge of #106184 - albertlarsan68:docs-106154, r=Nilstrieb
Fix `core::any` docs

Thanks to ``@pbevin`` in #106154

Closes #106154

``@rustbot`` labels +A-docs
2022-12-28 15:51:42 +08:00
fee1-dead
8b3d0c4cf9
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`
2022-12-28 15:51:41 +08:00
fee1-dead
ade9605a08
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
  ```
2022-12-28 15:51:40 +08:00
fee1-dead
0818ba43a4
Rollup merge of #104708 - jonasspinner:fix-backoff-doc-to-match-implementation, r=compiler-errors
Fix backoff doc to match implementation

The commit 8dddb22943 in the crossbeam-channel PR (#93563) changed the backoff strategy to be quadratic instead of exponential. This updates the doc to prevent confusion.
2022-12-28 15:51:40 +08:00
fee1-dead
58233e90b8
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
Fix `unused_must_use` warning for `Box::from_raw`
2022-12-28 15:51:39 +08:00
fee1-dead
d1193ad1e6
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.
2022-12-28 15:51:38 +08:00
fee1-dead
dc98aa681f
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).
2022-12-28 15:51:37 +08:00
bors
9b889e53e7 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.
2022-12-28 06:56:02 +00:00
Michael Goulet
605ad65f6a Remove some totally duplicated files 2022-12-28 05:45:12 +00:00
Michael Goulet
96d8011fa8 better names and a comment 2022-12-28 04:18:37 +00:00
Michael Goulet
c7b414adb6 Rename module compare_method -> compare_impl_item 2022-12-28 04:18:37 +00:00
Michael Goulet
91613c5030 make some things less pub 2022-12-28 04:18:37 +00:00
bors
6a4624d73b 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.
2022-12-28 03:56:46 +00:00
Esteban Küber
50c1be1d19 Emit fewer errors on invalid #[repr(transparent)] on enum
Fix #68420.
2022-12-27 18:28:02 -08:00
Esteban Küber
05e8ba126c 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
  ```
2022-12-27 16:45:55 -08:00
bors
739d68a76e 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
2022-12-27 20:54:06 +00:00
Albert Larsan
6d332c4a71
Fix core::any mod-level docs 2022-12-27 21:42:42 +01:00
Michael Goulet
49d43468a8
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?
2022-12-27 12:33:38 -08:00
Michael Goulet
79730d6e32
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.
2022-12-27 12:33:37 -08:00
Michael Goulet
4de5547aa0
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
2022-12-27 12:33:37 -08:00
Michael Goulet
7f5f31bc37
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.
2022-12-27 12:33:36 -08:00
Michael Goulet
18bf19c3a9
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
2022-12-27 12:33:35 -08:00
Michael Goulet
3fba7b4523
Rollup merge of #105965 - compiler-errors:issue-105896, r=cjgillot
Provide local extern function arg names

Fixes #105896
2022-12-27 12:33:35 -08:00
Michael Goulet
996fb664d3
Rollup merge of #105852 - compiler-errors:hex-float-lit, r=cjgillot
Suggest rewriting a malformed hex literal if we expect a float

Fixes #104706
2022-12-27 12:33:34 -08:00
Michael Goulet
a9fdeddafd
Rollup merge of #105765 - estebank:range-typo, r=compiler-errors
Detect likely `.` -> `..` typo in method calls

Fix #65015.
2022-12-27 12:33:34 -08:00
Michael Goulet
4b668a1fee
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.
2022-12-27 12:33:33 -08:00
Esteban Küber
7e84273b7f Make resolve suggestion more generic 2022-12-27 12:16:25 -08:00
Alex Rao
b026167eb9
Fix UnsafeCell Documentation Spelling Error
This fixes the spelling of "deallocated" (instead of the original "deallocted") In the `cell.rs` source file
2022-12-27 12:17:56 -06:00
bors
92c1937a90 Auto merge of #97176 - kraktus:cmd_debug, r=the8472
More verbose `Debug` implementation of `std::process:Command`

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

close https://github.com/rust-lang/rust/issues/42200
2022-12-27 18:13:23 +00:00
Chayim Refael Friedman
4df5459dd1
Update the documentation of Vec to use extend(array) instead of extend(array.iter().copied()) 2022-12-27 19:44:58 +02:00
Esteban Küber
0c0685bb68 review comments: make suggestion more accurate 2022-12-27 09:25:00 -08:00
Michael Goulet
e5c159cf90 Provide local extern function arg names 2022-12-27 17:21:08 +00:00
Michael Goulet
3cf22de90f Suggest rewriting a malformed hex literal if we expect a float 2022-12-27 17:14:45 +00:00
bors
db79625326 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
2022-12-27 15:44:53 +00:00
Matthias Krüger
b7657e9cec
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>
2022-12-27 16:37:48 +01:00
Matthias Krüger
d5b975cb7c
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>
2022-12-27 16:37:47 +01:00
Matthias Krüger
a0bf4f9b72
Rollup merge of #105817 - chenyukang:yukang/fix-105788-sugg-for-auto-trait, r=TaKO8Ki
Remove unreasonable help message for auto trait

Fixes #105788
2022-12-27 16:37:47 +01:00
bors
b38a6d373c 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.
2022-12-27 13:04:08 +00:00
kraktus
ce1e6a4612 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
2022-12-27 13:31:53 +01:00
bors
a1fc71196a 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
2022-12-27 10:23:32 +00:00
RetroSeven
9f18cc9e51
Fix a formatting error 2022-12-27 11:07:44 +01:00
kraktus
eb63dea57f More verbose Debug implementation of std::process:Command
based on commit: ccc019aabf 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.
2022-12-27 09:50:01 +01:00
Matthias Krüger
d5810e8339
Rollup merge of #106174 - GuillaumeGomez:rm-unused-ayu-css-rules, r=notriddle
Remove unused empty CSS rules in ayu theme

r? `@notriddle`
2022-12-27 08:57:48 +01:00
Matthias Krüger
e31e8b1176
Rollup merge of #106150 - estebank:issue-39232, r=compiler-errors
Detect when method call on LHS might be shadowed

Address #39232.
2022-12-27 08:57:48 +01:00