about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/diagnostics
AgeCommit message (Collapse)AuthorLines
2022-09-01do not suggest adding `move` to closure when `move` is already usedTakayuki Maeda-3/+11
2022-08-29Rollup merge of #101146 - jackh726:borrowck-logging, r=compiler-errorsMatthias Krüger-33/+9
Various changes to logging of borrowck-related code Cleanups found when doing other changes r? `@compiler-errors`
2022-08-29Various changes to logging of borrowck-related codeJack Huey-33/+9
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-4/+4
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-28Rollup merge of #101002 - estebank:hashmap-idx, r=davidtwcoMatthias Krüger-3/+113
Provide structured suggestion for `hashmap[idx] = val`
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-4/+4
2022-08-26diag-migAndyJado-52/+41
2022-08-25Provide structured suggestion for `hashmap[idx] = val`Esteban Küber-3/+113
2022-08-24Rollup merge of #100940 - ↵Matthias Krüger-0/+3
TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead Do not suggest adding a bound to a opaque type fixes #100442
2022-08-24Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwcoMatthias Krüger-2/+17
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing The error can be quite confusing to newcomers. Fixes #100873. I'm not so sure about the message, open to wording suggestions.
2022-08-24do not suggest adding a bound to a opaque typeTakayuki Maeda-1/+5
2022-08-23Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexingChayim Refael Friedman-2/+17
The error can be quite confusing to newcomers.
2022-08-22make some methods privateTakayuki Maeda-1/+2
2022-08-20Rollup merge of #100186 - compiler-errors:or-as_mut, r=fee1-deadMatthias Krüger-8/+6
Mention `as_mut` alongside `as_ref` in borrowck error message Kinda fixes #99426 but I guess that really might be better staying open to see if we could make it suggest `as_mut` in a structured way. Not sure how to change borrowck to know that info tho.
2022-08-16Make as_ref suggestion a noteMichael Goulet-8/+6
2022-08-15Fix #95079 by adding help and suggestion for missing move in nested closureYan Chen-0/+37
2022-08-14Suggest as_ref or as_mutMichael Goulet-1/+1
2022-08-14TypeError can be CopyMichael Goulet-3/+1
2022-08-10Use &mut Diagnostic instead of &mut DiagnosticBuilder unless neededMichael Goulet-8/+3
2022-08-04Rollup merge of #100095 - jackh726:early-binder, r=lcnrMatthias Krüger-16/+16
More EarlyBinder cleanups Each commit is independent r? types
2022-08-04Rollup merge of #100093 - wcampbell0x2a:unused-parens-for-match-arms, ↵Matthias Krüger-1/+1
r=petrochenkov Enable unused_parens for match arms Fixes: https://github.com/rust-lang/rust/issues/92751 Currently I can't get the `stderr` to work with `./x.py test`, but this should fix the issue. Help would be appreciated!
2022-08-04Enable unused_parens for match armswcampbell-1/+1
2022-08-03fix trailing whitespace in error messageklensy-1/+1
2022-08-02Add bound_predicates_of and bound_explicit_predicates_ofJack Huey-16/+16
2022-07-31Improve `cannot move out of` error messageObei Sideg-32/+100
2022-07-31Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillotDylan DPC-32/+27
Use LocalDefId for closures more
2022-07-30Use LocalDefId for closures moreCameron Steffen-32/+27
2022-07-29Change enclosing_body_owner to return LocalDefIdMiguel Guarniz-2/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29Change maybe_body_owned_by to take local def idMiguel Guarniz-2/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-26Replace LifetimeRes::Anonymous by LifetimeRes::Infer.Camille GILLOT-1/+1
2022-07-26Remove the distinction between LifetimeName::Implicit and ↵Camille GILLOT-1/+0
LifetimeName::Underscore.
2022-07-26Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-deadDylan DPC-1/+5
Use full type name instead of just saying `impl Trait` in "captures lifetime" error I think this is very useful, especially when there's >1 `impl Trait`, and it just means passing around a bit more info that we already have access to.
2022-07-26Use real opaque type instead of just saying impl TraitMichael Goulet-1/+5
2022-07-25avoid `&str`/`Symbol` to `String` conversionsTakayuki Maeda-5/+3
2022-07-20Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisabors-1/+1
Remove the unused StableSet and StableMap types from rustc_data_structures. The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp. I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-1/+1
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-6/+1
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-16Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, ↵Matthias Krüger-20/+15
r=compiler-errors Avoid some `Symbol` to `String` conversions This patch removes some Symbol to String conversions.
2022-07-16Rollup merge of #99258 - estebank:suggest-let, r=wesleywiserMatthias Krüger-2/+65
Provide structured suggestion for dropped temp value
2022-07-16Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebankMatthias Krüger-1/+6
Allow destructuring opaque types in their defining scopes fixes #96572 Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck. ```rust type T = impl Copy; let foo: T = (1u32, 2u32); let (a, b) = foo; ``` The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.
2022-07-17avoid some `Symbol` to `String` conversionsTakayuki Maeda-20/+15
2022-07-15Fix rebaseEsteban Küber-5/+3
2022-07-15Avoid incorrect suggestionEsteban Küber-3/+37
We check that there's a single level of block nesting to ensure always correct suggestions. If we don't, then we only provide a free-form message to avoid misleading users in cases like `src/test/ui/nll/borrowed-temporary-error.rs`. We could expand the analysis to suggest hoising all of the relevant parts of the users' code to make the code compile, but that could be too much.
2022-07-15Provide structured suggestion for dropped temp valueEsteban Küber-1/+32
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-1/+6
2022-07-15provide `generic_param_scope` for region errorslcnr-1/+1
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-9/+9
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
2022-07-13remove an unnecessary `span_to_snippet`Takayuki Maeda-12/+9
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-9/+9
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-11Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-deadDylan DPC-9/+2
Implement `SourceMap::is_span_accessible` This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.