diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs index d9afc1df28ebf..99c2d636115b0 100644 --- a/src/test/auxiliary/macro_crate_test.rs +++ b/src/test/auxiliary/macro_crate_test.rs @@ -32,7 +32,6 @@ macro_rules! unexported_macro { () => (3) } #[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"), @@ -94,29 +93,4 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt, } } -fn expand_forged_ident(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { - 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() {} diff --git a/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs b/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs deleted file mode 100644 index fd1deffb59d4d..0000000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs +++ /dev/null @@ -1,28 +0,0 @@ -// 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 or the MIT license -// , 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!()); -} diff --git a/src/test/run-make/cannot-read-embedded-idents/Makefile b/src/test/run-make/cannot-read-embedded-idents/Makefile deleted file mode 100644 index 0d047be02ca1d..0000000000000 --- a/src/test/run-make/cannot-read-embedded-idents/Makefile +++ /dev/null @@ -1,28 +0,0 @@ --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)" diff --git a/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs b/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs deleted file mode 100644 index 89352a16d8ba2..0000000000000 --- a/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs +++ /dev/null @@ -1,44 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::env; -use std::old_io::{File, Command}; - -// 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 = 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_str("pub fn main() { - let \x00name_0,ctxt_0\x00 = 3; - println!(\"{}\", \x00name_0,ctxt_0\x00); - }"); - - // 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.as_str() - .unwrap())) - .output().unwrap(); - let err = String::from_utf8_lossy(&result.error); - - // positive test so that this test will be updated when the - // compiler changes. - assert!(err.contains("unknown start of token")) -}