Skip to content

Commit ea007bf

Browse files
committed
Clean up test cases
1 parent 1a0629f commit ea007bf

6 files changed

+67
-34
lines changed

src/librustc_typeck/check/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,11 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
11351135

11361136
fn ty_infer(&self, ty_param_def: Option<ty::TypeParameterDef<'tcx>>, span: Span) -> Ty<'tcx> {
11371137
let default = ty_param_def.and_then(|t|
1138-
t.default.map(|ty| type_variable::Default { ty: ty, origin_span: span, definition_span: span }));
1138+
t.default.map(|ty| type_variable::Default {
1139+
ty: ty,
1140+
origin_span: span,
1141+
definition_span: span
1142+
}));
11391143
self.infcx().next_ty_var_with_default(default)
11401144
}
11411145

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+
}
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+
}

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

+11-3
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;

src/test/run-pass/default_type_parameter_default_dependent_associated_type.rs

-23
This file was deleted.

src/test/run-pass/default_type_parameter_dependent_defaults.rs

-7
This file was deleted.

0 commit comments

Comments
 (0)