diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index eace22d63f4f..dddcff4c6dd1 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -372,7 +372,7 @@ impl<'a, 'b> Rustc<'a, 'b> { fn lit(&mut self, kind: token::LitKind, symbol: Symbol, suffix: Option) -> Literal { Literal { lit: token::Lit::new(kind, symbol, suffix), - span: server::Context::call_site(self), + span: server::Server::call_site(self), } } } @@ -550,7 +550,7 @@ impl server::Group for Rustc<'_, '_> { Group { delimiter, stream: stream.unwrap_or_default(), - span: DelimSpan::from_single(server::Context::call_site(self)), + span: DelimSpan::from_single(server::Server::call_site(self)), flatten: false, } } @@ -582,7 +582,7 @@ impl server::Group for Rustc<'_, '_> { impl server::Punct for Rustc<'_, '_> { fn new(&mut self, ch: char, spacing: Spacing) -> Self::Punct { - Punct::new(ch, spacing == Spacing::Joint, server::Context::call_site(self)) + Punct::new(ch, spacing == Spacing::Joint, server::Server::call_site(self)) } fn as_char(&mut self, punct: Self::Punct) -> char { @@ -918,7 +918,7 @@ impl server::Span for Rustc<'_, '_> { } } -impl server::Context for Rustc<'_, '_> { +impl server::Server for Rustc<'_, '_> { fn def_site(&mut self) -> Self::Span { self.def_site } diff --git a/library/proc_macro/src/bridge/server.rs b/library/proc_macro/src/bridge/server.rs index d9a6ce81e4e7..debcffc6f79a 100644 --- a/library/proc_macro/src/bridge/server.rs +++ b/library/proc_macro/src/bridge/server.rs @@ -30,13 +30,6 @@ macro_rules! associated_fn { ($($item:tt)*) => ($($item)*;) } -/// Helper methods defined by `Server` types not invoked over RPC. -pub trait Context: Types { - fn def_site(&mut self) -> Self::Span; - fn call_site(&mut self) -> Self::Span; - fn mixed_site(&mut self) -> Self::Span; -} - macro_rules! declare_server_traits { ($($name:ident { $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)* @@ -45,23 +38,26 @@ macro_rules! declare_server_traits { $(associated_fn!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)?);)* })* - pub trait Server: Types + Context $(+ $name)* {} - impl Server for S {} + pub trait Server: Types $(+ $name)* { + fn def_site(&mut self) -> Self::Span; + fn call_site(&mut self) -> Self::Span; + fn mixed_site(&mut self) -> Self::Span; + } } } with_api!(Self, self_, declare_server_traits); pub(super) struct MarkedTypes(S); -impl Context for MarkedTypes { +impl Server for MarkedTypes { fn def_site(&mut self) -> Self::Span { - <_>::mark(Context::def_site(&mut self.0)) + <_>::mark(Server::def_site(&mut self.0)) } fn call_site(&mut self) -> Self::Span { - <_>::mark(Context::call_site(&mut self.0)) + <_>::mark(Server::call_site(&mut self.0)) } fn mixed_site(&mut self) -> Self::Span { - <_>::mark(Context::mixed_site(&mut self.0)) + <_>::mark(Server::mixed_site(&mut self.0)) } }