Commit Graph

20723 Commits

Author SHA1 Message Date
Michael Goulet
29420a8e7a
Rollup merge of #106600 - compiler-errors:no-private-field-ty-err, r=estebank
Suppress type errors that come from private fields

Fixes #57320

There was some discussion here (https://github.com/rust-lang/rust/issues/57320#issuecomment-451308420), but I honestly think the second error is worth suppressing regardless.

I would be open to feedback though -- perhaps we can suppress the `.len()` suggestion if there's type error (since we have access to [`Expectation`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/enum.Expectation.html), we can determine that).

r? ``@estebank``
2023-01-08 19:57:55 -08:00
Michael Goulet
eefc44b7e2
Rollup merge of #106497 - chenyukang:yukang/fix-106443-sugg-clone, r=estebank
Suggest using clone when we have &T and T implemented Clone

Fixes #106443
2023-01-08 19:57:54 -08:00
Michael Goulet
334426b7a8
Rollup merge of #106363 - estebank:mutability-mismatch-arg, r=Nilstrieb
Structured suggestion for `&mut dyn Iterator` when possible

Fix #37914.
2023-01-08 19:57:53 -08:00
Michael Goulet
6afd16171d
Rollup merge of #106131 - compiler-errors:not-ptrs, r=davidtwco
Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible

Fixes #80929
Fixes #67296
2023-01-08 19:57:53 -08:00
Ezra Shaw
24ce65c8d6
docs/test: add error-docs and UI test for E0711 2023-01-09 15:48:53 +13:00
Ezra Shaw
ecc0507fdd
docs/test: add empty error-docs for E0208, E0640 and E0717 2023-01-09 15:48:52 +13:00
Esteban Küber
6fdb54d2f1 Do not emit structured suggestion for turbofish with wrong span
Fix #79161.
2023-01-08 22:27:13 +00:00
Michael Goulet
59aa421f35 Suppress type errors that come from private fields 2023-01-08 20:04:40 +00:00
Michael Goulet
e77e8eb945 Don't store spans in assumed_wf_types actually 2023-01-08 19:38:17 +00:00
Michael Goulet
0bddce5090 Normalize assumed_wf_types after wfchecking is complete, for better spans 2023-01-08 18:50:09 +00:00
Michael Goulet
ca554efaf7 Improve spans of non-WF implied bound types 2023-01-08 18:50:08 +00:00
bors
fa51fc01ca Auto merge of #106235 - compiler-errors:rework-bounds-collection, r=davidtwco
Rework `Bounds` collection

I think it's weird for the `Bounds` struct in astconv to store its predicates *almost* converted into real predicates... so we do this eagerly, instead of lazily.
2023-01-08 14:40:52 +00:00
bors
e6485ed22a Auto merge of #105733 - compiler-errors:ty-ct-late-flags, r=cjgillot
Add type flags support for `Ty` and `Const` late-bound variables

I've been working on `for<T>` binders, and these will eventually be useful.
2023-01-08 11:51:41 +00:00
Yuki Okushi
789ebdca47
Rollup merge of #106581 - estebank:bad-suggestion, r=compiler-errors
Do not emit wrong E0308 suggestion for closure mismatch

Found in #76353.
2023-01-08 17:01:49 +09:00
Yuki Okushi
6459a51c3f
Rollup merge of #106580 - Ezrashaw:remove-e0313, r=compiler-errors
remove unreachable error code `E0313`

Fixes #103742
Makes #103433 redundant

Implements removal of `E0313`. I agree with the linked issue that this error code is unreachable but if someone could confirm that would be great, are crater runs done for this sort of thing?

Also removed a redundant `// ignore-tidy-filelength` that I found while reading code.

cc ``@GuillaumeGomez`` #61137
2023-01-08 17:01:49 +09:00
Yuki Okushi
3b5afa590b
Rollup merge of #106557 - Ezrashaw:ui-test-fixups-1, r=GuillaumeGomez
Add some UI tests and reword error-code docs

Added UI tests for `E0013` and `E0015`. Error code docs for `E0015` were a bit unclear (they referred to all non-const errors in const context, when only non-const functions applied), so I touched them up a bit.

I also fixed up some issues in the new `error_codes.rs` tidy check (linked #106341), that I overlooked previously.

r? ``@GuillaumeGomez``
2023-01-08 17:01:48 +09:00
Yuki Okushi
fe075319e6
Rollup merge of #106410 - clubby789:borrow-mut-self-mut-self-diag, r=compiler-errors
Suggest `mut self: &mut Self` for `?Sized` impls

Closes #106325
Closes #93078

The suggestion is _probably_ not what the user wants (hence `MaybeIncorrect`) but at least makes the problem in the above issues clearer. It might be better to add a note explaining why this is the case, but I'm not sure how best to word that so this is a start.

``@rustbot`` label +A-diagnostics
2023-01-08 17:01:46 +09:00
Michael Goulet
49f849a3d2 Mention signature rather than fn pointers when comparing impl/trait methods 2023-01-08 03:49:24 +00:00
Michael Goulet
3c41003873 Add type flags support for Ty and Const late-bound regions 2023-01-08 03:37:20 +00:00
Esteban Küber
ebbc5dafd3 Do not emit wrong E0308 suggestion for closure mismatch 2023-01-08 01:53:39 +00:00
Ezra Shaw
93c0d8d5d5
remove unreachable error code E0313 2023-01-08 14:47:12 +13:00
Ezra Shaw
ae61c250cd
doc/test: add UI test and reword docs for E0013 and E0015 2023-01-08 13:33:09 +13:00
Matthias Krüger
1e6710da59
Rollup merge of #106509 - estebank:closure-in-block, r=davidtwco
Detect closures assigned to binding in block

Fix #58497.
2023-01-07 20:43:22 +01:00
Matthias Krüger
0c8d11b97c
Rollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco
Point out span where we could introduce higher-ranked lifetime

Somewhat addresses #105422, but not really. We don't have that much useful information here since we're still in resolution :^(

Maybe this suggestion isn't worth it. If the reviewer has an idea how we can get a more succinct binder information for a structured suggestion, it would be appreciated.
2023-01-07 20:43:21 +01:00
Matthias Krüger
771cfa5581
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 3]

Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates:
1. [`rustc_middle::mir::interpret::InterpError`](b6097f2e1b/compiler/rustc_middle/src/mir/interpret/error.rs (L475)): I saw `rustc_middle` is unassigned, I am open to take this work.

2.  `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](9a31b3cdda) of this PR, but would like to know the team's preference on how we should keep replacing the other macros:
2.1. Update macros to expect a `Diagnostic`
2.2. Remove macros and expand the code on each use.
See [some examples of the different options in this experimental commit](64aee83e80)

_Part 2 - https://github.com/rust-lang/rust/pull/103792_

r? ``@davidtwco``
Cc ``@compiler-errors``
2023-01-07 20:43:19 +01:00
Matthias Krüger
405e48f1ac
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errors
Migrating rustc_infer to session diagnostics (part 3)

``@rustbot`` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717

Seems like a part of static_impl_trait.rs emits suggestions in a loop, and note.rs needs to have two instances of the same subdiagnostic, so these will need to wait until we have eager translation/list support.
Other than that, there is only error_reporting/mod.rs left to migrate.
2023-01-07 20:43:18 +01:00
bors
b1691f6413 Auto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwco
Perform SimplifyLocals before ConstProp.

MIR before `ConstProp` may have a lot of dead writes, this makes `ConstProp` do unnecessary work.

r? `@ghost`
2023-01-07 16:13:18 +00:00
bors
a2112fcb0a Auto merge of #106519 - estebank:tail-unit, r=cjgillot
Detect bindings assigned blocks without tail expressions

Fix #44173.
2023-01-07 13:24:12 +00:00
Ali MJ Al-Nasrawy
bf228ace5c don't eagerly normalize SelfCtor type
Delay until user annotations are registered.
See the added test.
2023-01-07 13:42:16 +03:00
Ali MJ Al-Nasrawy
dca15fd5b9 rename create_raw_ty -> handle_raw_ty 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
8afd3c47a8 remove unnecessary normalize call 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
c6a17bf8bc make ascribe_user_type a TypeOp
Projection types in user annotations may contain inference variables.
This makes the normalization depend on the unification with the actual
type and thus requires a separate TypeOp to track the obligations.
Otherwise simply calling `TypeChecker::normalize` would ICE with
"unexpected ambiguity"
2023-01-07 13:41:41 +03:00
Ali MJ Al-Nasrawy
37b40e471a fix method substs 2023-01-07 13:38:40 +03:00
Ali MJ Al-Nasrawy
be5a45d392 fix struct path 2023-01-07 13:38:39 +03:00
Ali MJ Al-Nasrawy
34329d6f6c introduce AstConv::probe_adt 2023-01-07 13:38:38 +03:00
Ali MJ Al-Nasrawy
d227506683 don't normalize in astconv
We delay projection normalization to further stages in order to
register user type annotations before normalization in HIR typeck.

There are two consumers of astconv: ItemCtxt and FnCtxt.
The former already expects unnormalized types from astconv, see its
AstConv trait impl.
The latter needs `RawTy` for a cleaner interface.

Unfortunately astconv still needs the normalization machinery in
order to resolve enum variants that have projections in the self type,
e.g. `<<T as Trait>::Assoc>::StructVariant {}`.
This is why `AstConv::normalize_ty_2` is necessary.
2023-01-07 13:38:38 +03:00
bors
d72b7d2d2a Auto merge of #106283 - JulianKnodt:enum_err, r=cjgillot
Add help diag. for `const = Enum` missing braces around `Enum`

Previously it was not clear why this errored or if it was even supported, as there was no diagnostic that suggested wrapping it in braces.

Thus, add a simple diagnostic that suggests wrapping enum variants in braces.

Fixes #105927
2023-01-07 10:04:39 +00:00
Michael Goulet
01cb9dcd5b
Rollup merge of #106554 - LingMan:explanation_typo, r=compiler-errors
Fix a typo in the explanation of E0588
2023-01-06 21:54:01 -08:00
Michael Goulet
eeb76eb593
Rollup merge of #106533 - TaKO8Ki:use-smaller-span-for-missing-lifetime/generic-args, r=compiler-errors
Use smaller spans for missing lifetime/generic args

We can remove ident from suggestions.
2023-01-06 21:54:00 -08:00
Michael Goulet
258257a029
Rollup merge of #106525 - compiler-errors:new-solver-wf, r=jackh726
Report WF error for chalk *and* new solver

addressing this nit https://github.com/rust-lang/rust/pull/106385#discussion_r1062571070

No test yet because new solver is currently unusable, lol

r? `@lcnr`
2023-01-06 21:53:59 -08:00
LingMan
dc0e4207d4 Fix a typo in the explanation of E0588 2023-01-07 05:10:53 +01:00
yukang
6082729646 use type_implements_trait to check Param clone 2023-01-07 09:20:05 +08:00
bors
84f22e44c5 Auto merge of #106544 - matthiaskrgr:rollup-e9prjed, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106287 (Add some docs to `bug`, `span_bug` and `delay_span_bug`)
 - #106341 (refactor: clean up `errors.rs` and `error_codes_check.rs`)
 - #106453 (Improve include macro documentation)
 - #106466 (Fix rustdoc source code rendering for `#[path = "../path/to/mod.rs"]` links)
 - #106528 (Tiny formatting fix)
 - #106534 (rustdoc-gui: Use new block syntax for define-function in goml scripts)
 - #106542 (Add default and latest stable edition to --edition in rustc (attempt 2))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-07 00:53:19 +00:00
wcampbell
d0cf7e3bf5 Use fmt named parameters in rustc_borrowck 2023-01-06 19:34:45 -05:00
Esteban Küber
b693365b84 fix rebase 2023-01-06 21:08:56 +00:00
Esteban Küber
2631a5df61 Turn IllegalSizedBound into struct variant 2023-01-06 21:03:26 +00:00
Esteban Küber
670a6f1ef5 Change wording to avoid being misleading 2023-01-06 21:03:26 +00:00
Esteban Küber
1eb828ecb1 Structured suggestion for &mut dyn Iterator when possible
Fix #37914.
2023-01-06 21:03:26 +00:00
yukang
ce4afed2ef comments feedback 2023-01-07 05:00:49 +08:00
Yukang
1a0a6132a8 Apply suggestions from code review
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2023-01-07 04:44:04 +08:00
yukang
e7a777805a Suggest possible clone when we have &T 2023-01-07 04:43:57 +08:00
Matthias Krüger
a1b3393f5f
Rollup merge of #106542 - sigaloid:master, r=bjorn3
Add default and latest stable edition to --edition in rustc (attempt 2)

Fixes #106041

No longer leaks string like my first attempt PR, #106094 - uses LazyLock to construct a `&'static str`

It will now output the default edition and latest stable edition in the help message for the `--edition` flag.

Going to request the same reviewer as the first attempt for continuity - r? `@Nilstrieb`
2023-01-06 21:26:12 +01:00
Matthias Krüger
9a090edf2e
Rollup merge of #106528 - estebank:quick-fix, r=TaKO8Ki
Tiny formatting fix
2023-01-06 21:26:11 +01:00
Matthias Krüger
498216e9db
Rollup merge of #106341 - Ezrashaw:refactor-error-code-tidy-check, r=mejrs,klensy,GuillaumeGomez
refactor: clean up `errors.rs` and `error_codes_check.rs`

`errors.rs` is basically unused now, `error_codes_check.rs` is useful but not well commented, etc. It also doesn't check certain things which are certainly not correct. For example, `E0505` has a UI test in `src/test/ui/error-codes/` but that test actually outputs `E0504`?! Other issues like these exist. I've implemented these with "warnings" which are a bit rough around the edges but should be removed eventually.

r? `@GuillaumeGomez` (again not sure if you want to review but its relevant to you)
2023-01-06 21:26:10 +01:00
Matthias Krüger
7568c49bf0
Rollup merge of #106287 - Nilstrieb:its-bugging-me-how-we-dont-have-docs, r=jyn514
Add some docs to `bug`, `span_bug` and `delay_span_bug`

cc `@mejrs` as you wanted me to do this, does this look good and understandable?
2023-01-06 21:26:09 +01:00
Matthew E
893938f64f
Update compiler/rustc_session/src/config.rs
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2023-01-06 14:36:52 -05:00
Matthew Esposito
5cda0a2f39 Add default and latest stable edition to --edition in rustc 2023-01-06 14:07:12 -05:00
bors
0fb8b72ce4 Auto merge of #106501 - cjgillot:resolved-elided-apit, r=compiler-errors
Correct detection of elided lifetimes in impl-trait.

Fixes https://github.com/rust-lang/rust/issues/106338

r? `@compiler-errors`
cc `@pnkfelix`
2023-01-06 18:15:56 +00:00
Paul Kirth
c5bde0699f Enable Shadow Call Stack for Fuchsia on AArch64
Fuchsia already uses SCS by default for C/C++ code on ARM hardware.
This patch allows SCS to be used for Rust code as well.
2023-01-06 17:42:20 +00:00
bors
afe8c4537c Auto merge of #106474 - erikdesjardins:noalias, r=bjorn3
cleanup: handle -Zmutable-noalias like -Zbox-noalias

r? `@bjorn3`

cc `@RalfJung` this will conflict with #106180
2023-01-06 15:20:58 +00:00
Takayuki Maeda
804dea9ca6 use smaller spans for missing lifetime/generic args
fix rustdoc ui test
2023-01-06 21:55:23 +09:00
bors
7bbbaabbb6 Auto merge of #105805 - yanchen4791:issue-105227-fix, r=estebank
Suggest adding named lifetime when the return contains value borrowed from more than one lifetimes of function inputs

fix for #105227.

The problem: The suggestion of adding an explicit `'_` lifetime bound is **incorrect** when the function's return type contains a value which could be borrowed from more than one lifetimes of the function's inputs. Instead, a named lifetime parameter can be introduced in such a case.

The solution: Checking the number of elided lifetimes in the function signature. If more than one lifetimes found in the function inputs when the suggestion of adding explicit `'_` lifetime, change it to using named lifetime parameter `'a` instead.
2023-01-06 12:08:49 +00:00
bors
1146560e1a Auto merge of #106529 - Dylan-DPC:rollup-mvncmrk, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #106400 (Point at expressions where inference refines an unexpected type)
 - #106491 (Fix error-index redirect to work with the back button.)
 - #106494 (Add regression test for #58355)
 - #106499 (fix [type error] for error E0029 and E0277)
 - #106502 (rustdoc: remove legacy user-select CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-06 09:17:14 +00:00
Dylan DPC
a8f7ec2c48
Rollup merge of #106499 - lyming2007:issue-105946-fix, r=estebank
fix [type error] for error E0029 and E0277

check explicitly for the type references error
if ty.references_error() is true change the error to be err.delay_as_bug() and prevent the error E0029 and E0277 from emitting out this fix #105946
2023-01-06 11:38:57 +05:30
Dylan DPC
6ae0f08c19
Rollup merge of #106400 - estebank:type-errs, r=compiler-errors
Point at expressions where inference refines an unexpected type

Fix #106355. Fix #14007. (!)

```
error[E0308]: mismatched types
  --> src/test/ui/type/type-check/point-at-inference.rs:12:9
   |
9  |         foo.push(i);
   |                  - this is of type `&{integer}`, which makes `foo` to be inferred as `Vec<&{integer}>`
...
12 |     bar(foo);
   |     --- ^^^ expected `i32`, found `&{integer}`
   |     |
   |     arguments to this function are incorrect
   |
   = note: expected struct `Vec<i32>`
              found struct `Vec<&{integer}>`
note: function defined here
  --> src/test/ui/type/type-check/point-at-inference.rs:2:4
   |
2  | fn bar(_: Vec<i32>) {}
   |    ^^^ -----------
help: consider dereferencing the borrow
   |
9  |         foo.push(*i);
   |                  +
```
2023-01-06 11:38:56 +05:30
bors
ce8fbe7901 Auto merge of #106429 - djkoloski:add_vendor_to_fuchsia_target_triple, r=nagisa
Add vendor to Fuchsia's target triple

Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia and aarch64-fuchsia. However, they should technically contain vendor information. This CL changes Fuchsia's target triples to include the "unknown" vendor since Clang now does normalization and handles all triple spellings.

This was previously attempted in #90510, which was closed due to inactivity.
2023-01-06 06:05:40 +00:00
Esteban Küber
0edca66a90 Tiny formatting fix 2023-01-06 05:34:56 +00:00
Yiming Lei
10dbcf0630 fix [type error] for error E0029 and E0277
check explicitly for the type references error
if ty.references_error() is true change the error to be err.delay_as_bug()
and prevent the error E0029 and E0277 from emitting out
this fix #105946
2023-01-05 21:21:13 -08:00
yanchen4791
523fe7a121 Suggests adding named lifetime when the return contains value borrowed from more than one lifetimes of the function's inputs 2023-01-05 21:09:27 -08:00
Esteban Küber
031e085450 Tweak output 2023-01-06 04:37:29 +00:00
Michael Goulet
a9d093bd6b Report WF error for new solver too 2023-01-06 04:09:44 +00:00
bors
0853d9677c Auto merge of #105890 - Nilstrieb:inline-fmt-part-1, r=jackh726
Fix `uninlined_format_args` in compiler crates with the diagnostic migration completed

Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).

Some of them have been reviewed by myself and they were all correct (though I still recommend going over all of them again for review).
2023-01-06 02:58:40 +00:00
Esteban Küber
1fa6ada9dd Detect bindings assigned blocks without tail expressions in trait errors
Address  #44173 for trait errors.
2023-01-06 02:43:16 +00:00
Esteban Küber
1983a627b3 Detect bindings assigned blocks without tail expressions
Address  #44173 for type check errors.
2023-01-06 00:45:10 +00:00
Esteban Küber
ce6b7179af Detect closures assigned to binding in block
Fix #58497.
2023-01-05 21:29:36 +00:00
Nilstrieb
5112f0281d Shrink ParseResult in the hot path.
A recent PR increased the size, which caused regressions. This uses the
existing generic infrastructure to differentiate between the hot path
and the diagnostics path.
2023-01-05 20:42:26 +01:00
nils
fd7a159710 Fix uninlined_format_args for some compiler crates
Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
2023-01-05 19:01:12 +01:00
Camille GILLOT
de1859fc32 Correct detection of elided lifetimes in impl-trait. 2023-01-05 18:00:45 +00:00
Esteban Küber
f98f2fcb5e fix rebase 2023-01-05 17:09:41 +00:00
clubby789
23c3a30730 Explain error with &mut self for unsized trait impls 2023-01-05 16:51:30 +00:00
Esteban Küber
b182259d39 review comments: reword 2023-01-05 16:51:17 +00:00
Esteban Küber
98f3936aa7 review comment: potentially produce more suggestions for arg type mismatch 2023-01-05 16:51:17 +00:00
Esteban Küber
c905f5e1b0 Account for type error on method arg caused by earlier inference
```rust
fn main() {
    let v = Vec::new();
    v.push(0);
    v.push(0);
    v.push("");
}
```

now produces

```
error[E0308]: mismatched types
  --> $DIR/point-at-inference-3.rs:6:12
   |
LL |     v.push(0);
   |            - this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>`
...
LL |     v.push("");
   |       ---- ^^ expected integer, found `&str`
   |       |
   |       arguments to this function are incorrect
   |
note: associated function defined here
  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
```
2023-01-05 16:51:17 +00:00
Esteban Küber
ad82eedfa1 Use BottomUpFolder 2023-01-05 16:51:16 +00:00
Esteban Küber
4ac7d1c3ab Formatting 2023-01-05 16:51:16 +00:00
Esteban Küber
9cc8d86190 Tweak output
- Only point at a the single expression where the found type was first
  inferred.
- Find method call argument that might have caused the found type to be
  inferred.
- Provide structured suggestion.
- Apply some review comments.
- Tweak wording.
2023-01-05 16:51:16 +00:00
Esteban Küber
6b0cce4b50 review comments: do not always point at init expr 2023-01-05 16:51:16 +00:00
Esteban Küber
48094a4a6f More eagerly resolve expr tys before writing them
This allows the expressions to have more accurate types
when showing inference steps.
2023-01-05 16:51:16 +00:00
Esteban Küber
05c30b0ca5 Skip macros to avoid talking about bindings the user can't see 2023-01-05 16:51:16 +00:00
Esteban Küber
ea43eb3721 Point at expressions where inference refines an unexpected type
Address #106355.
2023-01-05 16:51:16 +00:00
David Koloski
f6ef039775 Add vendor to Fuchsia's target triple
Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia
and aarch64-fuchsia. However, they should technically contain vendor
information. This CL changes Fuchsia's target triples to include the
"unknown" vendor since Clang now does normalization and handles all
triple spellings.

This was previously attempted in #90510, which was closed due to
inactivity.
2023-01-05 09:34:22 -05:00
bors
e94fab69d0 Auto merge of #106404 - tmiasko:dedup-box-derefs, r=wesleywiser
Remove duplicated elaborate box derefs pass

The pass runs earlier as a part of `run_runtime_lowering_passes`.

The duplicate was added in #99102.
2023-01-05 09:50:05 +00:00
bors
1429899700 Auto merge of #106482 - compiler-errors:rollup-g7n1p39, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #105846 (Account for return-position `impl Trait` in trait in `opt_suggest_box_span`)
 - #106385 (Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag)
 - #106403 (Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`)
 - #106462 (rustdoc: remove unnecessary wrapper around sidebar and mobile logos)
 - #106464 (Update Fuchsia walkthrough with new configs)
 - #106478 (Tweak wording of fn call with wrong number of args)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-05 06:47:02 +00:00
