Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #109442

Merged
merged 34 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
01d6c04
Link to Option/Result for `Iterator::sum/product`
clubby789 Jan 4, 2023
defa245
Implement read_buf for a few more types
tmiasko Feb 21, 2023
0a1b983
add dist.compression-profile option to control compression speed
pietroalbini Mar 14, 2023
4556037
use the best compression profile in CI
pietroalbini Mar 14, 2023
ed63201
replace usage of `evaluate_goal` with a new `add_goal`
BoxyUwU Mar 16, 2023
ee31e5f
review nits
BoxyUwU Mar 17, 2023
ea08d3a
add assert
BoxyUwU Mar 17, 2023
ce14a1e
add comments
BoxyUwU Mar 17, 2023
e06c62c
UNACEPTABLE
BoxyUwU Mar 17, 2023
aa8de17
fix let else unformatting
BoxyUwU Mar 17, 2023
e624ef4
replace chain with two `add_goal`
BoxyUwU Mar 17, 2023
9df35a5
fix bad assertion
BoxyUwU Mar 17, 2023
b85bc19
move `compute_goal` and `evaluate_x` methods to inner module
BoxyUwU Mar 17, 2023
69a82f7
add myself to mailmap
aDotInTheVoid Mar 19, 2023
9f80c75
Walk un-shifted nested `impl Trait` in trait when setting up default …
compiler-errors Mar 16, 2023
239ec6c
drive-by: Fix a comment in TyCtxt::fold_regions and remove an unused …
compiler-errors Mar 17, 2023
5b4fa5b
fix typo
lcnr Mar 20, 2023
8e4e55e
Support aggregate expressions
cbeuw Mar 20, 2023
e24f5ac
Fix off-by-one in mir syntax doc
cbeuw Mar 20, 2023
f404f33
Use builtin_index instead of match
cbeuw Mar 20, 2023
f321144
Add example for `Option::product` and `Result::product`
clubby789 Jan 4, 2023
5058cc8
not *all* retags might be explicit in Runtime MIR
RalfJung Mar 20, 2023
720cc40
Enforce non-lifetime-binders in supertrait preds are not object safe
compiler-errors Mar 7, 2023
0177176
change default to fast for everyone but the user profile
pietroalbini Mar 21, 2023
caae551
Rollup merge of #106434 - clubby789:document-sum-result, r=the8472
Noratrieb Mar 21, 2023
82dc127
Rollup merge of #108326 - tmiasko:read-buf, r=thomcc
Noratrieb Mar 21, 2023
0ef4da1
Rollup merge of #108842 - compiler-errors:non_lifetime_binders-object…
Noratrieb Mar 21, 2023
e79b182
Rollup merge of #108896 - BoxyUwU:new_solver_add_goal_fn, r=lcnr
Noratrieb Mar 21, 2023
09b1254
Rollup merge of #109124 - ferrocene:pa-compression-mode, r=Mark-Simul…
Noratrieb Mar 21, 2023
66ba60a
Rollup merge of #109240 - compiler-errors:dont-binder-twice, r=oli-obk
Noratrieb Mar 21, 2023
c0adce5
Rollup merge of #109385 - lcnr:typo, r=Dylan-DPC
Noratrieb Mar 21, 2023
15000ec
Rollup merge of #109386 - aDotInTheVoid:mailmap, r=WaffleLapkin
Noratrieb Mar 21, 2023
b2e48ed
Rollup merge of #109390 - cbeuw:aggregate-lit, r=oli-obk
Noratrieb Mar 21, 2023
925fbcd
Rollup merge of #109408 - RalfJung:retags, r=compiler-errors
Noratrieb Mar 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review nits
  • Loading branch information
BoxyUwU committed Mar 17, 2023
commit ee31e5fc57499cd7a97b7e0564425324b0186688
6 changes: 6 additions & 0 deletions compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ pub struct EvalCtxt<'a, 'tcx> {
pub(super) nested_goals: NestedGoals<'tcx>,
}

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub(super) enum IsNormalizesToHack {
Yes,
No,
}

#[derive(Debug, Clone)]
pub(super) struct NestedGoals<'tcx> {
pub(super) projection_eq_hack_goal: Option<Goal<'tcx, ty::ProjectionPredicate<'tcx>>>,
Expand Down
26 changes: 12 additions & 14 deletions compiler/rustc_trait_selection/src/solve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mod trait_goals;
pub use eval_ctxt::EvalCtxt;
pub use fulfill::FulfillmentCtxt;

use self::eval_ctxt::NestedGoals;
use self::eval_ctxt::{IsNormalizesToHack, NestedGoals};

trait CanonicalResponseExt {
fn has_no_inference_or_external_constraints(&self) -> bool;
Expand Down Expand Up @@ -86,7 +86,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
var_values: CanonicalVarValues::dummy(),
nested_goals: NestedGoals::new(),
}
.evaluate_goal(false, goal);
.evaluate_goal(IsNormalizesToHack::No, goal);

assert!(search_graph.is_empty());
result
Expand Down Expand Up @@ -130,7 +130,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
/// been constrained and the certainty of the result.
fn evaluate_goal(
&mut self,
is_projection_eq_hack_goal: bool,
is_normalizes_to_hack: IsNormalizesToHack,
goal: Goal<'tcx, ty::Predicate<'tcx>>,
) -> Result<(bool, Certainty), NoSolution> {
let (orig_values, canonical_goal) = self.canonicalize_goal(goal);
Expand All @@ -153,7 +153,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
// solver cycle.
if cfg!(debug_assertions)
&& has_changed
&& !is_projection_eq_hack_goal
&& is_normalizes_to_hack == IsNormalizesToHack::No
&& !self.search_graph.in_cycle()
{
debug!("rerunning goal to check result is stable");
Expand Down Expand Up @@ -223,11 +223,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
} else {
let kind = self.infcx.instantiate_binder_with_placeholders(kind);
let goal = goal.with(self.tcx(), ty::Binder::dummy(kind));
// `false` is fine to use as if this were a projection goal from the hack there would not be
// a binder as the real projection goal that is the parent of the hack goal would have already
// had its binder replaced with placeholders.
let (_, certainty) = self.evaluate_goal(false, goal)?;
self.evaluate_added_goals_and_make_canonical_response(certainty)
self.add_goal(goal);
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}
}

Expand Down Expand Up @@ -436,7 +433,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {

if let Some(goal) = goals.projection_eq_hack_goal.take() {
let (_, certainty) = match this.evaluate_goal(
true,
IsNormalizesToHack::Yes,
goal.with(this.tcx(), ty::Binder::dummy(goal.predicate)),
) {
Ok(r) => r,
Expand Down Expand Up @@ -480,10 +477,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}

for nested_goal in goals.goals.drain(..) {
let (changed, certainty) = match this.evaluate_goal(false, nested_goal) {
Ok(result) => result,
Err(NoSolution) => return Some(Err(NoSolution)),
};
let (changed, certainty) =
match this.evaluate_goal(IsNormalizesToHack::No, nested_goal) {
Ok(result) => result,
Err(NoSolution) => return Some(Err(NoSolution)),
};

if changed {
has_changed = Ok(());
Expand Down