diff options
| author | bors <bors@rust-lang.org> | 2024-03-21 13:28:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-21 13:28:59 +0000 |
| commit | 2627e9f3012a97d3136b3e11bf6bd0853c38a534 (patch) | |
| tree | a31d7bc829f5121aa89a9442fa6084f79bf84bdb /compiler/rustc_builtin_macros/src | |
| parent | 03994e498df79aa1f97f7bbcfd52d57c8e865049 (diff) | |
| parent | 62e414d3af8ad08aec8c4a0a29e2de1265944592 (diff) | |
| download | rust-2627e9f3012a97d3136b3e11bf6bd0853c38a534.tar.gz rust-2627e9f3012a97d3136b3e11bf6bd0853c38a534.zip | |
Auto merge of #122822 - matthiaskrgr:rollup-rjgmnbe, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #122222 (deref patterns: bare-bones feature gate and typechecking) - #122358 (Don't ICE when encountering bound regions in generator interior type) - #122696 (Add bare metal riscv32 target.) - #122773 (make "expected paren or brace" error translatable) - #122795 (Inherit `RUSTC_BOOTSTRAP` when testing wasm) - #122799 (Replace closures with `_` when suggesting fully qualified path for method call) - #122801 (Fix misc printing issues in emit=stable_mir) - #122806 (Make `type_ascribe!` not a built-in) Failed merges: - #122771 (add some comments to hir::ModuleItems) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/type_ascribe.rs | 35 |
2 files changed, 0 insertions, 37 deletions
diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index f344dbcd10c..554dac0852f 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -49,7 +49,6 @@ mod log_syntax; mod source_util; mod test; mod trace_macros; -mod type_ascribe; mod util; pub mod asm; @@ -99,7 +98,6 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) { std_panic: edition_panic::expand_panic, stringify: source_util::expand_stringify, trace_macros: trace_macros::expand_trace_macros, - type_ascribe: type_ascribe::expand_type_ascribe, unreachable: edition_panic::expand_unreachable, // tidy-alphabetical-end } diff --git a/compiler/rustc_builtin_macros/src/type_ascribe.rs b/compiler/rustc_builtin_macros/src/type_ascribe.rs deleted file mode 100644 index f3e66ffc759..00000000000 --- a/compiler/rustc_builtin_macros/src/type_ascribe.rs +++ /dev/null @@ -1,35 +0,0 @@ -use rustc_ast::ptr::P; -use rustc_ast::tokenstream::TokenStream; -use rustc_ast::{token, Expr, ExprKind, Ty}; -use rustc_errors::PResult; -use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult}; -use rustc_span::Span; - -pub fn expand_type_ascribe( - cx: &mut ExtCtxt<'_>, - span: Span, - tts: TokenStream, -) -> MacroExpanderResult<'static> { - let (expr, ty) = match parse_ascribe(cx, tts) { - Ok(parsed) => parsed, - Err(err) => { - let guar = err.emit(); - return ExpandResult::Ready(DummyResult::any(span, guar)); - } - }; - - let asc_expr = cx.expr(span, ExprKind::Type(expr, ty)); - - ExpandResult::Ready(MacEager::expr(asc_expr)) -} - -fn parse_ascribe<'a>(cx: &mut ExtCtxt<'a>, stream: TokenStream) -> PResult<'a, (P<Expr>, P<Ty>)> { - let mut parser = cx.new_parser_from_tts(stream); - - let expr = parser.parse_expr()?; - parser.expect(&token::Comma)?; - - let ty = parser.parse_ty()?; - - Ok((expr, ty)) -} |
