Skip to content

Commit e935301

Browse files
committed
Remove two cases of unecesary match branches
1 parent f6e62ac commit e935301

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
@@ -193,8 +193,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
193193
match ret_ty.sty {
194194
// `~` pointer return values never alias because ownership
195195
// is transferred
196-
ty::ty_uniq(it) if !common::type_is_sized(ccx.tcx(), it) => {}
197-
ty::ty_uniq(_) => {
196+
ty::ty_uniq(it) if common::type_is_sized(ccx.tcx(), it) => {
198197
attrs.ret(llvm::NoAliasAttribute);
199198
}
200199
_ => {}
@@ -203,9 +202,8 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
203202
// We can also mark the return value as `dereferenceable` in certain cases
204203
match ret_ty.sty {
205204
// These are not really pointers but pairs, (pointer, len)
206-
ty::ty_uniq(it) |
207-
ty::ty_rptr(_, ty::mt { ty: it, .. }) if !common::type_is_sized(ccx.tcx(), it) => {}
208-
ty::ty_uniq(inner) | ty::ty_rptr(_, ty::mt { ty: inner, .. }) => {
205+
ty::ty_rptr(_, ty::mt { ty: inner, .. })
206+
| ty::ty_uniq(inner) if common::type_is_sized(ccx.tcx(), inner) => {
209207
let llret_sz = machine::llsize_of_real(ccx, type_of::type_of(ccx, inner));
210208
attrs.ret(llvm::DereferenceableAttribute(llret_sz));
211209
}

0 commit comments

Comments
 (0)