Michael Goulet
e048ee2ac1
Rollup merge of #106478 - estebank:tweak-fn-mismatch, r=compiler-errors
Tweak wording of fn call with wrong number of args
2023-01-04 20:36:29 -08:00
Michael Goulet
5ce6311f34
Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillot
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`

The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`.

Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
2023-01-04 20:36:28 -08:00
Michael Goulet
13bb8a8b15
Rollup merge of #106385 - compiler-errors:new-solver-flag, r=jackh726
Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag

We'll eventually need a way to select more than chalk + not-chalk.

Does this need an MCP since it's touching a `-Z` flag? Or perhaps I should preserve `-Zchalk` for the time being... maybe I could make it a warning to use that flag? cc ``@rust-lang/types``

r? types
2023-01-04 20:36:27 -08:00
Michael Goulet
f9ccbf084f
Rollup merge of #105846 - compiler-errors:issue-105838, r=jackh726
Account for return-position `impl Trait` in trait in `opt_suggest_box_span`

RPITITs are the only types where their opaque bounds might normalize to some other self type than the opaque type itself. To avoid needing to do normalization, let's just match on either alias kind.

Ideally, we'd just get rid of `opt_suggest_box_span`. It's kind of a wart on type-checking `if`/`match`. I've recently refactored this expression for being confusing/wrong, but moving it into the error path is pretty hard.

