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

edition idioms: Trickiness with $crate in local macros #56683

Closed
alexcrichton opened this Issue Dec 10, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@alexcrichton
Copy link
Member

alexcrichton commented Dec 10, 2018

Originally reported with Cargo this code:

#![warn(rust_2018_compatibility)]
extern crate serde;
#[macro_use]
extern crate serde_derive;

use serde::{Deserialize, Deserializer};

macro_rules! event {
    (
        pub struct $name:ident() {}
    ) => {
        #[derive(Deserialize)]
        pub struct $name {
            pub event_type: $crate::EventType,
        }
    }
}

pub enum EventType {}

event! {
    pub struct CustomEvent() {}
}

impl<'de> Deserialize<'de> for EventType {
    fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        unimplemented!()
    }
}

gives an erroneous suggestion

which causes it to fail to be migrated by cargo fix

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 10, 2018

@ehuss also notes that #56622 may have an impact on the severity of this

@ehuss

This comment has been minimized.

Copy link
Contributor

ehuss commented Jan 1, 2019

This appears to be fixed now, presumably by #57155.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 2, 2019

Yay!

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