Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6cfdd53
Stabilize `slice_as_chunks` library feature
scottmcm Apr 11, 2025
c49ddc0
Improve rustdocs on slice_as_chunks methods
scottmcm Apr 19, 2025
64c8d5d
move existing tests away from using boxes
dianne Mar 17, 2025
0eb3b11
lower deref patterns on boxes using built-in derefs
dianne Apr 17, 2025
4313318
update unstable book to mention moving out of boxes
dianne Apr 18, 2025
f319dd9
add llvm wrappers and corresponding methods in attribute
Shourya742 Apr 20, 2025
9bc0401
add custom enzyme markers to target methods
Shourya742 Apr 20, 2025
4e555fa
Test partial moves via deref pats
Nadrieril Apr 27, 2025
6ceeb08
Implement the internal feature `cfg_target_has_reliable_f16_f128`
tgross35 Apr 24, 2025
dfa972e
Use `feature(target_has_reliable_f16_f128)` in library tests
tgross35 Apr 26, 2025
3ab6051
Move inline_asm to typeck, properly handle aliases
compiler-errors Apr 25, 2025
f07cc40
Rename sub_ptr to offset_from_unsigned in docs
DaniPopes Apr 28, 2025
8fa5e3a
Make bootstrap git tests more self-contained
Kobzol Apr 28, 2025
7018392
remove noinline attribute and add alwaysinline after AD pass
Shourya742 Apr 20, 2025
fa90fea
only return nested goals for `Certainty::Yes`
lcnr Apr 28, 2025
016105c
review
lcnr Apr 28, 2025
105d1dc
Do not compute type_of for impl item if impl where clauses are unsati…
compiler-errors Apr 25, 2025
3c42dc2
Workaround for windows-gnu rust-lld test failure
ChrisDenton Apr 28, 2025
d4845e1
Rollup merge of #139308 - Shourya742:2025-03-29-add-autodiff-inline, …
ChrisDenton Apr 28, 2025
17495e0
Rollup merge of #139656 - scottmcm:stabilize-slice-as-chunks, r=dtolnay
ChrisDenton Apr 28, 2025
8dd26cb
Rollup merge of #140022 - dianne:box-deref-pats, r=Nadrieril
ChrisDenton Apr 28, 2025
0bd531a
Rollup merge of #140276 - compiler-errors:typeof-less-eagerly, r=lcnr
ChrisDenton Apr 28, 2025
3f5406f
Rollup merge of #140302 - compiler-errors:inline_asm-bug, r=lcnr
ChrisDenton Apr 28, 2025
e082bf3
Rollup merge of #140323 - tgross35:cfg-unstable-float, r=Urgau
ChrisDenton Apr 28, 2025
fd95953
Rollup merge of #140391 - DaniPopes:sub-ptr-rename, r=RalfJung
ChrisDenton Apr 28, 2025
ec2dad7
Rollup merge of #140394 - Kobzol:git-test-self-contained, r=jieyouxu
ChrisDenton Apr 28, 2025
469f03d
Rollup merge of #140396 - ChrisDenton:gnu-threads, r=jieyouxu
ChrisDenton Apr 28, 2025
bf37847
Rollup merge of #140402 - lcnr:normalizes-to-certainty-yes, r=compile…
ChrisDenton Apr 28, 2025
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
  • Loading branch information
lcnr committed Apr 28, 2025
commit 016105cd7772a48333028bebefedd773061119fd
48 changes: 29 additions & 19 deletions compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,19 @@ where
/// the values inferred while solving the instantiated goal.
/// - `external_constraints`: additional constraints which aren't expressible
/// using simple unification of inference variables.
///
/// This takes the `shallow_certainty` which represents whether we're confident
/// that the final result of the current goal only depends on the nested goals.
///
/// In case this is `Certainy::Maybe`, there may still be additional nested goals
/// or inference constraints required for this candidate to be hold. The candidate
/// always requires all already added constraints and nested goals.
#[instrument(level = "trace", skip(self), ret)]
pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
&mut self,
certainty: Certainty,
shallow_certainty: Certainty,
) -> QueryResult<I> {
self.inspect.make_canonical_response(certainty);
self.inspect.make_canonical_response(shallow_certainty);

let goals_certainty = self.try_evaluate_added_goals()?;
assert_eq!(
Expand All @@ -103,25 +110,28 @@ where
NoSolution
})?;

// When normalizing, we've replaced the expected term with an unconstrained
// inference variable. This means that we dropped information which could
// have been important. We handle this by instead returning the nested goals
// to the caller, where they are then handled.
//
// As we return all ambiguous nested goals, we can ignore the certainty returned
// by `try_evaluate_added_goals()`.
let (certainty, normalization_nested_goals) =
if matches!(self.current_goal_kind, CurrentGoalKind::NormalizesTo)
&& matches!(certainty, Certainty::Yes)
{
let goals = std::mem::take(&mut self.nested_goals);
if goals.is_empty() {
assert!(matches!(goals_certainty, Certainty::Yes));
match (self.current_goal_kind, shallow_certainty) {
// When normalizing, we've replaced the expected term with an unconstrained
// inference variable. This means that we dropped information which could
// have been important. We handle this by instead returning the nested goals
// to the caller, where they are then handled. We only do so if we do not
// need to recompute the `NormalizesTo` goal afterwards to avoid repeatedly
// uplifting its nested goals. This is the case if the `shallow_certainty` is
// `Certainty::Yes`.
(CurrentGoalKind::NormalizesTo, Certainty::Yes) => {
let goals = std::mem::take(&mut self.nested_goals);
// As we return all ambiguous nested goals, we can ignore the certainty
// returned by `self.try_evaluate_added_goals()`.
if goals.is_empty() {
assert!(matches!(goals_certainty, Certainty::Yes));
}
(Certainty::Yes, NestedNormalizationGoals(goals))
}
_ => {
let certainty = shallow_certainty.unify_with(goals_certainty);
(certainty, NestedNormalizationGoals::empty())
}
(Certainty::Yes, NestedNormalizationGoals(goals))
} else {
let certainty = certainty.unify_with(goals_certainty);
(certainty, NestedNormalizationGoals::empty())
};

if let Certainty::Maybe(cause @ MaybeCause::Overflow { .. }) = certainty {
Expand Down
Loading