Skip to content

Rustc does display a correct error message on type missmatch but does not show line numbers #51635

Closed
@Yatekii

Description

@Yatekii

I have a case where rustc will show me properly that I have a Type missmatch.
Unfortunately it wont show me where exactly it is.

I tracked the error location down in my own code and can safely say that the code attached is the source, but I couldn't reproduce it yet.
Once I am able to reproduce it, I will report it here, but maybe someone already has a clue or similar experiences.

The faulty error report:

yatekii@partymobile:~/repos/schema_renderer$ cargo build --release
   Compiling schema_parser v0.1.0 (file:///home/yatekii/repos/schema_renderer)
error[E0308]: mismatched types
  |
  = note: expected type `euclid::TypedRect<f32, schema_parser::geometry::SchemaSpace>`
             found type `ncollide2d::bounding_volume::AABB<f32>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `schema_parser`.

To learn more, run the command again with --verbose.

And the code that triggers it:

// Error triggered by:

let bb = self.model.schema.get_bounding_box();
self.model.view_state.update_from_box_pan(bb);

// Where

pub fn get_bounding_box(&self) -> SchemaAABB {
    use ncollide2d::math::{ Point, Vector };
    let mut aabb = SchemaAABB::new(
        Point::new(0.0, 0.0),
        Point::new(0.0, 0.0)
    );
    for component in &self.drawables {
        let i = &component.instance;
        use schema_parser::helpers::Translatable;
        let bb = &i.get_boundingbox().translated(Vector::new(i.position.x, i.position.y));
        use ncollide2d::bounding_volume::BoundingVolume;
        aabb.merge(bb)
    }
    aabb
}

// and

pub fn update_from_box_pan(&mut self, rect: geometry::SchemaRect) {
    let m = (rect.max_x() - rect.min_x()).max(rect.max_y() - rect.min_y());
    if m > 0.0 {
        self.scale = 2.45 / m;
        self.center = (rect.bottom_left() + rect.top_right().to_vector()) / -2.0;
        self.update_perspective();
        println!("Rect: {}", rect);
    }
}

Rustc version is: nightly-x86_64-unknown-linux-gnu rustc 1.28.0-nightly (86a8f1a 2018-06-17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosC-bugCategory: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions