Skip to content

Commit e1e386f

Browse files
committed
---
yaml --- r: 138408 b: refs/heads/master c: 646ec7d h: refs/heads/master v: v3
1 parent e37c816 commit e1e386f

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 53ede4403bb79604eb378ba01f664a548a744044
2+
refs/heads/master: 646ec7d9a9df7c5cd00e781e89144fa2c20b2557
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5

trunk/src/librustc/middle/traits/select.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
314314
// an impl. Even if there are no impls in this crate, perhaps
315315
// the type would be unified with something from another crate
316316
// that does provide an impl.
317-
let input_types = self.input_types(&*stack.skol_trait_ref);
317+
let input_types = stack.skol_trait_ref.input_types();
318318
if input_types.iter().any(|&t| ty::type_is_skolemized(t)) {
319319
debug!("evaluate_stack_intercrate({}) --> unbound argument, must be ambiguous",
320320
stack.skol_trait_ref.repr(self.tcx()));
@@ -521,7 +521,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
521521
// found in the source. This is because all the
522522
// compiler-provided impls (such as those for unboxed
523523
// closures) do not have relevant coercions. This simplifies
524-
// life immensly.
524+
// life immensely.
525525

526526
let mut impls =
527527
self.assemble_method_candidates_from_impls(rcvr_ty, xform_self_ty, obligation);
@@ -586,7 +586,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
586586
*/
587587

588588
self.infcx.commit_if_ok(|| {
589-
match self.infcx.sub_types(false, infer::Misc(obligation.cause.span),
589+
match self.infcx.sub_types(false, infer::RelateSelfType(obligation.cause.span),
590590
rcvr_ty, xform_self_ty) {
591591
Ok(()) => { }
592592
Err(_) => { return Err(()); }
@@ -850,7 +850,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
850850
// scope. Otherwise, use the generic tcx cache, since the
851851
// result holds across all environments.
852852
if
853-
self.input_types(&**cache_skol_trait_ref).iter().any(
853+
cache_skol_trait_ref.input_types().iter().any(
854854
|&t| ty::type_has_self(t) || ty::type_has_params(t))
855855
{
856856
&self.param_env.selection_cache
@@ -1955,11 +1955,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19551955

19561956
found_skol
19571957
}
1958-
1959-
fn input_types<'a>(&self, trait_ref: &'a ty::TraitRef) -> &'a [ty::t] {
1960-
// Select only the "input types" from a trait-reference.
1961-
trait_ref.substs.types.as_slice()
1962-
}
19631958
}
19641959

19651960
impl Repr for Candidate {

trunk/src/librustc/middle/ty.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,14 @@ impl TraitRef {
12541254
pub fn self_ty(&self) -> ty::t {
12551255
self.substs.self_ty().unwrap()
12561256
}
1257+
1258+
pub fn input_types(&self) -> &[ty::t] {
1259+
// Select only the "input types" from a trait-reference. For
1260+
// now this is all the types that appear in the
1261+
// trait-reference, but it should eventually exclude
1262+
// associated types.
1263+
self.substs.types.as_slice()
1264+
}
12571265
}
12581266

12591267
/// When type checking, we use the `ParameterEnvironment` to track

0 commit comments

Comments
 (0)