about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2022-11-26Revert "Do not need to account for overflow in predicate_can_apply"Michael Goulet-4/+1
This reverts commit cbe932801892da06688b53638622be1c8a1c8974.
2022-11-26Revert "Drive-by: Don't manually call evaluate_obligation_no_overflow"Michael Goulet-2/+3
This reverts commit a884a9e634b827781e77bddf4082f1196301d86f.
2022-11-26Pretty-print generators with their `generator_kind`Arpad Borsos-1/+1
After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally. This now reverses that change so that async fn/blocks are pretty-printed as `[$movability `async` $something@$source-position]` in various diagnostics, and updates the tests that this touches.
2022-11-26Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errorsGuillaume Gomez-2/+2
Use the power of adding helper function to simplify code w/ `Mutability` r? `@compiler-errors`
2022-11-25Remove SelectionContext::infcx() in favor of field accessMichael Goulet-92/+75
2022-11-25Auto merge of #99798 - JulianKnodt:ac1, r=BoxyUwUbors-237/+206
Add `ConstKind::Expr` Starting to implement `ty::ConstKind::Abstract`, most of the match cases are stubbed out, some I was unsure what to add, others I didn't want to add until a more complete implementation was ready. r? `@lcnr`
2022-11-25Auto merge of #104902 - matthiaskrgr:rollup-oo27a4u, r=matthiaskrgrbors-232/+190
Rollup of 8 pull requests Successful merges: - #104716 (move 2 candidates into builtin candidate) - #104760 (Clarify `SyntaxExtensionKind::LegacyDerive`.) - #104797 (rustc_codegen_ssa: write `.dwp` in a streaming fashion) - #104835 (Use infcx.partially_normalize_associated_types_in) - #104853 (Fix typo in miri sysroot) - #104879 (jsondoclint: Recognise Typedef as valid kind for Type::ResolvedPath) - #104887 (rustbuild: Don't build doc::SharedAssets when building JSON docs.) - #104896 (rustdoc: fix broken tooltip CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-25Rollup merge of #104835 - ↵Matthias Krüger-28/+25
spastorino:use-partially_normalize_associated_types_in, r=lcnr Use infcx.partially_normalize_associated_types_in r? ``@lcnr``
2022-11-25Rollup merge of #104716 - lcnr:selection-candidate, r=jackh726Matthias Krüger-204/+165
move 2 candidates into builtin candidate having separate candidates for these isn't too helpful i think r? types
2022-11-25Auto merge of #104846 - ↵bors-99/+118
spastorino:santa-clauses-make-goals-early-christmas-🎄, r=oli-obk Branch Clause from Predicate r? `@oli-obk` This is part of what's proposed in https://github.com/rust-lang/compiler-team/issues/531
2022-11-25move 2 candidates into builtin candidatelcnr-204/+165
2022-11-25Rollup merge of #104841 - compiler-errors:fishy-bound-var, r=jackh726Matthias Krüger-24/+25
Assert that we don't capture escaping bound vars in `Fn` trait selection Fixes #104825
2022-11-25only emit "enable gce" error if it would fix compile errorBoxy-8/+17
2022-11-25Make `expand_abstract_consts` infallibleBoxy-30/+19
2022-11-25add FIXME'sBoxy-0/+7
2022-11-25dont skip const evalautable of non unevaluatedsBoxy-6/+1
2022-11-25add FIXME for things that I couldn't find ways to triggerBoxy-3/+5
2022-11-25fmtBoxy-1/+1
2022-11-25also handle it in evaluateBoxy-24/+51
2022-11-25handle assoc consts in fulfill `ConstEquate`Boxy-23/+27
2022-11-25fmtBoxy-16/+18
2022-11-25handle nested obligations in `satisfied_from_param_env`Boxy-37/+47
2022-11-25Add expand_abstract_constkadmin-74/+53
Adds the ability to directly expand a const to an expr without having to deal with intermediate steps.
2022-11-25Add empty ConstKind::Abstractkadmin-196/+141
Initial pass at expr/abstract const/s Address comments Switch to using a list instead of &[ty::Const], rm `AbstractConst` Remove try_unify_abstract_consts Update comments Add edits Recurse more More edits Prevent equating associated consts Move failing test to ui Changes this test from incremental to ui, and mark it as failing and a known bug. Does not cause the compiler to ICE, so should be ok.
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-69/+97
2022-11-25Simplify a bunch of trait ref obligation creationsOli Scherer-9/+4
2022-11-25get rid of to_poly_trait_predicateOli Scherer-21/+17
2022-11-24Remove comment, simplify since we asserted fn ptr Self type has no bound varsMichael Goulet-10/+1
2022-11-24Also check that fn pointer candidates don't have escaping bound varsMichael Goulet-1/+4
2022-11-24Assert that we don't capture escaping bound vars in Fn trait selectionMichael Goulet-13/+20
2022-11-24Rollup merge of #104822 - spastorino:selctx-new-instead-of-with_query_mode, ↵Matthias Krüger-8/+3
r=lcnr with_query_mode -> new r? ```@lcnr```
2022-11-24Rollup merge of #104820 - spastorino:remove-normalize_projection_type, ↵Matthias Krüger-60/+13
r=jackh726 Remove normalize_projection_type r? ``@lcnr``
2022-11-24Use infcx.partially_normalize_associated_types_inSantiago Pastorino-28/+25
2022-11-24Auto merge of #104321 - Swatinem:async-gen, r=oli-obkbors-54/+156
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-24with_query_mode -> newSantiago Pastorino-8/+3
2022-11-24Remove normalize_projection_typeSantiago Pastorino-60/+13
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-54/+156
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-24Rollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errorsMatthias Krüger-12/+0
Make `deref_into_dyn_supertrait` lint the impl and not the usage Proposed by ``@compiler-errors`` in https://github.com/rust-lang/rust/issues/89460#issuecomment-1320806785 r? ``@crlf0710``
2022-11-24Rollup merge of #104594 - compiler-errors:dyn-star-rcvr, r=eholk,estebankMatthias Krüger-7/+6
Properly handle `Pin<&mut dyn* Trait>` receiver in codegen This ensures we can actually await a `dyn* Future`, which seems important for async fn in dyn trait. Also, disable `dyn*` trait upcasting. It's not exactly complete right now, and can cause strange ICEs for no reason -- nobody's using it either. I thought it was cute to implement when I did it, but I didn't think about how it interacts structurally with `CoerceUnsized` correctly. Fixes #104794, presumably removing `dyn*` upcasting and its `CoerceUnsized` issues does the trick.
2022-11-24Auto merge of #104610 - ouz-a:revert-overflow, r=compiler-errorsbors-16/+0
Reverts check done by #100757 As my `fix` caused more issues than it resolved it's better to revert it. ( #103274 #104322 https://github.com/rust-lang/rust/issues/104606) r? `@compiler-errors` Reopens #95134
2022-11-24Disable dyn* upcastingMichael Goulet-7/+6
2022-11-24Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiserbors-1/+1
Use `as_deref` in compiler (but only where it makes sense) This simplifies some code :3 (there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
2022-11-23Add `Mutability::{is_mut,is_not}`Maybe Waffle-2/+2
2022-11-23Make `deref_into_dyn_supertrait` lint the impl and not the usageMaybe Waffle-12/+0
2022-11-23Rollup merge of #104509 - spastorino:use-obligation-ctxt, r=lcnrDylan DPC-41/+30
Use obligation ctxt instead of dyn TraitEngine r? `@lcnr`
2022-11-23Rollup merge of #104269 - compiler-errors:hang-in-where-clause-sugg, r=lcnrDylan DPC-4/+6
Fix hang in where-clause suggestion with `predicate_can_apply` Using `predicate_may_hold` during error reporting causes an evaluation overflow, which (because we use `evaluate_obligation_no_overflow`) then causes the predicate to need to be re-evaluated locally, which results in a hang. ... but since the "add a where clause" suggestion is best-effort, just throw any overflow errors. No need for 100% accuracy. r? `@lcnr` who has been thinking about overflows... Let me know if you want more context about this issue, and as always, feel free to reassign. Fixes #104225
2022-11-23Call fully_solve_obligations instead of repeating codeSantiago Pastorino-6/+11
2022-11-23Use ObligationCtxt intead of dyn TraitEngineSantiago Pastorino-41/+25
2022-11-23Drive-by: Don't manually call evaluate_obligation_no_overflowMichael Goulet-3/+2
2022-11-23Do not need to account for overflow in predicate_can_applyMichael Goulet-1/+4