File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,12 @@ impl LlvmType for Reg {
127127impl LlvmType for CastTarget {
128128 fn llvm_type ( & self , cx : & CodegenCx ) -> Type {
129129 let rest_ll_unit = self . rest . unit . llvm_type ( cx) ;
130- let rest_count = self . rest . total . bytes ( ) / self . rest . unit . size . bytes ( ) ;
131- let rem_bytes = self . rest . total . bytes ( ) % self . rest . unit . size . bytes ( ) ;
130+ let ( rest_count, rem_bytes) = if self . rest . unit . size . bytes ( ) == 0 {
131+ ( 0 , 0 )
132+ } else {
133+ ( self . rest . total . bytes ( ) / self . rest . unit . size . bytes ( ) ,
134+ self . rest . total . bytes ( ) % self . rest . unit . size . bytes ( ) )
135+ } ;
132136
133137 if self . prefix . iter ( ) . all ( |x| x. is_none ( ) ) {
134138 // Simplify to a single unit when there is no prefix and size <= unit size
Original file line number Diff line number Diff line change 1+ // Copyright 2017 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+ // Confirm that we don't accidently divide or mod by zero in llvm_type
12+
13+ // compile-pass
14+
15+ #![ feature( test) ]
16+
17+ mod a {
18+ pub trait A { }
19+ }
20+
21+ mod b {
22+ pub struct Builder { }
23+
24+ pub fn new ( ) -> Builder {
25+ Builder { }
26+ }
27+
28+ impl Builder {
29+ pub fn with_a ( & mut self , _a : fn ( ) -> :: a:: A ) { }
30+ }
31+ }
32+
33+ pub use self :: b:: new;
34+
35+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments