Skip to content

Commit f3cf7d4

Browse files
jroeschJared Roesch
authored andcommitted
---
yaml --- r: 228764 b: refs/heads/try c: e857871 h: refs/heads/master v: v3
1 parent 311c95c commit f3cf7d4

7 files changed

+68
-35
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: 01dcb3bdf0fd779208c915d704ae634beb5c4448
4+
refs/heads/try: e85787102fa6a7b27e1df845c07084f6a7d77fe3
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/check/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,11 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
11411141

11421142
fn ty_infer(&self, ty_param_def: Option<ty::TypeParameterDef<'tcx>>, span: Span) -> Ty<'tcx> {
11431143
let default = ty_param_def.and_then(|t|
1144-
t.default.map(|ty| type_variable::Default { ty: ty, origin_span: span, definition_span: span }));
1144+
t.default.map(|ty| type_variable::Default {
1145+
ty: ty,
1146+
origin_span: span,
1147+
definition_span: span
1148+
}));
11451149
self.infcx().next_ty_var_with_default(default)
11461150
}
11471151

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
use std::marker::PhantomData;
12+
13+
trait Id {
14+
type This;
15+
}
16+
17+
impl<A> Id for A {
18+
type This = A;
19+
}
20+
21+
struct Foo<X: Default = usize, Y = <X as Id>::This> {
22+
data: PhantomData<(X, Y)>
23+
}
24+
25+
impl<X: Default, Y> Foo<X, Y> {
26+
fn new() -> Foo<X, Y> {
27+
Foo { data: PhantomData }
28+
}
29+
}
30+
31+
fn main() {
32+
let foo = Foo::new();
33+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
12+
use std::marker::PhantomData;
13+
14+
struct Foo<T,U=T> { data: PhantomData<(T, U)> }
15+
16+
fn main() {
17+
let foo = Foo { data: PhantomData };
18+
}

branches/try/src/test/run-pass/default_type_parameter_struct_and_type_alias.rs renamed to branches/try/src/test/run-pass/default_ty_param_struct_and_type_alias.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
use std::marker::PhantomData;
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+
//
211

3-
trait TypeEq<A> {}
4-
impl<A> TypeEq<A> for A {}
12+
use std::marker::PhantomData;
513

614
struct DeterministicHasher;
715
struct RandomHasher;

branches/try/src/test/run-pass/default_type_parameter_default_dependent_associated_type.rs

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

branches/try/src/test/run-pass/default_type_parameter_dependent_defaults.rs

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

0 commit comments

Comments
 (0)