Skip to content

Commit b1af0f6

Browse files
jroeschJared Roesch
authored andcommitted
---
yaml --- r: 235835 b: refs/heads/stable c: e857871 h: refs/heads/master i: 235833: 01987d9 235831: e442262 v: v3
1 parent 430980a commit b1af0f6

7 files changed

+68
-35
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 01dcb3bdf0fd779208c915d704ae634beb5c4448
32+
refs/heads/stable: e85787102fa6a7b27e1df845c07084f6a7d77fe3
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/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/stable/src/test/run-pass/default_type_parameter_struct_and_type_alias.rs renamed to branches/stable/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/stable/src/test/run-pass/default_type_parameter_default_dependent_associated_type.rs

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

branches/stable/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)