Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE when using + or - instead of named methods of Num #3790

Closed
burg opened this issue Oct 17, 2012 · 2 comments
Closed

ICE when using + or - instead of named methods of Num #3790

burg opened this issue Oct 17, 2012 · 2 comments
Labels
A-traits Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@burg
Copy link

burg commented Oct 17, 2012

Test case: https://github.com/pcwalton/rust-geom/blob/master/rect.rs

This is really simple code. If any of the .add (say, in union or intersect) are changed to +, then compilation is terminated with an internal compiler error.

@burg
Copy link
Author

burg commented Oct 17, 2012

This bug blocks progress on Servo's inline layout.

This seems to be triggered even without + or -. Either of the two (correct) Rect::union implementations below will ICE, while the (wrong) one linked above works:

    pure fn union(other: &Rect<T>) -> Rect<T> {   
        let upper_left = Point2D(min(self.origin.x, other.origin.x),
                                 min(self.origin.y, other.origin.y));

        let lower_right = Point2D(max(self.origin.x + self.size.width,
                                     other.origin.x + other.size.width,
                                  max(self.origin.y + self.size.height,
                                     other.origin.y + other.size.height));

        Rect {
            origin: upper_left,
            size: Size2D(lower_right.x - upper_left.x, lower_right.y - upper_left.y))
        }
    }

Also broken (all vars inlined, no + or -):

    pure fn union(other: &Rect<T>) -> Rect<T> {   
        Rect {
            origin: Point2D(min(self.origin.x, other.origin.x),
                            min(self.origin.y, other.origin.y)),
            size:   Size2D(max(self.origin.x.add(&self.size.width),
                               other.origin.x.add(&other.size.width).sub(&min(self.origin.x, other.origin.x))),
                           max(self.origin.y.add(&self.size.height),
                               other.origin.y.add(&other.size.height).sub(&min(self.origin.y, other.origin.y))))
        }
    }

@burg
Copy link
Author

burg commented Oct 17, 2012

Servo is unblocked, but still changing any .add to + will cause an ICE.

@pcwalton pcwalton closed this as completed Dec 4, 2012
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 5, 2024
use a Miri-specific folder for ui tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants