Giacomo Pasini
ac4426c093
Merge borrowck permission checks
...
Merge `check_access_permission` and
`check_if_reassignment_to_immutable_state`.
The goal of this commit is twofold:
First, we simplify the codebase by removing duplicate logic.
Second, we avoid duplicate reporting of illegal reassignment
errors by reusing the exiting de-duplicating logic of
access_place.
2023-01-04 15:25:45 +01: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
Esteban Küber
545406528a
Verbose suggestions
2023-01-01 21:33:23 -08:00
Esteban Küber
5bfcfeee2a
Merge multiple mutable borrows of immutable binding errors
...
Fix #53466 .
2023-01-01 10:09:26 -08:00
bors
96c1f338bb
Auto merge of #106245 - estebank:mutability-suggestions, r=jyn514
...
Use verbose suggestions for mutability errors
2022-12-31 08:43:24 +00:00
Esteban Küber
b9439ebf12
Use verbose suggestions for mutability errors
2022-12-28 22:06:25 -08: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
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
Esteban Küber
8a13a7c148
review comments
2022-12-26 13:35:35 -08:00
Esteban Küber
bd890f9cd1
Remove redundant clone suggestion
2022-12-25 17:16:54 -08:00
Esteban Küber
2d6a2ff76e
Create new inference context
2022-12-25 16:51:11 -08:00
Matthias Krüger
d8874f259a
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
2022-12-25 17:32:26 +01:00
Esteban Küber
ea7de0d485
Do not use hir_ty_to_ty
2022-12-23 16:45:16 -08:00
Matthias Krüger
d23cb738d2
Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
...
rustc: Remove needless lifetimes
2022-12-24 00:31:41 +01:00
Esteban Küber
12fd9011b8
Verify receiver is of self: Pin<&mut Self>
2022-12-23 15:13:04 -08:00
Esteban Küber
a929316aed
Suggest .clone()
on method call move errors
2022-12-23 12:49:20 -08:00
Esteban Küber
c79db9c5e5
Suggest Pin::as_mut
when encountering borrow error
2022-12-23 09:59:39 -08:00
Jeremy Stucki
3dde32ca97
rustc: Remove needless lifetimes
2022-12-20 22:10:40 +01:00
Oli Scherer
c9588d5bf8
Hackily fix an opaque type ICE
2022-12-20 13:43:41 +00:00
Oli Scherer
e405dabf7d
Some style nits
2022-12-20 13:43:11 +00:00
Oli Scherer
8b1530260c
Replace a find
with a loop to simplify the logic.
2022-12-20 13:42:41 +00:00
Oli Scherer
562d846ff0
Make it easier to debug where a region error was created
2022-12-20 13:42:07 +00:00
Oli Scherer
8b5a96ec45
Some tracing cleanups
2022-12-20 13:39:48 +00:00
bors
eb9e5e711d
Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obk
...
Improve syntax of `newtype_index`
This makes it more like proper Rust and also makes the implementation a lot simpler.
Mostly just turns weird flags in the body into proper attributes.
It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
2022-12-20 07:27:01 +00:00
Dylan DPC
a9005b6cc0
Rollup merge of #105864 - matthiaskrgr:compl, r=Nilstrieb
...
clippy::complexity fixes
filter_next
needless_question_mark
bind_instead_of_map
manual_find
derivable_impls
map_identity
redundant_slicing
skip_while_next
unnecessary_unwrap
needless_bool
r? `@compiler-errors`
2022-12-19 14:41:35 +05:30
Matthias Krüger
1da4a49912
clippy::complexity fixes
...
filter_next
needless_question_mark
bind_instead_of_map
manual_find
derivable_impls
map_identity
redundant_slicing
skip_while_next
unnecessary_unwrap
needless_bool
2022-12-19 00:04:28 +01:00
Matthias Krüger
ebe3563764
Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=Nilstrieb
...
use &str / String literals instead of format!()
2022-12-18 23:03:07 +01:00
Matthias Krüger
221e71e7a1
Rollup merge of #105869 - matthiaskrgr:clone_on_copy, r=compiler-errors
...
don't clone Copy types
2022-12-18 23:03:07 +01:00
Nilstrieb
8bfd6450c7
A few small cleanups for newtype_index
...
Remove the `..` from the body, only a few invocations used it and it's
inconsistent with rust syntax.
Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18 21:47:28 +01:00
Nilstrieb
d679764fb6
Make #[debug_format]
an attribute in newtype_index
...
This removes the `custom` format functionality as its only user was
trivially migrated to using a normal format.
If a new use case for a custom formatting impl pops up, you can add it
back.
2022-12-18 21:37:38 +01:00
Matthias Krüger
3af7df91fc
use &str / String literals instead of format!()
2022-12-18 16:17:46 +01:00
Matthias Krüger
6e52a0f421
remove redundant fn params that were only "used" in recursion
2022-12-18 14:27:07 +01:00
Matthias Krüger
fec9e9ecf1
don't clone Copy types
2022-12-18 14:25:55 +01:00
bors
a8847df167
Auto merge of #105657 - oli-obk:mk_projection_ty, r=lcnr
...
Guard ProjectionTy creation against passing the wrong number of substs
r? `@lcnr`
2022-12-15 04:21:25 +00:00
bors
939a3ddf94
Auto merge of #104765 - chenyukang:yukang-fix-104639-lifetime-check, r=oli-obk
...
Find the right lower bound region in the scenario of partial order relations
Fixes #104639
2022-12-15 01:28:16 +00:00
Oli Scherer
a5cd3bde95
Ensure no one constructs AliasTy
s themselves
2022-12-14 15:36:39 +00:00
bors
918d0ac38e
Auto merge of #104986 - compiler-errors:opaques, r=oli-obk
...
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias`
Implements https://github.com/rust-lang/types-team/issues/79 .
This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so:
```
enum AliasKind {
Projection,
Opaque,
}
struct AliasTy<'tcx> {
def_id: DefId,
substs: SubstsRef<'tcx>,
}
```
Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example:
```diff
match ty.kind() {
- ty::Opaque(..) =>
+ ty::Alias(ty::Opaque, ..) => {}
_ => {}
}
```
This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically.
r? `@ghost`
2022-12-14 01:19:24 +00:00
Matthias Krüger
15b9e20640
Rollup merge of #105500 - oli-obk:unhide_unknown_spans, r=estebank
...
Make some diagnostics not depend on the source of what they reference being available
r? `@estebank`
follow up to https://github.com/rust-lang/rust/pull/104449
2022-12-13 19:57:11 +01:00
Esteban Küber
cf0b6b9337
Account for dereference expressions
2022-12-13 10:06:15 -08:00
Esteban Küber
b8bd1d0826
Fix span for &mut
removal suggestion
2022-12-13 10:06:14 -08:00
Esteban Küber
dd72b1a0df
Suggest ref
for some patterns as a fallback
2022-12-13 10:06:14 -08:00
Esteban Küber
e46416eed6
Change pattern borrowing suggestions to be verbose
...
Synthesize a more accurate span and use verbose suggestion output to
make the message clearer.
2022-12-13 10:06:13 -08:00
Michael Goulet
61adaf8187
Combine projection and opaque into alias
2022-12-13 17:48:55 +00:00
Michael Goulet
c13bd83528
squash OpaqueTy and ProjectionTy into AliasTy
2022-12-13 17:40:27 +00:00
Michael Goulet
7f3af72606
Use ty::OpaqueTy everywhere
2022-12-13 17:29:26 +00:00
Oli Scherer
6984085088
Stop pointing to operators if their libcore method source is not available
2022-12-13 10:06:11 +00:00
Oli Scherer
063b1675b2
Clarify what "this" means
2022-12-13 09:51:03 +00:00
Takayuki Maeda
ee40a67cd9
remove unnecessary uses of clone
2022-12-13 02:06:24 +09:00
Jakob Degen
9fb8da8f8f
Remove unneeded field from SwitchTargets
2022-12-09 04:53:10 -08:00