Fixes #105838
2023-01-04 20:36:27 -08:00
bors
03b9e1d154 Auto merge of #105409 - compiler-errors:closure-infer-cycle, r=jackh726
Don't deduce a signature that makes a closure cyclic

Sometimes when elaborating supertrait bounds for closure signature inference, we end up deducing a closure signature that is cyclical because either a parameter or the return type references a projection mentioning `Self` that also has escaping bound vars, which means that it's not eagerly replaced with an inference variable.

Interestingly, this is not *just* related to my PR that elaborates supertrait bounds for closure signature deduction. The committed test `supertrait-hint-cycle-3.rs` shows **stable** code that is fixed by this PR:

```rust
trait Foo<'a> {
    type Input;
}

impl<F: Fn(u32)> Foo<'_> for F {
    type Input = u32;
}

fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {}

fn main() {
    needs_super(|_: u32| {});
}
```

Fixes #105401
Fixes #105396

r? types
2023-01-05 03:59:31 +00:00
Esteban Küber
5393c6bbd1 Tweak wording of fn call with wrong number of args 2023-01-05 03:02:10 +00:00
bors
d26242d35f Auto merge of #106472 - matthiaskrgr:rollup-4w4v50e, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106391 (rustdoc: allow popover child links to work)
 - #106398 (Fix a few clippy lints in libtest)
 - #106412 (Fix link generation for local primitive types in rustdoc JSON output)
 - #106437 (rustdoc: fix buggy JS check for absolute URL)
 - #106451 (Merge borrowck permission checks)
 - #106460 (Move tests)
 - #106461 (docs: fix broken link "search bar")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-05 01:06:05 +00:00