about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
-rw-r--r--compiler/rustc_builtin_macros/src/concat_idents.rs71
-rw-r--r--compiler/rustc_builtin_macros/src/errors.rs21
-rw-r--r--compiler/rustc_builtin_macros/src/lib.rs2
3 files changed, 0 insertions, 94 deletions
diff --git a/compiler/rustc_builtin_macros/src/concat_idents.rs b/compiler/rustc_builtin_macros/src/concat_idents.rs
deleted file mode 100644
index a721f5b84c5..00000000000
--- a/compiler/rustc_builtin_macros/src/concat_idents.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-use rustc_ast::ptr::P;
-use rustc_ast::token::{self, Token};
-use rustc_ast::tokenstream::{TokenStream, TokenTree};
-use rustc_ast::{AttrVec, DUMMY_NODE_ID, Expr, ExprKind, Path, Ty, TyKind};
-use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult};
-use rustc_span::{Ident, Span, Symbol};
-
-use crate::errors;
-
-pub(crate) fn expand_concat_idents<'cx>(
-    cx: &'cx mut ExtCtxt<'_>,
-    sp: Span,
-    tts: TokenStream,
-) -> MacroExpanderResult<'cx> {
-    if tts.is_empty() {
-        let guar = cx.dcx().emit_err(errors::ConcatIdentsMissingArgs { span: sp });
-        return ExpandResult::Ready(DummyResult::any(sp, guar));
-    }
-
-    let mut res_str = String::new();
-    for (i, e) in tts.iter().enumerate() {
-        if i & 1 == 1 {
-            match e {
-                TokenTree::Token(Token { kind: token::Comma, .. }, _) => {}
-                _ => {
-                    let guar = cx.dcx().emit_err(errors::ConcatIdentsMissingComma { span: sp });
-                    return ExpandResult::Ready(DummyResult::any(sp, guar));
-                }
-            }
-        } else {
-            if let TokenTree::Token(token, _) = e {
-                if let Some((ident, _)) = token.ident() {
-                    res_str.push_str(ident.name.as_str());
-                    continue;
-                }
-            }
-
-            let guar = cx.dcx().emit_err(errors::ConcatIdentsIdentArgs { span: sp });
-            return ExpandResult::Ready(DummyResult::any(sp, guar));
-        }
-    }
-
-    let ident = Ident::new(Symbol::intern(&res_str), cx.with_call_site_ctxt(sp));
-
-    struct ConcatIdentsResult {
-        ident: Ident,
-    }
-
-    impl MacResult for ConcatIdentsResult {
-        fn make_expr(self: Box<Self>) -> Option<P<Expr>> {
-            Some(P(Expr {
-                id: DUMMY_NODE_ID,
-                kind: ExprKind::Path(None, Path::from_ident(self.ident)),
-                span: self.ident.span,
-                attrs: AttrVec::new(),
-                tokens: None,
-            }))
-        }
-
-        fn make_ty(self: Box<Self>) -> Option<P<Ty>> {
-            Some(P(Ty {
-                id: DUMMY_NODE_ID,
-                kind: TyKind::Path(None, Path::from_ident(self.ident)),
-                span: self.ident.span,
-                tokens: None,
-            }))
-        }
-    }
-
-    ExpandResult::Ready(Box::new(ConcatIdentsResult { ident }))
-}
diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs
index 3a2e96a5e5a..315257d606b 100644
--- a/compiler/rustc_builtin_macros/src/errors.rs
+++ b/compiler/rustc_builtin_macros/src/errors.rs
@@ -291,27 +291,6 @@ pub(crate) struct ConcatBytesBadRepeat {
 }
 
 #[derive(Diagnostic)]
-#[diag(builtin_macros_concat_idents_missing_args)]
-pub(crate) struct ConcatIdentsMissingArgs {
-    #[primary_span]
-    pub(crate) span: Span,
-}
-
-#[derive(Diagnostic)]
-#[diag(builtin_macros_concat_idents_missing_comma)]
-pub(crate) struct ConcatIdentsMissingComma {
-    #[primary_span]
-    pub(crate) span: Span,
-}
-
-#[derive(Diagnostic)]
-#[diag(builtin_macros_concat_idents_ident_args)]
-pub(crate) struct ConcatIdentsIdentArgs {
-    #[primary_span]
-    pub(crate) span: Span,
-}
-
-#[derive(Diagnostic)]
 #[diag(builtin_macros_bad_derive_target, code = E0774)]
 pub(crate) struct BadDeriveTarget {
     #[primary_span]
diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs
index 9e7d0ec9e81..9b6dea21438 100644
--- a/compiler/rustc_builtin_macros/src/lib.rs
+++ b/compiler/rustc_builtin_macros/src/lib.rs
@@ -36,7 +36,6 @@ mod cfg_eval;
 mod compile_error;
 mod concat;
 mod concat_bytes;
-mod concat_idents;
 mod define_opaque;
 mod derive;
 mod deriving;
@@ -84,7 +83,6 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
         compile_error: compile_error::expand_compile_error,
         concat: concat::expand_concat,
         concat_bytes: concat_bytes::expand_concat_bytes,
-        concat_idents: concat_idents::expand_concat_idents,
         const_format_args: format::expand_format_args,
         core_panic: edition_panic::expand_panic,
         env: env::expand_env,