Such things no longer exist.
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("make_a_1", expand_make_a_1);
- reg.register_macro("forged_ident", expand_forged_ident);
reg.register_macro("identity", expand_identity);
reg.register_syntax_extension(
token::intern("into_foo"),
}
}
-fn expand_forged_ident(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacResult+'static> {
- use syntax::ext::quote::rt::*;
-
- if !tts.is_empty() {
- cx.span_fatal(sp, "forged_ident takes no arguments");
- }
-
- // Most of this is modelled after the expansion of the `quote_expr!`
- // macro ...
- let parse_sess = cx.parse_sess();
- let cfg = cx.cfg();
-
- // ... except this is where we inject a forged identifier,
- // and deliberately do not call `cx.parse_tts_with_hygiene`
- // (because we are testing that this will be *rejected*
- // by the default parser).
-
- let expr = {
- let tt = cx.parse_tts("\x00name_2,ctxt_0\x00".to_string());
- let mut parser = new_parser_from_tts(parse_sess, cfg, tt);
- parser.parse_expr()
- };
- MacEager::expr(expr)
-}
-
pub fn foo() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:macro_crate_test.rs
-// ignore-stage1
-// error-pattern: unknown start of token: \u{0}
-
-// Issue #15750 and #15962 : this test is checking that the standard
-// parser rejects embedded idents. pnkfelix did not want to attempt
-// to make a test file that itself used the embedded ident input form,
-// since he worried that would be difficult to work with in many text
-// editors, so instead he made a macro that expands into the embedded
-// ident form.
-
-#![feature(plugin)]
-#![plugin(macro_crate_test)]
-
-fn main() {
- let x = 0;
- assert_eq!(3, forged_ident!());
-}
+++ /dev/null
--include ../tools.mk
-
-# Issue #15750, #15962 : This test ensures that our special embedded
-# ident syntax hack is not treated as legitimate input by the lexer in
-# normal mode.
-#
-# It is modelled after the `unicode-input/` test, since we need to
-# create files with syntax that can trip up normal text editting tools
-# (namely text with embedded nul-bytes).
-
-# This test attempts to run rustc itself from the compiled binary; but
-# that means that you need to set the LD_LIBRARY_PATH for rustc itself
-# while running create_and_compile, and that won't work for stage1.
-
-# FIXME ignore windows
-ifndef IS_WINDOWS
-ifeq ($(RUST_BUILD_STAGE),1)
-DOTEST=
-else
-DOTEST=dotest
-endif
-endif
-
-all: $(DOTEST)
-
-dotest:
- $(RUSTC) create_and_compile.rs
- $(call RUN,create_and_compile) "$(RUSTC)" "$(TMPDIR)"
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::env;
-use std::fs::File;
-use std::process::Command;
-use std::io::Write;
-use std::path::Path;
-
-// creates broken.rs, which has the Ident \x00name_0,ctxt_0\x00
-// embedded within it, and then attempts to compile broken.rs with the
-// provided `rustc`
-
-fn main() {
- let args: Vec<String> = env::args().collect();
- let rustc = &args[1];
- let tmpdir = Path::new(&args[2]);
-
- let main_file = tmpdir.join("broken.rs");
- let _ = File::create(&main_file).unwrap()
- .write_all(b"pub fn main() {
- let \x00name_0,ctxt_0\x00 = 3;
- println!(\"{}\", \x00name_0,ctxt_0\x00);
- }").unwrap();
-
- // rustc is passed to us with --out-dir and -L etc., so we
- // can't exec it directly
- let result = Command::new("sh")
- .arg("-c")
- .arg(&format!("{} {}", rustc, main_file.display()))
- .output().unwrap();
- let err = String::from_utf8_lossy(&result.stderr);
-
- // positive test so that this test will be updated when the
- // compiler changes.
- assert!(err.contains("unknown start of token"))
-}