Skip to content

Commit 177251b

Browse files
committed
make it compile in stage2
1 parent 1e9ed94 commit 177251b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/librustc_typeck/check/cast.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ pub struct CastCheck<'tcx> {
5656
span: Span,
5757
}
5858

59-
#[derive(Copy, PartialEq, Eq)]
59+
#[derive(Copy, Clone, PartialEq, Eq)]
6060
enum IntTy {
6161
U(ast::UintTy),
6262
I
6363
}
6464

6565
// Valid types for the result of a non-coercion cast
66-
#[derive(Copy, PartialEq, Eq)]
66+
#[derive(Copy, Clone, PartialEq, Eq)]
6767
enum ETy<'tcx> {
6868
CEnum,
6969
Int(IntTy),
@@ -94,7 +94,7 @@ impl<'tcx> ETy<'tcx> {
9494
}
9595
}
9696

97-
#[derive(Copy, PartialEq, Eq)]
97+
#[derive(Copy, Clone, PartialEq, Eq)]
9898
enum UnsizeKind {
9999
Vtable,
100100
Length
@@ -118,7 +118,7 @@ fn unsize_kind<'a,'tcx>(fcx: &FnCtxt<'a, 'tcx>,
118118
}
119119
}
120120

121-
#[derive(Copy)]
121+
#[derive(Copy, Clone)]
122122
enum CastError {
123123
CastToBool,
124124
CastToChar,

src/test/run-pass/cast-rfc0401.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ fn main()
6060
assert_eq!(1 as f64, 1f64);
6161

6262
assert_eq!(l as f64, 9264081114510712022f64);
63-
// assert_eq!(l as f32 as i64 as u64, 9264082620822882088u64);
63+
6464
assert_eq!(l as i64 as f64, -9182662959198838444f64);
65+
// float overflow : needs fixing
66+
// assert_eq!(l as f32 as i64 as u64, 9264082620822882088u64);
6567
// assert_eq!(l as i64 as f32 as i64, 9182664080220408446i64);
6668

6769
assert_eq!(4294967040f32 as u32, 0xffffff00u32);
@@ -72,9 +74,9 @@ fn main()
7274

7375
// enum-cast
7476
assert_eq!(Simple::A as u8, 0);
75-
// assert_eq!(Simple::A as bool, false);
77+
assert_eq!(Simple::A as bool, false);
7678
assert_eq!(Simple::B as u8, 1);
77-
// assert_eq!(Simple::B as bool, true);
79+
assert_eq!(Simple::B as bool, true);
7880

7981
assert_eq!(Valued::H8 as i8, -93);
8082
assert_eq!(Valued::H7 as i8, 67);

0 commit comments

Comments
 (0)