Matthias Krüger
313541c766
Rollup merge of #106223 - estebank:suggest-let-ty-borrow, r=compiler-errors
...
On unsized locals with explicit types suggest `&`
Fix #72742 .
2022-12-29 13:16:04 +01:00
Matthias Krüger
c610aeb592
Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors
...
Rename `Rptr` to `Ref` in AST and HIR
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-29 13:16:04 +01:00
Matthias Krüger
2c4560cb12
Rollup merge of #106218 - GuillaumeGomez:migrate-css-var-scraped-examples, r=notriddle
...
Migrate css var scraped examples
r? ``@notriddle``
2022-12-29 13:16:03 +01:00
Matthias Krüger
bdf37b7bbb
Rollup merge of #106217 - notriddle:notriddle/tooltip-center, r=GuillaumeGomez
...
rustdoc: remove unnecessary `.tooltip::after { text-align: center }`
This doesn't have an effect, since these tooltip are only one line anyway.
2022-12-29 13:16:03 +01:00
Matthias Krüger
497d21412a
Rollup merge of #106208 - compiler-errors:compare-item-region-err, r=estebank
...
Make trait/impl `where` clause mismatch on region error a bit more actionable
Improve `where` clause suggestions for GATs/methods that have incompatible region predicates in their `where` clauses.
Also addresses this diagnostic that went away https://github.com/rust-lang/rust/pull/106129#discussion_r1056875772
2022-12-29 13:16:02 +01:00
bors
11a338ab66
Auto merge of #106139 - cjgillot:mir-inline-location, r=eholk
...
Give the correct track-caller location with MIR inlining.
Fixes https://github.com/rust-lang/rust/issues/105538
2022-12-29 08:06:03 +00:00
Matthias Krüger
c52d58f346
Rollup merge of #105570 - Nilstrieb:actual-best-failure, r=compiler-errors
...
Properly calculate best failure in macro matching
Previously, we used spans. This was not good. Sometimes, the span of the token that failed to match may come from a position later in the file which has been transcribed into a token stream way earlier in the file. If precisely this token fails to match, we think that it was the best match because its span is so high, even though other arms might have gotten further in the token stream.
We now try to properly use the location in the token stream.
This needs a little cleanup as the `best_failure` field is getting out of hand but it should be mostly good to go. I hope I didn't violate too many abstraction boundaries..
2022-12-28 22:22:19 +01:00
Esteban Küber
083eb936ec
On unsized locals with explicit types suggest &
...
Fix #72742 .
2022-12-28 11:03:28 -08:00
Michael Goulet
992ba801c2
Add test for bad suggestion
2022-12-28 18:35:21 +00:00
Michael Goulet
01d784131f
Make trait/impl where clause mismatch on region error a bit more actionable
2022-12-28 18:09:27 +00:00
Nilstrieb
9067e4417e
Rename Rptr to Ref in AST and HIR
...
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already
as well.
2022-12-28 18:52:36 +01:00
Michael Howell
9221e43313
rustdoc: remove unnecessary .tooltip::after { text-align: center }
...
This doesn't have an effect, since these tooltip are only one line anyway.
2022-12-28 10:48:15 -07:00
bors
270c94e484
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
2022-12-28 17:00:00 +00:00
Guillaume Gomez
aa20f885c4
Add GUI test for scraped examples colors
2022-12-28 17:15:09 +01:00
Matthias Krüger
d37cb3ff89
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 .
2022-12-28 14:40:03 +01:00
Matthias Krüger
08e2e4e4e4
Rollup merge of #106194 - notriddle:notriddle/sidebar-background, r=GuillaumeGomez
...
rustdoc: combine common sidebar background color CSS rules
2022-12-28 14:40:02 +01:00
Matthias Krüger
d07be1a304
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
2022-12-28 14:40:01 +01:00
Matthias Krüger
31f5e753fb
Rollup merge of #106172 - estebank:suggest-impl-trait, r=compiler-errors
...
Suggest `impl Iterator` when possible for `_` return type
Address #106096 .
2022-12-28 14:40:00 +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
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
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
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
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
8e039b6948
Silence knock-down errors on [type error] bindings
...
Fix #56036 , fix #76589 .
2022-12-27 18:26:54 -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
Esteban Küber
b400bde52a
Shorten type in note
2022-12-27 15:36:10 -08:00
Michael Howell
5c0b60f967
rustdoc: combine common sidebar background color CSS rules
2022-12-27 14:15:49 -07: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
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
Esteban Küber
7e84273b7f
Make resolve suggestion more generic
2022-12-27 12:16:25 -08: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
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
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
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
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
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
Matthias Krüger
b8d71fc41f
Rollup merge of #105515 - estebank:issue-104141, r=oli-obk
...
Account for macros in const generics
Fix #104141 .
2022-12-27 08:57:45 +01:00
bors
0ca50032ce
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>`.
2022-12-27 07:31:42 +00:00
Michael Goulet
aff403cf68
Recover fn keyword as Fn trait in bounds
2022-12-27 06:14:46 +00:00
yukang
90753de099
fix #105788 , Remove unreasonable help message for auto trait
2022-12-27 12:56:40 +08:00
Esteban Küber
c9381fc334
Detect likely . -> .. typo in method calls
...
Fix #65015 .
2022-12-26 18:27:40 -08:00
Esteban Küber
1b341fe8a1
Suggest impl Iterator when possible for _ return type
...
Address #106096 .
2022-12-26 18:21:45 -08:00