Skip to content

Cannot implement simple trait #15316

Closed
Closed
@mdias

Description

@mdias

I've got a simple trait that isn't being implemented somehow, and that compiles fine even though it shouldn't:

MyProject/MyFramework/base.rs

pub trait Base
{
    fn run(&self);
}

MyProject/MyFramework/mod.rs

pub use self::base::Base;

mod base;

MyProject/MyApp/main.rs

#[path="../MyFramework/mod.rs"]
mod myFramework;

struct MyApp;

impl myFramework::Base for MyApp
{
    // notice that there's no implementation for run()
}

fn main()
{
}

This compiles fine even though it shouldn't.
If I put the trait declaration inside the main.rs file, the compiler outputs the proper error, as expected.
Also, if I create an instance of MyApp inside main() and try to call Run() it says the type doesn't have that method, which I believe is because the trait isn't being implemented at all, hence no errors compiling...

I'm sorry if I should be more descriptive, but this is my first time trying rust and I don't know what else is important.

[edit]
I compiled rust from git, revision ff94f86.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions