diff --git a/src/lib.rs b/src/lib.rs index 0f7ee956..979ef344 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -106,9 +106,10 @@ impl TokenStream { #[derive(Copy, Clone)] pub struct Span(imp::Span); +#[doc(hidden)] impl Default for Span { fn default() -> Span { - Span(imp::Span::default()) + Span(imp::Span::def_site()) } } @@ -116,6 +117,10 @@ impl Span { pub fn call_site() -> Span { Span(imp::Span::call_site()) } + + pub fn def_site() -> Span { + Span(imp::Span::def_site()) + } } #[derive(Clone, Debug)] diff --git a/src/stable.rs b/src/stable.rs index 911d6488..8277d4c3 100644 --- a/src/stable.rs +++ b/src/stable.rs @@ -137,13 +137,17 @@ impl IntoIterator for TokenStream { } } -#[derive(Clone, Copy, Default, Debug)] +#[derive(Clone, Copy, Debug)] pub struct Span; impl Span { pub fn call_site() -> Span { Span } + + pub fn def_site() -> Span { + Span + } } #[derive(Copy, Clone)] diff --git a/src/unstable.rs b/src/unstable.rs index a3ce1fd8..6705fb59 100644 --- a/src/unstable.rs +++ b/src/unstable.rs @@ -166,10 +166,8 @@ impl Span { pub fn call_site() -> Span { Span(proc_macro::Span::call_site()) } -} -impl Default for Span { - fn default() -> Span { + pub fn def_site() -> Span { Span(proc_macro::Span::def_site()) } }