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

The attribute `table_name` is currently unknown to the compiler and may have meaning added to it in the future #1782

Closed
raintears opened this Issue Jul 9, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@raintears

raintears commented Jul 9, 2018

It keeps complaining about #[table_name = "users"] and I don't see what's wrong.

I have two tables in schema.rs


table! {
    school (id) {
        id -> Varchar,
        location -> Varchar,
    }
}

table! {
    users (email) {
        email -> Varchar,
        password -> Varchar,
    }
}

This is my user.rs everything looks fine to me

#[table_name = "users"]
#[derive(Serialize, Deserialize)]
pub struct User {
    pub email: String,
    pub password: String
}

It works for school.rs though

#[table_name = "schools"]
#[derive(Serialize, Deserialize)]
pub struct School {
    pub id: i32,
    pub location: String
}
@sgrif

This comment has been minimized.

Member

sgrif commented Jul 11, 2018

This is a known issue in Rust that is caused by #![feature(proc_macro)], there is nothing Diesel can do about it.

@sgrif sgrif closed this Jul 11, 2018

@sgrif

This comment has been minimized.

Member

sgrif commented Jul 11, 2018

Actually I lied, this is because you don't need any of the #[table_name] attributes you've applied. Just delete them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment