summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/diagnostics
AgeCommit message (Collapse)AuthorLines
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
2022-11-28Rollup merge of #104956 - mucinoab:issue-104870, r=compiler-errorsMatthias Krüger-7/+9
Avoid ICE if the Clone trait is not found while building error suggestions Fixes #104870 r? `@compiler-errors`
2022-11-27Avoid ICE if the Clone trait is not found while building error suggestionsBruno A. Muciño-7/+9
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-2/+2
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-27/+7
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-2/+2
2022-11-26Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errorsGuillaume Gomez-16/+9
Use the power of adding helper function to simplify code w/ `Mutability` r? `@compiler-errors`
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-14/+18
2022-11-24Auto merge of #104321 - Swatinem:async-gen, r=oli-obkbors-4/+11
Avoid `GenFuture` shim when compiling async constructs Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through. --- Given this demo code: ```rust pub async fn a(arg: u32) -> Backtrace { let bt = b().await; let _arg = arg; bt } pub async fn b() -> Backtrace { Backtrace::force_capture() } ``` I would get the following with the latest stable compiler (on Windows): ``` 4: async_codegen::b::async_fn$0 at .\src\lib.rs:10 5: core::future::from_generator::impl$1::poll<enum2$<async_codegen::b::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 6: async_codegen::a::async_fn$0 at .\src\lib.rs:4 7: core::future::from_generator::impl$1::poll<enum2$<async_codegen::a::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 ``` whereas now I get a much cleaner stack trace: ``` 3: async_codegen::b::async_fn$0 at .\src\lib.rs:10 4: async_codegen::a::async_fn$0 at .\src\lib.rs:4 ```
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-4/+11
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
2022-11-23Fix rebaseEsteban Küber-2/+1
2022-11-23Add `Mutability::mutably_str`Maybe Waffle-4/+1
2022-11-23Add `Mutability::{is_mut,is_not}`Maybe Waffle-1/+1
2022-11-23Account for closuresEsteban Küber-5/+9
2022-11-23Account for `x @ y` and suggest `ref x @ ref y`Esteban Küber-8/+22
2022-11-23review comments: inline bindings and fix typoEsteban Küber-5/+9
2022-11-23Tweak output to account for alternative bindings in the same patternEsteban Küber-22/+17
2022-11-23Fix wordingEsteban Küber-1/+1
2022-11-23Tweak output in for loopsEsteban Küber-3/+11
Do not suggest `.clone()` as we already suggest borrowing the iterated value.
2022-11-23Remove logic duplicationEsteban Küber-33/+18
2022-11-23Extract suggestion logic to its own methodEsteban Küber-140/+156
2022-11-23Use `type_implements_trait`Esteban Küber-20/+5
2022-11-23Do not suggest `ref` multiple times for the same bindingEsteban Küber-1/+3
2022-11-23Suggest `.clone()` or `ref binding` on E0382Esteban Küber-19/+173
2022-11-23Add `Mutability::ref_prefix_str`, order `Mutability`, simplify codeMaybe Waffle-12/+8
2022-11-23Separate lifetime ident from resolution in HIR.Camille GILLOT-27/+7
2022-11-23Rollup merge of #104728 - WaffleLapkin:require-lang-items-politely, ↵Yuki Okushi-2/+2
r=compiler-errors Use `tcx.require_lang_item` instead of unwrapping lang items I clearly remember esteban telling me that there is `require_lang_item` but he was from a phone atm and I couldn't find it, so I didn't use it. Stumbled on it today, so here we are :)
2022-11-22Use `tcx.require_lang_item` instead of unwrappingMaybe Waffle-2/+2
2022-11-22Auto merge of #103578 - petrochenkov:nofict, r=nagisabors-1/+1
Unreserve braced enum variants in value namespace With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed. Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
2022-11-21Stop passing the self-type as a separate argument.Oli Scherer-8/+2
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-1/+1
2022-11-11Rollup merge of #103960 - AndyJado:var_path_only_diag, r=davidtwcoManish Goregaokar-48/+79
piece of diagnostic migrate r? `@davidtwco`
2022-11-09Rollup merge of #102763 - compiler-errors:nits, r=cjgillotMichael Goulet-14/+7
Some diagnostic-related nits 1. Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` 2. Make `diag.span_suggestions` take an `IntoIterator` instead of `Iterator`, just to remove some `.into_iter` calls on the caller. idk if I should add a lint to make sure people use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` in cases where we're just, e.g., adding subdiagnostics to the diagnostic... maybe a followup.
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-1/+1
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-09Make span_suggestions take IntoIteratorMichael Goulet-1/+1
2022-11-09DiagnosticBuilder -> DiagnosticMichael Goulet-13/+6
2022-11-09struct error E0505AndyJado-4/+7
2022-11-09var_subdiag refinementAndyJado-27/+29
trim old
2022-11-09remove old var_span_path_onlyAndyJado-17/+31
doc comment
2022-11-09lint auto passAndyJado-0/+12
Revert "lint auto pass" This reverts commit e58e4466384924c491a932d3f18ef50ffa5a5065.
2022-11-09Auto merge of #104179 - Manishearth:rollup-yvsx5hh, r=Manishearthbors-4/+30
Rollup of 7 pull requests Successful merges: - #100508 (avoid making substs of type aliases late bound when used as fn args) - #101381 (Test that target feature mix up with homogeneous floats is sound) - #103353 (Fix Access Violation when using lld & ThinLTO on windows-msvc) - #103521 (Avoid possible infinite loop when next_point reaching the end of file) - #103559 (first move on a nested span_label) - #103778 (Update several crates for improved support of the new targets) - #103827 (Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-08Rollup merge of #103559 - AndyJado:var_span_label, r=davidtwcoManish Goregaokar-4/+30
first move on a nested span_label trying not to be smart this time.
2022-11-09Auto merge of #103171 - jackh726:gen-interior-hrtb-error, r=cjgillotbors-1/+4
Better error for HRTB error from generator interior cc #100013 This is just a first pass at an error. It could be better, and shouldn't really be emitted in the first place. But this is better than what was being emitted before.
2022-11-07Add an optional Span to BrAnon and use it to print better error for HRTB ↵Jack Huey-1/+4
error from generator interior
2022-11-07Auto merge of #103218 - CastilloDel:infer, r=jackh726bors-4/+4
Remove #![allow(rustc::potential_query_instability)] from rustc_infer Related to #84447 This PR probably needs to be benchmarked to check for regressions.