From 837b550238aa671a591ccf282dddeab29cadb206 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:42 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui-fulldeps/auxiliary/empty-plugin.rs | 9 - tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs | 61 ------- tests/ui-fulldeps/auxiliary/lint-for-crate.rs | 43 ----- .../auxiliary/lint-group-plugin-test.rs | 44 ----- tests/ui-fulldeps/auxiliary/lint-plugin-test.rs | 33 ---- tests/ui-fulldeps/auxiliary/lint-tool-test.rs | 52 ------ .../auxiliary/lto-syntax-extension-lib.rs | 5 - .../auxiliary/lto-syntax-extension-plugin.rs | 11 -- tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs | 10 -- tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs | 10 -- .../auxiliary/outlive-expansion-phase.rs | 24 --- tests/ui-fulldeps/auxiliary/rlib-crate-test.rs | 12 -- tests/ui-fulldeps/compiler-calls.rs | 1 - .../deriving-encodable-decodable-box.rs | 34 ---- .../deriving-encodable-decodable-cell-refcell.rs | 44 ----- tests/ui-fulldeps/feature-gate-plugin.rs | 8 - tests/ui-fulldeps/feature-gate-plugin.stderr | 20 --- tests/ui-fulldeps/fluent-messages/test.rs | 4 +- tests/ui-fulldeps/gated-plugin.rs | 8 - tests/ui-fulldeps/gated-plugin.stderr | 20 --- tests/ui-fulldeps/hash-stable-is-unstable.rs | 1 - tests/ui-fulldeps/hash-stable-is-unstable.stderr | 10 +- tests/ui-fulldeps/internal-lints/diagnostics.rs | 8 +- .../ui-fulldeps/internal-lints/diagnostics.stderr | 10 +- tests/ui-fulldeps/issue-14021.rs | 33 ---- tests/ui-fulldeps/issue-15778-fail.rs | 9 - tests/ui-fulldeps/issue-15778-fail.stderr | 22 --- tests/ui-fulldeps/issue-40001.rs | 10 -- tests/ui-fulldeps/issue-40001.stderr | 10 -- .../ui-fulldeps/lint-group-denied-lint-allowed.rs | 7 - .../lint-group-forbid-always-trumps-cli.rs | 7 - .../lint-group-forbid-always-trumps-cli.stderr | 10 -- .../ui-fulldeps/lint-group-plugin-deny-cmdline.rs | 17 -- .../lint-group-plugin-deny-cmdline.stderr | 26 --- tests/ui-fulldeps/lint-group-plugin.rs | 17 -- tests/ui-fulldeps/lint-group-plugin.stderr | 26 --- tests/ui-fulldeps/lint-plugin-cmdline-allow.rs | 12 -- tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr | 10 -- tests/ui-fulldeps/lint-plugin-cmdline-load.rs | 13 -- tests/ui-fulldeps/lint-plugin-cmdline-load.stderr | 18 -- tests/ui-fulldeps/lint-plugin-deny-attr.rs | 13 -- tests/ui-fulldeps/lint-plugin-deny-attr.stderr | 22 --- tests/ui-fulldeps/lint-plugin-deny-cmdline.rs | 13 -- tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr | 18 -- tests/ui-fulldeps/lint-plugin-forbid-attrs.rs | 16 -- tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr | 41 ----- tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs | 15 -- .../ui-fulldeps/lint-plugin-forbid-cmdline.stderr | 35 ---- tests/ui-fulldeps/lint-plugin.rs | 13 -- tests/ui-fulldeps/lint-plugin.stderr | 18 -- tests/ui-fulldeps/lint-tool-cmdline-allow.rs | 12 -- tests/ui-fulldeps/lint-tool-cmdline-allow.stderr | 30 ---- tests/ui-fulldeps/lint-tool-test.rs | 36 ---- tests/ui-fulldeps/lint-tool-test.stderr | 95 ----------- tests/ui-fulldeps/lto-syntax-extension.rs | 15 -- tests/ui-fulldeps/lto-syntax-extension.stderr | 10 -- tests/ui-fulldeps/macro-crate-rlib.rs | 8 - tests/ui-fulldeps/macro-crate-rlib.stderr | 9 - tests/ui-fulldeps/multiple-plugins.rs | 12 -- tests/ui-fulldeps/multiple-plugins.stderr | 16 -- tests/ui-fulldeps/outlive-expansion-phase.rs | 8 - tests/ui-fulldeps/outlive-expansion-phase.stderr | 10 -- tests/ui-fulldeps/pathless-extern-unstable.rs | 1 - tests/ui-fulldeps/pathless-extern-unstable.stderr | 2 +- tests/ui-fulldeps/plugin-args.rs | 9 - tests/ui-fulldeps/plugin-args.stderr | 17 -- tests/ui-fulldeps/plugin-as-extern-crate.rs | 10 -- tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs | 9 + .../plugin/auxiliary/issue-40001-plugin.rs | 61 +++++++ .../ui-fulldeps/plugin/auxiliary/lint-for-crate.rs | 43 +++++ .../plugin/auxiliary/lint-group-plugin-test.rs | 44 +++++ .../plugin/auxiliary/lint-plugin-test.rs | 33 ++++ .../ui-fulldeps/plugin/auxiliary/lint-tool-test.rs | 52 ++++++ .../plugin/auxiliary/lto-syntax-extension-lib.rs | 5 + .../auxiliary/lto-syntax-extension-plugin.rs | 11 ++ .../plugin/auxiliary/multiple-plugins-1.rs | 10 ++ .../plugin/auxiliary/multiple-plugins-2.rs | 10 ++ .../plugin/auxiliary/outlive-expansion-phase.rs | 24 +++ .../plugin/auxiliary/rlib-crate-test.rs | 12 ++ tests/ui-fulldeps/plugin/feature-gate-plugin.rs | 8 + .../ui-fulldeps/plugin/feature-gate-plugin.stderr | 20 +++ tests/ui-fulldeps/plugin/gated-plugin.rs | 8 + tests/ui-fulldeps/plugin/gated-plugin.stderr | 20 +++ tests/ui-fulldeps/plugin/issue-15778-fail.rs | 9 + tests/ui-fulldeps/plugin/issue-15778-fail.stderr | 22 +++ tests/ui-fulldeps/plugin/issue-40001.rs | 10 ++ tests/ui-fulldeps/plugin/issue-40001.stderr | 10 ++ .../plugin/lint-group-plugin-deny-cmdline.rs | 17 ++ .../plugin/lint-group-plugin-deny-cmdline.stderr | 26 +++ tests/ui-fulldeps/plugin/lint-group-plugin.rs | 17 ++ tests/ui-fulldeps/plugin/lint-group-plugin.stderr | 26 +++ .../plugin/lint-plugin-cmdline-allow.rs | 12 ++ .../plugin/lint-plugin-cmdline-allow.stderr | 10 ++ .../ui-fulldeps/plugin/lint-plugin-cmdline-load.rs | 13 ++ .../plugin/lint-plugin-cmdline-load.stderr | 18 ++ tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs | 13 ++ .../plugin/lint-plugin-deny-attr.stderr | 22 +++ .../ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs | 13 ++ .../plugin/lint-plugin-deny-cmdline.stderr | 18 ++ .../ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs | 16 ++ .../plugin/lint-plugin-forbid-attrs.stderr | 41 +++++ .../plugin/lint-plugin-forbid-cmdline.rs | 15 ++ .../plugin/lint-plugin-forbid-cmdline.stderr | 35 ++++ tests/ui-fulldeps/plugin/lint-plugin.rs | 13 ++ tests/ui-fulldeps/plugin/lint-plugin.stderr | 18 ++ .../ui-fulldeps/plugin/lint-tool-cmdline-allow.rs | 12 ++ .../plugin/lint-tool-cmdline-allow.stderr | 30 ++++ tests/ui-fulldeps/plugin/lint-tool-test.rs | 36 ++++ tests/ui-fulldeps/plugin/lint-tool-test.stderr | 95 +++++++++++ tests/ui-fulldeps/plugin/lto-syntax-extension.rs | 15 ++ .../ui-fulldeps/plugin/lto-syntax-extension.stderr | 10 ++ tests/ui-fulldeps/plugin/macro-crate-rlib.rs | 9 + tests/ui-fulldeps/plugin/macro-crate-rlib.stderr | 9 + tests/ui-fulldeps/plugin/multiple-plugins.rs | 12 ++ tests/ui-fulldeps/plugin/multiple-plugins.stderr | 16 ++ .../ui-fulldeps/plugin/outlive-expansion-phase.rs | 8 + .../plugin/outlive-expansion-phase.stderr | 10 ++ tests/ui-fulldeps/plugin/plugin-args.rs | 9 + tests/ui-fulldeps/plugin/plugin-args.stderr | 17 ++ tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs | 10 ++ .../diagnostic-derive-doc-comment-field.rs | 49 ++++++ .../diagnostic-derive-doc-comment-field.stderr | 30 ++++ .../session-diagnostic/diagnostic-derive.rs | 7 +- .../session-diagnostic/diagnostic-derive.stderr | 189 +++++++++++---------- .../session-diagnostic/subdiagnostic-derive.rs | 5 +- .../session-diagnostic/subdiagnostic-derive.stderr | 182 ++++++++++---------- tests/ui-fulldeps/stable-mir/crate-info.rs | 38 ++++- 127 files changed, 1391 insertions(+), 1404 deletions(-) delete mode 100644 tests/ui-fulldeps/auxiliary/empty-plugin.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-for-crate.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-group-plugin-test.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-plugin-test.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-tool-test.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lto-syntax-extension-lib.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lto-syntax-extension-plugin.rs delete mode 100644 tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs delete mode 100644 tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs delete mode 100644 tests/ui-fulldeps/auxiliary/outlive-expansion-phase.rs delete mode 100644 tests/ui-fulldeps/auxiliary/rlib-crate-test.rs delete mode 100644 tests/ui-fulldeps/deriving-encodable-decodable-box.rs delete mode 100644 tests/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs delete mode 100644 tests/ui-fulldeps/feature-gate-plugin.rs delete mode 100644 tests/ui-fulldeps/feature-gate-plugin.stderr delete mode 100644 tests/ui-fulldeps/gated-plugin.rs delete mode 100644 tests/ui-fulldeps/gated-plugin.stderr delete mode 100644 tests/ui-fulldeps/issue-14021.rs delete mode 100644 tests/ui-fulldeps/issue-15778-fail.rs delete mode 100644 tests/ui-fulldeps/issue-15778-fail.stderr delete mode 100644 tests/ui-fulldeps/issue-40001.rs delete mode 100644 tests/ui-fulldeps/issue-40001.stderr delete mode 100644 tests/ui-fulldeps/lint-group-denied-lint-allowed.rs delete mode 100644 tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.rs delete mode 100644 tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.stderr delete mode 100644 tests/ui-fulldeps/lint-group-plugin-deny-cmdline.rs delete mode 100644 tests/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr delete mode 100644 tests/ui-fulldeps/lint-group-plugin.rs delete mode 100644 tests/ui-fulldeps/lint-group-plugin.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-allow.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-load.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-load.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-attr.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-attr.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-cmdline.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-attrs.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-cmdline.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin.rs delete mode 100644 tests/ui-fulldeps/lint-plugin.stderr delete mode 100644 tests/ui-fulldeps/lint-tool-cmdline-allow.rs delete mode 100644 tests/ui-fulldeps/lint-tool-cmdline-allow.stderr delete mode 100644 tests/ui-fulldeps/lint-tool-test.rs delete mode 100644 tests/ui-fulldeps/lint-tool-test.stderr delete mode 100644 tests/ui-fulldeps/lto-syntax-extension.rs delete mode 100644 tests/ui-fulldeps/lto-syntax-extension.stderr delete mode 100644 tests/ui-fulldeps/macro-crate-rlib.rs delete mode 100644 tests/ui-fulldeps/macro-crate-rlib.stderr delete mode 100644 tests/ui-fulldeps/multiple-plugins.rs delete mode 100644 tests/ui-fulldeps/multiple-plugins.stderr delete mode 100644 tests/ui-fulldeps/outlive-expansion-phase.rs delete mode 100644 tests/ui-fulldeps/outlive-expansion-phase.stderr delete mode 100644 tests/ui-fulldeps/plugin-args.rs delete mode 100644 tests/ui-fulldeps/plugin-args.stderr delete mode 100644 tests/ui-fulldeps/plugin-as-extern-crate.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs create mode 100644 tests/ui-fulldeps/plugin/feature-gate-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/feature-gate-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/gated-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/gated-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/issue-15778-fail.rs create mode 100644 tests/ui-fulldeps/plugin/issue-15778-fail.stderr create mode 100644 tests/ui-fulldeps/plugin/issue-40001.rs create mode 100644 tests/ui-fulldeps/plugin/issue-40001.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs create mode 100644 tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-tool-test.rs create mode 100644 tests/ui-fulldeps/plugin/lint-tool-test.stderr create mode 100644 tests/ui-fulldeps/plugin/lto-syntax-extension.rs create mode 100644 tests/ui-fulldeps/plugin/lto-syntax-extension.stderr create mode 100644 tests/ui-fulldeps/plugin/macro-crate-rlib.rs create mode 100644 tests/ui-fulldeps/plugin/macro-crate-rlib.stderr create mode 100644 tests/ui-fulldeps/plugin/multiple-plugins.rs create mode 100644 tests/ui-fulldeps/plugin/multiple-plugins.stderr create mode 100644 tests/ui-fulldeps/plugin/outlive-expansion-phase.rs create mode 100644 tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr create mode 100644 tests/ui-fulldeps/plugin/plugin-args.rs create mode 100644 tests/ui-fulldeps/plugin/plugin-args.stderr create mode 100644 tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs create mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs create mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr (limited to 'tests/ui-fulldeps') diff --git a/tests/ui-fulldeps/auxiliary/empty-plugin.rs b/tests/ui-fulldeps/auxiliary/empty-plugin.rs deleted file mode 100644 index c24cdc97a..000000000 --- a/tests/ui-fulldeps/auxiliary/empty-plugin.rs +++ /dev/null @@ -1,9 +0,0 @@ -// force-host - -#![feature(rustc_private)] - -extern crate rustc_driver; -use rustc_driver::plugin::Registry; - -#[no_mangle] -fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs deleted file mode 100644 index 3f6caecaa..000000000 --- a/tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ /dev/null @@ -1,61 +0,0 @@ -#![feature(plugin, rustc_private)] -#![crate_type = "dylib"] - -extern crate rustc_ast_pretty; -extern crate rustc_driver; -extern crate rustc_hir; -extern crate rustc_lint; -#[macro_use] -extern crate rustc_session; -extern crate rustc_ast; -extern crate rustc_span; - -use rustc_ast_pretty::pprust; -use rustc_driver::plugin::Registry; -use rustc_hir as hir; -use rustc_hir::intravisit; -use rustc_hir::Node; -use rustc_lint::{LateContext, LateLintPass, LintContext}; -use rustc_span::def_id::LocalDefId; -use rustc_span::source_map; - -#[no_mangle] -fn __rustc_plugin_registrar(reg: &mut Registry) { - reg.lint_store.register_lints(&[&MISSING_ALLOWED_ATTR]); - reg.lint_store.register_late_pass(|_| Box::new(MissingAllowedAttrPass)); -} - -declare_lint! { - MISSING_ALLOWED_ATTR, - Deny, - "Checks for missing `allowed_attr` attribute" -} - -declare_lint_pass!(MissingAllowedAttrPass => [MISSING_ALLOWED_ATTR]); - -impl<'tcx> LateLintPass<'tcx> for MissingAllowedAttrPass { - fn check_fn( - &mut self, - cx: &LateContext<'tcx>, - _: intravisit::FnKind<'tcx>, - _: &'tcx hir::FnDecl, - _: &'tcx hir::Body, - span: source_map::Span, - def_id: LocalDefId, - ) { - let id = cx.tcx.hir().local_def_id_to_hir_id(def_id); - let item = match cx.tcx.hir().get(id) { - Node::Item(item) => item, - _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id).def_id), - }; - - let allowed = |attr| pprust::attribute_to_string(attr).contains("allowed_attr"); - if !cx.tcx.hir().attrs(item.hir_id()).iter().any(allowed) { - cx.lint( - MISSING_ALLOWED_ATTR, - "Missing 'allowed_attr' attribute", - |lint| lint.set_span(span) - ); - } - } -} diff --git a/tests/ui-fulldeps/auxiliary/lint-for-crate.rs b/tests/ui-fulldeps/auxiliary/lint-for-crate.rs deleted file mode 100644 index 6304c07d2..000000000 --- a/tests/ui-fulldeps/auxiliary/lint-for-crate.rs +++ /dev/null @@ -1,43 +0,0 @@ -// force-host - -#![feature(rustc_private)] - -extern crate rustc_driver; -extern crate rustc_hir; -extern crate rustc_lint; -#[macro_use] -extern crate rustc_session; -extern crate rustc_ast; -extern crate rustc_span; - -use rustc_ast::attr; -use rustc_driver::plugin::Registry; -use rustc_lint::{LateContext, LateLintPass, LintContext}; -use rustc_span::def_id::CRATE_DEF_ID; -use rustc_span::symbol::Symbol; - -declare_lint! { - CRATE_NOT_OKAY, - Warn, - "crate not marked with #![crate_okay]" -} - -declare_lint_pass!(Pass => [CRATE_NOT_OKAY]); - -impl<'tcx> LateLintPass<'tcx> for Pass { - fn check_crate(&mut self, cx: &LateContext) { - let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID); - let span = cx.tcx.def_span(CRATE_DEF_ID); - if !attr::contains_name(attrs, Symbol::intern("crate_okay")) { - cx.lint(CRATE_NOT_OKAY, "crate is not marked with #![crate_okay]", |lint| { - lint.set_span(span) - }); - } - } -} - -#[no_mangle] -fn __rustc_plugin_registrar(reg: &mut Registry) { - reg.lint_store.register_lints(&[&CRATE_NOT_OKAY]); - reg.lint_store.register_late_pass(|_| Box::new(Pass)); -} diff --git a/tests/ui-fulldeps/auxiliary/lint-group-plugin-test.rs b/tests/ui-fulldeps/auxiliary/lint-group-plugin-test.rs deleted file mode 100644 index 4a41e7fbb..000000000 --- a/tests/ui-fulldeps/auxiliary/lint-group-plugin-test.rs +++ /dev/null @@ -1,44 +0,0 @@ -// force-host - -#![feature(rustc_private)] - -// Load rustc as a plugin to get macros. -extern crate rustc_driver; -extern crate rustc_hir; -#[macro_use] -extern crate rustc_lint; -#[macro_use] -extern crate rustc_session; - -use rustc_driver::plugin::Registry; -use rustc_lint::{LateContext, LateLintPass, LintArray, LintContext, LintId, LintPass}; - -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); - -declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]); - -impl<'tcx> LateLintPass<'tcx> for Pass { - fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) { - match it.ident.as_str() { - "lintme" => cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)), - "pleaselintme" => { - cx.lint(PLEASE_LINT, "item is named 'pleaselintme'", |lint| lint.set_span(it.span)) - } - _ => {} - } - } -} - -#[no_mangle] -fn __rustc_plugin_registrar(reg: &mut Registry) { - reg.lint_store.register_lints(&[&TEST_LINT, &PLEASE_LINT]); - reg.lint_store.register_late_pass(|_| Box::new(Pass)); - reg.lint_store.register_group( - true, - "lint_me", - None, - vec![LintId::of(&TEST_LINT), LintId::of(&PLEASE_LINT)], - ); -} diff --git a/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs b/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs deleted file mode 100644 index 30956deb7..000000000 --- a/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs +++ /dev/null @@ -1,33 +0,0 @@ -// force-host - -#![feature(rustc_private)] - -extern crate rustc_ast; - -// Load rustc as a plugin to get macros -extern crate rustc_driver; -#[macro_use] -extern crate rustc_lint; -#[macro_use] -extern crate rustc_session; - -use rustc_driver::plugin::Registry; -use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; -use rustc_ast as ast; -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -declare_lint_pass!(Pass => [TEST_LINT]); - -impl EarlyLintPass for Pass { - fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { - if it.ident.name.as_str() == "lintme" { - cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)); - } - } -} - -#[no_mangle] -fn __rustc_plugin_registrar(reg: &mut Registry) { - reg.lint_store.register_lints(&[&TEST_LINT]); - reg.lint_store.register_early_pass(|| Box::new(Pass)); -} diff --git a/tests/ui-fulldeps/auxiliary/lint-tool-test.rs b/tests/ui-fulldeps/auxiliary/lint-tool-test.rs deleted file mode 100644 index c2c024865..000000000 --- a/tests/ui-fulldeps/auxiliary/lint-tool-test.rs +++ /dev/null @@ -1,52 +0,0 @@ -#![feature(rustc_private)] - -extern crate rustc_ast; - -// Load rustc as a plugin to get macros -extern crate rustc_driver; -#[macro_use] -extern crate rustc_lint; -#[macro_use] -extern crate rustc_session; - -use rustc_driver::plugin::Registry; -use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass}; -use rustc_ast as ast; -declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); -declare_tool_lint!( - /// Some docs - pub clippy::TEST_GROUP, - Warn, "Warn about other stuff" -); - -declare_tool_lint!( - /// Some docs - pub rustc::TEST_RUSTC_TOOL_LINT, - Deny, - "Deny internal stuff" -); - -declare_lint_pass!(Pass => [TEST_LINT, TEST_GROUP, TEST_RUSTC_TOOL_LINT]); - -impl EarlyLintPass for Pass { - fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { - if it.ident.name.as_str() == "lintme" { - cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)); - } - if it.ident.name.as_str() == "lintmetoo" { - cx.lint(TEST_GROUP, "item is named 'lintmetoo'", |lint| lint.set_span(it.span)); - } - } -} - -#[no_mangle] -fn __rustc_plugin_registrar(reg: &mut Registry) { - reg.lint_store.register_lints(&[&TEST_RUSTC_TOOL_LINT, &TEST_LINT, &TEST_GROUP]); - reg.lint_store.register_early_pass(|| Box::new(Pass)); - reg.lint_store.register_group( - true, - "clippy::group", - Some("clippy_group"), - vec![LintId::of(&TEST_LINT), LintId::of(&TEST_GROUP)], - ); -} diff --git a/tests/ui-fulldeps/auxiliary/lto-syntax-extension-lib.rs b/tests/ui-fulldeps/auxiliary/lto-syntax-extension-lib.rs deleted file mode 100644 index 954a1e554..000000000 --- a/tests/ui-fulldeps/auxiliary/lto-syntax-extension-lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/tests/ui-fulldeps/auxiliary/lto-syntax-extension-plugin.rs b/tests/ui-fulldeps/auxiliary/lto-syntax-extension-plugin.rs deleted file mode 100644 index 9b075c1a5..000000000 --- a/tests/ui-fulldeps/auxiliary/lto-syntax-extension-plugin.rs +++ /dev/null @@ -1,11 +0,0 @@ -// force-host - -#![feature(rustc_private)] - -extern crate rustc_middle; -extern crate rustc_driver; - -use rustc_driver::plugin::Registry; - -#[no_mangle] -fn __rustc_plugin_registrar(_reg: &mut Registry) {} diff --git a/tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs b/tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs deleted file mode 100644 index fd6e9e20f..000000000 --- a/tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "dylib"] -#![feature(rustc_private)] - -extern crate rustc_middle; -extern crate rustc_driver; - -use rustc_driver::plugin::Registry; - -#[no_mangle] -fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs b/tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs deleted file mode 100644 index fd6e9e20f..000000000 --- a/tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "dylib"] -#![feature(rustc_private)] - -extern crate rustc_middle; -extern crate rustc_driver; - -use rustc_driver::plugin::Registry; - -#[no_mangle] -fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/auxiliary/outlive-expansion-phase.rs b/tests/ui-fulldeps/auxiliary/outlive-expansion-phase.rs deleted file mode 100644 index e83dfe804..000000000 --- a/tests/ui-fulldeps/auxiliary/outlive-expansion-phase.rs +++ /dev/null @@ -1,24 +0,0 @@ -// force-host - -#![feature(rustc_private)] - -extern crate rustc_middle; -extern crate rustc_driver; - -use std::any::Any; -use std::cell::RefCell; -use rustc_driver::plugin::Registry; - -struct Foo { - foo: isize -} - -impl Drop for Foo { - fn drop(&mut self) {} -} - -#[no_mangle] -fn __rustc_plugin_registrar(_: &mut Registry) { - thread_local!(static FOO: RefCell>> = RefCell::new(None)); - FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box)); -} diff --git a/tests/ui-fulldeps/auxiliary/rlib-crate-test.rs b/tests/ui-fulldeps/auxiliary/rlib-crate-test.rs deleted file mode 100644 index 3ba73538e..000000000 --- a/tests/ui-fulldeps/auxiliary/rlib-crate-test.rs +++ /dev/null @@ -1,12 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![feature(rustc_private)] - -extern crate rustc_middle; -extern crate rustc_driver; - -use rustc_driver::plugin::Registry; - -#[no_mangle] -fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/compiler-calls.rs b/tests/ui-fulldeps/compiler-calls.rs index a9520b592..b6d3b7b04 100644 --- a/tests/ui-fulldeps/compiler-calls.rs +++ b/tests/ui-fulldeps/compiler-calls.rs @@ -2,7 +2,6 @@ // Test that the Callbacks interface to the compiler works. // ignore-cross-compile -// ignore-stage1 // ignore-remote #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/deriving-encodable-decodable-box.rs b/tests/ui-fulldeps/deriving-encodable-decodable-box.rs deleted file mode 100644 index 1c376f59e..000000000 --- a/tests/ui-fulldeps/deriving-encodable-decodable-box.rs +++ /dev/null @@ -1,34 +0,0 @@ -// run-pass - -#![allow(unused_imports)] -#![feature(rustc_private)] - -extern crate rustc_macros; -extern crate rustc_serialize; - -// Necessary to pull in object code as the rest of the rustc crates are shipped only as rmeta -// files. -#[allow(unused_extern_crates)] -extern crate rustc_driver; - -use rustc_macros::{Decodable, Encodable}; -use rustc_serialize::opaque::{MemDecoder, MemEncoder}; -use rustc_serialize::{Decodable, Encodable, Encoder}; - -#[derive(Encodable, Decodable)] -struct A { - foo: Box<[bool]>, -} - -fn main() { - let obj = A { foo: Box::new([true, false]) }; - - let mut encoder = MemEncoder::new(); - obj.encode(&mut encoder); - let data = encoder.finish(); - - let mut decoder = MemDecoder::new(&data, 0); - let obj2 = A::decode(&mut decoder); - - assert_eq!(obj.foo, obj2.foo); -} diff --git a/tests/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs b/tests/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs deleted file mode 100644 index 844d40f2e..000000000 --- a/tests/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs +++ /dev/null @@ -1,44 +0,0 @@ -// run-pass - -#![allow(unused_imports)] -// This briefly tests the capability of `Cell` and `RefCell` to implement the -// `Encodable` and `Decodable` traits via `#[derive(Encodable, Decodable)]` -#![feature(rustc_private)] - -extern crate rustc_macros; -extern crate rustc_serialize; - -// Necessary to pull in object code as the rest of the rustc crates are shipped only as rmeta -// files. -#[allow(unused_extern_crates)] -extern crate rustc_driver; - -use rustc_macros::{Decodable, Encodable}; -use rustc_serialize::opaque::{MemDecoder, MemEncoder}; -use rustc_serialize::{Decodable, Encodable, Encoder}; -use std::cell::{Cell, RefCell}; - -#[derive(Encodable, Decodable)] -struct A { - baz: isize, -} - -#[derive(Encodable, Decodable)] -struct B { - foo: Cell, - bar: RefCell, -} - -fn main() { - let obj = B { foo: Cell::new(true), bar: RefCell::new(A { baz: 2 }) }; - - let mut encoder = MemEncoder::new(); - obj.encode(&mut encoder); - let data = encoder.finish(); - - let mut decoder = MemDecoder::new(&data, 0); - let obj2 = B::decode(&mut decoder); - - assert_eq!(obj.foo.get(), obj2.foo.get()); - assert_eq!(obj.bar.borrow().baz, obj2.bar.borrow().baz); -} diff --git a/tests/ui-fulldeps/feature-gate-plugin.rs b/tests/ui-fulldeps/feature-gate-plugin.rs deleted file mode 100644 index 85eaf5336..000000000 --- a/tests/ui-fulldeps/feature-gate-plugin.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:empty-plugin.rs -// ignore-stage1 - -#![plugin(empty_plugin)] -//~^ ERROR compiler plugins are deprecated -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated - -fn main() {} diff --git a/tests/ui-fulldeps/feature-gate-plugin.stderr b/tests/ui-fulldeps/feature-gate-plugin.stderr deleted file mode 100644 index 5e40561c7..000000000 --- a/tests/ui-fulldeps/feature-gate-plugin.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0658]: compiler plugins are deprecated - --> $DIR/feature-gate-plugin.rs:4:1 - | -LL | #![plugin(empty_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #29597 for more information - = help: add `#![feature(plugin)]` to the crate attributes to enable - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/feature-gate-plugin.rs:4:1 - | -LL | #![plugin(empty_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs index 6ba13387b..1dd6d211b 100644 --- a/tests/ui-fulldeps/fluent-messages/test.rs +++ b/tests/ui-fulldeps/fluent-messages/test.rs @@ -3,8 +3,8 @@ #![feature(rustc_private)] #![crate_type = "lib"] -extern crate rustc_macros; -use rustc_macros::fluent_messages; +extern crate rustc_fluent_macro; +use rustc_fluent_macro::fluent_messages; /// Copy of the relevant `DiagnosticMessage` variant constructed by `fluent_messages` as it /// expects `crate::DiagnosticMessage` to exist. diff --git a/tests/ui-fulldeps/gated-plugin.rs b/tests/ui-fulldeps/gated-plugin.rs deleted file mode 100644 index 85eaf5336..000000000 --- a/tests/ui-fulldeps/gated-plugin.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:empty-plugin.rs -// ignore-stage1 - -#![plugin(empty_plugin)] -//~^ ERROR compiler plugins are deprecated -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated - -fn main() {} diff --git a/tests/ui-fulldeps/gated-plugin.stderr b/tests/ui-fulldeps/gated-plugin.stderr deleted file mode 100644 index f48f1eab6..000000000 --- a/tests/ui-fulldeps/gated-plugin.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0658]: compiler plugins are deprecated - --> $DIR/gated-plugin.rs:4:1 - | -LL | #![plugin(empty_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #29597 for more information - = help: add `#![feature(plugin)]` to the crate attributes to enable - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/gated-plugin.rs:4:1 - | -LL | #![plugin(empty_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.rs b/tests/ui-fulldeps/hash-stable-is-unstable.rs index 11fe688f3..37d7472ec 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.rs +++ b/tests/ui-fulldeps/hash-stable-is-unstable.rs @@ -1,4 +1,3 @@ -// ignore-stage1 // compile-flags: -Zdeduplicate-diagnostics=yes extern crate rustc_data_structures; //~^ use of unstable library feature 'rustc_private' diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.stderr b/tests/ui-fulldeps/hash-stable-is-unstable.stderr index d25657691..1a8994d72 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.stderr +++ b/tests/ui-fulldeps/hash-stable-is-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:3:1 + --> $DIR/hash-stable-is-unstable.rs:2:1 | LL | extern crate rustc_data_structures; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | extern crate rustc_data_structures; = help: add `#![feature(rustc_private)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:5:1 + --> $DIR/hash-stable-is-unstable.rs:4:1 | LL | extern crate rustc_macros; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | extern crate rustc_macros; = help: add `#![feature(rustc_private)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:7:1 + --> $DIR/hash-stable-is-unstable.rs:6:1 | LL | extern crate rustc_query_system; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | extern crate rustc_query_system; = help: add `#![feature(rustc_private)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:10:5 + --> $DIR/hash-stable-is-unstable.rs:9:5 | LL | use rustc_macros::HashStable; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | use rustc_macros::HashStable; = help: add `#![feature(rustc_private)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:13:10 + --> $DIR/hash-stable-is-unstable.rs:12:10 | LL | #[derive(HashStable)] | ^^^^^^^^^^ diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index 3aa65d53d..994fc26ba 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -7,15 +7,17 @@ #![deny(rustc::diagnostic_outside_of_impl)] extern crate rustc_errors; +extern crate rustc_fluent_macro; extern crate rustc_macros; extern crate rustc_session; extern crate rustc_span; use rustc_errors::{ - AddToDiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder, - ErrorGuaranteed, Handler, DiagnosticMessage, SubdiagnosticMessage, + AddToDiagnostic, Diagnostic, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, Handler, + IntoDiagnostic, SubdiagnosticMessage, }; -use rustc_macros::{fluent_messages, Diagnostic, Subdiagnostic}; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::Span; fluent_messages! { "./diagnostics.ftl" } diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr index 6f797ebc2..6e670c018 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.stderr +++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr @@ -1,5 +1,5 @@ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:41:17 + --> $DIR/diagnostics.rs:43:17 | LL | handler.struct_err("untranslatable diagnostic") | ^^^^^^^^^^ @@ -11,13 +11,13 @@ LL | #![deny(rustc::untranslatable_diagnostic)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:61:14 + --> $DIR/diagnostics.rs:63:14 | LL | diag.note("untranslatable diagnostic"); | ^^^^ error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls - --> $DIR/diagnostics.rs:78:25 + --> $DIR/diagnostics.rs:80:25 | LL | let _diag = handler.struct_err(crate::fluent_generated::no_crate_example); | ^^^^^^^^^^ @@ -29,13 +29,13 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls - --> $DIR/diagnostics.rs:81:25 + --> $DIR/diagnostics.rs:83:25 | LL | let _diag = handler.struct_err("untranslatable diagnostic"); | ^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:81:25 + --> $DIR/diagnostics.rs:83:25 | LL | let _diag = handler.struct_err("untranslatable diagnostic"); | ^^^^^^^^^^ diff --git a/tests/ui-fulldeps/issue-14021.rs b/tests/ui-fulldeps/issue-14021.rs deleted file mode 100644 index 309b5c4a0..000000000 --- a/tests/ui-fulldeps/issue-14021.rs +++ /dev/null @@ -1,33 +0,0 @@ -// run-pass - -#![allow(unused_mut)] -#![allow(unused_imports)] -#![feature(rustc_private)] - -extern crate rustc_macros; -extern crate rustc_serialize; - -// Necessary to pull in object code as the rest of the rustc crates are shipped only as rmeta -// files. -#[allow(unused_extern_crates)] -extern crate rustc_driver; - -use rustc_macros::{Decodable, Encodable}; -use rustc_serialize::opaque::{MemDecoder, MemEncoder}; -use rustc_serialize::{Decodable, Encodable, Encoder}; - -#[derive(Encodable, Decodable, PartialEq, Debug)] -struct UnitLikeStruct; - -pub fn main() { - let obj = UnitLikeStruct; - - let mut encoder = MemEncoder::new(); - obj.encode(&mut encoder); - let data = encoder.finish(); - - let mut decoder = MemDecoder::new(&data, 0); - let obj2 = UnitLikeStruct::decode(&mut decoder); - - assert_eq!(obj, obj2); -} diff --git a/tests/ui-fulldeps/issue-15778-fail.rs b/tests/ui-fulldeps/issue-15778-fail.rs deleted file mode 100644 index beecaadf9..000000000 --- a/tests/ui-fulldeps/issue-15778-fail.rs +++ /dev/null @@ -1,9 +0,0 @@ -// 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)] -//~^ WARN use of deprecated attribute `plugin` - -pub fn main() { } diff --git a/tests/ui-fulldeps/issue-15778-fail.stderr b/tests/ui-fulldeps/issue-15778-fail.stderr deleted file mode 100644 index a37893e12..000000000 --- a/tests/ui-fulldeps/issue-15778-fail.stderr +++ /dev/null @@ -1,22 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/issue-15778-fail.rs:6:1 - | -LL | #![plugin(lint_for_crate)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: crate is not marked with #![crate_okay] - --> $DIR/issue-15778-fail.rs:5:1 - | -LL | / #![feature(plugin)] -LL | | #![plugin(lint_for_crate)] -LL | | -LL | | -LL | | pub fn main() { } - | |_________________^ - | - = note: requested on the command line with `-D crate-not-okay` - -error: aborting due to previous error; 1 warning emitted - diff --git a/tests/ui-fulldeps/issue-40001.rs b/tests/ui-fulldeps/issue-40001.rs deleted file mode 100644 index e14338fdb..000000000 --- a/tests/ui-fulldeps/issue-40001.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// aux-build:issue-40001-plugin.rs -// ignore-stage1 - -#![feature(plugin, register_tool)] -#![plugin(issue_40001_plugin)] //~ WARNING compiler plugins are deprecated -#![register_tool(plugin)] - -#[plugin::allowed_attr] -fn main() {} diff --git a/tests/ui-fulldeps/issue-40001.stderr b/tests/ui-fulldeps/issue-40001.stderr deleted file mode 100644 index 73ec06924..000000000 --- a/tests/ui-fulldeps/issue-40001.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/issue-40001.rs:6:1 - | -LL | #![plugin(issue_40001_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui-fulldeps/lint-group-denied-lint-allowed.rs b/tests/ui-fulldeps/lint-group-denied-lint-allowed.rs deleted file mode 100644 index 7498745f2..000000000 --- a/tests/ui-fulldeps/lint-group-denied-lint-allowed.rs +++ /dev/null @@ -1,7 +0,0 @@ -// aux-build:lint-group-plugin-test.rs -// check-pass -// compile-flags: -D unused -A unused-variables - -fn main() { - let x = 1; -} diff --git a/tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.rs b/tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.rs deleted file mode 100644 index fc19bc039..000000000 --- a/tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.rs +++ /dev/null @@ -1,7 +0,0 @@ -// aux-build:lint-group-plugin-test.rs -// compile-flags: -F unused -A unused - -fn main() { - let x = 1; - //~^ ERROR unused variable: `x` -} diff --git a/tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.stderr b/tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.stderr deleted file mode 100644 index 6bab367b0..000000000 --- a/tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unused variable: `x` - --> $DIR/lint-group-forbid-always-trumps-cli.rs:5:9 - | -LL | let x = 1; - | ^ help: if this is intentional, prefix it with an underscore: `_x` - | - = note: `-F unused-variables` implied by `-F unused` - -error: aborting due to previous error - diff --git a/tests/ui-fulldeps/lint-group-plugin-deny-cmdline.rs b/tests/ui-fulldeps/lint-group-plugin-deny-cmdline.rs deleted file mode 100644 index 9f8a87960..000000000 --- a/tests/ui-fulldeps/lint-group-plugin-deny-cmdline.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:lint-group-plugin-test.rs -// ignore-stage1 -// compile-flags: -D lint-me - -#![feature(plugin)] - -#![plugin(lint_group_plugin_test)] -//~^ WARN use of deprecated attribute `plugin` - -fn lintme() { } //~ ERROR item is named 'lintme' - -fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' - -pub fn main() { - lintme(); - pleaselintme(); -} diff --git a/tests/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr deleted file mode 100644 index 20486d596..000000000 --- a/tests/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr +++ /dev/null @@ -1,26 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-group-plugin-deny-cmdline.rs:7:1 - | -LL | #![plugin(lint_group_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: item is named 'lintme' - --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: `-D test-lint` implied by `-D lint-me` - -error: item is named 'pleaselintme' - --> $DIR/lint-group-plugin-deny-cmdline.rs:12:1 - | -LL | fn pleaselintme() { } - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D please-lint` implied by `-D lint-me` - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/tests/ui-fulldeps/lint-group-plugin.rs b/tests/ui-fulldeps/lint-group-plugin.rs deleted file mode 100644 index 7b74be7a9..000000000 --- a/tests/ui-fulldeps/lint-group-plugin.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass -// aux-build:lint-group-plugin-test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(lint_group_plugin_test)] //~ WARNING use of deprecated attribute -#![allow(dead_code)] - -fn lintme() { } //~ WARNING item is named 'lintme' -fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' - -#[allow(lint_me)] -pub fn main() { - fn lintme() { } - - fn pleaselintme() { } -} diff --git a/tests/ui-fulldeps/lint-group-plugin.stderr b/tests/ui-fulldeps/lint-group-plugin.stderr deleted file mode 100644 index 6f429dad0..000000000 --- a/tests/ui-fulldeps/lint-group-plugin.stderr +++ /dev/null @@ -1,26 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-group-plugin.rs:6:1 - | -LL | #![plugin(lint_group_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: item is named 'lintme' - --> $DIR/lint-group-plugin.rs:9:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(test_lint)]` on by default - -warning: item is named 'pleaselintme' - --> $DIR/lint-group-plugin.rs:10:1 - | -LL | fn pleaselintme() { } - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(please_lint)]` on by default - -warning: 3 warnings emitted - diff --git a/tests/ui-fulldeps/lint-plugin-cmdline-allow.rs b/tests/ui-fulldeps/lint-plugin-cmdline-allow.rs deleted file mode 100644 index 1cc16e2fd..000000000 --- a/tests/ui-fulldeps/lint-plugin-cmdline-allow.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// aux-build:lint-plugin-test.rs -// ignore-stage1 -// compile-flags: -A test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] //~ WARNING compiler plugins are deprecated - -fn lintme() { } - -pub fn main() { -} diff --git a/tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr b/tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr deleted file mode 100644 index f06703a27..000000000 --- a/tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-cmdline-allow.rs:7:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui-fulldeps/lint-plugin-cmdline-load.rs b/tests/ui-fulldeps/lint-plugin-cmdline-load.rs deleted file mode 100644 index 0bd95dfbd..000000000 --- a/tests/ui-fulldeps/lint-plugin-cmdline-load.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// aux-build:lint-plugin-test.rs -// ignore-stage1 -// compile-flags: -Z crate-attr=plugin(lint_plugin_test) - -#![feature(plugin)] - -fn lintme() { } //~ WARNING item is named 'lintme' - -#[allow(test_lint)] -pub fn main() { - fn lintme() { } -} diff --git a/tests/ui-fulldeps/lint-plugin-cmdline-load.stderr b/tests/ui-fulldeps/lint-plugin-cmdline-load.stderr deleted file mode 100644 index 82679c9e1..000000000 --- a/tests/ui-fulldeps/lint-plugin-cmdline-load.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: item is named 'lintme' - --> $DIR/lint-plugin-cmdline-load.rs:8:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(test_lint)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> :1:1 - | -LL | plugin(lint_plugin_test) - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: 2 warnings emitted - diff --git a/tests/ui-fulldeps/lint-plugin-deny-attr.rs b/tests/ui-fulldeps/lint-plugin-deny-attr.rs deleted file mode 100644 index 04230a8e8..000000000 --- a/tests/ui-fulldeps/lint-plugin-deny-attr.rs +++ /dev/null @@ -1,13 +0,0 @@ -// aux-build:lint-plugin-test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(lint_plugin_test)] -//~^ WARN use of deprecated attribute `plugin` -#![deny(test_lint)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -pub fn main() { - lintme(); -} diff --git a/tests/ui-fulldeps/lint-plugin-deny-attr.stderr b/tests/ui-fulldeps/lint-plugin-deny-attr.stderr deleted file mode 100644 index 5e8891bf1..000000000 --- a/tests/ui-fulldeps/lint-plugin-deny-attr.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: item is named 'lintme' - --> $DIR/lint-plugin-deny-attr.rs:9:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-plugin-deny-attr.rs:7:9 - | -LL | #![deny(test_lint)] - | ^^^^^^^^^ - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-deny-attr.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to previous error; 1 warning emitted - diff --git a/tests/ui-fulldeps/lint-plugin-deny-cmdline.rs b/tests/ui-fulldeps/lint-plugin-deny-cmdline.rs deleted file mode 100644 index c460cfd5f..000000000 --- a/tests/ui-fulldeps/lint-plugin-deny-cmdline.rs +++ /dev/null @@ -1,13 +0,0 @@ -// aux-build:lint-plugin-test.rs -// ignore-stage1 -// compile-flags: -D test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] -//~^ WARN use of deprecated attribute `plugin` - -fn lintme() { } //~ ERROR item is named 'lintme' - -pub fn main() { - lintme(); -} diff --git a/tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr deleted file mode 100644 index d5d6b5352..000000000 --- a/tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: item is named 'lintme' - --> $DIR/lint-plugin-deny-cmdline.rs:9:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: requested on the command line with `-D test-lint` - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-deny-cmdline.rs:6:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to previous error; 1 warning emitted - diff --git a/tests/ui-fulldeps/lint-plugin-forbid-attrs.rs b/tests/ui-fulldeps/lint-plugin-forbid-attrs.rs deleted file mode 100644 index cf31b3ec1..000000000 --- a/tests/ui-fulldeps/lint-plugin-forbid-attrs.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:lint-plugin-test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(lint_plugin_test)] -//~^ WARN use of deprecated attribute `plugin` -#![forbid(test_lint)] - -fn lintme() {} //~ ERROR item is named 'lintme' - -#[allow(test_lint)] -//~^ ERROR allow(test_lint) incompatible -//~| ERROR allow(test_lint) incompatible -pub fn main() { - lintme(); -} diff --git a/tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr deleted file mode 100644 index ae34b25cc..000000000 --- a/tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ /dev/null @@ -1,41 +0,0 @@ -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-attrs.rs:11:9 - | -LL | #![forbid(test_lint)] - | --------- `forbid` level set here -... -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - -error: item is named 'lintme' - --> $DIR/lint-plugin-forbid-attrs.rs:9:1 - | -LL | fn lintme() {} - | ^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-plugin-forbid-attrs.rs:7:11 - | -LL | #![forbid(test_lint)] - | ^^^^^^^^^ - -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-attrs.rs:11:9 - | -LL | #![forbid(test_lint)] - | --------- `forbid` level set here -... -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-forbid-attrs.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to 3 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs deleted file mode 100644 index b9d1aa85a..000000000 --- a/tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs +++ /dev/null @@ -1,15 +0,0 @@ -// aux-build:lint-plugin-test.rs -// ignore-stage1 -// compile-flags: -F test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] -//~^ WARN use of deprecated attribute `plugin` -fn lintme() { } //~ ERROR item is named 'lintme' - -#[allow(test_lint)] //~ ERROR allow(test_lint) incompatible - //~| ERROR allow(test_lint) incompatible - -pub fn main() { - lintme(); -} diff --git a/tests/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/tests/ui-fulldeps/lint-plugin-forbid-cmdline.stderr deleted file mode 100644 index 491c4d206..000000000 --- a/tests/ui-fulldeps/lint-plugin-forbid-cmdline.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 - | -LL | #[allow(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:8:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: requested on the command line with `-F test-lint` - -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 - | -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - | - = note: `forbid` lint level was set on command line - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to 3 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui-fulldeps/lint-plugin.rs b/tests/ui-fulldeps/lint-plugin.rs deleted file mode 100644 index 66057eea6..000000000 --- a/tests/ui-fulldeps/lint-plugin.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass -// aux-build:lint-plugin-test.rs -// ignore-stage1 -#![feature(plugin)] -#![plugin(lint_plugin_test)] //~ WARNING use of deprecated attribute -#![allow(dead_code)] - -fn lintme() { } //~ WARNING item is named 'lintme' - -#[allow(test_lint)] -pub fn main() { - fn lintme() { } -} diff --git a/tests/ui-fulldeps/lint-plugin.stderr b/tests/ui-fulldeps/lint-plugin.stderr deleted file mode 100644 index dd5d3d72e..000000000 --- a/tests/ui-fulldeps/lint-plugin.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: item is named 'lintme' - --> $DIR/lint-plugin.rs:8:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(test_lint)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: 2 warnings emitted - diff --git a/tests/ui-fulldeps/lint-tool-cmdline-allow.rs b/tests/ui-fulldeps/lint-tool-cmdline-allow.rs deleted file mode 100644 index 83a8b3e1a..000000000 --- a/tests/ui-fulldeps/lint-tool-cmdline-allow.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// aux-build:lint-tool-test.rs -// ignore-stage1 -// compile-flags: -A test-lint - -#![feature(plugin)] -#![plugin(lint_tool_test)] //~ WARNING compiler plugins are deprecated - -fn lintme() {} -//~^ WARNING item is named 'lintme' [clippy::test_lint] - -pub fn main() {} diff --git a/tests/ui-fulldeps/lint-tool-cmdline-allow.stderr b/tests/ui-fulldeps/lint-tool-cmdline-allow.stderr deleted file mode 100644 index b060e3a3e..000000000 --- a/tests/ui-fulldeps/lint-tool-cmdline-allow.stderr +++ /dev/null @@ -1,30 +0,0 @@ -warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint - | - = note: requested on the command line with `-A test_lint` - -warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint - | - = note: requested on the command line with `-A test_lint` - -warning: item is named 'lintme' - --> $DIR/lint-tool-cmdline-allow.rs:9:1 - | -LL | fn lintme() {} - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(clippy::test_lint)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-cmdline-allow.rs:7:1 - | -LL | #![plugin(lint_tool_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint - | - = note: requested on the command line with `-A test_lint` - -warning: 5 warnings emitted - diff --git a/tests/ui-fulldeps/lint-tool-test.rs b/tests/ui-fulldeps/lint-tool-test.rs deleted file mode 100644 index f92bcd213..000000000 --- a/tests/ui-fulldeps/lint-tool-test.rs +++ /dev/null @@ -1,36 +0,0 @@ -// aux-build:lint-tool-test.rs -// ignore-stage1 -// compile-flags: --cfg foo - -#![feature(plugin)] -#![plugin(lint_tool_test)] -//~^ WARN use of deprecated attribute `plugin` -#![allow(dead_code)] -#![cfg_attr(foo, warn(test_lint))] -//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future -#![deny(clippy_group)] -//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future - -fn lintme() { } //~ ERROR item is named 'lintme' - -#[allow(clippy::group)] -fn lintmetoo() {} - -#[allow(clippy::test_lint)] -pub fn main() { - fn lintme() { } - fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' -} - -#[allow(test_group)] -//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future -#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` -fn hello() { - fn lintmetoo() { } -} diff --git a/tests/ui-fulldeps/lint-tool-test.stderr b/tests/ui-fulldeps/lint-tool-test.stderr deleted file mode 100644 index 027cf8f80..000000000 --- a/tests/ui-fulldeps/lint-tool-test.stderr +++ /dev/null @@ -1,95 +0,0 @@ -warning: lint name `test_lint` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:9:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - | - = note: `#[warn(renamed_and_removed_lints)]` on by default - -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:13:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ help: change it to: `clippy::group` - -warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:29:9 - | -LL | #[allow(test_group)] - | ^^^^^^^^^^ help: change it to: `clippy::test_group` - -warning: lint name `test_lint` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:9:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:13:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ help: change it to: `clippy::group` - -error: item is named 'lintme' - --> $DIR/lint-tool-test.rs:18:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-tool-test.rs:13:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ - = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]` - -error: item is named 'lintmetoo' - --> $DIR/lint-tool-test.rs:26:5 - | -LL | fn lintmetoo() { } - | ^^^^^^^^^^^^^^^^^^ - | - = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` - -warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:29:9 - | -LL | #[allow(test_group)] - | ^^^^^^^^^^ help: change it to: `clippy::test_group` - -warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint-tool-test.rs:33:8 - | -LL | #[deny(this_lint_does_not_exist)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unknown_lints)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-test.rs:6:1 - | -LL | #![plugin(lint_tool_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: lint name `test_lint` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:9:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:13:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ help: change it to: `clippy::group` - -warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:29:9 - | -LL | #[allow(test_group)] - | ^^^^^^^^^^ help: change it to: `clippy::test_group` - -error: aborting due to 2 previous errors; 11 warnings emitted - diff --git a/tests/ui-fulldeps/lto-syntax-extension.rs b/tests/ui-fulldeps/lto-syntax-extension.rs deleted file mode 100644 index 5964e70f1..000000000 --- a/tests/ui-fulldeps/lto-syntax-extension.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// aux-build:lto-syntax-extension-lib.rs -// aux-build:lto-syntax-extension-plugin.rs -// compile-flags:-C lto -// ignore-stage1 -// no-prefer-dynamic - -#![feature(plugin)] -#![plugin(lto_syntax_extension_plugin)] //~ WARNING compiler plugins are deprecated - -extern crate lto_syntax_extension_lib; - -fn main() { - lto_syntax_extension_lib::foo(); -} diff --git a/tests/ui-fulldeps/lto-syntax-extension.stderr b/tests/ui-fulldeps/lto-syntax-extension.stderr deleted file mode 100644 index 555493f32..000000000 --- a/tests/ui-fulldeps/lto-syntax-extension.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lto-syntax-extension.rs:9:1 - | -LL | #![plugin(lto_syntax_extension_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui-fulldeps/macro-crate-rlib.rs b/tests/ui-fulldeps/macro-crate-rlib.rs deleted file mode 100644 index 1fd514c61..000000000 --- a/tests/ui-fulldeps/macro-crate-rlib.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:rlib-crate-test.rs -// 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 - -fn main() {} diff --git a/tests/ui-fulldeps/macro-crate-rlib.stderr b/tests/ui-fulldeps/macro-crate-rlib.stderr deleted file mode 100644 index 9c2b992b7..000000000 --- a/tests/ui-fulldeps/macro-crate-rlib.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format - --> $DIR/macro-crate-rlib.rs:5: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/tests/ui-fulldeps/multiple-plugins.rs b/tests/ui-fulldeps/multiple-plugins.rs deleted file mode 100644 index 9af3ebd57..000000000 --- a/tests/ui-fulldeps/multiple-plugins.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -// aux-build:multiple-plugins-1.rs -// aux-build:multiple-plugins-2.rs -// ignore-stage1 - -// Check that the plugin registrar of multiple plugins doesn't conflict - -#![feature(plugin)] -#![plugin(multiple_plugins_1)] //~ WARN use of deprecated attribute `plugin` -#![plugin(multiple_plugins_2)] //~ WARN use of deprecated attribute `plugin` - -fn main() {} diff --git a/tests/ui-fulldeps/multiple-plugins.stderr b/tests/ui-fulldeps/multiple-plugins.stderr deleted file mode 100644 index 878ffabfc..000000000 --- a/tests/ui-fulldeps/multiple-plugins.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/multiple-plugins.rs:9:1 - | -LL | #![plugin(multiple_plugins_1)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/multiple-plugins.rs:10:1 - | -LL | #![plugin(multiple_plugins_2)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - -warning: 2 warnings emitted - diff --git a/tests/ui-fulldeps/outlive-expansion-phase.rs b/tests/ui-fulldeps/outlive-expansion-phase.rs deleted file mode 100644 index fb22888d9..000000000 --- a/tests/ui-fulldeps/outlive-expansion-phase.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -// aux-build:outlive-expansion-phase.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(outlive_expansion_phase)] //~ WARNING compiler plugins are deprecated - -pub fn main() {} diff --git a/tests/ui-fulldeps/outlive-expansion-phase.stderr b/tests/ui-fulldeps/outlive-expansion-phase.stderr deleted file mode 100644 index e40a08ae7..000000000 --- a/tests/ui-fulldeps/outlive-expansion-phase.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/outlive-expansion-phase.rs:6:1 - | -LL | #![plugin(outlive_expansion_phase)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui-fulldeps/pathless-extern-unstable.rs b/tests/ui-fulldeps/pathless-extern-unstable.rs index 524b0c2f7..7fba8343b 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.rs +++ b/tests/ui-fulldeps/pathless-extern-unstable.rs @@ -1,4 +1,3 @@ -// ignore-stage1 // edition:2018 // compile-flags:--extern rustc_middle diff --git a/tests/ui-fulldeps/pathless-extern-unstable.stderr b/tests/ui-fulldeps/pathless-extern-unstable.stderr index dcc3cddd3..174cd3c28 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.stderr +++ b/tests/ui-fulldeps/pathless-extern-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/pathless-extern-unstable.rs:7:9 + --> $DIR/pathless-extern-unstable.rs:6:9 | LL | pub use rustc_middle; | ^^^^^^^^^^^^ diff --git a/tests/ui-fulldeps/plugin-args.rs b/tests/ui-fulldeps/plugin-args.rs deleted file mode 100644 index 488f2b775..000000000 --- a/tests/ui-fulldeps/plugin-args.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:empty-plugin.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(empty_plugin(args))] -//~^ ERROR malformed `plugin` attribute -//~| WARNING compiler plugins are deprecated - -fn main() {} diff --git a/tests/ui-fulldeps/plugin-args.stderr b/tests/ui-fulldeps/plugin-args.stderr deleted file mode 100644 index 177f33005..000000000 --- a/tests/ui-fulldeps/plugin-args.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0498]: malformed `plugin` attribute - --> $DIR/plugin-args.rs:5:11 - | -LL | #![plugin(empty_plugin(args))] - | ^^^^^^^^^^^^^^^^^^ malformed attribute - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/plugin-args.rs:5:1 - | -LL | #![plugin(empty_plugin(args))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0498`. diff --git a/tests/ui-fulldeps/plugin-as-extern-crate.rs b/tests/ui-fulldeps/plugin-as-extern-crate.rs deleted file mode 100644 index 4d26e08d8..000000000 --- a/tests/ui-fulldeps/plugin-as-extern-crate.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -// aux-build:empty-plugin.rs -// ignore-cross-compile -// -// empty_plugin will not compile on a cross-compiled target because -// librustc_ast is not compiled for it. - -extern crate empty_plugin; // OK, plugin crates are still crates - -fn main() {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs new file mode 100644 index 000000000..c24cdc97a --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs @@ -0,0 +1,9 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_driver; +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs new file mode 100644 index 000000000..3f6caecaa --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs @@ -0,0 +1,61 @@ +#![feature(plugin, rustc_private)] +#![crate_type = "dylib"] + +extern crate rustc_ast_pretty; +extern crate rustc_driver; +extern crate rustc_hir; +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; +extern crate rustc_ast; +extern crate rustc_span; + +use rustc_ast_pretty::pprust; +use rustc_driver::plugin::Registry; +use rustc_hir as hir; +use rustc_hir::intravisit; +use rustc_hir::Node; +use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_span::def_id::LocalDefId; +use rustc_span::source_map; + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&MISSING_ALLOWED_ATTR]); + reg.lint_store.register_late_pass(|_| Box::new(MissingAllowedAttrPass)); +} + +declare_lint! { + MISSING_ALLOWED_ATTR, + Deny, + "Checks for missing `allowed_attr` attribute" +} + +declare_lint_pass!(MissingAllowedAttrPass => [MISSING_ALLOWED_ATTR]); + +impl<'tcx> LateLintPass<'tcx> for MissingAllowedAttrPass { + fn check_fn( + &mut self, + cx: &LateContext<'tcx>, + _: intravisit::FnKind<'tcx>, + _: &'tcx hir::FnDecl, + _: &'tcx hir::Body, + span: source_map::Span, + def_id: LocalDefId, + ) { + let id = cx.tcx.hir().local_def_id_to_hir_id(def_id); + let item = match cx.tcx.hir().get(id) { + Node::Item(item) => item, + _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id).def_id), + }; + + let allowed = |attr| pprust::attribute_to_string(attr).contains("allowed_attr"); + if !cx.tcx.hir().attrs(item.hir_id()).iter().any(allowed) { + cx.lint( + MISSING_ALLOWED_ATTR, + "Missing 'allowed_attr' attribute", + |lint| lint.set_span(span) + ); + } + } +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs new file mode 100644 index 000000000..6304c07d2 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs @@ -0,0 +1,43 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_driver; +extern crate rustc_hir; +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; +extern crate rustc_ast; +extern crate rustc_span; + +use rustc_ast::attr; +use rustc_driver::plugin::Registry; +use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_span::def_id::CRATE_DEF_ID; +use rustc_span::symbol::Symbol; + +declare_lint! { + CRATE_NOT_OKAY, + Warn, + "crate not marked with #![crate_okay]" +} + +declare_lint_pass!(Pass => [CRATE_NOT_OKAY]); + +impl<'tcx> LateLintPass<'tcx> for Pass { + fn check_crate(&mut self, cx: &LateContext) { + let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID); + let span = cx.tcx.def_span(CRATE_DEF_ID); + if !attr::contains_name(attrs, Symbol::intern("crate_okay")) { + cx.lint(CRATE_NOT_OKAY, "crate is not marked with #![crate_okay]", |lint| { + lint.set_span(span) + }); + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&CRATE_NOT_OKAY]); + reg.lint_store.register_late_pass(|_| Box::new(Pass)); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs new file mode 100644 index 000000000..4a41e7fbb --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs @@ -0,0 +1,44 @@ +// force-host + +#![feature(rustc_private)] + +// Load rustc as a plugin to get macros. +extern crate rustc_driver; +extern crate rustc_hir; +#[macro_use] +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; + +use rustc_driver::plugin::Registry; +use rustc_lint::{LateContext, LateLintPass, LintArray, LintContext, LintId, LintPass}; + +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); + +declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]); + +impl<'tcx> LateLintPass<'tcx> for Pass { + fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) { + match it.ident.as_str() { + "lintme" => cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)), + "pleaselintme" => { + cx.lint(PLEASE_LINT, "item is named 'pleaselintme'", |lint| lint.set_span(it.span)) + } + _ => {} + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&TEST_LINT, &PLEASE_LINT]); + reg.lint_store.register_late_pass(|_| Box::new(Pass)); + reg.lint_store.register_group( + true, + "lint_me", + None, + vec![LintId::of(&TEST_LINT), LintId::of(&PLEASE_LINT)], + ); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs new file mode 100644 index 000000000..30956deb7 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs @@ -0,0 +1,33 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_ast; + +// Load rustc as a plugin to get macros +extern crate rustc_driver; +#[macro_use] +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; + +use rustc_driver::plugin::Registry; +use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; +use rustc_ast as ast; +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +declare_lint_pass!(Pass => [TEST_LINT]); + +impl EarlyLintPass for Pass { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { + if it.ident.name.as_str() == "lintme" { + cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)); + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&TEST_LINT]); + reg.lint_store.register_early_pass(|| Box::new(Pass)); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs new file mode 100644 index 000000000..c2c024865 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs @@ -0,0 +1,52 @@ +#![feature(rustc_private)] + +extern crate rustc_ast; + +// Load rustc as a plugin to get macros +extern crate rustc_driver; +#[macro_use] +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; + +use rustc_driver::plugin::Registry; +use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass}; +use rustc_ast as ast; +declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); +declare_tool_lint!( + /// Some docs + pub clippy::TEST_GROUP, + Warn, "Warn about other stuff" +); + +declare_tool_lint!( + /// Some docs + pub rustc::TEST_RUSTC_TOOL_LINT, + Deny, + "Deny internal stuff" +); + +declare_lint_pass!(Pass => [TEST_LINT, TEST_GROUP, TEST_RUSTC_TOOL_LINT]); + +impl EarlyLintPass for Pass { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { + if it.ident.name.as_str() == "lintme" { + cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)); + } + if it.ident.name.as_str() == "lintmetoo" { + cx.lint(TEST_GROUP, "item is named 'lintmetoo'", |lint| lint.set_span(it.span)); + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&TEST_RUSTC_TOOL_LINT, &TEST_LINT, &TEST_GROUP]); + reg.lint_store.register_early_pass(|| Box::new(Pass)); + reg.lint_store.register_group( + true, + "clippy::group", + Some("clippy_group"), + vec![LintId::of(&TEST_LINT), LintId::of(&TEST_GROUP)], + ); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs new file mode 100644 index 000000000..954a1e554 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs @@ -0,0 +1,5 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs new file mode 100644 index 000000000..9b075c1a5 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs @@ -0,0 +1,11 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_reg: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs new file mode 100644 index 000000000..fd6e9e20f --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs new file mode 100644 index 000000000..fd6e9e20f --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs b/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs new file mode 100644 index 000000000..e83dfe804 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs @@ -0,0 +1,24 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use std::any::Any; +use std::cell::RefCell; +use rustc_driver::plugin::Registry; + +struct Foo { + foo: isize +} + +impl Drop for Foo { + fn drop(&mut self) {} +} + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) { + thread_local!(static FOO: RefCell>> = RefCell::new(None)); + FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box)); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs b/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs new file mode 100644 index 000000000..3ba73538e --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs @@ -0,0 +1,12 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/feature-gate-plugin.rs b/tests/ui-fulldeps/plugin/feature-gate-plugin.rs new file mode 100644 index 000000000..85eaf5336 --- /dev/null +++ b/tests/ui-fulldeps/plugin/feature-gate-plugin.rs @@ -0,0 +1,8 @@ +// aux-build:empty-plugin.rs +// ignore-stage1 + +#![plugin(empty_plugin)] +//~^ ERROR compiler plugins are deprecated +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr b/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr new file mode 100644 index 000000000..5e40561c7 --- /dev/null +++ b/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr @@ -0,0 +1,20 @@ +error[E0658]: compiler plugins are deprecated + --> $DIR/feature-gate-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #29597 for more information + = help: add `#![feature(plugin)]` to the crate attributes to enable + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/feature-gate-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui-fulldeps/plugin/gated-plugin.rs b/tests/ui-fulldeps/plugin/gated-plugin.rs new file mode 100644 index 000000000..85eaf5336 --- /dev/null +++ b/tests/ui-fulldeps/plugin/gated-plugin.rs @@ -0,0 +1,8 @@ +// aux-build:empty-plugin.rs +// ignore-stage1 + +#![plugin(empty_plugin)] +//~^ ERROR compiler plugins are deprecated +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/gated-plugin.stderr b/tests/ui-fulldeps/plugin/gated-plugin.stderr new file mode 100644 index 000000000..f48f1eab6 --- /dev/null +++ b/tests/ui-fulldeps/plugin/gated-plugin.stderr @@ -0,0 +1,20 @@ +error[E0658]: compiler plugins are deprecated + --> $DIR/gated-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #29597 for more information + = help: add `#![feature(plugin)]` to the crate attributes to enable + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/gated-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui-fulldeps/plugin/issue-15778-fail.rs b/tests/ui-fulldeps/plugin/issue-15778-fail.rs new file mode 100644 index 000000000..beecaadf9 --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-15778-fail.rs @@ -0,0 +1,9 @@ +// 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)] +//~^ WARN use of deprecated attribute `plugin` + +pub fn main() { } diff --git a/tests/ui-fulldeps/plugin/issue-15778-fail.stderr b/tests/ui-fulldeps/plugin/issue-15778-fail.stderr new file mode 100644 index 000000000..a37893e12 --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-15778-fail.stderr @@ -0,0 +1,22 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/issue-15778-fail.rs:6:1 + | +LL | #![plugin(lint_for_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: crate is not marked with #![crate_okay] + --> $DIR/issue-15778-fail.rs:5:1 + | +LL | / #![feature(plugin)] +LL | | #![plugin(lint_for_crate)] +LL | | +LL | | +LL | | pub fn main() { } + | |_________________^ + | + = note: requested on the command line with `-D crate-not-okay` + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/issue-40001.rs b/tests/ui-fulldeps/plugin/issue-40001.rs new file mode 100644 index 000000000..e14338fdb --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-40001.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-40001-plugin.rs +// ignore-stage1 + +#![feature(plugin, register_tool)] +#![plugin(issue_40001_plugin)] //~ WARNING compiler plugins are deprecated +#![register_tool(plugin)] + +#[plugin::allowed_attr] +fn main() {} diff --git a/tests/ui-fulldeps/plugin/issue-40001.stderr b/tests/ui-fulldeps/plugin/issue-40001.stderr new file mode 100644 index 000000000..73ec06924 --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-40001.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/issue-40001.rs:6:1 + | +LL | #![plugin(issue_40001_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs new file mode 100644 index 000000000..9f8a87960 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs @@ -0,0 +1,17 @@ +// aux-build:lint-group-plugin-test.rs +// ignore-stage1 +// compile-flags: -D lint-me + +#![feature(plugin)] + +#![plugin(lint_group_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` + +fn lintme() { } //~ ERROR item is named 'lintme' + +fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + +pub fn main() { + lintme(); + pleaselintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr new file mode 100644 index 000000000..20486d596 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr @@ -0,0 +1,26 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-group-plugin-deny-cmdline.rs:7:1 + | +LL | #![plugin(lint_group_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: item is named 'lintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `-D test-lint` implied by `-D lint-me` + +error: item is named 'pleaselintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:12:1 + | +LL | fn pleaselintme() { } + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D please-lint` implied by `-D lint-me` + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin.rs b/tests/ui-fulldeps/plugin/lint-group-plugin.rs new file mode 100644 index 000000000..7b74be7a9 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin.rs @@ -0,0 +1,17 @@ +// run-pass +// aux-build:lint-group-plugin-test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_group_plugin_test)] //~ WARNING use of deprecated attribute +#![allow(dead_code)] + +fn lintme() { } //~ WARNING item is named 'lintme' +fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' + +#[allow(lint_me)] +pub fn main() { + fn lintme() { } + + fn pleaselintme() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin.stderr new file mode 100644 index 000000000..6f429dad0 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin.stderr @@ -0,0 +1,26 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-group-plugin.rs:6:1 + | +LL | #![plugin(lint_group_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: item is named 'lintme' + --> $DIR/lint-group-plugin.rs:9:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(test_lint)]` on by default + +warning: item is named 'pleaselintme' + --> $DIR/lint-group-plugin.rs:10:1 + | +LL | fn pleaselintme() { } + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(please_lint)]` on by default + +warning: 3 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs new file mode 100644 index 000000000..1cc16e2fd --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs @@ -0,0 +1,12 @@ +// check-pass +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -A test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] //~ WARNING compiler plugins are deprecated + +fn lintme() { } + +pub fn main() { +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr new file mode 100644 index 000000000..f06703a27 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-cmdline-allow.rs:7:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs new file mode 100644 index 000000000..0bd95dfbd --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs @@ -0,0 +1,13 @@ +// check-pass +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -Z crate-attr=plugin(lint_plugin_test) + +#![feature(plugin)] + +fn lintme() { } //~ WARNING item is named 'lintme' + +#[allow(test_lint)] +pub fn main() { + fn lintme() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr new file mode 100644 index 000000000..82679c9e1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr @@ -0,0 +1,18 @@ +warning: item is named 'lintme' + --> $DIR/lint-plugin-cmdline-load.rs:8:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(test_lint)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> :1:1 + | +LL | plugin(lint_plugin_test) + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 2 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs new file mode 100644 index 000000000..04230a8e8 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs @@ -0,0 +1,13 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` +#![deny(test_lint)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr new file mode 100644 index 000000000..5e8891bf1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr @@ -0,0 +1,22 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-attr.rs:9:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-plugin-deny-attr.rs:7:9 + | +LL | #![deny(test_lint)] + | ^^^^^^^^^ + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-attr.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs new file mode 100644 index 000000000..c460cfd5f --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs @@ -0,0 +1,13 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -D test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr new file mode 100644 index 000000000..d5d6b5352 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr @@ -0,0 +1,18 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-cmdline.rs:9:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-D test-lint` + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs new file mode 100644 index 000000000..cf31b3ec1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs @@ -0,0 +1,16 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` +#![forbid(test_lint)] + +fn lintme() {} //~ ERROR item is named 'lintme' + +#[allow(test_lint)] +//~^ ERROR allow(test_lint) incompatible +//~| ERROR allow(test_lint) incompatible +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr new file mode 100644 index 000000000..ae34b25cc --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr @@ -0,0 +1,41 @@ +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-attrs.rs:11:9 + | +LL | #![forbid(test_lint)] + | --------- `forbid` level set here +... +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-attrs.rs:9:1 + | +LL | fn lintme() {} + | ^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-plugin-forbid-attrs.rs:7:11 + | +LL | #![forbid(test_lint)] + | ^^^^^^^^^ + +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-attrs.rs:11:9 + | +LL | #![forbid(test_lint)] + | --------- `forbid` level set here +... +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-attrs.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs new file mode 100644 index 000000000..b9d1aa85a --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs @@ -0,0 +1,15 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -F test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(test_lint)] //~ ERROR allow(test_lint) incompatible + //~| ERROR allow(test_lint) incompatible + +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr new file mode 100644 index 000000000..491c4d206 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr @@ -0,0 +1,35 @@ +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 + | +LL | #[allow(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:8:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-F test-lint` + +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 + | +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui-fulldeps/plugin/lint-plugin.rs b/tests/ui-fulldeps/plugin/lint-plugin.rs new file mode 100644 index 000000000..66057eea6 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:lint-plugin-test.rs +// ignore-stage1 +#![feature(plugin)] +#![plugin(lint_plugin_test)] //~ WARNING use of deprecated attribute +#![allow(dead_code)] + +fn lintme() { } //~ WARNING item is named 'lintme' + +#[allow(test_lint)] +pub fn main() { + fn lintme() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin.stderr b/tests/ui-fulldeps/plugin/lint-plugin.stderr new file mode 100644 index 000000000..dd5d3d72e --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin.stderr @@ -0,0 +1,18 @@ +warning: item is named 'lintme' + --> $DIR/lint-plugin.rs:8:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(test_lint)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 2 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs new file mode 100644 index 000000000..83a8b3e1a --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs @@ -0,0 +1,12 @@ +// check-pass +// aux-build:lint-tool-test.rs +// ignore-stage1 +// compile-flags: -A test-lint + +#![feature(plugin)] +#![plugin(lint_tool_test)] //~ WARNING compiler plugins are deprecated + +fn lintme() {} +//~^ WARNING item is named 'lintme' [clippy::test_lint] + +pub fn main() {} diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr new file mode 100644 index 000000000..b060e3a3e --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr @@ -0,0 +1,30 @@ +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: item is named 'lintme' + --> $DIR/lint-tool-cmdline-allow.rs:9:1 + | +LL | fn lintme() {} + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(clippy::test_lint)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-cmdline-allow.rs:7:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: 5 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-tool-test.rs b/tests/ui-fulldeps/plugin/lint-tool-test.rs new file mode 100644 index 000000000..f92bcd213 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-test.rs @@ -0,0 +1,36 @@ +// aux-build:lint-tool-test.rs +// ignore-stage1 +// compile-flags: --cfg foo + +#![feature(plugin)] +#![plugin(lint_tool_test)] +//~^ WARN use of deprecated attribute `plugin` +#![allow(dead_code)] +#![cfg_attr(foo, warn(test_lint))] +//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future +#![deny(clippy_group)] +//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future + +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(clippy::group)] +fn lintmetoo() {} + +#[allow(clippy::test_lint)] +pub fn main() { + fn lintme() { } + fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' +} + +#[allow(test_group)] +//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future +#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` +fn hello() { + fn lintmetoo() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-tool-test.stderr b/tests/ui-fulldeps/plugin/lint-tool-test.stderr new file mode 100644 index 000000000..027cf8f80 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-test.stderr @@ -0,0 +1,95 @@ +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + | + = note: `#[warn(renamed_and_removed_lints)]` on by default + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:29:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +error: item is named 'lintme' + --> $DIR/lint-tool-test.rs:18:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ + = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]` + +error: item is named 'lintmetoo' + --> $DIR/lint-tool-test.rs:26:5 + | +LL | fn lintmetoo() { } + | ^^^^^^^^^^^^^^^^^^ + | + = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:29:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +warning: unknown lint: `this_lint_does_not_exist` + --> $DIR/lint-tool-test.rs:33:8 + | +LL | #[deny(this_lint_does_not_exist)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_lints)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-test.rs:6:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:29:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +error: aborting due to 2 previous errors; 11 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lto-syntax-extension.rs b/tests/ui-fulldeps/plugin/lto-syntax-extension.rs new file mode 100644 index 000000000..5964e70f1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lto-syntax-extension.rs @@ -0,0 +1,15 @@ +// run-pass +// aux-build:lto-syntax-extension-lib.rs +// aux-build:lto-syntax-extension-plugin.rs +// compile-flags:-C lto +// ignore-stage1 +// no-prefer-dynamic + +#![feature(plugin)] +#![plugin(lto_syntax_extension_plugin)] //~ WARNING compiler plugins are deprecated + +extern crate lto_syntax_extension_lib; + +fn main() { + lto_syntax_extension_lib::foo(); +} diff --git a/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr b/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr new file mode 100644 index 000000000..555493f32 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lto-syntax-extension.rs:9:1 + | +LL | #![plugin(lto_syntax_extension_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/macro-crate-rlib.rs b/tests/ui-fulldeps/plugin/macro-crate-rlib.rs new file mode 100644 index 000000000..38bd34053 --- /dev/null +++ b/tests/ui-fulldeps/plugin/macro-crate-rlib.rs @@ -0,0 +1,9 @@ +// aux-build:rlib-crate-test.rs +// ignore-stage1 +// 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 + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr b/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr new file mode 100644 index 000000000..0651cee56 --- /dev/null +++ b/tests/ui-fulldeps/plugin/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:6: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/tests/ui-fulldeps/plugin/multiple-plugins.rs b/tests/ui-fulldeps/plugin/multiple-plugins.rs new file mode 100644 index 000000000..9af3ebd57 --- /dev/null +++ b/tests/ui-fulldeps/plugin/multiple-plugins.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:multiple-plugins-1.rs +// aux-build:multiple-plugins-2.rs +// ignore-stage1 + +// Check that the plugin registrar of multiple plugins doesn't conflict + +#![feature(plugin)] +#![plugin(multiple_plugins_1)] //~ WARN use of deprecated attribute `plugin` +#![plugin(multiple_plugins_2)] //~ WARN use of deprecated attribute `plugin` + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/multiple-plugins.stderr b/tests/ui-fulldeps/plugin/multiple-plugins.stderr new file mode 100644 index 000000000..878ffabfc --- /dev/null +++ b/tests/ui-fulldeps/plugin/multiple-plugins.stderr @@ -0,0 +1,16 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/multiple-plugins.rs:9:1 + | +LL | #![plugin(multiple_plugins_1)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/multiple-plugins.rs:10:1 + | +LL | #![plugin(multiple_plugins_2)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + +warning: 2 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs b/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs new file mode 100644 index 000000000..fb22888d9 --- /dev/null +++ b/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:outlive-expansion-phase.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(outlive_expansion_phase)] //~ WARNING compiler plugins are deprecated + +pub fn main() {} diff --git a/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr b/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr new file mode 100644 index 000000000..e40a08ae7 --- /dev/null +++ b/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/outlive-expansion-phase.rs:6:1 + | +LL | #![plugin(outlive_expansion_phase)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/plugin-args.rs b/tests/ui-fulldeps/plugin/plugin-args.rs new file mode 100644 index 000000000..488f2b775 --- /dev/null +++ b/tests/ui-fulldeps/plugin/plugin-args.rs @@ -0,0 +1,9 @@ +// aux-build:empty-plugin.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(empty_plugin(args))] +//~^ ERROR malformed `plugin` attribute +//~| WARNING compiler plugins are deprecated + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/plugin-args.stderr b/tests/ui-fulldeps/plugin/plugin-args.stderr new file mode 100644 index 000000000..177f33005 --- /dev/null +++ b/tests/ui-fulldeps/plugin/plugin-args.stderr @@ -0,0 +1,17 @@ +error[E0498]: malformed `plugin` attribute + --> $DIR/plugin-args.rs:5:11 + | +LL | #![plugin(empty_plugin(args))] + | ^^^^^^^^^^^^^^^^^^ malformed attribute + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/plugin-args.rs:5:1 + | +LL | #![plugin(empty_plugin(args))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0498`. diff --git a/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs b/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs new file mode 100644 index 000000000..4d26e08d8 --- /dev/null +++ b/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs @@ -0,0 +1,10 @@ +// check-pass +// aux-build:empty-plugin.rs +// ignore-cross-compile +// +// empty_plugin will not compile on a cross-compiled target because +// librustc_ast is not compiled for it. + +extern crate empty_plugin; // OK, plugin crates are still crates + +fn main() {} diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs new file mode 100644 index 000000000..642b58b07 --- /dev/null +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs @@ -0,0 +1,49 @@ +// check-fail +// Tests that a doc comment will not preclude a field from being considered a diagnostic argument +// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" +// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC" + +// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, +// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler +// the test is just ignored on stable and beta: +// ignore-stage1 +// ignore-beta +// ignore-stable + +#![feature(rustc_private)] +#![crate_type = "lib"] + +extern crate rustc_errors; +extern crate rustc_fluent_macro; +extern crate rustc_macros; +extern crate rustc_session; +extern crate rustc_span; + +use rustc_errors::{Applicability, DiagnosticMessage, SubdiagnosticMessage}; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::{Diagnostic, Subdiagnostic}; +use rustc_span::Span; + +fluent_messages! { "./example.ftl" } + +struct NotIntoDiagnosticArg; + +#[derive(Diagnostic)] +#[diag(no_crate_example)] +struct Test { + #[primary_span] + span: Span, + /// A doc comment + arg: NotIntoDiagnosticArg, + //~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied +} + +#[derive(Subdiagnostic)] +#[label(no_crate_example)] +struct SubTest { + #[primary_span] + span: Span, + /// A doc comment + arg: NotIntoDiagnosticArg, + //~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied +} diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr new file mode 100644 index 000000000..e4b8958b4 --- /dev/null +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -0,0 +1,30 @@ +error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied + --> $DIR/diagnostic-derive-doc-comment-field.rs:37:10 + | +LL | #[derive(Diagnostic)] + | ---------- required by a bound introduced by this call +... +LL | arg: NotIntoDiagnosticArg, + | ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` + | + = help: normalized in stderr +note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` + --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC + = note: this error originates in the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied + --> $DIR/diagnostic-derive-doc-comment-field.rs:47:10 + | +LL | #[derive(Subdiagnostic)] + | ------------- required by a bound introduced by this call +... +LL | arg: NotIntoDiagnosticArg, + | ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` + | + = help: normalized in stderr +note: required by a bound in `Diagnostic::set_arg` + --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:964:5 + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 6cc7bab37..39e34d73f 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -6,6 +6,7 @@ // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, // changing the output of this test. Since Diagnostic is strictly internal to the compiler // the test is just ignored on stable and beta: +// ignore-stage1 // ignore-beta // ignore-stable @@ -16,8 +17,10 @@ extern crate rustc_span; use rustc_span::symbol::Ident; use rustc_span::Span; +extern crate rustc_fluent_macro; extern crate rustc_macros; -use rustc_macros::{fluent_messages, Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; extern crate rustc_middle; use rustc_middle::ty::Ty; @@ -336,12 +339,12 @@ struct ErrorWithDefaultLabelAttr<'a> { } #[derive(Diagnostic)] -//~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied #[diag(no_crate_example, code = "E0123")] struct ArgFieldWithoutSkip { #[primary_span] span: Span, other: Hello, + //~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied } #[derive(Diagnostic)] diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index a2f3bb527..801e4b579 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -1,11 +1,11 @@ error: unsupported type attribute for diagnostic derive enum - --> $DIR/diagnostic-derive.rs:41:1 + --> $DIR/diagnostic-derive.rs:44:1 | LL | #[diag(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:44:5 + --> $DIR/diagnostic-derive.rs:47:5 | LL | Foo, | ^^^ @@ -13,7 +13,7 @@ LL | Foo, = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:46:5 + --> $DIR/diagnostic-derive.rs:49:5 | LL | Bar, | ^^^ @@ -21,19 +21,19 @@ LL | Bar, = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: expected parentheses: #[diag(...)] - --> $DIR/diagnostic-derive.rs:52:8 + --> $DIR/diagnostic-derive.rs:55:8 | LL | #[diag = "E0123"] | ^ error: `#[nonsense(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:57:1 + --> $DIR/diagnostic-derive.rs:60:1 | LL | #[nonsense(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:57:1 + --> $DIR/diagnostic-derive.rs:60:1 | LL | / #[nonsense(no_crate_example, code = "E0123")] LL | | @@ -45,7 +45,7 @@ LL | | struct InvalidStructAttr {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:64:1 + --> $DIR/diagnostic-derive.rs:67:1 | LL | / #[diag("E0123")] LL | | @@ -55,13 +55,13 @@ LL | | struct InvalidLitNestedAttr {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug must be the first argument - --> $DIR/diagnostic-derive.rs:74:16 + --> $DIR/diagnostic-derive.rs:77:16 | LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")] | ^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:74:1 + --> $DIR/diagnostic-derive.rs:77:1 | LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")] LL | | @@ -72,7 +72,7 @@ LL | | struct InvalidNestedStructAttr1 {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: unknown argument - --> $DIR/diagnostic-derive.rs:80:8 + --> $DIR/diagnostic-derive.rs:83:8 | LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] | ^^^^^^^^ @@ -80,7 +80,7 @@ LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] = note: only the `code` parameter is valid after the slug error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:80:1 + --> $DIR/diagnostic-derive.rs:83:1 | LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")] LL | | @@ -91,7 +91,7 @@ LL | | struct InvalidNestedStructAttr2 {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: unknown argument - --> $DIR/diagnostic-derive.rs:86:8 + --> $DIR/diagnostic-derive.rs:89:8 | LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] | ^^^^^^^^ @@ -99,7 +99,7 @@ LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] = note: only the `code` parameter is valid after the slug error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:86:1 + --> $DIR/diagnostic-derive.rs:89:1 | LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")] LL | | @@ -110,7 +110,7 @@ LL | | struct InvalidNestedStructAttr3 {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: unknown argument - --> $DIR/diagnostic-derive.rs:92:42 + --> $DIR/diagnostic-derive.rs:95:42 | LL | #[diag(no_crate_example, code = "E0123", slug = "foo")] | ^^^^ @@ -118,55 +118,55 @@ LL | #[diag(no_crate_example, code = "E0123", slug = "foo")] = note: only the `code` parameter is valid after the slug error: `#[suggestion = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:99:5 + --> $DIR/diagnostic-derive.rs:102:5 | LL | #[suggestion = "bar"] | ^^^^^^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:106:8 + --> $DIR/diagnostic-derive.rs:109:8 | LL | #[diag(no_crate_example, code = "E0456")] | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:105:8 + --> $DIR/diagnostic-derive.rs:108:8 | LL | #[diag(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:106:26 + --> $DIR/diagnostic-derive.rs:109:26 | LL | #[diag(no_crate_example, code = "E0456")] | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:105:26 + --> $DIR/diagnostic-derive.rs:108:26 | LL | #[diag(no_crate_example, code = "E0123")] | ^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:112:42 + --> $DIR/diagnostic-derive.rs:115:42 | LL | #[diag(no_crate_example, code = "E0456", code = "E0457")] | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:112:26 + --> $DIR/diagnostic-derive.rs:115:26 | LL | #[diag(no_crate_example, code = "E0456", code = "E0457")] | ^^^^ error: diagnostic slug must be the first argument - --> $DIR/diagnostic-derive.rs:117:43 + --> $DIR/diagnostic-derive.rs:120:43 | LL | #[diag(no_crate_example, no_crate::example, code = "E0456")] | ^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:122:1 + --> $DIR/diagnostic-derive.rs:125:1 | LL | struct KindNotProvided {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -174,7 +174,7 @@ LL | struct KindNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:125:1 + --> $DIR/diagnostic-derive.rs:128:1 | LL | / #[diag(code = "E0456")] LL | | @@ -184,31 +184,31 @@ LL | | struct SlugNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:136:5 + --> $DIR/diagnostic-derive.rs:139:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: `#[nonsense]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:144:5 + --> $DIR/diagnostic-derive.rs:147:5 | LL | #[nonsense] | ^^^^^^^^^^^ error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:161:5 + --> $DIR/diagnostic-derive.rs:164:5 | LL | #[label(no_crate_label)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `name` doesn't refer to a field on this type - --> $DIR/diagnostic-derive.rs:169:46 + --> $DIR/diagnostic-derive.rs:172:46 | LL | #[suggestion(no_crate_suggestion, code = "{name}")] | ^^^^^^^^ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/diagnostic-derive.rs:174:10 + --> $DIR/diagnostic-derive.rs:177:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ expected `'}'` in format string @@ -217,7 +217,7 @@ LL | #[derive(Diagnostic)] = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid format string: unmatched `}` found - --> $DIR/diagnostic-derive.rs:184:10 + --> $DIR/diagnostic-derive.rs:187:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ unmatched `}` in format string @@ -226,19 +226,19 @@ LL | #[derive(Diagnostic)] = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:204:5 + --> $DIR/diagnostic-derive.rs:207:5 | LL | #[label(no_crate_label)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:223:5 + --> $DIR/diagnostic-derive.rs:226:5 | LL | #[suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid nested attribute - --> $DIR/diagnostic-derive.rs:231:18 + --> $DIR/diagnostic-derive.rs:234:18 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^ @@ -246,13 +246,13 @@ LL | #[suggestion(nonsense = "bar")] = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:231:5 + --> $DIR/diagnostic-derive.rs:234:5 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid nested attribute - --> $DIR/diagnostic-derive.rs:240:18 + --> $DIR/diagnostic-derive.rs:243:18 | LL | #[suggestion(msg = "bar")] | ^^^ @@ -260,13 +260,13 @@ LL | #[suggestion(msg = "bar")] = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:240:5 + --> $DIR/diagnostic-derive.rs:243:5 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: wrong field type for suggestion - --> $DIR/diagnostic-derive.rs:263:5 + --> $DIR/diagnostic-derive.rs:266:5 | LL | / #[suggestion(no_crate_suggestion, code = "This is suggested code")] LL | | @@ -276,79 +276,79 @@ LL | | suggestion: Applicability, = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` error: specified multiple times - --> $DIR/diagnostic-derive.rs:279:24 + --> $DIR/diagnostic-derive.rs:282:24 | LL | suggestion: (Span, Span, Applicability), | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:279:18 + --> $DIR/diagnostic-derive.rs:282:18 | LL | suggestion: (Span, Span, Applicability), | ^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:287:33 + --> $DIR/diagnostic-derive.rs:290:33 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:287:18 + --> $DIR/diagnostic-derive.rs:290:18 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ error: `#[label = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:294:5 + --> $DIR/diagnostic-derive.rs:297:5 | LL | #[label = "bar"] | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:445:5 + --> $DIR/diagnostic-derive.rs:448:5 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:447:24 + --> $DIR/diagnostic-derive.rs:450:24 | LL | suggestion: (Span, Applicability), | ^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/diagnostic-derive.rs:453:69 + --> $DIR/diagnostic-derive.rs:456:69 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] | ^^^^^^^^ error: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()` - --> $DIR/diagnostic-derive.rs:520:5 + --> $DIR/diagnostic-derive.rs:523:5 | LL | #[help(no_crate_help)] | ^^^^^^^^^^^^^^^^^^^^^^ error: a diagnostic slug must be the first argument to the attribute - --> $DIR/diagnostic-derive.rs:529:32 + --> $DIR/diagnostic-derive.rs:532:32 | LL | #[label(no_crate_label, foo)] | ^ error: invalid nested attribute - --> $DIR/diagnostic-derive.rs:537:29 + --> $DIR/diagnostic-derive.rs:540:29 | LL | #[label(no_crate_label, foo = "...")] | ^^^ error: invalid nested attribute - --> $DIR/diagnostic-derive.rs:545:29 + --> $DIR/diagnostic-derive.rs:548:29 | LL | #[label(no_crate_label, foo("..."))] | ^^^ error: `#[primary_span]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:557:5 + --> $DIR/diagnostic-derive.rs:560:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -356,13 +356,13 @@ LL | #[primary_span] = help: the `primary_span` field attribute is not valid for lint diagnostics error: `#[error(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:577:1 + --> $DIR/diagnostic-derive.rs:580:1 | LL | #[error(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:577:1 + --> $DIR/diagnostic-derive.rs:580:1 | LL | / #[error(no_crate_example, code = "E0123")] LL | | @@ -374,13 +374,13 @@ LL | | struct ErrorAttribute {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[warn_(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:584:1 + --> $DIR/diagnostic-derive.rs:587:1 | LL | #[warn_(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:584:1 + --> $DIR/diagnostic-derive.rs:587:1 | LL | / #[warn_(no_crate_example, code = "E0123")] LL | | @@ -392,13 +392,13 @@ LL | | struct WarnAttribute {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:591:1 + --> $DIR/diagnostic-derive.rs:594:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:591:1 + --> $DIR/diagnostic-derive.rs:594:1 | LL | / #[lint(no_crate_example, code = "E0123")] LL | | @@ -410,19 +410,19 @@ LL | | struct LintAttributeOnSessionDiag {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:598:1 + --> $DIR/diagnostic-derive.rs:601:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:598:1 + --> $DIR/diagnostic-derive.rs:601:1 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:598:1 + --> $DIR/diagnostic-derive.rs:601:1 | LL | / #[lint(no_crate_example, code = "E0123")] LL | | @@ -435,19 +435,19 @@ LL | | struct LintAttributeOnLintDiag {} = help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]` error: specified multiple times - --> $DIR/diagnostic-derive.rs:608:53 + --> $DIR/diagnostic-derive.rs:611:53 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:608:39 + --> $DIR/diagnostic-derive.rs:611:39 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] | ^^^^ error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:617:24 + --> $DIR/diagnostic-derive.rs:620:24 | LL | suggestion: (Span, usize), | ^^^^^ @@ -455,7 +455,7 @@ LL | suggestion: (Span, usize), = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:625:17 + --> $DIR/diagnostic-derive.rs:628:17 | LL | suggestion: (Span,), | ^^^^^^^ @@ -463,13 +463,13 @@ LL | suggestion: (Span,), = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:632:5 + --> $DIR/diagnostic-derive.rs:635:5 | LL | #[suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:639:1 + --> $DIR/diagnostic-derive.rs:642:1 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -477,7 +477,7 @@ LL | #[multipart_suggestion(no_crate_suggestion)] = help: consider creating a `Subdiagnostic` instead error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:646:5 + --> $DIR/diagnostic-derive.rs:649:5 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -485,13 +485,13 @@ LL | #[multipart_suggestion(no_crate_suggestion)] = help: consider creating a `Subdiagnostic` instead error: unexpected end of input, unexpected token in nested attribute, expected ident - --> $DIR/diagnostic-derive.rs:642:24 + --> $DIR/diagnostic-derive.rs:645:24 | LL | #[multipart_suggestion()] | ^ error: `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:654:1 + --> $DIR/diagnostic-derive.rs:657:1 | LL | #[suggestion(no_crate_suggestion, code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,7 +499,7 @@ LL | #[suggestion(no_crate_suggestion, code = "...")] = help: `#[label]` and `#[suggestion]` can only be applied to fields error: `#[label]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:663:1 + --> $DIR/diagnostic-derive.rs:666:1 | LL | #[label] | ^^^^^^^^ @@ -507,31 +507,31 @@ LL | #[label] = help: `#[label]` and `#[suggestion]` can only be applied to fields error: `eager` is the only supported nested attribute for `subdiagnostic` - --> $DIR/diagnostic-derive.rs:697:7 + --> $DIR/diagnostic-derive.rs:700:7 | LL | #[subdiagnostic(bad)] | ^^^^^^^^^^^^^^^^^^ error: `#[subdiagnostic = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:705:5 + --> $DIR/diagnostic-derive.rs:708:5 | LL | #[subdiagnostic = "bad"] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `eager` is the only supported nested attribute for `subdiagnostic` - --> $DIR/diagnostic-derive.rs:713:7 + --> $DIR/diagnostic-derive.rs:716:7 | LL | #[subdiagnostic(bad, bad)] | ^^^^^^^^^^^^^^^^^^^^^^^ error: `eager` is the only supported nested attribute for `subdiagnostic` - --> $DIR/diagnostic-derive.rs:721:7 + --> $DIR/diagnostic-derive.rs:724:7 | LL | #[subdiagnostic("bad")] | ^^^^^^^^^^^^^^^^^^^^ error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:729:5 + --> $DIR/diagnostic-derive.rs:732:5 | LL | #[subdiagnostic(eager)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -539,31 +539,31 @@ LL | #[subdiagnostic(eager)] = help: eager subdiagnostics are not supported on lints error: expected at least one string literal for `code(...)` - --> $DIR/diagnostic-derive.rs:787:23 + --> $DIR/diagnostic-derive.rs:790:23 | LL | #[suggestion(code())] | ^ error: `code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:795:23 + --> $DIR/diagnostic-derive.rs:798:23 | LL | #[suggestion(code(foo))] | ^^^ error: unexpected token - --> $DIR/diagnostic-derive.rs:795:23 + --> $DIR/diagnostic-derive.rs:798:23 | LL | #[suggestion(code(foo))] | ^^^ error: expected string literal - --> $DIR/diagnostic-derive.rs:804:25 + --> $DIR/diagnostic-derive.rs:807:25 | LL | #[suggestion(code = 3)] | ^ error: `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:819:5 + --> $DIR/diagnostic-derive.rs:822:5 | LL | #[suggestion(no_crate_suggestion, code = "")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -573,67 +573,67 @@ LL | #[suggestion(no_crate_suggestion, code = "")] = help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]` error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:57:3 + --> $DIR/diagnostic-derive.rs:60:3 | LL | #[nonsense(no_crate_example, code = "E0123")] | ^^^^^^^^ error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:144:7 + --> $DIR/diagnostic-derive.rs:147:7 | LL | #[nonsense] | ^^^^^^^^ error: cannot find attribute `error` in this scope - --> $DIR/diagnostic-derive.rs:577:3 + --> $DIR/diagnostic-derive.rs:580:3 | LL | #[error(no_crate_example, code = "E0123")] | ^^^^^ error: cannot find attribute `warn_` in this scope - --> $DIR/diagnostic-derive.rs:584:3 + --> $DIR/diagnostic-derive.rs:587:3 | LL | #[warn_(no_crate_example, code = "E0123")] | ^^^^^ help: a built-in attribute with a similar name exists: `warn` error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:591:3 + --> $DIR/diagnostic-derive.rs:594:3 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^ help: a built-in attribute with a similar name exists: `link` error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:598:3 + --> $DIR/diagnostic-derive.rs:601:3 | LL | #[lint(no_crate_example, code = "E0123")] | ^^^^ help: a built-in attribute with a similar name exists: `link` error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:639:3 + --> $DIR/diagnostic-derive.rs:642:3 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:642:3 + --> $DIR/diagnostic-derive.rs:645:3 | LL | #[multipart_suggestion()] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:646:7 + --> $DIR/diagnostic-derive.rs:649:7 | LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated` - --> $DIR/diagnostic-derive.rs:69:8 + --> $DIR/diagnostic-derive.rs:72:8 | LL | #[diag(nonsense, code = "E0123")] | ^^^^^^^^ not found in `crate::fluent_generated` error[E0425]: cannot find value `__code_34` in this scope - --> $DIR/diagnostic-derive.rs:801:10 + --> $DIR/diagnostic-derive.rs:804:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ not found in this scope @@ -641,15 +641,18 @@ LL | #[derive(Diagnostic)] = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive.rs:338:10 + --> $DIR/diagnostic-derive.rs:346:12 | LL | #[derive(Diagnostic)] - | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` + | ---------- required by a bound introduced by this call +... +LL | other: Hello, + | ^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` | = help: normalized in stderr note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC - = note: this error originates in the derive macro `Diagnostic` which comes from the expansion of the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 84 previous errors diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index 1d928ca93..1bfbb6001 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -4,6 +4,7 @@ // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, // changing the output of this test. Since Subdiagnostic is strictly internal to the compiler // the test is just ignored on stable and beta: +// ignore-stage1 // ignore-beta // ignore-stable @@ -11,12 +12,14 @@ #![crate_type = "lib"] extern crate rustc_errors; +extern crate rustc_fluent_macro; extern crate rustc_macros; extern crate rustc_session; extern crate rustc_span; use rustc_errors::{Applicability, DiagnosticMessage, SubdiagnosticMessage}; -use rustc_macros::{fluent_messages, Subdiagnostic}; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::Subdiagnostic; use rustc_span::Span; fluent_messages! { "./example.ftl" } diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index 4211b91f0..fca4f5068 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -1,5 +1,5 @@ error: label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:49:1 + --> $DIR/subdiagnostic-derive.rs:52:1 | LL | / #[label(no_crate_example)] LL | | @@ -9,133 +9,133 @@ LL | | } | |_^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:56:1 + --> $DIR/subdiagnostic-derive.rs:59:1 | LL | #[label] | ^^^^^^^^ error: `#[foo]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:65:1 + --> $DIR/subdiagnostic-derive.rs:68:1 | LL | #[foo] | ^^^^^^ error: `#[label = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:75:1 + --> $DIR/subdiagnostic-derive.rs:78:1 | LL | #[label = "..."] | ^^^^^^^^^^^^^^^^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:84:9 + --> $DIR/subdiagnostic-derive.rs:87:9 | LL | #[label(bug = "...")] | ^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:84:1 + --> $DIR/subdiagnostic-derive.rs:87:1 | LL | #[label(bug = "...")] | ^^^^^^^^^^^^^^^^^^^^^ error: unexpected literal in nested attribute, expected ident - --> $DIR/subdiagnostic-derive.rs:94:9 + --> $DIR/subdiagnostic-derive.rs:97:9 | LL | #[label("...")] | ^^^^^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:103:9 + --> $DIR/subdiagnostic-derive.rs:106:9 | LL | #[label(slug = 4)] | ^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:103:1 + --> $DIR/subdiagnostic-derive.rs:106:1 | LL | #[label(slug = 4)] | ^^^^^^^^^^^^^^^^^^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:113:9 + --> $DIR/subdiagnostic-derive.rs:116:9 | LL | #[label(slug("..."))] | ^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:113:1 + --> $DIR/subdiagnostic-derive.rs:116:1 | LL | #[label(slug("..."))] | ^^^^^^^^^^^^^^^^^^^^^ error: unexpected end of input, unexpected token in nested attribute, expected ident - --> $DIR/subdiagnostic-derive.rs:133:9 + --> $DIR/subdiagnostic-derive.rs:136:9 | LL | #[label()] | ^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:142:27 + --> $DIR/subdiagnostic-derive.rs:145:27 | LL | #[label(no_crate_example, code = "...")] | ^^^^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:151:27 + --> $DIR/subdiagnostic-derive.rs:154:27 | LL | #[label(no_crate_example, applicability = "machine-applicable")] | ^^^^^^^^^^^^^ error: unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:160:1 + --> $DIR/subdiagnostic-derive.rs:163:1 | LL | #[foo] | ^^^^^^ error: `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:174:5 + --> $DIR/subdiagnostic-derive.rs:177:5 | LL | #[bar] | ^^^^^^ error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:186:5 + --> $DIR/subdiagnostic-derive.rs:189:5 | LL | #[bar = "..."] | ^^^^^^^^^^^^^^ error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:198:5 + --> $DIR/subdiagnostic-derive.rs:201:5 | LL | #[bar = 4] | ^^^^^^^^^^ error: `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:210:5 + --> $DIR/subdiagnostic-derive.rs:213:5 | LL | #[bar("...")] | ^^^^^^^^^^^^^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:222:13 + --> $DIR/subdiagnostic-derive.rs:225:13 | LL | #[label(code = "...")] | ^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:222:5 + --> $DIR/subdiagnostic-derive.rs:225:5 | LL | #[label(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:251:5 + --> $DIR/subdiagnostic-derive.rs:254:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:248:1 + --> $DIR/subdiagnostic-derive.rs:251:1 | LL | / #[label(no_crate_example)] LL | | @@ -147,13 +147,13 @@ LL | | } | |_^ error: `#[applicability]` is only valid on suggestions - --> $DIR/subdiagnostic-derive.rs:261:5 + --> $DIR/subdiagnostic-derive.rs:264:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:271:5 + --> $DIR/subdiagnostic-derive.rs:274:5 | LL | #[bar] | ^^^^^^ @@ -161,13 +161,13 @@ LL | #[bar] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:282:5 + --> $DIR/subdiagnostic-derive.rs:285:5 | LL | #[bar = "..."] | ^^^^^^^^^^^^^^ error: `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:293:5 + --> $DIR/subdiagnostic-derive.rs:296:5 | LL | #[bar("...")] | ^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | #[bar("...")] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: unexpected unsupported untagged union - --> $DIR/subdiagnostic-derive.rs:309:1 + --> $DIR/subdiagnostic-derive.rs:312:1 | LL | / union AC { LL | | @@ -185,73 +185,73 @@ LL | | } | |_^ error: a diagnostic slug must be the first argument to the attribute - --> $DIR/subdiagnostic-derive.rs:324:44 + --> $DIR/subdiagnostic-derive.rs:327:44 | LL | #[label(no_crate_example, no_crate::example)] | ^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:337:5 + --> $DIR/subdiagnostic-derive.rs:340:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:334:5 + --> $DIR/subdiagnostic-derive.rs:337:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: subdiagnostic kind not specified - --> $DIR/subdiagnostic-derive.rs:343:8 + --> $DIR/subdiagnostic-derive.rs:346:8 | LL | struct AG { | ^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:380:46 + --> $DIR/subdiagnostic-derive.rs:383:46 | LL | #[suggestion(no_crate_example, code = "...", code = "...")] | ^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:380:32 + --> $DIR/subdiagnostic-derive.rs:383:32 | LL | #[suggestion(no_crate_example, code = "...", code = "...")] | ^^^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:398:5 + --> $DIR/subdiagnostic-derive.rs:401:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:395:5 + --> $DIR/subdiagnostic-derive.rs:398:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: the `#[applicability]` attribute can only be applied to fields of type `Applicability` - --> $DIR/subdiagnostic-derive.rs:408:5 + --> $DIR/subdiagnostic-derive.rs:411:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:421:1 + --> $DIR/subdiagnostic-derive.rs:424:1 | LL | #[suggestion(no_crate_example)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/subdiagnostic-derive.rs:431:62 + --> $DIR/subdiagnostic-derive.rs:434:62 | LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")] | ^^^^^ error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:449:1 + --> $DIR/subdiagnostic-derive.rs:452:1 | LL | / #[suggestion(no_crate_example, code = "...")] LL | | @@ -261,25 +261,25 @@ LL | | } | |_^ error: unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:463:1 + --> $DIR/subdiagnostic-derive.rs:466:1 | LL | #[label] | ^^^^^^^^ error: `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:483:39 + --> $DIR/subdiagnostic-derive.rs:486:39 | LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:502:43 + --> $DIR/subdiagnostic-derive.rs:505:43 | LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: `#[suggestion_part]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:525:5 + --> $DIR/subdiagnostic-derive.rs:528:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ LL | #[suggestion_part] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead error: `#[suggestion_part(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:528:5 + --> $DIR/subdiagnostic-derive.rs:531:5 | LL | #[suggestion_part(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -295,7 +295,7 @@ LL | #[suggestion_part(code = "...")] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:522:1 + --> $DIR/subdiagnostic-derive.rs:525:1 | LL | / #[suggestion(no_crate_example, code = "...")] LL | | @@ -307,7 +307,7 @@ LL | | } | |_^ error: invalid nested attribute - --> $DIR/subdiagnostic-derive.rs:537:42 + --> $DIR/subdiagnostic-derive.rs:540:42 | LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] | ^^^^ @@ -315,7 +315,7 @@ LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "mac = help: only `style` and `applicability` are valid nested attributes error: multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:537:1 + --> $DIR/subdiagnostic-derive.rs:540:1 | LL | / #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] LL | | @@ -326,19 +326,19 @@ LL | | } | |_^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:547:5 + --> $DIR/subdiagnostic-derive.rs:550:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ error: unexpected end of input, unexpected token in nested attribute, expected ident - --> $DIR/subdiagnostic-derive.rs:555:23 + --> $DIR/subdiagnostic-derive.rs:558:23 | LL | #[suggestion_part()] | ^ error: `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:564:5 + --> $DIR/subdiagnostic-derive.rs:567:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -346,7 +346,7 @@ LL | #[primary_span] = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` error: multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:561:1 + --> $DIR/subdiagnostic-derive.rs:564:1 | LL | / #[multipart_suggestion(no_crate_example)] LL | | @@ -358,121 +358,121 @@ LL | | } | |_^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:572:5 + --> $DIR/subdiagnostic-derive.rs:575:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ error: `code` is the only valid nested attribute - --> $DIR/subdiagnostic-derive.rs:578:23 + --> $DIR/subdiagnostic-derive.rs:581:23 | LL | #[suggestion_part(foo = "bar")] | ^^^ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:582:5 + --> $DIR/subdiagnostic-derive.rs:585:5 | LL | #[suggestion_part(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:585:5 + --> $DIR/subdiagnostic-derive.rs:588:5 | LL | #[suggestion_part()] | ^^^^^^^^^^^^^^^^^^^^ error: unexpected end of input, unexpected token in nested attribute, expected ident - --> $DIR/subdiagnostic-derive.rs:575:23 + --> $DIR/subdiagnostic-derive.rs:578:23 | LL | #[suggestion_part()] | ^ error: expected `,` - --> $DIR/subdiagnostic-derive.rs:578:27 + --> $DIR/subdiagnostic-derive.rs:581:27 | LL | #[suggestion_part(foo = "bar")] | ^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:593:37 + --> $DIR/subdiagnostic-derive.rs:596:37 | LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:593:23 + --> $DIR/subdiagnostic-derive.rs:596:23 | LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^ error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` - --> $DIR/subdiagnostic-derive.rs:622:5 + --> $DIR/subdiagnostic-derive.rs:625:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:670:34 + --> $DIR/subdiagnostic-derive.rs:673:34 | LL | #[suggestion_part(code("foo"))] | ^ error: unexpected token - --> $DIR/subdiagnostic-derive.rs:670:28 + --> $DIR/subdiagnostic-derive.rs:673:28 | LL | #[suggestion_part(code("foo"))] | ^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:680:41 + --> $DIR/subdiagnostic-derive.rs:683:41 | LL | #[suggestion_part(code("foo", "bar"))] | ^ error: unexpected token - --> $DIR/subdiagnostic-derive.rs:680:28 + --> $DIR/subdiagnostic-derive.rs:683:28 | LL | #[suggestion_part(code("foo", "bar"))] | ^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:690:30 + --> $DIR/subdiagnostic-derive.rs:693:30 | LL | #[suggestion_part(code(3))] | ^ error: unexpected token - --> $DIR/subdiagnostic-derive.rs:690:28 + --> $DIR/subdiagnostic-derive.rs:693:28 | LL | #[suggestion_part(code(3))] | ^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:700:29 + --> $DIR/subdiagnostic-derive.rs:703:29 | LL | #[suggestion_part(code())] | ^ error: expected string literal - --> $DIR/subdiagnostic-derive.rs:712:30 + --> $DIR/subdiagnostic-derive.rs:715:30 | LL | #[suggestion_part(code = 3)] | ^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:754:1 + --> $DIR/subdiagnostic-derive.rs:757:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:754:1 + --> $DIR/subdiagnostic-derive.rs:757:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:763:1 + --> $DIR/subdiagnostic-derive.rs:766:1 | LL | #[suggestion_hidden(no_crate_example, code = "")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -480,7 +480,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "")] = help: Use `#[suggestion(..., style = "hidden")]` instead error: `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:771:1 + --> $DIR/subdiagnostic-derive.rs:774:1 | LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -488,7 +488,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] = help: Use `#[suggestion(..., style = "hidden")]` instead error: invalid suggestion style - --> $DIR/subdiagnostic-derive.rs:779:51 + --> $DIR/subdiagnostic-derive.rs:782:51 | LL | #[suggestion(no_crate_example, code = "", style = "foo")] | ^^^^^ @@ -496,31 +496,31 @@ LL | #[suggestion(no_crate_example, code = "", style = "foo")] = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only` error: expected `= "xxx"` - --> $DIR/subdiagnostic-derive.rs:787:49 + --> $DIR/subdiagnostic-derive.rs:790:49 | LL | #[suggestion(no_crate_example, code = "", style = 42)] | ^ error: a diagnostic slug must be the first argument to the attribute - --> $DIR/subdiagnostic-derive.rs:795:48 + --> $DIR/subdiagnostic-derive.rs:798:48 | LL | #[suggestion(no_crate_example, code = "", style)] | ^ error: expected `= "xxx"` - --> $DIR/subdiagnostic-derive.rs:803:48 + --> $DIR/subdiagnostic-derive.rs:806:48 | LL | #[suggestion(no_crate_example, code = "", style("foo"))] | ^ error: expected `,` - --> $DIR/subdiagnostic-derive.rs:803:48 + --> $DIR/subdiagnostic-derive.rs:806:48 | LL | #[suggestion(no_crate_example, code = "", style("foo"))] | ^ error: `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:815:5 + --> $DIR/subdiagnostic-derive.rs:818:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -529,7 +529,7 @@ LL | #[primary_span] = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:812:1 + --> $DIR/subdiagnostic-derive.rs:815:1 | LL | / #[suggestion(no_crate_example, code = "")] LL | | @@ -541,67 +541,67 @@ LL | | } | |_^ error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:65:3 + --> $DIR/subdiagnostic-derive.rs:68:3 | LL | #[foo] | ^^^ error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:160:3 + --> $DIR/subdiagnostic-derive.rs:163:3 | LL | #[foo] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:174:7 + --> $DIR/subdiagnostic-derive.rs:177:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:186:7 + --> $DIR/subdiagnostic-derive.rs:189:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:198:7 + --> $DIR/subdiagnostic-derive.rs:201:7 | LL | #[bar = 4] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:210:7 + --> $DIR/subdiagnostic-derive.rs:213:7 | LL | #[bar("...")] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:271:7 + --> $DIR/subdiagnostic-derive.rs:274:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:282:7 + --> $DIR/subdiagnostic-derive.rs:285:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:293:7 + --> $DIR/subdiagnostic-derive.rs:296:7 | LL | #[bar("...")] | ^^^ error[E0425]: cannot find value `slug` in module `crate::fluent_generated` - --> $DIR/subdiagnostic-derive.rs:123:9 + --> $DIR/subdiagnostic-derive.rs:126:9 | LL | #[label(slug)] | ^^^^ not found in `crate::fluent_generated` error[E0425]: cannot find value `__code_29` in this scope - --> $DIR/subdiagnostic-derive.rs:706:10 + --> $DIR/subdiagnostic-derive.rs:709:10 | LL | #[derive(Subdiagnostic)] | ^^^^^^^^^^^^^ not found in this scope diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index dfde8c97e..a3db2e9ef 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -33,7 +33,6 @@ fn test_stable_mir(tcx: TyCtxt<'_>) { // Find items in the local crate. let items = stable_mir::all_local_items(); - assert!(get_item(tcx, &items, (DefKind::Fn, "foo_bar")).is_some()); assert!(get_item(tcx, &items, (DefKind::Fn, "foo::bar")).is_some()); // Find the `std` crate. @@ -41,6 +40,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) { let bar = get_item(tcx, &items, (DefKind::Fn, "bar")).unwrap(); let body = bar.body(); + assert_eq!(body.locals.len(), 2); assert_eq!(body.blocks.len(), 1); let block = &body.blocks[0]; assert_eq!(block.statements.len(), 1); @@ -52,6 +52,34 @@ fn test_stable_mir(tcx: TyCtxt<'_>) { stable_mir::mir::Terminator::Return => {} other => panic!("{other:?}"), } + + let foo_bar = get_item(tcx, &items, (DefKind::Fn, "foo_bar")).unwrap(); + let body = foo_bar.body(); + assert_eq!(body.locals.len(), 7); + assert_eq!(body.blocks.len(), 4); + let block = &body.blocks[0]; + match &block.terminator { + stable_mir::mir::Terminator::Call { .. } => {} + other => panic!("{other:?}"), + } + + let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap(); + let body = drop.body(); + assert_eq!(body.blocks.len(), 2); + let block = &body.blocks[0]; + match &block.terminator { + stable_mir::mir::Terminator::Drop { .. } => {} + other => panic!("{other:?}"), + } + + let assert = get_item(tcx, &items, (DefKind::Fn, "assert")).unwrap(); + let body = assert.body(); + assert_eq!(body.blocks.len(), 2); + let block = &body.blocks[0]; + match &block.terminator { + stable_mir::mir::Terminator::Assert { .. } => {} + other => panic!("{other:?}"), + } } // Use internal API to find a function in a crate. @@ -97,7 +125,7 @@ impl Callbacks for SMirCalls { queries: &'tcx Queries<'tcx>, ) -> Compilation { queries.global_ctxt().unwrap().enter(|tcx| { - test_stable_mir(tcx); + rustc_smir::rustc_internal::run(tcx, || test_stable_mir(tcx)); }); // No need to keep going. Compilation::Stop @@ -123,6 +151,12 @@ fn generate_input(path: &str) -> std::io::Result<()> { let x_64 = foo::bar(x); let y_64 = foo::bar(y); x_64.wrapping_add(y_64) + }} + + pub fn drop(_: String) {{}} + + pub fn assert(x: i32) -> i32 {{ + x + 1 }}"# )?; Ok(()) -- cgit v1.2.3