Skip to content

Commit 0fc198a

Browse files
arielb1Ariel Ben-Yehuda
authored andcommitted
---
yaml --- r: 227516 b: refs/heads/try c: 1af7266 h: refs/heads/master v: v3
1 parent c4170b0 commit 0fc198a

File tree

6 files changed

+28
-40
lines changed

6 files changed

+28
-40
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 73fb19c04ac227fe2aad2c618f76b6eb05dd7ec9
4+
refs/heads/try: 1af72660a76605a485866ba3a80a79d331586a0a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/liblibc/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,7 @@ pub use funcs::bsd43::*;
146146
#[link(name = "m")]
147147
extern {}
148148

149-
// When compiling rust with musl, statically include libc.a in liblibc.rlib.
150-
// A cargo build of the libc crate will therefore automatically pick up the
151-
// libc.a symbols because liblibc is transitively linked to by the stdlib.
152-
#[cfg(all(target_env = "musl", not(feature = "cargo-build"), not(test)))]
149+
#[cfg(all(target_env = "musl", not(test)))]
153150
#[link(name = "c", kind = "static")]
154151
extern {}
155152

branches/try/src/librustc_typeck/check/method/probe.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,19 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
398398
}
399399

400400
let (impl_ty, impl_substs) = self.impl_ty_and_substs(impl_def_id);
401-
let impl_ty = self.fcx.instantiate_type_scheme(self.span, &impl_substs, &impl_ty);
401+
402+
// We can't use instantiate_type_scheme here as it will pollute
403+
// the fcx's fulfillment context if this probe is rolled back.
404+
let cause = traits::ObligationCause::misc(self.span, self.fcx.body_id);
405+
let mut selcx = &mut traits::SelectionContext::new(self.fcx.infcx(), self.fcx);
406+
let traits::Normalized { value: impl_ty, .. } =
407+
traits::normalize(selcx, cause, &impl_ty.subst(self.tcx(), &impl_substs));
402408

403409
// Determine the receiver type that the method itself expects.
404410
let xform_self_ty =
405411
self.xform_self_ty(&item, impl_ty, &impl_substs);
412+
debug!("assemble_inherent_impl_probe: self ty = {:?}",
413+
xform_self_ty.repr(self.tcx()));
406414

407415
self.inherent_candidates.push(Candidate {
408416
xform_self_ty: xform_self_ty,

branches/try/src/librustc_typeck/constrained_type_params.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,10 @@ pub enum Parameter {
1919
Region(ty::EarlyBoundRegion),
2020
}
2121

22-
/// Returns the list of parameters that are constrained by the type `ty`
23-
/// - i.e. the value of each parameter in the list is uniquely determined
24-
/// by `ty` (see RFC 447).
2522
pub fn parameters_for_type<'tcx>(ty: Ty<'tcx>) -> Vec<Parameter> {
26-
let mut result = vec![];
27-
ty::maybe_walk_ty(ty, |t| {
28-
if let ty::TyProjection(..) = t.sty {
29-
false // projections are not injective.
30-
} else {
31-
result.append(&mut parameters_for_type_shallow(t));
32-
// non-projection type constructors are injective.
33-
true
34-
}
35-
});
36-
result
23+
ty.walk()
24+
.flat_map(|ty| parameters_for_type_shallow(ty))
25+
.collect()
3726
}
3827

3928
pub fn parameters_for_trait_ref<'tcx>(trait_ref: &ty::TraitRef<'tcx>) -> Vec<Parameter> {

branches/try/src/librustdoc/html/render.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,13 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> {
456456
let did = ast_util::local_def(pid);
457457
match paths.get(&did) {
458458
Some(&(ref fqp, _)) => {
459-
// Needed to determine `self` type.
460-
let parent_basename = Some(fqp[fqp.len() - 1].clone());
461459
search_index.push(IndexItem {
462460
ty: shortty(item),
463461
name: item.name.clone().unwrap(),
464462
path: fqp[..fqp.len() - 1].connect("::"),
465463
desc: shorter(item.doc_value()),
466464
parent: Some(did),
467-
search_type: get_index_search_type(&item, parent_basename),
465+
search_type: None,
468466
});
469467
},
470468
None => {}

branches/try/src/test/compile-fail/issue-26262.rs renamed to branches/try/src/test/run-pass/issue-25679.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,21 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Check that projections don't count as constraining type parameters.
12-
13-
struct S<T>(T);
14-
15-
trait Tr { type Assoc; fn test(); }
11+
trait Device {
12+
type Resources;
13+
}
14+
struct Foo<D, R>(D, R);
1615

17-
impl<T: Tr> S<T::Assoc> {
18-
//~^ ERROR the type parameter `T` is not constrained
19-
fn foo(self, _: T) {
20-
T::test();
21-
}
16+
impl<D: Device, S> Foo<D, S> {
17+
fn present(&self) {}
2218
}
2319

24-
trait Trait1<T> { type Bar; }
25-
trait Trait2<'x> { type Foo; }
20+
struct Res;
21+
struct Dev;
2622

27-
impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T {
28-
//~^ ERROR the lifetime parameter `'a` is not constrained
29-
type Bar = &'a ();
30-
}
23+
impl Device for Dev { type Resources = Res; }
3124

32-
fn main() {}
25+
fn main() {
26+
let foo = Foo(Dev, Res);
27+
foo.present();
28+
}

0 commit comments

Comments
 (0)