Skip to content

Commit 99987fa

Browse files
committed
---
yaml --- r: 227518 b: refs/heads/try c: c656e99 h: refs/heads/master v: v3
1 parent 6aec77d commit 99987fa

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
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: 6cdccc5a78fac61d68fc04d342b999e69df149ac
4+
refs/heads/try: c656e99e435aadc852057a4c71832c03051cfb2e
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ pub use funcs::bsd43::*;
146146
#[link(name = "m")]
147147
extern {}
148148

149-
#[cfg(all(target_env = "musl", not(test)))]
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)))]
150153
#[link(name = "c", kind = "static")]
151154
extern {}
152155

branches/try/src/librustc_typeck/constrained_type_params.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,21 @@ 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).
2225
pub fn parameters_for_type<'tcx>(ty: Ty<'tcx>) -> Vec<Parameter> {
23-
ty.walk()
24-
.flat_map(|ty| parameters_for_type_shallow(ty))
25-
.collect()
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
2637
}
2738

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,15 @@ 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());
459461
search_index.push(IndexItem {
460462
ty: shortty(item),
461463
name: item.name.clone().unwrap(),
462464
path: fqp[..fqp.len() - 1].connect("::"),
463465
desc: shorter(item.doc_value()),
464466
parent: Some(did),
465-
search_type: None,
467+
search_type: get_index_search_type(&item, parent_basename),
466468
});
467469
},
468470
None => {}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
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(); }
16+
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+
}
22+
}
23+
24+
trait Trait1<T> { type Bar; }
25+
trait Trait2<'x> { type Foo; }
26+
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+
}
31+
32+
fn main() {}

0 commit comments

Comments
 (0)