Skip to content

Commit d4a82cc

Browse files
committed
Remove all union stuffs
The rustc's PR wasn't merged. Hopefully this commit can simply be reverted when it's time.
1 parent 52ae0d4 commit d4a82cc

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

clippy_lints/src/derive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
141141
}
142142

143143
match ty.sty {
144-
TypeVariants::TyUnion(..) => return,
144+
//FIXME:unions: TypeVariants::TyUnion(..) => return,
145145

146146
// Some types are not Clone by default but could be cloned “by hand” if necessary
147147
TypeVariants::TyEnum(def, substs) |

clippy_lints/src/len_zero.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
209209
}
210210
ty::TyProjection(_) => ty.ty_to_def_id().map_or(false, |id| has_is_empty_impl(cx, &id)),
211211
ty::TyEnum(id, _) |
212-
ty::TyStruct(id, _) |
213-
ty::TyUnion(id, _) => has_is_empty_impl(cx, &id.did),
212+
ty::TyStruct(id, _) /*FIXME:unions: |
213+
ty::TyUnion(id, _)*/ => has_is_empty_impl(cx, &id.did),
214214
ty::TyArray(..) | ty::TyStr => true,
215215
_ => false,
216216
}

clippy_lints/src/missing_doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl LateLintPass for MissingDoc {
123123
hir::ItemStruct(..) => "a struct",
124124
hir::ItemTrait(..) => "a trait",
125125
hir::ItemTy(..) => "a type alias",
126-
hir::ItemUnion(..) => "a union",
126+
//FIXME:unions: hir::ItemUnion(..) => "a union",
127127
hir::ItemDefaultImpl(..) |
128128
hir::ItemExternCrate(..) |
129129
hir::ItemForeignMod(..) |

tests/compile-fail/derive.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(plugin)]
22
#![plugin(clippy)]
33

4-
#![feature(untagged_unions)]
4+
//FIXME:unions: #![feature(untagged_unions)]
55

66
#![deny(warnings)]
77
#![allow(dead_code)]
@@ -47,6 +47,7 @@ impl Clone for Qux {
4747
fn clone(&self) -> Self { Qux }
4848
}
4949

50+
/* FIXME:unions
5051
// looks like unions don't support deriving Clone for now
5152
#[derive(Copy)]
5253
union Union {
@@ -60,6 +61,7 @@ impl Clone for Union {
6061
}
6162
}
6263
}
64+
*/
6365

6466
// See #666
6567
#[derive(Copy)]

tests/compile-fail/no_effect.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![deny(no_effect, unnecessary_operation)]
55
#![allow(dead_code)]
66
#![allow(path_statements)]
7-
#![feature(untagged_unions)]
7+
//FIXME:unions #![feature(untagged_unions)]
88

99
struct Unit;
1010
struct Tuple(i32);
@@ -16,10 +16,12 @@ enum Enum {
1616
Struct { field: i32 },
1717
}
1818

19+
/*FIXME:unions:
1920
union Union {
2021
a: u8,
2122
b: f64,
2223
}
24+
*/
2325

2426
fn get_number() -> i32 { 0 }
2527
fn get_struct() -> Struct { Struct { field: 0 } }
@@ -36,7 +38,7 @@ fn main() {
3638
Tuple(0); //~ERROR statement with no effect
3739
Struct { field: 0 }; //~ERROR statement with no effect
3840
Struct { ..s }; //~ERROR statement with no effect
39-
Union { a: 0 }; //~ERROR statement with no effect
41+
//FIXME:unions: Union { a: 0 }; // /**FIXME*~***/ ERROR statement with no effect
4042
Enum::Tuple(0); //~ERROR statement with no effect
4143
Enum::Struct { field: 0 }; //~ERROR statement with no effect
4244
5 + 6; //~ERROR statement with no effect

0 commit comments

Comments
 (0)