From 17ec2900816a205da424e8eabda918d280ef25cb Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 2 Dec 2018 22:42:43 +0300 Subject: Move compile-fail-fulldeps tests to ui-fulldeps --- .../auxiliary/attr_plugin_test.rs | 31 ---- .../auxiliary/lint_for_crate.rs | 47 ------ .../auxiliary/lint_group_plugin_test.rs | 51 ------- .../auxiliary/lint_plugin_test.rs | 48 ------- .../auxiliary/macro_crate_test.rs | 159 --------------------- .../auxiliary/macro_reexport_1.rs | 15 -- .../auxiliary/pub_and_stability.rs | 143 ------------------ .../auxiliary/rlib_crate_test.rs | 22 --- .../auxiliary/use_from_trait_xc.rs | 40 ------ .../dropck_tarena_cycle_checked.rs | 127 ---------------- .../dropck_tarena_unsound_drop.rs | 53 ------- .../compile-fail-fulldeps/explore-issue-38412.rs | 77 ---------- src/test/compile-fail-fulldeps/gated-plugin.rs | 16 --- src/test/compile-fail-fulldeps/gated-quote.rs | 67 --------- src/test/compile-fail-fulldeps/issue-15778-fail.rs | 18 --- src/test/compile-fail-fulldeps/issue-18986.rs | 20 --- src/test/compile-fail-fulldeps/issue-48941.rs | 26 ---- .../lint-group-plugin-deny-cmdline.rs | 25 ---- .../compile-fail-fulldeps/lint-plugin-deny-attr.rs | 22 --- .../lint-plugin-deny-cmdline.rs | 22 --- .../lint-plugin-forbid-cmdline.rs | 23 --- .../macro-crate-doesnt-resolve.rs | 18 --- src/test/compile-fail-fulldeps/macro-crate-rlib.rs | 19 --- .../macro-crate-unexported-macro.rs | 19 --- .../compile-fail-fulldeps/no-link-unknown-crate.rs | 14 -- .../plugin-as-extern-crate.rs | 22 --- .../plugin-attr-register-deny.rs | 30 ---- .../plugin-plus-extern-crate.rs | 27 ---- src/test/compile-fail-fulldeps/qquote.rs | 37 ----- src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs | 31 ++++ src/test/ui-fulldeps/auxiliary/lint_for_crate.rs | 47 ++++++ src/test/ui-fulldeps/auxiliary/macro_crate_test.rs | 159 +++++++++++++++++++++ src/test/ui-fulldeps/auxiliary/macro_reexport_1.rs | 15 ++ .../ui-fulldeps/auxiliary/pub_and_stability.rs | 143 ++++++++++++++++++ src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs | 22 +++ .../ui-fulldeps/auxiliary/use_from_trait_xc.rs | 40 ++++++ .../ui-fulldeps/dropck_tarena_cycle_checked.rs | 127 ++++++++++++++++ .../ui-fulldeps/dropck_tarena_cycle_checked.stderr | 13 ++ src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs | 53 +++++++ .../ui-fulldeps/dropck_tarena_unsound_drop.stderr | 13 ++ src/test/ui-fulldeps/explore-issue-38412.rs | 77 ++++++++++ src/test/ui-fulldeps/explore-issue-38412.stderr | 132 +++++++++++++++++ src/test/ui-fulldeps/gated-plugin.rs | 16 +++ src/test/ui-fulldeps/gated-plugin.stderr | 11 ++ src/test/ui-fulldeps/gated-quote.rs | 67 +++++++++ src/test/ui-fulldeps/gated-quote.stderr | 80 +++++++++++ src/test/ui-fulldeps/issue-15778-fail.rs | 18 +++ src/test/ui-fulldeps/issue-15778-fail.stderr | 13 ++ src/test/ui-fulldeps/issue-18986.rs | 20 +++ src/test/ui-fulldeps/issue-18986.stderr | 9 ++ src/test/ui-fulldeps/issue-48941.rs | 26 ++++ src/test/ui-fulldeps/issue-48941.stderr | 14 ++ .../ui-fulldeps/lint-group-plugin-deny-cmdline.rs | 25 ++++ .../lint-group-plugin-deny-cmdline.stderr | 18 +++ src/test/ui-fulldeps/lint-plugin-deny-attr.rs | 22 +++ src/test/ui-fulldeps/lint-plugin-deny-attr.stderr | 14 ++ src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs | 22 +++ .../ui-fulldeps/lint-plugin-deny-cmdline.stderr | 10 ++ src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs | 23 +++ .../ui-fulldeps/lint-plugin-forbid-cmdline.stderr | 19 +++ src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs | 18 +++ .../ui-fulldeps/macro-crate-doesnt-resolve.stderr | 9 ++ src/test/ui-fulldeps/macro-crate-rlib.rs | 19 +++ src/test/ui-fulldeps/macro-crate-rlib.stderr | 9 ++ .../ui-fulldeps/macro-crate-unexported-macro.rs | 19 +++ .../macro-crate-unexported-macro.stderr | 8 ++ src/test/ui-fulldeps/no-link-unknown-crate.rs | 14 ++ src/test/ui-fulldeps/no-link-unknown-crate.stderr | 9 ++ src/test/ui-fulldeps/plugin-as-extern-crate.rs | 22 +++ src/test/ui-fulldeps/plugin-as-extern-crate.stderr | 14 ++ src/test/ui-fulldeps/plugin-attr-register-deny.rs | 30 ++++ .../ui-fulldeps/plugin-attr-register-deny.stderr | 26 ++++ src/test/ui-fulldeps/plugin-plus-extern-crate.rs | 27 ++++ .../ui-fulldeps/plugin-plus-extern-crate.stderr | 14 ++ src/test/ui-fulldeps/qquote.rs | 37 +++++ src/test/ui-fulldeps/qquote.stderr | 9 ++ 76 files changed, 1583 insertions(+), 1238 deletions(-) delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs delete mode 100644 src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs delete mode 100644 src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs delete mode 100644 src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs delete mode 100644 src/test/compile-fail-fulldeps/explore-issue-38412.rs delete mode 100644 src/test/compile-fail-fulldeps/gated-plugin.rs delete mode 100644 src/test/compile-fail-fulldeps/gated-quote.rs delete mode 100644 src/test/compile-fail-fulldeps/issue-15778-fail.rs delete mode 100644 src/test/compile-fail-fulldeps/issue-18986.rs delete mode 100644 src/test/compile-fail-fulldeps/issue-48941.rs delete mode 100644 src/test/compile-fail-fulldeps/lint-group-plugin-deny-cmdline.rs delete mode 100644 src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs delete mode 100644 src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs delete mode 100644 src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs delete mode 100644 src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs delete mode 100644 src/test/compile-fail-fulldeps/macro-crate-rlib.rs delete mode 100644 src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs delete mode 100644 src/test/compile-fail-fulldeps/no-link-unknown-crate.rs delete mode 100644 src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs delete mode 100644 src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs delete mode 100644 src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs delete mode 100644 src/test/compile-fail-fulldeps/qquote.rs create mode 100644 src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/lint_for_crate.rs create mode 100644 src/test/ui-fulldeps/auxiliary/macro_crate_test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/macro_reexport_1.rs create mode 100644 src/test/ui-fulldeps/auxiliary/pub_and_stability.rs create mode 100644 src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/use_from_trait_xc.rs create mode 100644 src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs create mode 100644 src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr create mode 100644 src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs create mode 100644 src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr create mode 100644 src/test/ui-fulldeps/explore-issue-38412.rs create mode 100644 src/test/ui-fulldeps/explore-issue-38412.stderr create mode 100644 src/test/ui-fulldeps/gated-plugin.rs create mode 100644 src/test/ui-fulldeps/gated-plugin.stderr create mode 100644 src/test/ui-fulldeps/gated-quote.rs create mode 100644 src/test/ui-fulldeps/gated-quote.stderr create mode 100644 src/test/ui-fulldeps/issue-15778-fail.rs create mode 100644 src/test/ui-fulldeps/issue-15778-fail.stderr create mode 100644 src/test/ui-fulldeps/issue-18986.rs create mode 100644 src/test/ui-fulldeps/issue-18986.stderr create mode 100644 src/test/ui-fulldeps/issue-48941.rs create mode 100644 src/test/ui-fulldeps/issue-48941.stderr create mode 100644 src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs create mode 100644 src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr create mode 100644 src/test/ui-fulldeps/lint-plugin-deny-attr.rs create mode 100644 src/test/ui-fulldeps/lint-plugin-deny-attr.stderr create mode 100644 src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs create mode 100644 src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr create mode 100644 src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs create mode 100644 src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr create mode 100644 src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs create mode 100644 src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr create mode 100644 src/test/ui-fulldeps/macro-crate-rlib.rs create mode 100644 src/test/ui-fulldeps/macro-crate-rlib.stderr create mode 100644 src/test/ui-fulldeps/macro-crate-unexported-macro.rs create mode 100644 src/test/ui-fulldeps/macro-crate-unexported-macro.stderr create mode 100644 src/test/ui-fulldeps/no-link-unknown-crate.rs create mode 100644 src/test/ui-fulldeps/no-link-unknown-crate.stderr create mode 100644 src/test/ui-fulldeps/plugin-as-extern-crate.rs create mode 100644 src/test/ui-fulldeps/plugin-as-extern-crate.stderr create mode 100644 src/test/ui-fulldeps/plugin-attr-register-deny.rs create mode 100644 src/test/ui-fulldeps/plugin-attr-register-deny.stderr create mode 100644 src/test/ui-fulldeps/plugin-plus-extern-crate.rs create mode 100644 src/test/ui-fulldeps/plugin-plus-extern-crate.stderr create mode 100644 src/test/ui-fulldeps/qquote.rs create mode 100644 src/test/ui-fulldeps/qquote.stderr diff --git a/src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs deleted file mode 100644 index bab3721a313..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs +++ /dev/null @@ -1,31 +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. - -// force-host - -#![feature(plugin_registrar)] -#![feature(rustc_private)] - -extern crate syntax; - -extern crate rustc; -extern crate rustc_plugin; - -use syntax::feature_gate::AttributeType; -use rustc_plugin::Registry; - - - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_attribute("foo".to_owned(), AttributeType::Normal); - reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel); - reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs deleted file mode 100644 index fc53031e7f2..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 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. - -// force-host - -#![feature(plugin_registrar, rustc_private)] -#![feature(box_syntax)] - -#[macro_use] extern crate rustc; -extern crate rustc_plugin; -extern crate syntax; - -use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; -use rustc_plugin::Registry; -use rustc::hir; -use syntax::attr; - -declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); - -struct Pass; - -impl LintPass for Pass { - fn get_lints(&self) -> LintArray { - lint_array!(CRATE_NOT_OKAY) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { - if !attr::contains_name(&krate.attrs, "crate_okay") { - cx.span_lint(CRATE_NOT_OKAY, krate.span, - "crate is not marked with #![crate_okay]"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box Pass); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs deleted file mode 100644 index f697642f843..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs +++ /dev/null @@ -1,51 +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. - -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] - -// Load rustc as a plugin to get macros -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; - -use rustc::hir; -use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; -use rustc_plugin::Registry; - -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); - -struct Pass; - -impl LintPass for Pass { - fn get_lints(&self) -> LintArray { - lint_array!(TEST_LINT, PLEASE_LINT) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - match &*it.name.as_str() { - "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), - "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), - _ => {} - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box Pass); - reg.register_lint_group("lint_me", None, vec![TEST_LINT, PLEASE_LINT]); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs deleted file mode 100644 index 8647797270f..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs +++ /dev/null @@ -1,48 +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. - -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] - -extern crate syntax; - -// Load rustc as a plugin to get macros -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; - -use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, - EarlyLintPassObject, LintArray}; -use rustc_plugin::Registry; -use syntax::ast; -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -struct Pass; - -impl LintPass for Pass { - fn get_lints(&self) -> LintArray { - lint_array!(TEST_LINT) - } -} - -impl EarlyLintPass for Pass { - fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { - if it.ident.name == "lintme" { - cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_early_lint_pass(box Pass as EarlyLintPassObject); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs deleted file mode 100644 index fb0f9105b0d..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2013-2015 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. - -// force-host - -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast::{self, Item, MetaItem, ItemKind}; -use syntax::ext::base::*; -use syntax::parse; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[macro_export] -macro_rules! exported_macro { () => (2) } -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("identity", expand_identity); - reg.register_syntax_extension( - Symbol::intern("into_multi_foo"), - MultiModifier(Box::new(expand_into_foo_multi))); - reg.register_syntax_extension( - Symbol::intern("noop_attribute"), - MultiModifier(Box::new(expand_noop_attribute))); - reg.register_syntax_extension( - Symbol::intern("duplicate"), - MultiDecorator(Box::new(expand_duplicate))); -} - -fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) - -> Box { - if !tts.is_empty() { - cx.span_fatal(sp, "make_a_1 takes no arguments"); - } - MacEager::expr(quote_expr!(cx, 1)) -} - -// See Issue #15750 -fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) - -> Box { - // Parse an expression and emit it unchanged. - let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); - let expr = parser.parse_expr().unwrap(); - MacEager::expr(quote_expr!(&mut *cx, $expr)) -} - -fn expand_into_foo_multi(cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) -> Annotatable { - match it { - Annotatable::Item(it) => { - Annotatable::Item(P(Item { - attrs: it.attrs.clone(), - ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() - })) - } - Annotatable::ImplItem(_) => { - quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Impl(.., mut items) => { - Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) - } - _ => unreachable!("impl parsed to something other than impl") - } - }) - } - Annotatable::TraitItem(_) => { - quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Trait(.., mut items) => { - Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) - } - _ => unreachable!("trait parsed to something other than trait") - } - }) - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(_) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -fn expand_noop_attribute(_cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) -> Annotatable { - it -} - -// Create a duplicate of the annotatable, based on the MetaItem -fn expand_duplicate(cx: &mut ExtCtxt, - _sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) -{ - let copy_name = match mi.node { - ast::MetaItemKind::List(ref xs) => { - if let Some(word) = xs[0].word() { - word.ident.segments.last().unwrap().ident - } else { - cx.span_err(mi.span, "Expected word"); - return; - } - } - _ => { - cx.span_err(mi.span, "Expected list"); - return; - } - }; - - // Duplicate the item but replace its ident by the MetaItem - match it.clone() { - Annotatable::Item(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::Item(P(new_it))); - } - Annotatable::ImplItem(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::ImplItem(P(new_it))); - } - Annotatable::TraitItem(tt) => { - let mut new_it = (*tt).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::TraitItem(P(new_it))); - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(_) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -pub fn foo() {} diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs deleted file mode 100644 index aaeccc6e898..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs +++ /dev/null @@ -1,15 +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. - -#![crate_type = "dylib"] -#[macro_export] -macro_rules! reexported { - () => ( 3 ) -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs b/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs deleted file mode 100644 index f46d906d865..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2017 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. - -// This crate attempts to enumerate the various scenarios for how a -// type can define fields and methods with various visibilities and -// stabilities. -// -// The basic stability pattern in this file has four cases: -// 1. no stability attribute at all -// 2. a stable attribute (feature "unit_test") -// 3. an unstable attribute that unit test declares (feature "unstable_declared") -// 4. an unstable attribute that unit test fails to declare (feature "unstable_undeclared") -// -// This file also covers four kinds of visibility: private, -// pub(module), pub(crate), and pub. -// -// However, since stability attributes can only be observed in -// cross-crate linkage scenarios, there is little reason to take the -// cross-product (4 stability cases * 4 visibility cases), because the -// first three visibility cases cannot be accessed outside this crate, -// and therefore stability is only relevant when the visibility is pub -// to the whole universe. -// -// (The only reason to do so would be if one were worried about the -// compiler having some subtle bug where adding a stability attribute -// introduces a privacy violation. As a way to provide evidence that -// this is not occurring, I have put stability attributes on some -// non-pub fields, marked with SILLY below) - -#![feature(staged_api)] - -#![stable(feature = "unit_test", since = "1.0.0")] - -#[stable(feature = "unit_test", since = "1.0.0")] -pub use m::{Record, Trait, Tuple}; - -mod m { - #[derive(Default)] - #[stable(feature = "unit_test", since = "1.0.0")] - pub struct Record { - #[stable(feature = "unit_test", since = "1.0.0")] - pub a_stable_pub: i32, - #[unstable(feature = "unstable_declared", issue = "38412")] - pub a_unstable_declared_pub: i32, - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub a_unstable_undeclared_pub: i32, - #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY - pub(crate) b_crate: i32, - #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY - pub(in m) c_mod: i32, - #[stable(feature = "unit_test", since = "1.0.0")] // SILLY - d_priv: i32 - } - - #[derive(Default)] - #[stable(feature = "unit_test", since = "1.0.0")] - pub struct Tuple( - #[stable(feature = "unit_test", since = "1.0.0")] - pub i32, - #[unstable(feature = "unstable_declared", issue = "38412")] - pub i32, - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub i32, - - pub(crate) i32, - pub(in m) i32, - i32); - - impl Record { - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn new() -> Self { Default::default() } - } - - impl Tuple { - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn new() -> Self { Default::default() } - } - - - #[stable(feature = "unit_test", since = "1.0.0")] - pub trait Trait { - #[stable(feature = "unit_test", since = "1.0.0")] - type Type; - #[stable(feature = "unit_test", since = "1.0.0")] - fn stable_trait_method(&self) -> Self::Type; - #[unstable(feature = "unstable_undeclared", issue = "38412")] - fn unstable_undeclared_trait_method(&self) -> Self::Type; - #[unstable(feature = "unstable_declared", issue = "38412")] - fn unstable_declared_trait_method(&self) -> Self::Type; - } - - #[stable(feature = "unit_test", since = "1.0.0")] - impl Trait for Record { - type Type = i32; - fn stable_trait_method(&self) -> i32 { self.d_priv } - fn unstable_undeclared_trait_method(&self) -> i32 { self.d_priv } - fn unstable_declared_trait_method(&self) -> i32 { self.d_priv } - } - - #[stable(feature = "unit_test", since = "1.0.0")] - impl Trait for Tuple { - type Type = i32; - fn stable_trait_method(&self) -> i32 { self.3 } - fn unstable_undeclared_trait_method(&self) -> i32 { self.3 } - fn unstable_declared_trait_method(&self) -> i32 { self.3 } - } - - impl Record { - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub fn unstable_undeclared(&self) -> i32 { self.d_priv } - #[unstable(feature = "unstable_declared", issue = "38412")] - pub fn unstable_declared(&self) -> i32 { self.d_priv } - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn stable(&self) -> i32 { self.d_priv } - - #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY - pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } - #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY - pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } - #[stable(feature = "unit_test", since = "1.0.0")] // SILLY - fn private(&self) -> i32 { self.d_priv } - } - - impl Tuple { - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub fn unstable_undeclared(&self) -> i32 { self.0 } - #[unstable(feature = "unstable_declared", issue = "38412")] - pub fn unstable_declared(&self) -> i32 { self.0 } - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn stable(&self) -> i32 { self.0 } - - pub(crate) fn pub_crate(&self) -> i32 { self.0 } - pub(in m) fn pub_mod(&self) -> i32 { self.0 } - fn private(&self) -> i32 { self.0 } - } -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs deleted file mode 100644 index ae1568b2f88..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-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. - -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![feature(plugin_registrar, rustc_private)] - -extern crate rustc; -extern crate rustc_plugin; - -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(_: &mut Registry) {} diff --git a/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs b/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs deleted file mode 100644 index 9a6d176d088..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs +++ /dev/null @@ -1,40 +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. - - -pub use self::sub::{Bar, Baz}; - -pub trait Trait { - fn foo(&self); - type Assoc; - const CONST: u32; -} - -struct Foo; - -impl Foo { - pub fn new() {} - - pub const C: u32 = 0; -} - -mod sub { - pub struct Bar; - - impl Bar { - pub fn new() {} - } - - pub enum Baz {} - - impl Baz { - pub fn new() {} - } -} diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs deleted file mode 100644 index 5ab6b99eb62..00000000000 --- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2015 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. - -// Reject mixing cyclic structure and Drop when using TypedArena. -// -// (Compare against compile-fail/dropck_vec_cycle_checked.rs) -// -// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs, -// which is a reduction of this code to more directly show the reason -// for the error message we see here.) - -#![feature(rustc_private)] - -extern crate arena; - -use arena::TypedArena; -use std::cell::Cell; -use id::Id; - -mod s { - use std::sync::atomic::{AtomicUsize, Ordering}; - - static S_COUNT: AtomicUsize = AtomicUsize::new(0); - - pub fn next_count() -> usize { - S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 - } -} - -mod id { - use s; - #[derive(Debug)] - pub struct Id { - orig_count: usize, - count: usize, - } - - impl Id { - pub fn new() -> Id { - let c = s::next_count(); - println!("building Id {}", c); - Id { orig_count: c, count: c } - } - pub fn count(&self) -> usize { - println!("Id::count on {} returns {}", self.orig_count, self.count); - self.count - } - } - - impl Drop for Id { - fn drop(&mut self) { - println!("dropping Id {}", self.count); - self.count = 0; - } - } -} - -trait HasId { - fn count(&self) -> usize; -} - -#[derive(Debug)] -struct CheckId { - v: T -} - -#[allow(non_snake_case)] -fn CheckId(t: T) -> CheckId { CheckId{ v: t } } - -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -#[derive(Debug)] -struct C<'a> { - id: Id, - v: Vec>>>>, -} - -impl<'a> HasId for Cell>> { - fn count(&self) -> usize { - match self.get() { - None => 1, - Some(c) => c.id.count(), - } - } -} - -impl<'a> C<'a> { - fn new() -> C<'a> { - C { id: Id::new(), v: Vec::new() } - } -} - -fn f<'a>(arena: &'a TypedArena>) { - let c1 = arena.alloc(C::new()); - let c2 = arena.alloc(C::new()); - let c3 = arena.alloc(C::new()); - - c1.v.push(CheckId(Cell::new(None))); - c1.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c3.v.push(CheckId(Cell::new(None))); - c3.v.push(CheckId(Cell::new(None))); - - c1.v[0].v.set(Some(c2)); - c1.v[1].v.set(Some(c3)); - c2.v[0].v.set(Some(c2)); - c2.v[1].v.set(Some(c3)); - c3.v[0].v.set(Some(c1)); - c3.v[1].v.set(Some(c2)); -} - -fn main() { - let arena = TypedArena::default(); - f(&arena); -} //~^ ERROR `arena` does not live long enough diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs deleted file mode 100644 index e2231b0814f..00000000000 --- a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 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. - -// Check that an arena (TypedArena) cannot carry elements whose drop -// methods might access borrowed data of lifetime that does not -// strictly outlive the arena itself. -// -// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a -// similar setup, but loosens `f` so that the struct `C<'a>` can be -// fed a lifetime longer than that of the arena. -// -// (Also compare against dropck_tarena_cycle_checked.rs, from which -// this was reduced to better understand its error message.) - -#![feature(rustc_private)] - -extern crate arena; - -use arena::TypedArena; - -trait HasId { fn count(&self) -> usize; } - -struct CheckId { v: T } - -// In the code below, the impl of HasId for `&'a usize` does not -// actually access the borrowed data, but the point is that the -// interface to CheckId does not (and cannot) know that, and therefore -// when encountering a value V of type CheckId, we must -// conservatively force the type S to strictly outlive V. -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -struct C<'a> { v: CheckId<&'a usize>, } - -impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } - -fn f<'a>(_arena: &'a TypedArena>) {} - -fn main() { - let arena: TypedArena = TypedArena::default(); - f(&arena); -} //~^ ERROR `arena` does not live long enough - diff --git a/src/test/compile-fail-fulldeps/explore-issue-38412.rs b/src/test/compile-fail-fulldeps/explore-issue-38412.rs deleted file mode 100644 index 4b9a5b71618..00000000000 --- a/src/test/compile-fail-fulldeps/explore-issue-38412.rs +++ /dev/null @@ -1,77 +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:pub_and_stability.rs - -#![feature(unused_feature)] - -// A big point of this test is that we *declare* `unstable_declared`, -// but do *not* declare `unstable_undeclared`. This way we can check -// that the compiler is letting in uses of declared feature-gated -// stuff but still rejecting uses of undeclared feature-gated stuff. -#![feature(unstable_declared)] - -extern crate pub_and_stability; -use pub_and_stability::{Record, Trait, Tuple}; - -fn main() { - // Okay - let Record { .. } = Record::new(); - - // Okay - let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new(); - - let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = - Record::new(); - //~^^ ERROR use of unstable library feature 'unstable_undeclared' - - let r = Record::new(); - let t = Tuple::new(); - - r.a_stable_pub; - r.a_unstable_declared_pub; - r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature - r.b_crate; //~ ERROR is private - r.c_mod; //~ ERROR is private - r.d_priv; //~ ERROR is private - - t.0; - t.1; - t.2; //~ ERROR use of unstable library feature - t.3; //~ ERROR is private - t.4; //~ ERROR is private - t.5; //~ ERROR is private - - r.stable_trait_method(); - r.unstable_declared_trait_method(); - r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature - - r.stable(); - r.unstable_declared(); - r.unstable_undeclared(); //~ ERROR use of unstable library feature - - r.pub_crate(); //~ ERROR `pub_crate` is private - r.pub_mod(); //~ ERROR `pub_mod` is private - r.private(); //~ ERROR `private` is private - - let t = Tuple::new(); - t.stable_trait_method(); - t.unstable_declared_trait_method(); - t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature - - t.stable(); - t.unstable_declared(); - t.unstable_undeclared(); //~ ERROR use of unstable library feature - - t.pub_crate(); //~ ERROR `pub_crate` is private - t.pub_mod(); //~ ERROR `pub_mod` is private - t.private(); //~ ERROR `private` is private - -} diff --git a/src/test/compile-fail-fulldeps/gated-plugin.rs b/src/test/compile-fail-fulldeps/gated-plugin.rs deleted file mode 100644 index 4e80ca46c0a..00000000000 --- a/src/test/compile-fail-fulldeps/gated-plugin.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 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 - -#![plugin(macro_crate_test)] -//~^ ERROR compiler plugins are experimental and possibly buggy - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/gated-quote.rs b/src/test/compile-fail-fulldeps/gated-quote.rs deleted file mode 100644 index 63e1c6f16b3..00000000000 --- a/src/test/compile-fail-fulldeps/gated-quote.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 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. - -// Test that `quote`-related macro are gated by `quote` feature gate. - -// (To sanity-check the code, uncomment this.) -// #![feature(quote)] - -// FIXME the error message that is current emitted seems pretty bad. - -// gate-test-quote - -#![feature(rustc_private)] -#![allow(dead_code, unused_imports, unused_variables)] - -#[macro_use] -extern crate syntax; - -use syntax::ast; -use syntax::parse; - -struct ParseSess; - -impl ParseSess { - fn cfg(&self) -> ast::CrateConfig { loop { } } - fn parse_sess<'a>(&'a self) -> &'a parse::ParseSess { loop { } } - fn call_site(&self) -> () { loop { } } - fn ident_of(&self, st: &str) -> ast::Ident { loop { } } - fn name_of(&self, st: &str) -> ast::Name { loop { } } -} - -pub fn main() { - let ecx = &ParseSess; - let x = quote_tokens!(ecx, 3); - //~^ ERROR cannot find macro `quote_tokens!` in this scope - let x = quote_expr!(ecx, 3); - //~^ ERROR cannot find macro `quote_expr!` in this scope - let x = quote_ty!(ecx, 3); - //~^ ERROR cannot find macro `quote_ty!` in this scope - let x = quote_method!(ecx, 3); - //~^ ERROR cannot find macro `quote_method!` in this scope - let x = quote_item!(ecx, 3); - //~^ ERROR cannot find macro `quote_item!` in this scope - let x = quote_pat!(ecx, 3); - //~^ ERROR cannot find macro `quote_pat!` in this scope - let x = quote_arm!(ecx, 3); - //~^ ERROR cannot find macro `quote_arm!` in this scope - let x = quote_stmt!(ecx, 3); - //~^ ERROR cannot find macro `quote_stmt!` in this scope - let x = quote_attr!(ecx, 3); - //~^ ERROR cannot find macro `quote_attr!` in this scope - let x = quote_arg!(ecx, 3); - //~^ ERROR cannot find macro `quote_arg!` in this scope - let x = quote_block!(ecx, 3); - //~^ ERROR cannot find macro `quote_block!` in this scope - let x = quote_meta_item!(ecx, 3); - //~^ ERROR cannot find macro `quote_meta_item!` in this scope - let x = quote_path!(ecx, 3); - //~^ ERROR cannot find macro `quote_path!` in this scope -} diff --git a/src/test/compile-fail-fulldeps/issue-15778-fail.rs b/src/test/compile-fail-fulldeps/issue-15778-fail.rs deleted file mode 100644 index d56571ee1ac..00000000000 --- a/src/test/compile-fail-fulldeps/issue-15778-fail.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 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:lint_for_crate.rs -// ignore-stage1 -// compile-flags: -D crate-not-okay - -#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] -#![plugin(lint_for_crate)] - -pub fn main() { } diff --git a/src/test/compile-fail-fulldeps/issue-18986.rs b/src/test/compile-fail-fulldeps/issue-18986.rs deleted file mode 100644 index 95af3760544..00000000000 --- a/src/test/compile-fail-fulldeps/issue-18986.rs +++ /dev/null @@ -1,20 +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:use_from_trait_xc.rs - -extern crate use_from_trait_xc; -pub use use_from_trait_xc::Trait; - -fn main() { - match () { - Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` - } -} diff --git a/src/test/compile-fail-fulldeps/issue-48941.rs b/src/test/compile-fail-fulldeps/issue-48941.rs deleted file mode 100644 index baeb019df1c..00000000000 --- a/src/test/compile-fail-fulldeps/issue-48941.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-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. - -// This is a regression test against an ICE that used to occur -// on malformed attributes for a custom MultiModifier. - -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(macro_crate_test)] - -#[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a -fn knight() { } - -#[noop_attribute("/user", data= = " or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lint_group_plugin_test.rs -// ignore-stage1 -// compile-flags: -D lint-me - -#![feature(plugin)] -#![plugin(lint_group_plugin_test)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' - -pub fn main() { - lintme(); - pleaselintme(); -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs b/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs deleted file mode 100644 index e3dbdc331a7..00000000000 --- a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs +++ /dev/null @@ -1,22 +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:lint_plugin_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(lint_plugin_test)] -#![deny(test_lint)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -pub fn main() { - lintme(); -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs deleted file mode 100644 index 41d25becd84..00000000000 --- a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs +++ /dev/null @@ -1,22 +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:lint_plugin_test.rs -// ignore-stage1 -// compile-flags: -D test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -pub fn main() { - lintme(); -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs deleted file mode 100644 index 155294f8026..00000000000 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs +++ /dev/null @@ -1,23 +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:lint_plugin_test.rs -// ignore-stage1 -// compile-flags: -F test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -#[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) -pub fn main() { - lintme(); -} diff --git a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs b/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs deleted file mode 100644 index c676076aef3..00000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013-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 - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -fn main() { - macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` -} diff --git a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs b/src/test/compile-fail-fulldeps/macro-crate-rlib.rs deleted file mode 100644 index 5b34d8e3adb..00000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013-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:rlib_crate_test.rs -// ignore-tidy-linelength -// ignore-cross-compile gives a different error message - -#![feature(plugin)] -#![plugin(rlib_crate_test)] -//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs b/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs deleted file mode 100644 index 886b6247c0a..00000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs +++ /dev/null @@ -1,19 +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 - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -fn main() { - unexported_macro!(); - //~^ ERROR cannot find macro `unexported_macro!` in this scope -} diff --git a/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs b/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs deleted file mode 100644 index 8e4692bdee1..00000000000 --- a/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 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. - -#[no_link] -extern crate doesnt_exist; //~ ERROR can't find crate - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs b/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs deleted file mode 100644 index bb292e2e52a..00000000000 --- a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-2015 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-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![allow(unused_extern_crates)] - -extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library - -fn main() { } diff --git a/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs b/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs deleted file mode 100644 index 0d2a5a30c10..00000000000 --- a/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs +++ /dev/null @@ -1,30 +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:attr_plugin_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(attr_plugin_test)] -#![deny(unused_attributes)] - -#[baz] -fn baz() { } // no error - -#[foo] -pub fn main() { - //~^^ ERROR unused - #[bar] - fn inner() {} - //~^^ ERROR crate - //~^^^ ERROR unused - baz(); - inner(); -} diff --git a/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs b/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs deleted file mode 100644 index 3dfd8838ebe..00000000000 --- a/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013-2015 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 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] - -extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library - -fn main() { - assert_eq!(1, make_a_1!()); - macro_crate_test::foo(); -} diff --git a/src/test/compile-fail-fulldeps/qquote.rs b/src/test/compile-fail-fulldeps/qquote.rs deleted file mode 100644 index 4b0bc8f02b4..00000000000 --- a/src/test/compile-fail-fulldeps/qquote.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012-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. - -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::ast; -use syntax::source_map::FilePathMapping; -use syntax::print::pprust; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - let ps = syntax::parse::ParseSess::new(FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23"); - - let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope - assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7"); -} diff --git a/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs new file mode 100644 index 00000000000..bab3721a313 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs @@ -0,0 +1,31 @@ +// 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. + +// force-host + +#![feature(plugin_registrar)] +#![feature(rustc_private)] + +extern crate syntax; + +extern crate rustc; +extern crate rustc_plugin; + +use syntax::feature_gate::AttributeType; +use rustc_plugin::Registry; + + + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_attribute("foo".to_owned(), AttributeType::Normal); + reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel); + reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs b/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs new file mode 100644 index 00000000000..fc53031e7f2 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs @@ -0,0 +1,47 @@ +// Copyright 2015 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. + +// force-host + +#![feature(plugin_registrar, rustc_private)] +#![feature(box_syntax)] + +#[macro_use] extern crate rustc; +extern crate rustc_plugin; +extern crate syntax; + +use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; +use rustc_plugin::Registry; +use rustc::hir; +use syntax::attr; + +declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); + +struct Pass; + +impl LintPass for Pass { + fn get_lints(&self) -> LintArray { + lint_array!(CRATE_NOT_OKAY) + } +} + +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + if !attr::contains_name(&krate.attrs, "crate_okay") { + cx.span_lint(CRATE_NOT_OKAY, krate.span, + "crate is not marked with #![crate_okay]"); + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box Pass); +} diff --git a/src/test/ui-fulldeps/auxiliary/macro_crate_test.rs b/src/test/ui-fulldeps/auxiliary/macro_crate_test.rs new file mode 100644 index 00000000000..fb0f9105b0d --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/macro_crate_test.rs @@ -0,0 +1,159 @@ +// Copyright 2013-2015 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. + +// force-host + +#![feature(plugin_registrar, quote, rustc_private)] + +extern crate syntax; +extern crate syntax_pos; +extern crate rustc; +extern crate rustc_plugin; + +use syntax::ast::{self, Item, MetaItem, ItemKind}; +use syntax::ext::base::*; +use syntax::parse; +use syntax::ptr::P; +use syntax::symbol::Symbol; +use syntax::tokenstream::TokenTree; +use syntax_pos::Span; +use rustc_plugin::Registry; + +#[macro_export] +macro_rules! exported_macro { () => (2) } +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("identity", expand_identity); + reg.register_syntax_extension( + Symbol::intern("into_multi_foo"), + MultiModifier(Box::new(expand_into_foo_multi))); + reg.register_syntax_extension( + Symbol::intern("noop_attribute"), + MultiModifier(Box::new(expand_noop_attribute))); + reg.register_syntax_extension( + Symbol::intern("duplicate"), + MultiDecorator(Box::new(expand_duplicate))); +} + +fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) + -> Box { + if !tts.is_empty() { + cx.span_fatal(sp, "make_a_1 takes no arguments"); + } + MacEager::expr(quote_expr!(cx, 1)) +} + +// See Issue #15750 +fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) + -> Box { + // Parse an expression and emit it unchanged. + let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); + let expr = parser.parse_expr().unwrap(); + MacEager::expr(quote_expr!(&mut *cx, $expr)) +} + +fn expand_into_foo_multi(cx: &mut ExtCtxt, + _sp: Span, + _attr: &MetaItem, + it: Annotatable) -> Annotatable { + match it { + Annotatable::Item(it) => { + Annotatable::Item(P(Item { + attrs: it.attrs.clone(), + ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() + })) + } + Annotatable::ImplItem(_) => { + quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { + match i.node { + ItemKind::Impl(.., mut items) => { + Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) + } + _ => unreachable!("impl parsed to something other than impl") + } + }) + } + Annotatable::TraitItem(_) => { + quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { + match i.node { + ItemKind::Trait(.., mut items) => { + Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) + } + _ => unreachable!("trait parsed to something other than trait") + } + }) + } + // covered in proc_macro/macros-in-extern.rs + Annotatable::ForeignItem(_) => unimplemented!(), + // covered in proc_macro/attr-stmt-expr.rs + Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") + } +} + +fn expand_noop_attribute(_cx: &mut ExtCtxt, + _sp: Span, + _attr: &MetaItem, + it: Annotatable) -> Annotatable { + it +} + +// Create a duplicate of the annotatable, based on the MetaItem +fn expand_duplicate(cx: &mut ExtCtxt, + _sp: Span, + mi: &MetaItem, + it: &Annotatable, + push: &mut FnMut(Annotatable)) +{ + let copy_name = match mi.node { + ast::MetaItemKind::List(ref xs) => { + if let Some(word) = xs[0].word() { + word.ident.segments.last().unwrap().ident + } else { + cx.span_err(mi.span, "Expected word"); + return; + } + } + _ => { + cx.span_err(mi.span, "Expected list"); + return; + } + }; + + // Duplicate the item but replace its ident by the MetaItem + match it.clone() { + Annotatable::Item(it) => { + let mut new_it = (*it).clone(); + new_it.attrs.clear(); + new_it.ident = copy_name; + push(Annotatable::Item(P(new_it))); + } + Annotatable::ImplItem(it) => { + let mut new_it = (*it).clone(); + new_it.attrs.clear(); + new_it.ident = copy_name; + push(Annotatable::ImplItem(P(new_it))); + } + Annotatable::TraitItem(tt) => { + let mut new_it = (*tt).clone(); + new_it.attrs.clear(); + new_it.ident = copy_name; + push(Annotatable::TraitItem(P(new_it))); + } + // covered in proc_macro/macros-in-extern.rs + Annotatable::ForeignItem(_) => unimplemented!(), + // covered in proc_macro/attr-stmt-expr.rs + Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") + } +} + +pub fn foo() {} diff --git a/src/test/ui-fulldeps/auxiliary/macro_reexport_1.rs b/src/test/ui-fulldeps/auxiliary/macro_reexport_1.rs new file mode 100644 index 00000000000..aaeccc6e898 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/macro_reexport_1.rs @@ -0,0 +1,15 @@ +// 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. + +#![crate_type = "dylib"] +#[macro_export] +macro_rules! reexported { + () => ( 3 ) +} diff --git a/src/test/ui-fulldeps/auxiliary/pub_and_stability.rs b/src/test/ui-fulldeps/auxiliary/pub_and_stability.rs new file mode 100644 index 00000000000..f46d906d865 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/pub_and_stability.rs @@ -0,0 +1,143 @@ +// Copyright 2017 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. + +// This crate attempts to enumerate the various scenarios for how a +// type can define fields and methods with various visibilities and +// stabilities. +// +// The basic stability pattern in this file has four cases: +// 1. no stability attribute at all +// 2. a stable attribute (feature "unit_test") +// 3. an unstable attribute that unit test declares (feature "unstable_declared") +// 4. an unstable attribute that unit test fails to declare (feature "unstable_undeclared") +// +// This file also covers four kinds of visibility: private, +// pub(module), pub(crate), and pub. +// +// However, since stability attributes can only be observed in +// cross-crate linkage scenarios, there is little reason to take the +// cross-product (4 stability cases * 4 visibility cases), because the +// first three visibility cases cannot be accessed outside this crate, +// and therefore stability is only relevant when the visibility is pub +// to the whole universe. +// +// (The only reason to do so would be if one were worried about the +// compiler having some subtle bug where adding a stability attribute +// introduces a privacy violation. As a way to provide evidence that +// this is not occurring, I have put stability attributes on some +// non-pub fields, marked with SILLY below) + +#![feature(staged_api)] + +#![stable(feature = "unit_test", since = "1.0.0")] + +#[stable(feature = "unit_test", since = "1.0.0")] +pub use m::{Record, Trait, Tuple}; + +mod m { + #[derive(Default)] + #[stable(feature = "unit_test", since = "1.0.0")] + pub struct Record { + #[stable(feature = "unit_test", since = "1.0.0")] + pub a_stable_pub: i32, + #[unstable(feature = "unstable_declared", issue = "38412")] + pub a_unstable_declared_pub: i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub a_unstable_undeclared_pub: i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY + pub(crate) b_crate: i32, + #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY + pub(in m) c_mod: i32, + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY + d_priv: i32 + } + + #[derive(Default)] + #[stable(feature = "unit_test", since = "1.0.0")] + pub struct Tuple( + #[stable(feature = "unit_test", since = "1.0.0")] + pub i32, + #[unstable(feature = "unstable_declared", issue = "38412")] + pub i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub i32, + + pub(crate) i32, + pub(in m) i32, + i32); + + impl Record { + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn new() -> Self { Default::default() } + } + + impl Tuple { + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn new() -> Self { Default::default() } + } + + + #[stable(feature = "unit_test", since = "1.0.0")] + pub trait Trait { + #[stable(feature = "unit_test", since = "1.0.0")] + type Type; + #[stable(feature = "unit_test", since = "1.0.0")] + fn stable_trait_method(&self) -> Self::Type; + #[unstable(feature = "unstable_undeclared", issue = "38412")] + fn unstable_undeclared_trait_method(&self) -> Self::Type; + #[unstable(feature = "unstable_declared", issue = "38412")] + fn unstable_declared_trait_method(&self) -> Self::Type; + } + + #[stable(feature = "unit_test", since = "1.0.0")] + impl Trait for Record { + type Type = i32; + fn stable_trait_method(&self) -> i32 { self.d_priv } + fn unstable_undeclared_trait_method(&self) -> i32 { self.d_priv } + fn unstable_declared_trait_method(&self) -> i32 { self.d_priv } + } + + #[stable(feature = "unit_test", since = "1.0.0")] + impl Trait for Tuple { + type Type = i32; + fn stable_trait_method(&self) -> i32 { self.3 } + fn unstable_undeclared_trait_method(&self) -> i32 { self.3 } + fn unstable_declared_trait_method(&self) -> i32 { self.3 } + } + + impl Record { + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub fn unstable_undeclared(&self) -> i32 { self.d_priv } + #[unstable(feature = "unstable_declared", issue = "38412")] + pub fn unstable_declared(&self) -> i32 { self.d_priv } + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn stable(&self) -> i32 { self.d_priv } + + #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY + pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } + #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY + pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY + fn private(&self) -> i32 { self.d_priv } + } + + impl Tuple { + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub fn unstable_undeclared(&self) -> i32 { self.0 } + #[unstable(feature = "unstable_declared", issue = "38412")] + pub fn unstable_declared(&self) -> i32 { self.0 } + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn stable(&self) -> i32 { self.0 } + + pub(crate) fn pub_crate(&self) -> i32 { self.0 } + pub(in m) fn pub_mod(&self) -> i32 { self.0 } + fn private(&self) -> i32 { self.0 } + } +} diff --git a/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs b/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs new file mode 100644 index 00000000000..ae1568b2f88 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs @@ -0,0 +1,22 @@ +// Copyright 2013-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. + +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature(plugin_registrar, rustc_private)] + +extern crate rustc; +extern crate rustc_plugin; + +use rustc_plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(_: &mut Registry) {} diff --git a/src/test/ui-fulldeps/auxiliary/use_from_trait_xc.rs b/src/test/ui-fulldeps/auxiliary/use_from_trait_xc.rs new file mode 100644 index 00000000000..9a6d176d088 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/use_from_trait_xc.rs @@ -0,0 +1,40 @@ +// 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. + + +pub use self::sub::{Bar, Baz}; + +pub trait Trait { + fn foo(&self); + type Assoc; + const CONST: u32; +} + +struct Foo; + +impl Foo { + pub fn new() {} + + pub const C: u32 = 0; +} + +mod sub { + pub struct Bar; + + impl Bar { + pub fn new() {} + } + + pub enum Baz {} + + impl Baz { + pub fn new() {} + } +} diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs new file mode 100644 index 00000000000..5ab6b99eb62 --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs @@ -0,0 +1,127 @@ +// Copyright 2015 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. + +// Reject mixing cyclic structure and Drop when using TypedArena. +// +// (Compare against compile-fail/dropck_vec_cycle_checked.rs) +// +// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs, +// which is a reduction of this code to more directly show the reason +// for the error message we see here.) + +#![feature(rustc_private)] + +extern crate arena; + +use arena::TypedArena; +use std::cell::Cell; +use id::Id; + +mod s { + use std::sync::atomic::{AtomicUsize, Ordering}; + + static S_COUNT: AtomicUsize = AtomicUsize::new(0); + + pub fn next_count() -> usize { + S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 + } +} + +mod id { + use s; + #[derive(Debug)] + pub struct Id { + orig_count: usize, + count: usize, + } + + impl Id { + pub fn new() -> Id { + let c = s::next_count(); + println!("building Id {}", c); + Id { orig_count: c, count: c } + } + pub fn count(&self) -> usize { + println!("Id::count on {} returns {}", self.orig_count, self.count); + self.count + } + } + + impl Drop for Id { + fn drop(&mut self) { + println!("dropping Id {}", self.count); + self.count = 0; + } + } +} + +trait HasId { + fn count(&self) -> usize; +} + +#[derive(Debug)] +struct CheckId { + v: T +} + +#[allow(non_snake_case)] +fn CheckId(t: T) -> CheckId { CheckId{ v: t } } + +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +#[derive(Debug)] +struct C<'a> { + id: Id, + v: Vec>>>>, +} + +impl<'a> HasId for Cell>> { + fn count(&self) -> usize { + match self.get() { + None => 1, + Some(c) => c.id.count(), + } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { id: Id::new(), v: Vec::new() } + } +} + +fn f<'a>(arena: &'a TypedArena>) { + let c1 = arena.alloc(C::new()); + let c2 = arena.alloc(C::new()); + let c3 = arena.alloc(C::new()); + + c1.v.push(CheckId(Cell::new(None))); + c1.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + + c1.v[0].v.set(Some(c2)); + c1.v[1].v.set(Some(c3)); + c2.v[0].v.set(Some(c2)); + c2.v[1].v.set(Some(c3)); + c3.v[0].v.set(Some(c1)); + c3.v[1].v.set(Some(c2)); +} + +fn main() { + let arena = TypedArena::default(); + f(&arena); +} //~^ ERROR `arena` does not live long enough diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr new file mode 100644 index 00000000000..eae33bab453 --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck_tarena_cycle_checked.rs:126:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } //~^ ERROR `arena` does not live long enough + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs new file mode 100644 index 00000000000..e2231b0814f --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs @@ -0,0 +1,53 @@ +// Copyright 2015 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. + +// Check that an arena (TypedArena) cannot carry elements whose drop +// methods might access borrowed data of lifetime that does not +// strictly outlive the arena itself. +// +// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a +// similar setup, but loosens `f` so that the struct `C<'a>` can be +// fed a lifetime longer than that of the arena. +// +// (Also compare against dropck_tarena_cycle_checked.rs, from which +// this was reduced to better understand its error message.) + +#![feature(rustc_private)] + +extern crate arena; + +use arena::TypedArena; + +trait HasId { fn count(&self) -> usize; } + +struct CheckId { v: T } + +// In the code below, the impl of HasId for `&'a usize` does not +// actually access the borrowed data, but the point is that the +// interface to CheckId does not (and cannot) know that, and therefore +// when encountering a value V of type CheckId, we must +// conservatively force the type S to strictly outlive V. +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +struct C<'a> { v: CheckId<&'a usize>, } + +impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } + +fn f<'a>(_arena: &'a TypedArena>) {} + +fn main() { + let arena: TypedArena = TypedArena::default(); + f(&arena); +} //~^ ERROR `arena` does not live long enough + diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr new file mode 100644 index 00000000000..75ceb692c75 --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck_tarena_unsound_drop.rs:51:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } //~^ ERROR `arena` does not live long enough + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/explore-issue-38412.rs b/src/test/ui-fulldeps/explore-issue-38412.rs new file mode 100644 index 00000000000..4b9a5b71618 --- /dev/null +++ b/src/test/ui-fulldeps/explore-issue-38412.rs @@ -0,0 +1,77 @@ +// 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:pub_and_stability.rs + +#![feature(unused_feature)] + +// A big point of this test is that we *declare* `unstable_declared`, +// but do *not* declare `unstable_undeclared`. This way we can check +// that the compiler is letting in uses of declared feature-gated +// stuff but still rejecting uses of undeclared feature-gated stuff. +#![feature(unstable_declared)] + +extern crate pub_and_stability; +use pub_and_stability::{Record, Trait, Tuple}; + +fn main() { + // Okay + let Record { .. } = Record::new(); + + // Okay + let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new(); + + let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = + Record::new(); + //~^^ ERROR use of unstable library feature 'unstable_undeclared' + + let r = Record::new(); + let t = Tuple::new(); + + r.a_stable_pub; + r.a_unstable_declared_pub; + r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature + r.b_crate; //~ ERROR is private + r.c_mod; //~ ERROR is private + r.d_priv; //~ ERROR is private + + t.0; + t.1; + t.2; //~ ERROR use of unstable library feature + t.3; //~ ERROR is private + t.4; //~ ERROR is private + t.5; //~ ERROR is private + + r.stable_trait_method(); + r.unstable_declared_trait_method(); + r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + + r.stable(); + r.unstable_declared(); + r.unstable_undeclared(); //~ ERROR use of unstable library feature + + r.pub_crate(); //~ ERROR `pub_crate` is private + r.pub_mod(); //~ ERROR `pub_mod` is private + r.private(); //~ ERROR `private` is private + + let t = Tuple::new(); + t.stable_trait_method(); + t.unstable_declared_trait_method(); + t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + + t.stable(); + t.unstable_declared(); + t.unstable_undeclared(); //~ ERROR use of unstable library feature + + t.pub_crate(); //~ ERROR `pub_crate` is private + t.pub_mod(); //~ ERROR `pub_mod` is private + t.private(); //~ ERROR `private` is private + +} diff --git a/src/test/ui-fulldeps/explore-issue-38412.stderr b/src/test/ui-fulldeps/explore-issue-38412.stderr new file mode 100644 index 00000000000..8e31c1c7e01 --- /dev/null +++ b/src/test/ui-fulldeps/explore-issue-38412.stderr @@ -0,0 +1,132 @@ +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:31:63 + | +LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:40:5 + | +LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0616]: field `b_crate` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:41:5 + | +LL | r.b_crate; //~ ERROR is private + | ^^^^^^^^^ + +error[E0616]: field `c_mod` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:42:5 + | +LL | r.c_mod; //~ ERROR is private + | ^^^^^^^ + +error[E0616]: field `d_priv` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:43:5 + | +LL | r.d_priv; //~ ERROR is private + | ^^^^^^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:47:5 + | +LL | t.2; //~ ERROR use of unstable library feature + | ^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:48:5 + | +LL | t.3; //~ ERROR is private + | ^^^ + +error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:49:5 + | +LL | t.4; //~ ERROR is private + | ^^^ + +error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:50:5 + | +LL | t.5; //~ ERROR is private + | ^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:54:7 + | +LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:58:7 + | +LL | r.unstable_undeclared(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0624]: method `pub_crate` is private + --> $DIR/explore-issue-38412.rs:60:7 + | +LL | r.pub_crate(); //~ ERROR `pub_crate` is private + | ^^^^^^^^^ + +error[E0624]: method `pub_mod` is private + --> $DIR/explore-issue-38412.rs:61:7 + | +LL | r.pub_mod(); //~ ERROR `pub_mod` is private + | ^^^^^^^ + +error[E0624]: method `private` is private + --> $DIR/explore-issue-38412.rs:62:7 + | +LL | r.private(); //~ ERROR `private` is private + | ^^^^^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:67:7 + | +LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:71:7 + | +LL | t.unstable_undeclared(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0624]: method `pub_crate` is private + --> $DIR/explore-issue-38412.rs:73:7 + | +LL | t.pub_crate(); //~ ERROR `pub_crate` is private + | ^^^^^^^^^ + +error[E0624]: method `pub_mod` is private + --> $DIR/explore-issue-38412.rs:74:7 + | +LL | t.pub_mod(); //~ ERROR `pub_mod` is private + | ^^^^^^^ + +error[E0624]: method `private` is private + --> $DIR/explore-issue-38412.rs:75:7 + | +LL | t.private(); //~ ERROR `private` is private + | ^^^^^^^ + +error: aborting due to 19 previous errors + +Some errors occurred: E0616, E0624, E0658. +For more information about an error, try `rustc --explain E0616`. diff --git a/src/test/ui-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs new file mode 100644 index 00000000000..4e80ca46c0a --- /dev/null +++ b/src/test/ui-fulldeps/gated-plugin.rs @@ -0,0 +1,16 @@ +// Copyright 2013 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 + +#![plugin(macro_crate_test)] +//~^ ERROR compiler plugins are experimental and possibly buggy + +fn main() {} diff --git a/src/test/ui-fulldeps/gated-plugin.stderr b/src/test/ui-fulldeps/gated-plugin.stderr new file mode 100644 index 00000000000..075bc799b33 --- /dev/null +++ b/src/test/ui-fulldeps/gated-plugin.stderr @@ -0,0 +1,11 @@ +error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597) + --> $DIR/gated-plugin.rs:13:1 + | +LL | #![plugin(macro_crate_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(plugin)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui-fulldeps/gated-quote.rs b/src/test/ui-fulldeps/gated-quote.rs new file mode 100644 index 00000000000..63e1c6f16b3 --- /dev/null +++ b/src/test/ui-fulldeps/gated-quote.rs @@ -0,0 +1,67 @@ +// Copyright 2015 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. + +// Test that `quote`-related macro are gated by `quote` feature gate. + +// (To sanity-check the code, uncomment this.) +// #![feature(quote)] + +// FIXME the error message that is current emitted seems pretty bad. + +// gate-test-quote + +#![feature(rustc_private)] +#![allow(dead_code, unused_imports, unused_variables)] + +#[macro_use] +extern crate syntax; + +use syntax::ast; +use syntax::parse; + +struct ParseSess; + +impl ParseSess { + fn cfg(&self) -> ast::CrateConfig { loop { } } + fn parse_sess<'a>(&'a self) -> &'a parse::ParseSess { loop { } } + fn call_site(&self) -> () { loop { } } + fn ident_of(&self, st: &str) -> ast::Ident { loop { } } + fn name_of(&self, st: &str) -> ast::Name { loop { } } +} + +pub fn main() { + let ecx = &ParseSess; + let x = quote_tokens!(ecx, 3); + //~^ ERROR cannot find macro `quote_tokens!` in this scope + let x = quote_expr!(ecx, 3); + //~^ ERROR cannot find macro `quote_expr!` in this scope + let x = quote_ty!(ecx, 3); + //~^ ERROR cannot find macro `quote_ty!` in this scope + let x = quote_method!(ecx, 3); + //~^ ERROR cannot find macro `quote_method!` in this scope + let x = quote_item!(ecx, 3); + //~^ ERROR cannot find macro `quote_item!` in this scope + let x = quote_pat!(ecx, 3); + //~^ ERROR cannot find macro `quote_pat!` in this scope + let x = quote_arm!(ecx, 3); + //~^ ERROR cannot find macro `quote_arm!` in this scope + let x = quote_stmt!(ecx, 3); + //~^ ERROR cannot find macro `quote_stmt!` in this scope + let x = quote_attr!(ecx, 3); + //~^ ERROR cannot find macro `quote_attr!` in this scope + let x = quote_arg!(ecx, 3); + //~^ ERROR cannot find macro `quote_arg!` in this scope + let x = quote_block!(ecx, 3); + //~^ ERROR cannot find macro `quote_block!` in this scope + let x = quote_meta_item!(ecx, 3); + //~^ ERROR cannot find macro `quote_meta_item!` in this scope + let x = quote_path!(ecx, 3); + //~^ ERROR cannot find macro `quote_path!` in this scope +} diff --git a/src/test/ui-fulldeps/gated-quote.stderr b/src/test/ui-fulldeps/gated-quote.stderr new file mode 100644 index 00000000000..db091938c6e --- /dev/null +++ b/src/test/ui-fulldeps/gated-quote.stderr @@ -0,0 +1,80 @@ +error: cannot find macro `quote_path!` in this scope + --> $DIR/gated-quote.rs:65:13 + | +LL | let x = quote_path!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_meta_item!` in this scope + --> $DIR/gated-quote.rs:63:13 + | +LL | let x = quote_meta_item!(ecx, 3); + | ^^^^^^^^^^^^^^^ + +error: cannot find macro `quote_block!` in this scope + --> $DIR/gated-quote.rs:61:13 + | +LL | let x = quote_block!(ecx, 3); + | ^^^^^^^^^^^ + +error: cannot find macro `quote_arg!` in this scope + --> $DIR/gated-quote.rs:59:13 + | +LL | let x = quote_arg!(ecx, 3); + | ^^^^^^^^^ + +error: cannot find macro `quote_attr!` in this scope + --> $DIR/gated-quote.rs:57:13 + | +LL | let x = quote_attr!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_stmt!` in this scope + --> $DIR/gated-quote.rs:55:13 + | +LL | let x = quote_stmt!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_arm!` in this scope + --> $DIR/gated-quote.rs:53:13 + | +LL | let x = quote_arm!(ecx, 3); + | ^^^^^^^^^ + +error: cannot find macro `quote_pat!` in this scope + --> $DIR/gated-quote.rs:51:13 + | +LL | let x = quote_pat!(ecx, 3); + | ^^^^^^^^^ + +error: cannot find macro `quote_item!` in this scope + --> $DIR/gated-quote.rs:49:13 + | +LL | let x = quote_item!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_method!` in this scope + --> $DIR/gated-quote.rs:47:13 + | +LL | let x = quote_method!(ecx, 3); + | ^^^^^^^^^^^^ + +error: cannot find macro `quote_ty!` in this scope + --> $DIR/gated-quote.rs:45:13 + | +LL | let x = quote_ty!(ecx, 3); + | ^^^^^^^^ + +error: cannot find macro `quote_expr!` in this scope + --> $DIR/gated-quote.rs:43:13 + | +LL | let x = quote_expr!(ecx, 3); + | ^^^^^^^^^^ + +error: cannot find macro `quote_tokens!` in this scope + --> $DIR/gated-quote.rs:41:13 + | +LL | let x = quote_tokens!(ecx, 3); + | ^^^^^^^^^^^^ + +error: aborting due to 13 previous errors + diff --git a/src/test/ui-fulldeps/issue-15778-fail.rs b/src/test/ui-fulldeps/issue-15778-fail.rs new file mode 100644 index 00000000000..d56571ee1ac --- /dev/null +++ b/src/test/ui-fulldeps/issue-15778-fail.rs @@ -0,0 +1,18 @@ +// Copyright 2015 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:lint_for_crate.rs +// ignore-stage1 +// compile-flags: -D crate-not-okay + +#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +#![plugin(lint_for_crate)] + +pub fn main() { } diff --git a/src/test/ui-fulldeps/issue-15778-fail.stderr b/src/test/ui-fulldeps/issue-15778-fail.stderr new file mode 100644 index 00000000000..49a2b260a1e --- /dev/null +++ b/src/test/ui-fulldeps/issue-15778-fail.stderr @@ -0,0 +1,13 @@ +error: crate is not marked with #![crate_okay] + --> $DIR/issue-15778-fail.rs:15:1 + | +LL | / #![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +LL | | #![plugin(lint_for_crate)] +LL | | +LL | | pub fn main() { } + | |_________________^ + | + = note: requested on the command line with `-D crate-not-okay` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/issue-18986.rs b/src/test/ui-fulldeps/issue-18986.rs new file mode 100644 index 00000000000..95af3760544 --- /dev/null +++ b/src/test/ui-fulldeps/issue-18986.rs @@ -0,0 +1,20 @@ +// 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:use_from_trait_xc.rs + +extern crate use_from_trait_xc; +pub use use_from_trait_xc::Trait; + +fn main() { + match () { + Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` + } +} diff --git a/src/test/ui-fulldeps/issue-18986.stderr b/src/test/ui-fulldeps/issue-18986.stderr new file mode 100644 index 00000000000..241cc4250a3 --- /dev/null +++ b/src/test/ui-fulldeps/issue-18986.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found trait `Trait` + --> $DIR/issue-18986.rs:18:9 + | +LL | Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` + | ^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/src/test/ui-fulldeps/issue-48941.rs b/src/test/ui-fulldeps/issue-48941.rs new file mode 100644 index 00000000000..baeb019df1c --- /dev/null +++ b/src/test/ui-fulldeps/issue-48941.rs @@ -0,0 +1,26 @@ +// Copyright 2013-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. + +// This is a regression test against an ICE that used to occur +// on malformed attributes for a custom MultiModifier. + +// aux-build:macro_crate_test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(macro_crate_test)] + +#[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a +fn knight() { } + +#[noop_attribute("/user", data= = " $DIR/issue-48941.rs:20:24 + | +LL | #[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a + | ^^^^ + +error: expected unsuffixed literal or identifier, found = + --> $DIR/issue-48941.rs:23:27 + | +LL | #[noop_attribute("/user", data= = " or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:lint_group_plugin_test.rs +// ignore-stage1 +// compile-flags: -D lint-me + +#![feature(plugin)] +#![plugin(lint_group_plugin_test)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + +pub fn main() { + lintme(); + pleaselintme(); +} diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr new file mode 100644 index 00000000000..446fc75d584 --- /dev/null +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr @@ -0,0 +1,18 @@ +error: item is named 'lintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: `-D test-lint` implied by `-D lint-me` + +error: item is named 'pleaselintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:20:1 + | +LL | fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D please-lint` implied by `-D lint-me` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.rs b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs new file mode 100644 index 00000000000..e3dbdc331a7 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs @@ -0,0 +1,22 @@ +// 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:lint_plugin_test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +#![deny(test_lint)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr new file mode 100644 index 00000000000..e0ea1e0065a --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -0,0 +1,14 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-attr.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-plugin-deny-attr.rs:16:9 + | +LL | #![deny(test_lint)] + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs new file mode 100644 index 00000000000..41d25becd84 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs @@ -0,0 +1,22 @@ +// 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:lint_plugin_test.rs +// ignore-stage1 +// compile-flags: -D test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr new file mode 100644 index 00000000000..9084253b71e --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -0,0 +1,10 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-cmdline.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-D test-lint` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs new file mode 100644 index 00000000000..155294f8026 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs @@ -0,0 +1,23 @@ +// 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:lint_plugin_test.rs +// ignore-stage1 +// compile-flags: -F test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) +pub fn main() { + lintme(); +} diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr new file mode 100644 index 00000000000..30043db41da --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -0,0 +1,19 @@ +error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) + --> $DIR/lint-plugin-forbid-cmdline.rs:20:9 + | +LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) + | ^^^^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line + +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-cmdline.rs:18:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-F test-lint` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs new file mode 100644 index 00000000000..c676076aef3 --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs @@ -0,0 +1,18 @@ +// Copyright 2013-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 + +#[macro_use] #[no_link] +extern crate macro_crate_test; + +fn main() { + macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` +} diff --git a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr new file mode 100644 index 00000000000..c45cfa9070f --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find function `foo` in module `macro_crate_test` + --> $DIR/macro-crate-doesnt-resolve.rs:17:23 + | +LL | macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` + | ^^^ not found in `macro_crate_test` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui-fulldeps/macro-crate-rlib.rs b/src/test/ui-fulldeps/macro-crate-rlib.rs new file mode 100644 index 00000000000..5b34d8e3adb --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-rlib.rs @@ -0,0 +1,19 @@ +// Copyright 2013-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:rlib_crate_test.rs +// ignore-tidy-linelength +// ignore-cross-compile gives a different error message + +#![feature(plugin)] +#![plugin(rlib_crate_test)] +//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format + +fn main() {} diff --git a/src/test/ui-fulldeps/macro-crate-rlib.stderr b/src/test/ui-fulldeps/macro-crate-rlib.stderr new file mode 100644 index 00000000000..8a7f7883a10 --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-rlib.stderr @@ -0,0 +1,9 @@ +error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format + --> $DIR/macro-crate-rlib.rs:16:11 + | +LL | #![plugin(rlib_crate_test)] + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0457`. diff --git a/src/test/ui-fulldeps/macro-crate-unexported-macro.rs b/src/test/ui-fulldeps/macro-crate-unexported-macro.rs new file mode 100644 index 00000000000..886b6247c0a --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-unexported-macro.rs @@ -0,0 +1,19 @@ +// 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 + +#[macro_use] #[no_link] +extern crate macro_crate_test; + +fn main() { + unexported_macro!(); + //~^ ERROR cannot find macro `unexported_macro!` in this scope +} diff --git a/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr b/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr new file mode 100644 index 00000000000..8d87c882a1a --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr @@ -0,0 +1,8 @@ +error: cannot find macro `unexported_macro!` in this scope + --> $DIR/macro-crate-unexported-macro.rs:17:5 + | +LL | unexported_macro!(); + | ^^^^^^^^^^^^^^^^ help: you could try the macro: `exported_macro` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/no-link-unknown-crate.rs b/src/test/ui-fulldeps/no-link-unknown-crate.rs new file mode 100644 index 00000000000..8e4692bdee1 --- /dev/null +++ b/src/test/ui-fulldeps/no-link-unknown-crate.rs @@ -0,0 +1,14 @@ +// Copyright 2013 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. + +#[no_link] +extern crate doesnt_exist; //~ ERROR can't find crate + +fn main() {} diff --git a/src/test/ui-fulldeps/no-link-unknown-crate.stderr b/src/test/ui-fulldeps/no-link-unknown-crate.stderr new file mode 100644 index 00000000000..182b484f80b --- /dev/null +++ b/src/test/ui-fulldeps/no-link-unknown-crate.stderr @@ -0,0 +1,9 @@ +error[E0463]: can't find crate for `doesnt_exist` + --> $DIR/no-link-unknown-crate.rs:12:1 + | +LL | extern crate doesnt_exist; //~ ERROR can't find crate + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.rs b/src/test/ui-fulldeps/plugin-as-extern-crate.rs new file mode 100644 index 00000000000..bb292e2e52a --- /dev/null +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.rs @@ -0,0 +1,22 @@ +// Copyright 2013-2015 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-cross-compile +// +// macro_crate_test will not compile on a cross-compiled target because +// libsyntax is not compiled for it. + +#![deny(plugin_as_library)] +#![allow(unused_extern_crates)] + +extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + +fn main() { } diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr new file mode 100644 index 00000000000..713f1b07345 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr @@ -0,0 +1,14 @@ +error: compiler plugin used as an ordinary library + --> $DIR/plugin-as-extern-crate.rs:20:1 + | +LL | extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-as-extern-crate.rs:17:9 + | +LL | #![deny(plugin_as_library)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.rs b/src/test/ui-fulldeps/plugin-attr-register-deny.rs new file mode 100644 index 00000000000..0d2a5a30c10 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.rs @@ -0,0 +1,30 @@ +// 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:attr_plugin_test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(attr_plugin_test)] +#![deny(unused_attributes)] + +#[baz] +fn baz() { } // no error + +#[foo] +pub fn main() { + //~^^ ERROR unused + #[bar] + fn inner() {} + //~^^ ERROR crate + //~^^^ ERROR unused + baz(); + inner(); +} diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.stderr b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr new file mode 100644 index 00000000000..0bb2d1c9f5e --- /dev/null +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr @@ -0,0 +1,26 @@ +error: unused attribute + --> $DIR/plugin-attr-register-deny.rs:24:5 + | +LL | #[bar] + | ^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-attr-register-deny.rs:16:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/plugin-attr-register-deny.rs:24:5 + | +LL | #[bar] + | ^^^^^^ + +error: unused attribute + --> $DIR/plugin-attr-register-deny.rs:21:1 + | +LL | #[foo] + | ^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui-fulldeps/plugin-plus-extern-crate.rs b/src/test/ui-fulldeps/plugin-plus-extern-crate.rs new file mode 100644 index 00000000000..3dfd8838ebe --- /dev/null +++ b/src/test/ui-fulldeps/plugin-plus-extern-crate.rs @@ -0,0 +1,27 @@ +// Copyright 2013-2015 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 +// ignore-cross-compile +// +// macro_crate_test will not compile on a cross-compiled target because +// libsyntax is not compiled for it. + +#![deny(plugin_as_library)] +#![feature(plugin)] +#![plugin(macro_crate_test)] + +extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + +fn main() { + assert_eq!(1, make_a_1!()); + macro_crate_test::foo(); +} diff --git a/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr b/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr new file mode 100644 index 00000000000..faefe04e14a --- /dev/null +++ b/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr @@ -0,0 +1,14 @@ +error: compiler plugin used as an ordinary library + --> $DIR/plugin-plus-extern-crate.rs:22:1 + | +LL | extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-plus-extern-crate.rs:18:9 + | +LL | #![deny(plugin_as_library)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/qquote.rs b/src/test/ui-fulldeps/qquote.rs new file mode 100644 index 00000000000..4b0bc8f02b4 --- /dev/null +++ b/src/test/ui-fulldeps/qquote.rs @@ -0,0 +1,37 @@ +// Copyright 2012-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. + +// ignore-cross-compile + +#![feature(quote, rustc_private)] + +extern crate syntax; +extern crate syntax_pos; + +use syntax::ast; +use syntax::source_map::FilePathMapping; +use syntax::print::pprust; +use syntax::symbol::Symbol; +use syntax_pos::DUMMY_SP; + +fn main() { + let ps = syntax::parse::ParseSess::new(FilePathMapping::empty()); + let mut resolver = syntax::ext::base::DummyResolver; + let mut cx = syntax::ext::base::ExtCtxt::new( + &ps, + syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), + &mut resolver); + let cx = &mut cx; + + assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23"); + + let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope + assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7"); +} diff --git a/src/test/ui-fulldeps/qquote.stderr b/src/test/ui-fulldeps/qquote.stderr new file mode 100644 index 00000000000..4c136ad4b78 --- /dev/null +++ b/src/test/ui-fulldeps/qquote.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `abcd` in this scope + --> $DIR/qquote.rs:35:38 + | +LL | let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope + | ^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. -- cgit 1.4.1-3-g733a5