Skip to content

Commit ea04cdf

Browse files
committed
Remove two cases of unecesary match branches
1 parent d8d59a9 commit ea04cdf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/librustc_trans/trans/attributes.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
189189
match ret_ty.sty {
190190
// `~` pointer return values never alias because ownership
191191
// is transferred
192-
ty::ty_uniq(it) if !common::type_is_sized(ccx.tcx(), it) => {}
193-
ty::ty_uniq(_) => {
192+
ty::ty_uniq(it) if common::type_is_sized(ccx.tcx(), it) => {
194193
attrs.ret(llvm::NoAliasAttribute);
195194
}
196195
_ => {}
@@ -199,9 +198,8 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
199198
// We can also mark the return value as `dereferenceable` in certain cases
200199
match ret_ty.sty {
201200
// These are not really pointers but pairs, (pointer, len)
202-
ty::ty_uniq(it) |
203-
ty::ty_rptr(_, ty::mt { ty: it, .. }) if !common::type_is_sized(ccx.tcx(), it) => {}
204-
ty::ty_uniq(inner) | ty::ty_rptr(_, ty::mt { ty: inner, .. }) => {
201+
ty::ty_rptr(_, ty::mt { ty: inner, .. })
202+
| ty::ty_uniq(inner) if common::type_is_sized(ccx.tcx(), inner) => {
205203
let llret_sz = machine::llsize_of_real(ccx, type_of::type_of(ccx, inner));
206204
attrs.ret(llvm::DereferenceableAttribute(llret_sz));
207205
}

0 commit comments

Comments
 (0)