about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2023-01-30Use ObligationCtxt::new_in_snapshot in satisfied_from_param_envMichael Goulet-1/+1
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-14/+17
2023-01-30Rollup merge of #107146 - compiler-errors:unsizing-params, r=cjgillotDylan DPC-44/+10
Make `unsizing_params_for_adt` into a query Addresses a FIXME in confirmation. r? ``@ghost``
2023-01-29Auto merge of #106253 - nbdd0121:upcast, r=compiler-errorsbors-20/+39
Skip possible where_clause_object_safety lints when checking `multiple_supertrait_upcastable` Fix #106247 To achieve this, I lifted the `WhereClauseReferencesSelf` out from `object_safety_violations` and move it into `is_object_safe` (which is changed to a new query). cc `@dtolnay` r? `@compiler-errors`
2023-01-29Rollup merge of #107401 - ↵Matthias Krüger-8/+5
lenko-d:remove_the_usize_field_from_CandidateSource_AliasBound, r=compiler-errors remove the usize field from CandidateSource::AliasBound Fixes [#107380](https://github.com/rust-lang/rust/issues/107380)
2023-01-28Make unsizing_params_for_adt into a queryMichael Goulet-44/+10
2023-01-28Auto merge of #107303 - compiler-errors:intern-canonical-var-values, r=lcnrbors-26/+4
Intern `CanonicalVarValues` So that they are copy :sparkles:
2023-01-28Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkinbors-9/+6
Remove HirId -> LocalDefId map from HIR. Having this map in HIR prevents the creating of new definitions after HIR has been built. Thankfully, we do not need it. Based on https://github.com/rust-lang/rust/pull/103902
2023-01-28Rename `is_object_safe` to `check_is_object_safe` to hint side effectsGary Guo-8/+11
2023-01-28Make `is_object_safe` a query and move lint_object_unsafe_trait call thereGary Guo-14/+32
2023-01-28Replace `object_safety_violations().is_empty()` calls with `is_object_safe`Gary Guo-3/+1
2023-01-28Use field-less variant for AliasBound.Lenko Donchev-6/+5
2023-01-28Rollup merge of #107398 - scottmcm:its-their-funeral, r=dtolnayMatthias Krüger-4/+4
Remove `ControlFlow::{BREAK, CONTINUE}` Libs-API decided to remove these in #102697. Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged. r? libs
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-9/+6
2023-01-27remove the usize field from CandidateSource::AliasBoundLenko Donchev-7/+5
2023-01-28Rollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnrMatthias Krüger-23/+54
Minor tweaks in the new solver 1. `InferCtxt::probe` is not needed in `compute_subtype_goal` and `compute_well_formed_goal`. 2. Add a handful of comments. 3. Add a micro-optimization in `consider_assumption` where we check the def-ids of the assumption and goal match before instantiating any binders. r? ``@lcnr``
2023-01-28Rollup merge of #107306 - ↵Matthias Krüger-10/+20
compiler-errors:correct-sugg-for-closure-arg-needs-borrow, r=oli-obk Correct suggestions for closure arguments that need a borrow Fixes #107301 by dealing with binders correctly Fixes another issue where we were suggesting adding just `&` when we expected `&mut _` in a closure arg
2023-01-28Rollup merge of #107103 - compiler-errors:new-solver-evaluate_obligation, r=lcnrMatthias Krüger-6/+37
Use new solver in `evaluate_obligation` query (when new solver is enabled) (only when `-Ztrait-solver=next`, of course) ... Does this make sense? It seems to me like it should be reasonable, but maybe there's some reason why this is a bad idea. r? ``@lcnr`` Needs a perf run because I guess this `solver == TraitSolver::Next` check is on a hot path.
2023-01-27Remove `ControlFlow::{BREAK, CONTINUE}`Scott McMurray-4/+4
Libs-API decided to remove these in #102697. Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged.
2023-01-28Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obkbors-40/+257
Compute generator saved locals on MIR Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type. This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later. This PR proposes to drop the HIR-based computation, and only keep the MIR one. This is done in 3 steps. 1. During type-checking, the `witness` type variable is never unified. This allows to stall all the obligations that depend on it until the end of type-checking. Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification. 2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`. From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do. There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked. 3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query. If any obligation was wrongly marked as fulfilled in step 1, it should be reported here. There are still many issues: - ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables. - the diagnostics for captured types don't show where they are used/dropped; - I do not attempt to support chalk. cc `@eholk` `@jyn514` for the drop-tracking work r? `@oli-obk` as you warned me of potential unsoundness
2023-01-27Pacify tidy.Camille GILLOT-5/+5
2023-01-27Restrict amount of ignored locals.Camille GILLOT-1/+1
2023-01-27Compute generator saved locals on MIR.Camille GILLOT-9/+184
2023-01-27Micro-optimization in consider_assumptionMichael Goulet-2/+6
2023-01-27Add some commentsMichael Goulet-0/+31
2023-01-27No need to probe when computing goalsMichael Goulet-21/+17
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-3/+33
2023-01-27Separate trait selection from ambiguity reporting.Camille GILLOT-23/+3
2023-01-27Do not abort compilation when failing to normalize opaque types.Camille GILLOT-11/+43
2023-01-27Use now solver in evaluate_obligationMichael Goulet-6/+37
2023-01-27Auto merge of #107372 - JohnTitor:rollup-zkl2ges, r=JohnTitorbors-13/+11
Rollup of 9 pull requests Successful merges: - #106806 (Replace format flags u32 by enums and bools.) - #107194 (Remove dependency on slice_internals feature in rustc_ast) - #107234 (Revisit fix_is_ci_llvm_available logic) - #107316 (Update snap from `1.0.1` to `1.1.0`) - #107321 (solver comments + remove `TyCtxt::evaluate_goal`) - #107332 (Fix wording from `rustbuild` to `bootstrap`) - #107347 (reduce rightward-drift) - #107352 (compiler: Fix E0587 explanation) - #107357 (Fix infinite loop in rustdoc get_all_import_attributes function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-28Rollup merge of #107321 - lcnr:comment, r=compiler-errorsYuki Okushi-13/+11
solver comments + remove `TyCtxt::evaluate_goal` from the `RustcContributor::explore` session yesterday. This also removes `TyCtxt::evaluate_goal` because to canonicalize you have to use an `InferCtxt` anyways at which point we should just always get people to use `evaluate_root_goal`. r? ``@spastorino``
2023-01-27Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnrbors-2/+2
Switch to `EarlyBinder` for `fn_sig` query Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78). Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`. r? `@lcnr`
2023-01-27assert that solver results are stablelcnr-8/+46
2023-01-27small refactor to new projection codelcnr-37/+40
2023-01-26fixup new usages of fn_sig, bound_fn_sig after rebasingKyle Matsuda-1/+1
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-1/+1
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-1/+1
2023-01-26Make make_identity take CanonicalVarInfosMichael Goulet-21/+2
2023-01-26Intern CanonicalVarValuesMichael Goulet-22/+19
2023-01-26Use new solver during selectionMichael Goulet-14/+43
2023-01-26solver comments + remove `TyCtxt::evaluate_goal`lcnr-13/+11
2023-01-26Rollup merge of #107286 - compiler-errors:new-solver-deny-infers, r=lcnrMatthias Krüger-22/+33
ICE in new solver if we see an inference variable By construction, we do not expect to see any `ty::Infer(ty::TyVar(_))` inference types in the solver (we treat this as ambiguous, since we need to be able to structurally resolve the self type at least one layer to assemble candidates for it). Additionally, since we're doing no freshening, we also don't expect to see any fresh vars of any kind in the solver. Let's make that an ICE so we can catch any mistakes. When #107282 lands, we should also ICE there too if we see a non-int/float infer. r? `@lcnr`
2023-01-26Rollup merge of #107285 - compiler-errors:new-solver-future-and-generator, ↵Matthias Krüger-11/+184
r=lcnr Implement `Generator` and `Future` in the new solver r? `@lcnr`
2023-01-26Rollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnrMatthias Krüger-6/+63
Implement ObjectSafe and WF in the new solver r? ``@lcnr``
2023-01-26ICE in new solver if we see an inference variableMichael Goulet-22/+33
2023-01-26Implement Generator and FutureMichael Goulet-1/+127
2023-01-26Report the right fulfillment errorsMichael Goulet-10/+57
2023-01-25Don't normalize obligations in WF goal for the new solverMichael Goulet-7/+31
2023-01-25Implement ObjectSafe and WF in the new solverMichael Goulet-4/+37