about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/diagnostics
AgeCommit message (Collapse)AuthorLines
2023-01-12Provide help on closures capturing self causing borrow checker errorsyukang-5/+147
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-1/+1
2023-01-09Rollup merge of #106549 - wcampbell0x2a:use-fmt-named-parameters-borrowck, ↵fee1-dead-91/+62
r=estebank Use fmt named parameters in rustc_borrowck
2023-01-08Rollup merge of #106410 - clubby789:borrow-mut-self-mut-self-diag, ↵Yuki Okushi-11/+16
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-07Rollup merge of #106509 - estebank:closure-in-block, r=davidtwcoMatthias Krüger-7/+38
Detect closures assigned to binding in block Fix #58497.
2023-01-06Use fmt named parameters in rustc_borrowckwcampbell-91/+62
2023-01-05Suggests adding named lifetime when the return contains value borrowed from ↵yanchen4791-2/+11
more than one lifetimes of the function's inputs
2023-01-05Detect closures assigned to binding in blockEsteban Küber-7/+38
Fix #58497.
2023-01-05Explain error with `&mut self` for unsized trait implsclubby789-11/+16
2023-01-04Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillotMichael Goulet-2/+2
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-04Address commentsMichael Goulet-67/+8
2023-01-04Simplify some iterator combinatorsMichael Goulet-42/+31
2023-01-04rename get_parent_node to parent_idMichael Goulet-2/+2
2023-01-01Verbose suggestionsEsteban Küber-3/+3
2023-01-01Merge multiple mutable borrows of immutable binding errorsEsteban Küber-21/+69
Fix #53466.
2022-12-31Auto merge of #106245 - estebank:mutability-suggestions, r=jyn514bors-21/+12
Use verbose suggestions for mutability errors
2022-12-28Use verbose suggestions for mutability errorsEsteban Küber-21/+12
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-7/+4
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-27Auto merge of #106095 - estebank:pin-mut-reborrow, r=compiler-errorsbors-10/+59
Suggest `Pin::as_mut` when encountering borrow error Fix #65409 for `Pin<&mut T>`.
2022-12-26review commentsEsteban Küber-7/+5
2022-12-25Remove redundant clone suggestionEsteban Küber-1/+13
2022-12-25Create new inference contextEsteban Küber-29/+33
2022-12-23Do not use `hir_ty_to_ty`Esteban Küber-15/+10
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-1/+1
rustc: Remove needless lifetimes
2022-12-23Verify receiver is of `self: Pin<&mut Self>`Esteban Küber-2/+6
2022-12-23Suggest `.clone()` on method call move errorsEsteban Küber-9/+34
2022-12-23Suggest `Pin::as_mut` when encountering borrow errorEsteban Küber-0/+11
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-1/+1
2022-12-20Hackily fix an opaque type ICEOli Scherer-4/+6
2022-12-20Make it easier to debug where a region error was createdOli Scherer-2/+18
2022-12-18use &str / String literals instead of format!()Matthias Krüger-3/+3
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-2/+2
2022-12-14Auto merge of #104986 - compiler-errors:opaques, r=oli-obkbors-3/+3
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-13Rollup merge of #105500 - oli-obk:unhide_unknown_spans, r=estebankMatthias Krüger-8/+16
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-13Account for dereference expressionsEsteban Küber-7/+22
2022-12-13Fix span for `&mut ` removal suggestionEsteban Küber-0/+1
2022-12-13Suggest `ref` for some patterns as a fallbackEsteban Küber-10/+16
2022-12-13Change pattern borrowing suggestions to be verboseEsteban Küber-29/+35
Synthesize a more accurate span and use verbose suggestion output to make the message clearer.
2022-12-13Combine projection and opaque into aliasMichael Goulet-2/+2
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-2/+2
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-3/+3
2022-12-13Stop pointing to operators if their libcore method source is not availableOli Scherer-6/+1
2022-12-13Clarify what "this" meansOli Scherer-2/+15
2022-12-13remove unnecessary uses of `clone`Takayuki Maeda-1/+1
2022-12-06`rustc_borrowck`: remove `ref` patternsMaybe Waffle-58/+50
2022-11-30Auto merge of #104905 - compiler-errors:normalization-changes, r=spastorinobors-4/+4
Some initial normalization method changes 1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`) 2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`) 3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize` 4. Remove some unused other normalization fns in `Inherited` and `FnCtxt` Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic. Stacked on top of #104835 for convenience. r? types
2022-11-29Rollup merge of #104951 - Swatinem:async-kind, r=compiler-errorsMatthias Krüger-6/+1
Simplify checking for `GeneratorKind::Async` Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Simplify checking for `GeneratorKind::Async`Arpad Borsos-6/+1
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Make ObligationCtxt::normalize take cause by borrowMichael Goulet-1/+1
2022-11-28partially_normalize_... -> At::normalizeMichael Goulet-3/+3