Skip to content

Commit 25acecb

Browse files
committed
method calls :3
1 parent 478ba4b commit 25acecb

File tree

45 files changed

+343
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+343
-199
lines changed

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16331633
expected: Expectation<'tcx>,
16341634
) -> Ty<'tcx> {
16351635
let rcvr_t = self.check_expr(rcvr);
1636-
// no need to check for bot/err -- callee does that
1637-
let rcvr_t = self.structurally_resolve_type(rcvr.span, rcvr_t);
1636+
let rcvr_t = self.try_structurally_resolve_type(rcvr.span, rcvr_t);
16381637

16391638
match self.lookup_method(rcvr_t, segment, segment.ident.span, expr, rcvr, args) {
16401639
Ok(method) => {

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
182182
assert_eq!(n, pick.autoderefs);
183183

184184
let mut adjustments = self.adjust_steps(&autoderef);
185-
let mut target = self.structurally_resolve_type(autoderef.span(), ty);
185+
let mut target = self.try_structurally_resolve_type(autoderef.span(), ty);
186186

187187
match pick.autoref_or_ptr_adjustment {
188188
Some(probe::AutorefOrPtrAdjustment::Autoref { mutbl, unsize }) => {

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 134 additions & 28 deletions
Large diffs are not rendered by default.

compiler/rustc_infer/src/infer/canonical/query_response.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,22 @@ impl<'tcx> InferCtxt<'tcx> {
8585
where
8686
T: Debug + TypeFoldable<TyCtxt<'tcx>>,
8787
{
88+
let opaque_types = if self.next_trait_solver() {
89+
self.inner
90+
.borrow_mut()
91+
.opaque_type_storage
92+
.iter_opaque_types()
93+
.map(|(k, v)| (k, v.ty))
94+
.collect()
95+
} else {
96+
vec![]
97+
};
98+
8899
self.canonicalize_response(QueryResponse {
89100
var_values: inference_vars,
90101
region_constraints: QueryRegionConstraints::default(),
91102
certainty: Certainty::Proven, // Ambiguities are OK!
92-
opaque_types: vec![],
103+
opaque_types,
93104
value: answer,
94105
})
95106
}

compiler/rustc_middle/src/traits/query.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ impl<'tcx> FromIterator<DropckConstraint<'tcx>> for DropckConstraint<'tcx> {
154154
#[derive(Debug, HashStable)]
155155
pub struct CandidateStep<'tcx> {
156156
pub self_ty: Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>,
157+
pub self_ty_is_opaque: bool,
157158
pub autoderefs: usize,
158159
/// `true` if the type results from a dereference of a raw pointer.
159160
/// when assembling candidates, we include these steps, but not when

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ where
194194
D: SolverDelegate<Interner = I>,
195195
I: Interner,
196196
{
197-
#[instrument(level = "debug", skip(self))]
197+
#[instrument(level = "debug", skip(self), ret)]
198198
fn evaluate_root_goal(
199199
&self,
200200
goal: Goal<I, I::Predicate>,
@@ -206,6 +206,7 @@ where
206206
})
207207
}
208208

209+
#[instrument(level = "debug", skip(self), ret)]
209210
fn root_goal_may_hold_opaque_types_jank(
210211
&self,
211212
goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,

compiler/rustc_next_trait_solver/src/solve/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ where
381381
}
382382

383383
/// The result of evaluating a goal.
384+
#[derive_where(Debug; I: Interner)]
384385
pub struct GoalEvaluation<I: Interner> {
385386
/// The goal we've evaluated. This is the input goal, but potentially with its
386387
/// inference variables resolved. This never applies any inference constraints

compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_infer::traits::solve::Goal;
22
use rustc_macros::extension;
3-
use rustc_middle::span_bug;
3+
use rustc_middle::{span_bug, ty};
44
use rustc_next_trait_solver::solve::SolverDelegateEvalExt;
55

66
use crate::infer::InferCtxt;
@@ -22,7 +22,7 @@ impl<'tcx> InferCtxt<'tcx> {
2222
/// for more details.
2323
fn predicate_may_hold_opaque_types_jank(&self, obligation: &PredicateObligation<'tcx>) -> bool {
2424
if self.next_trait_solver() {
25-
<&SolverDelegate<'tcx>>::from(self).root_goal_may_hold_opaque_types_jank(Goal::new(
25+
self.goal_may_hold_opaque_types_jank(Goal::new(
2626
self.tcx,
2727
obligation.param_env,
2828
obligation.predicate,
@@ -32,6 +32,13 @@ impl<'tcx> InferCtxt<'tcx> {
3232
}
3333
}
3434

35+
/// See the comment on [OpaqueTypesJank](crate::solve::OpaqueTypesJank)
36+
/// for more details.
37+
fn goal_may_hold_opaque_types_jank(&self, goal: Goal<'tcx, ty::Predicate<'tcx>>) -> bool {
38+
assert!(self.next_trait_solver());
39+
<&SolverDelegate<'tcx>>::from(self).root_goal_may_hold_opaque_types_jank(goal)
40+
}
41+
3542
/// Evaluates whether the predicate can be satisfied in the given
3643
/// `ParamEnv`, and returns `false` if not certain. However, this is
3744
/// not entirely accurate if inference variables are involved.

tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | needs_foo(|x| {
55
| ^
66
...
77
LL | x.to_string();
8-
| - type must be known at this point
8+
| --------- type must be known at this point
99
|
1010
help: consider giving this closure parameter an explicit type
1111
|

tests/ui/impl-trait/call_method_ambiguous.next.stderr

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)