summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
AgeCommit message (Collapse)AuthorLines
2023-01-19Do not filter substs in `remap_generic_params_to_declaration_params`.Camille GILLOT-1/+1
The relevant filtering should have been performed by borrowck.
2022-12-07Rollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8KiMatthias Krüger-160/+145
Remove more `ref` patterns from the compiler Previous PR: #105045
2022-12-06`rustc_borrowck`: remove `ref` patternsMaybe Waffle-160/+145
2022-12-06drive-by: Default param for ToPredicateMichael Goulet-4/+2
2022-12-01Create `format_args` as late as possibleOli Scherer-6/+4
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 #103876 - oli-obk:tait_implications, r=lcnrMatthias Krüger-6/+6
type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds fixes #103642 https://github.com/rust-lang/rust/pull/102417 only made sure that hidden types cannot outlive lifetimes other than the ones mentioned on bounds, but didn't allow us to actually infer anything from that. cc `@aliemjay`
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-5/+5
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-5/+5
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-18/+22
2022-11-24Rollup merge of #104773 - oli-obk:overlap, r=lcnrMatthias Krüger-10/+4
OpaqueCast projections are always overlapping, they can't possibly be disjoint r? ``@lcnr``
2022-11-24Auto merge of #104321 - Swatinem:async-gen, r=oli-obkbors-5/+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-5/+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-23OpaqueCast projections are always overlapping, they can't possibly be disjointOli Scherer-10/+4
2022-11-22Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnrManish Goregaokar-14/+2
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases r? ````@lcnr```` fixes #99840
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-18/+10
2022-11-21Add helper to create the trait ref for a lang itemOli Scherer-28/+9
2022-11-21Allow iterators instead of requiring slices that will get turned into iteratorsOli Scherer-6/+6
2022-11-21Assert that various types have the right amount of generic args and fix the ↵Oli Scherer-23/+28
sites that used the wrong amount
2022-11-21Add more regression testsOli Scherer-6/+6
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-1/+1
2022-11-21Remove a function that doesn't actually do anythingOli Scherer-8/+1
2022-11-21Register obligations from type relationOli Scherer-1/+1