Commit Graph

1246 Commits

Author SHA1 Message Date
Michael Goulet
8e27211dbc is_ty_infer -> is_ty_or_numeric_infer 2023-01-12 23:57:41 +00:00
nils
c61f29ca52
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137
2023-01-12 15:44:52 +01:00
bors
606c390725 Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - #103800 (Stabilize `::{core,std}::pin::pin!`)
 - #106097 (Migrate mir_build diagnostics 2 of 3)
 - #106170 (Move autoderef to `rustc_hir_analysis`)
 - #106323 (Stabilize f16c_target_feature)
 - #106360 (Tweak E0277 `&`-removal suggestions)
 - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 10:46:19 +00:00
Ezra Shaw
02005e9f22
remove unreachable error code E0490 2023-01-12 14:15:21 +13:00
yanchen4791
621d412241
Fix invalid syntax in impl Trait parameter type suggestions for E0311 2023-01-11 14:49:55 -08:00
Michael Goulet
c8334ce60c Move autoderef to rustc_hir_analysis 2023-01-11 20:12:57 +00:00
Albert Larsan
40ba0e84d5
Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
Yuki Okushi
e5e116dca9
Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk
No need to take opaques in `check_type_bounds`

`InferCtxt` already has its defining use anchor set to err

r? ``@oli-obk``
2023-01-10 08:05:34 +09:00
Michael Goulet
f769d34291 Assert defining anchor is set in take_opaque_types 2023-01-09 18:14:28 +00:00
fee1-dead
f8319bb403
Rollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnr
Simplify some canonical type alias names

* delete the `Canonicalized<'tcx>` type alias in favor for `Canonical<'tcx>`
* `CanonicalizedQueryResponse` -> `CanonicalQueryResponse`

I don't particularly care about the latter, but it should be consistent. We could alternatively delete the first alias and rename the struct to `Canonicalized`, and then keep the name of `CanonicalizedQueryResponse` untouched.
2023-01-09 23:35:30 +08:00
fee1-dead
7779386a3a
Rollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk
Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`

Makes sense for this function to live with its sibling `resolve_regions_and_report_errors`, around which it's basically just a wrapper.
2023-01-09 23:35:29 +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
Michael Goulet
49f849a3d2 Mention signature rather than fn pointers when comparing impl/trait methods 2023-01-08 03:49:24 +00:00
Ezra Shaw
93c0d8d5d5
remove unreachable error code E0313 2023-01-08 14:47:12 +13: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
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
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
ad82eedfa1 Use BottomUpFolder 2023-01-05 16:51:16 +00: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
2baee88bdb Address comments 2023-01-04 00:51:50 +00:00
Michael Goulet
7690fe3bc6 Simplify some iterator combinators 2023-01-04 00:48:07 +00:00
Michael Goulet
b1b19bd851 get_parent and find_parent 2023-01-04 00:43:13 +00:00
Michael Goulet
a313ef05a7 rename get_parent_node to parent_id 2023-01-04 00:43:13 +00:00
Michael Goulet
c104ee9f6d Move check_region_obligations_and_report_errors to TypeErrCtxt 2023-01-03 23:58:12 +00:00
Michael Goulet
50ab306015 Simplify some canonical type alias names 2023-01-03 01:16:10 +00: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
Michael Goulet
6e794dcc8b Address review comments 2022-12-28 18:41:22 +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
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
Nikita Tomashevich
0c50e1f146
eager is the default now 2022-12-28 15:24:18 +03:00
Nikita Tomashevich
2a8b17dbc5
Fix formatting 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
dda3ebad0a
Fix broken rebase 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
a86173766c
Fix nits 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
62f9962eaf
Made ty_or_sig and trait_path use their actual types instead of String 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
7ecd064bbe
Split infer_explicit_lifetime_required into several diags 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
19b8579803
Address changes of pr 103345 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
40b221814e
Rename subdiagnostic fields that do not need to be unique now 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
eb7ce1703b
Use eager translation 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
71d24da665
Split into several messages 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
6c19c08140
More descriptive names for ActualImplExplNotes variants 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
57fdd196ae
Rebase and fix 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
0634b0119c
Partial work on static_impl_trait.rs 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
3935a81d47
Migrate trait_impl_difference.rs 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
2118ff401f
Migrate placeholder_error.rs 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
8360a40a8a
Migrate named_anon_conflict.rs 2022-12-28 14:53:47 +03: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
Michael Goulet
605ad65f6a Remove some totally duplicated files 2022-12-28 05:45:12 +00:00
Michael Goulet
c7b414adb6 Rename module compare_method -> compare_impl_item 2022-12-28 04:18:37 +00: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