From 8e3b9d21186ee0b48c72c1af5296aeb75876d2af Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Sun, 16 Jun 2019 01:24:37 +0200 Subject: [PATCH 01/25] Stabilize todo macro --- src/libcore/macros.rs | 16 ++++++++++------ src/libstd/lib.rs | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 9dfa09cf8a512..c6b4433eb0a8f 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -450,7 +450,7 @@ macro_rules! writeln { /// The unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which /// will cause undefined behavior if the code is reached. /// -/// [`panic!`]: ../std/macro.panic.html +/// [`panic!`]: ../std/macro.panic.html /// [`unreachable_unchecked`]: ../std/hint/fn.unreachable_unchecked.html /// [`std::hint`]: ../std/hint/index.html /// @@ -459,6 +459,7 @@ macro_rules! writeln { /// This will always [`panic!`] /// /// [`panic!`]: ../std/macro.panic.html +/// /// # Examples /// /// Match arms: @@ -510,6 +511,9 @@ macro_rules! unreachable { /// code type-check, or if you're implementing a trait that requires multiple /// methods, and you're only planning on using one of them. /// +/// There is no difference between `unimplemented!` and `todo!` apart from the +/// name. +/// /// # Panics /// /// This will always [panic!](macro.panic.html) @@ -564,8 +568,10 @@ macro_rules! unimplemented { /// Indicates unfinished code. /// /// This can be useful if you are prototyping and are just looking to have your -/// code typecheck. `todo!` works exactly like `unimplemented!`. The only -/// difference between the two macros is the name. +/// code typecheck. +/// +/// There is no difference between `unimplemented!` and `todo!` apart from the +/// name. /// /// # Panics /// @@ -587,8 +593,6 @@ macro_rules! unimplemented { /// `baz()`, so we can use `todo!`: /// /// ``` -/// #![feature(todo_macro)] -/// /// # trait Foo { /// # fn bar(&self); /// # fn baz(&self); @@ -614,7 +618,7 @@ macro_rules! unimplemented { /// } /// ``` #[macro_export] -#[unstable(feature = "todo_macro", issue = "59277")] +#[stable(feature = "todo_macro", since = "1.37.0")] macro_rules! todo { () => (panic!("not yet implemented")); ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*))); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e044b46e0d076..84c2968b71d71 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -298,7 +298,6 @@ #![feature(stmt_expr_attributes)] #![feature(str_internals)] #![feature(thread_local)] -#![feature(todo_macro)] #![feature(toowned_clone_into)] #![feature(try_reserve)] #![feature(unboxed_closures)] From 560bf1ba0cb476305dcccd4365d750620833f761 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Wed, 4 Sep 2019 19:34:41 +0200 Subject: [PATCH 02/25] Update src/libcore/macros.rs Co-Authored-By: Mazdak Farrokhzad --- src/libcore/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index c6b4433eb0a8f..627ceade5cc16 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -618,7 +618,7 @@ macro_rules! unimplemented { /// } /// ``` #[macro_export] -#[stable(feature = "todo_macro", since = "1.37.0")] +#[stable(feature = "todo_macro", since = "1.38.0")] macro_rules! todo { () => (panic!("not yet implemented")); ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*))); From 711f6735bc9461392331842b317abb0525973949 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Wed, 4 Sep 2019 19:35:57 +0200 Subject: [PATCH 03/25] Update macros.rs --- src/libcore/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 627ceade5cc16..a9a30ed80add0 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -618,7 +618,7 @@ macro_rules! unimplemented { /// } /// ``` #[macro_export] -#[stable(feature = "todo_macro", since = "1.38.0")] +#[stable(feature = "todo_macro", since = "1.39.0")] macro_rules! todo { () => (panic!("not yet implemented")); ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*))); From 445e7350f2a0a776b541ddca7b028a804639b40f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 25 Sep 2019 17:08:40 +0200 Subject: [PATCH 04/25] Prevent rustdoc feature to be passed down to doctests --- src/librustdoc/config.rs | 1 - src/librustdoc/core.rs | 5 ++++- src/librustdoc/test.rs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 19ea781430041..fe4e2bd091519 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -344,7 +344,6 @@ impl Options { .map(|s| PathBuf::from(&s)) .unwrap_or_else(|| PathBuf::from("doc")); let mut cfgs = matches.opt_strs("cfg"); - cfgs.push("rustdoc".to_string()); if should_test { cfgs.push("doctest".to_string()); } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 010e4cf6cd0d5..00265caa965ea 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -234,7 +234,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt error_format, libs, externs, - cfgs, + mut cfgs, codegen_options, debugging_options, target, @@ -250,6 +250,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt .. } = options; + // Add the rustdoc cfg into the doc build. + cfgs.push("rustdoc".to_string()); + let cpath = Some(input.clone()); let input = Input::File(input); diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 6576165b6ce74..3e77ca47e8a6a 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -62,9 +62,11 @@ pub fn run(options: Options) -> i32 { ..config::Options::default() }; + let mut cfgs = options.cfgs.clone(); + cfgs.push("rustdoc".to_owned()); let config = interface::Config { opts: sessopts, - crate_cfg: config::parse_cfgspecs(options.cfgs.clone()), + crate_cfg: config::parse_cfgspecs(cfgs), input, input_path: None, output_file: None, From 366fdebff8dc6259c67206f78d53f1b1d64854ab Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 30 Sep 2019 16:19:08 +0200 Subject: [PATCH 05/25] Add new rustdoc-ui test to ensuire that rustdoc feature isn't passed down to doctests --- src/test/rustdoc-ui/doc-test-rustdoc-feature.rs | 14 ++++++++++++++ .../rustdoc-ui/doc-test-rustdoc-feature.stdout | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 src/test/rustdoc-ui/doc-test-rustdoc-feature.rs create mode 100644 src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs b/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs new file mode 100644 index 0000000000000..d0ead4136575f --- /dev/null +++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.rs @@ -0,0 +1,14 @@ +// build-pass +// compile-flags:--test +// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" + +#![feature(doc_cfg)] + +// Make sure `cfg(rustdoc)` is set when finding doctests but not inside the doctests. + +/// ``` +/// #![feature(doc_cfg)] +/// assert!(!cfg!(rustdoc)); +/// ``` +#[cfg(rustdoc)] +pub struct Foo; diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout new file mode 100644 index 0000000000000..f2525c2dbec21 --- /dev/null +++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/doc-test-rustdoc-feature.rs - Foo (line 9) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + From 2ab7a67326b04d4d7f083c32f8776a69d3ff906c Mon Sep 17 00:00:00 2001 From: BO41 Date: Wed, 2 Oct 2019 17:28:48 +0200 Subject: [PATCH 06/25] Replace mentions of IRC with Discord --- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 7 +++---- README.md | 12 +++++------- src/bootstrap/README.md | 8 +++++--- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index ece8dedb0aed7..58b829e31d677 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -33,7 +33,7 @@ In the Rust community we strive to go the extra step to look out for each other. And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust. -The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. +The enforcement policies listed above apply to all official Rust venues; including all communication channels (Rust Discord server, Rust Zulip server); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. *Adapted from the [Node.js Policy on Trolling](https://blog.izs.me/2012/08/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4daaa986a2dc2..c3a9a68963eb7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ links to the major sections: * [Helpful Links and Information](#helpful-links-and-information) If you have questions, please make a post on [internals.rust-lang.org][internals] or -hop on the [Rust Discord server][rust-discord], [Rust Zulip server][rust-zulip] or [#rust-internals][pound-rust-internals]. +hop on the [Rust Discord server][rust-discord] or [Rust Zulip server][rust-zulip]. As a reminder, all contributors are expected to follow our [Code of Conduct][coc]. @@ -25,7 +25,6 @@ to contribute to it in more detail than this document. If this is your first time contributing, the [walkthrough] chapter of the guide can give you a good example of how a typical contribution would go. -[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals [internals]: https://internals.rust-lang.org [rust-discord]: http://discord.gg/rust-lang [rust-zulip]: https://rust-lang.zulipchat.com @@ -404,7 +403,7 @@ If you're looking for somewhere to start, check out the [E-easy][eeasy] tag. There are a number of other ways to contribute to Rust that don't deal with this repository. -Answer questions in [#rust][pound-rust], or on [users.rust-lang.org][users], +Answer questions in the _Get Help!_ channels from the [Rust Discord server][rust-discord], on [users.rust-lang.org][users], or on [StackOverflow][so]. Participate in the [RFC process](https://github.com/rust-lang/rfcs). @@ -413,7 +412,7 @@ Find a [requested community library][community-library], build it, and publish it to [Crates.io](http://crates.io). Easier said than done, but very, very valuable! -[pound-rust]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust +[rust-discord]: https://discord.gg/rust-lang [users]: https://users.rust-lang.org/ [so]: http://stackoverflow.com/questions/tagged/rust [community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library diff --git a/README.md b/README.md index 9462b10494c93..c5468a2924888 100644 --- a/README.md +++ b/README.md @@ -244,19 +244,17 @@ The Rust community congregates in a few places: To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md). -Rust has an [IRC] culture and most real-time collaboration happens in a -variety of channels on Mozilla's IRC network, irc.mozilla.org. The -most popular channel is [#rust], a venue for general discussion about -Rust. And a good place to ask for help would be [#rust-beginners]. +Most real-time collaboration happens in a variety of channels on the +[Rust Discord server][rust-discord], with channels dedicated for getting help, +community, documentation, and all major contribution areas in the Rust ecosystem. +A good place to ask for help would be the #help channel. The [rustc guide] might be a good place to start if you want to find out how various parts of the compiler work. Also, you may find the [rustdocs for the compiler itself][rustdocs] useful. -[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat -[#rust]: irc://irc.mozilla.org/rust -[#rust-beginners]: irc://irc.mozilla.org/rust-beginners +[rust-discord]: https://discord.gg/rust-lang [rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html [rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ diff --git a/src/bootstrap/README.md b/src/bootstrap/README.md index 3e877fc4e317c..c501378bff549 100644 --- a/src/bootstrap/README.md +++ b/src/bootstrap/README.md @@ -328,6 +328,8 @@ are: `Config` struct. * Adding a sanity check? Take a look at `bootstrap/sanity.rs`. -If you have any questions feel free to reach out on `#rust-infra` on IRC or ask on -internals.rust-lang.org. When you encounter bugs, please file issues on the -rust-lang/rust issue tracker. +If you have any questions feel free to reach out on `#infra` channel in the +[Rust Discord server][rust-discord] or ask on internals.rust-lang.org. When +you encounter bugs, please file issues on the rust-lang/rust issue tracker. + +[rust-discord]: https://discord.gg/rust-lang From 9fbb2a9b347d44074fff8aab27cd161a9cd54c74 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 2 Oct 2019 21:43:24 +0200 Subject: [PATCH 07/25] Fix missing calls to drop on unwind with lto=fat; issue 64655. --- src/librustc_codegen_llvm/attributes.rs | 51 ++++++++++++++++++------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 33b50401b22f1..4189904a8018c 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -273,25 +273,50 @@ pub fn from_fn_attrs( } else if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND) { // Special attribute for allocator functions, which can't unwind false - } else if let Some(id) = id { + } else if let Some(_) = id { + // rust-lang/rust#64655, rust-lang/rust#63909: to minimize + // risk associated with changing cases where nounwind + // attribute is attached, this code is deliberately mimicking + // old control flow based on whether `id` is `Some` or `None`. + // + // However, in the long term we should either: + // - fold this into final else (i.e. stop inspecting `id`) + // - or better still: whole-heartedly adopt Rust PR #63909. + // + // see also Rust RFC 2753. + let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig); - if cx.tcx.is_foreign_item(id) { - // Foreign items like `extern "C" { fn foo(); }` are assumed not to - // unwind - false - } else if sig.abi != Abi::Rust && sig.abi != Abi::RustCall { - // Any items defined in Rust that *don't* have the `extern` ABI are - // defined to not unwind. We insert shims to abort if an unwind - // happens to enforce this. - false - } else { - // Anything else defined in Rust is assumed that it can possibly - // unwind + if sig.abi == Abi::Rust || sig.abi == Abi::RustCall { + // Any Rust method (or `extern "Rust" fn` or `extern + // "rust-call" fn`) is explicitly allowed to unwind + // (unless it has no-unwind attribute, handled above). true + } else { + // Anything else is either: + // + // 1. A foreign item (like `extern "C" { fn foo(); }`), or + // + // 2. A Rust item using a non-Rust ABI (like `extern "C" fn foo() { ... }`). + // + // Foreign items (case 1) are assumed to not unwind; it is + // UB otherwise. (At least for now; see also + // rust-lang/rust#63909 and Rust RFC 2753.) + // + // Items defined in Rust with non-Rust ABIs (case 2) are + // defined to not unwind. We insert shims to abort if an + // unwind happens to enforce this. + // + // In either case, we mark item as explicitly nounwind. + false } } else { // assume this can possibly unwind, avoiding the application of a // `nounwind` attribute below. + // + // (But: See comments in previous branch. Specifically, it is + // unclear whether there is real value in the assumption this + // can unwind. The conservatism here may just be papering over + // a real problem by making some UB a bit harder to hit.) true }); From a3719728325e7a6fa511aee5c8191c248262a9af Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 2 Oct 2019 21:43:40 +0200 Subject: [PATCH 08/25] Regression tests for issue 64655. --- ...llow-unwind-when-calling-panic-directly.rs | 63 ++++++++++++++ ...sue-64655-extern-rust-must-allow-unwind.rs | 82 +++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs create mode 100644 src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs diff --git a/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs b/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs new file mode 100644 index 0000000000000..ac715e4328fd7 --- /dev/null +++ b/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs @@ -0,0 +1,63 @@ +// run-pass + +// rust-lang/rust#64655: with panic=unwind, a panic from a subroutine +// should still run desstructors as it unwindws the stack. However, +// bugs with how the nounwind LLVM attribute was applied led to this +// simple case being mishandled *if* you had fat LTO turned on. + +// Unlike issue-64655-extern-rust-must-allow-unwind.rs, the issue +// embodied in this test cropped up regardless of optimization level. +// Therefore it seemed worthy of being enshrined as a dedicated unit +// test. + +// LTO settings cannot be combined with -C prefer-dynamic +// no-prefer-dynamic + +// The revisions just enumerate lto settings (the opt-level appeared irrelevant in practice) + +// revisions: no thin fat +//[no]compile-flags: -C lto=no +//[thin]compile-flags: -C lto=thin +//[fat]compile-flags: -C lto=fat + +#![feature(core_panic)] + +// (For some reason, reproducing the LTO issue requires pulling in std +// explicitly this way.) +#![no_std] +extern crate std; + +fn main() { + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::boxed::Box; + + static SHARED: AtomicUsize = AtomicUsize::new(0); + + assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 0); + + let old_hook = std::panic::take_hook(); + + std::panic::set_hook(Box::new(|_| { } )); // no-op on panic. + + let handle = std::thread::spawn(|| { + struct Droppable; + impl Drop for Droppable { + fn drop(&mut self) { + SHARED.fetch_add(1, Ordering::SeqCst); + } + } + + let _guard = Droppable; + let s = "issue-64655-allow-unwind-when-calling-panic-directly.rs"; + core::panicking::panic(&("???", s, 17, 4)); + }); + + let wait = handle.join(); + + // reinstate handler to ease observation of assertion failures. + std::panic::set_hook(old_hook); + + assert!(wait.is_err()); + + assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 1); +} diff --git a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs new file mode 100644 index 0000000000000..4f7e8e3072f6e --- /dev/null +++ b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs @@ -0,0 +1,82 @@ +// run-pass + +// rust-lang/rust#64655: with panic=unwind, a panic from a subroutine +// should still run desstructors as it unwindws the stack. However, +// bugs with how the nounwind LLVM attribute was applied led to this +// simple case being mishandled *if* you had optimization *and* fat +// LTO turned on. + +// This test is the closest thing to a "regression test" we can do +// without actually spawning subprocesses and comparing stderr +// results. +// +// This test takes the code from the above issue and adapts it to +// better fit our test infrastructure: +// +// * Instead of relying on println! to observe whether the destructor +// is run, we instead run the code in a spawned thread and +// communicate the destructor's operation via a synchronous atomic +// in static memory. +// +// * To keep the output from confusing a casual user, we override the +// panic hook to be a no-op (rather than printing a message to +// stderr). +// +// (pnkfelix has confirmed by hand that these additions do not mask +// the underlying bug.) + +// LTO settings cannot be combined with -C prefer-dynamic +// no-prefer-dynamic + +// The revisions combine each lto setting with each optimization +// setting; pnkfelix observed three differing behaviors at opt-levels +// 0/1/2+3 for this test, so it seems prudent to be thorough. + +// revisions: no0 no1 no2 no3 thin0 thin1 thin2 thin3 fat0 fat1 fat2 fat3 + +//[no0]compile-flags: -C opt-level=0 -C lto=no +//[no1]compile-flags: -C opt-level=1 -C lto=no +//[no2]compile-flags: -C opt-level=2 -C lto=no +//[no3]compile-flags: -C opt-level=3 -C lto=no +//[thin0]compile-flags: -C opt-level=0 -C lto=thin +//[thin1]compile-flags: -C opt-level=1 -C lto=thin +//[thin2]compile-flags: -C opt-level=2 -C lto=thin +//[thin3]compile-flags: -C opt-level=3 -C lto=thin +//[fat0]compile-flags: -C opt-level=0 -C lto=fat +//[fat1]compile-flags: -C opt-level=1 -C lto=fat +//[fat2]compile-flags: -C opt-level=2 -C lto=fat +//[fat3]compile-flags: -C opt-level=3 -C lto=fat + +fn main() { + use std::sync::atomic::{AtomicUsize, Ordering}; + + static SHARED: AtomicUsize = AtomicUsize::new(0); + + assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 0); + + let old_hook = std::panic::take_hook(); + + std::panic::set_hook(Box::new(|_| { } )); // no-op on panic. + + let handle = std::thread::spawn(|| { + struct Droppable; + impl Drop for Droppable { + fn drop(&mut self) { + SHARED.fetch_add(1, Ordering::SeqCst); + } + } + + let _guard = Droppable; + None::<()>.expect("???"); + }); + + let wait = handle.join(); + + // reinstate handler to ease observation of assertion failures. + std::panic::set_hook(old_hook); + + assert!(wait.is_err()); + + assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 1); +} + From 3adcc3ed222bdc6fc669281c42ef933aa3f6116b Mon Sep 17 00:00:00 2001 From: Felix S Klock II Date: Wed, 2 Oct 2019 22:04:30 +0200 Subject: [PATCH 09/25] fix typo --- src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs index 4f7e8e3072f6e..18e441625ab9d 100644 --- a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs +++ b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs @@ -1,7 +1,7 @@ // run-pass // rust-lang/rust#64655: with panic=unwind, a panic from a subroutine -// should still run desstructors as it unwindws the stack. However, +// should still run desstructors as it unwinds the stack. However, // bugs with how the nounwind LLVM attribute was applied led to this // simple case being mishandled *if* you had optimization *and* fat // LTO turned on. From a8d70d1b4ad9c82b082d3e15a8b965289625d8e6 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 2 Oct 2019 18:03:23 -0300 Subject: [PATCH 10/25] Add visit_projection_elem method to visitors --- src/librustc/mir/visit.rs | 53 ++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 1e3b9eb29c79d..7236b17999948 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -166,6 +166,15 @@ macro_rules! make_mir_visitor { self.super_projection(base, projection, context, location); } + fn visit_projection_elem(&mut self, + base: & $($mutability)? PlaceBase<'tcx>, + proj_base: & $($mutability)? [PlaceElem<'tcx>], + elem: & $($mutability)? PlaceElem<'tcx>, + context: PlaceContext, + location: Location) { + self.super_projection_elem(base, proj_base, elem, context, location); + } + fn visit_constant(&mut self, constant: & $($mutability)? Constant<'tcx>, location: Location) { @@ -727,25 +736,33 @@ macro_rules! make_mir_visitor { location: Location) { if let [proj_base @ .., elem] = projection { self.visit_projection(base, proj_base, context, location); + self.visit_projection_elem(base, proj_base, elem, context, location); + } + } - match elem { - ProjectionElem::Field(_field, ty) => { - self.visit_ty(ty, TyContext::Location(location)); - } - ProjectionElem::Index(local) => { - self.visit_local( - local, - PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy), - location - ); - } - ProjectionElem::Deref | - ProjectionElem::Subslice { from: _, to: _ } | - ProjectionElem::ConstantIndex { offset: _, - min_length: _, - from_end: _ } | - ProjectionElem::Downcast(_, _) => { - } + fn super_projection_elem(&mut self, + _base: & $($mutability)? PlaceBase<'tcx>, + _proj_base: & $($mutability)? [PlaceElem<'tcx>], + elem: & $($mutability)? PlaceElem<'tcx>, + _context: PlaceContext, + location: Location) { + match elem { + ProjectionElem::Field(_field, ty) => { + self.visit_ty(ty, TyContext::Location(location)); + } + ProjectionElem::Index(local) => { + self.visit_local( + local, + PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy), + location + ); + } + ProjectionElem::Deref | + ProjectionElem::Subslice { from: _, to: _ } | + ProjectionElem::ConstantIndex { offset: _, + min_length: _, + from_end: _ } | + ProjectionElem::Downcast(_, _) => { } } } From 287ceed469e11214ff2650f0aea94e94711aa401 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 22 Sep 2019 01:32:51 +0200 Subject: [PATCH 11/25] Deprecate `#![plugin]` and `#[plugin_registrar]`. --- src/libsyntax/feature_gate/builtin_attrs.rs | 11 ++++++++--- src/libsyntax/feature_gate/check.rs | 4 ++++ .../hotplug_codegen_backend/the_backend.rs | 8 ++++---- src/test/ui-fulldeps/gated-plugin.rs | 4 +++- src/test/ui-fulldeps/gated-plugin.stderr | 12 ++++++++++-- src/test/ui-fulldeps/macro-crate-rlib.rs | 1 + src/test/ui-fulldeps/macro-crate-rlib.stderr | 8 ++++++++ src/test/ui/feature-gates/feature-gate-plugin.rs | 3 ++- .../ui/feature-gates/feature-gate-plugin.stderr | 10 +++++++++- .../feature-gates/feature-gate-plugin_registrar.rs | 2 ++ .../feature-gate-plugin_registrar.stderr | 6 ++++++ src/test/ui/invalid/invalid-plugin-attr.rs | 3 +++ src/test/ui/invalid/invalid-plugin-attr.stderr | 14 +++++++++++--- src/test/ui/malformed/malformed-plugin-1.rs | 3 +++ src/test/ui/malformed/malformed-plugin-1.stderr | 10 +++++++++- src/test/ui/malformed/malformed-plugin-2.rs | 3 +++ src/test/ui/malformed/malformed-plugin-2.stderr | 10 +++++++++- src/test/ui/malformed/malformed-plugin-3.rs | 3 +++ src/test/ui/malformed/malformed-plugin-3.stderr | 10 +++++++++- src/test/ui/multiple-plugin-registrars.stderr | 12 ++++++++++++ 20 files changed, 119 insertions(+), 18 deletions(-) diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs index d14afc6deaa69..d1c2ffb2880bf 100644 --- a/src/libsyntax/feature_gate/builtin_attrs.rs +++ b/src/libsyntax/feature_gate/builtin_attrs.rs @@ -279,9 +279,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Plugins: ungated!(plugin_registrar, Normal, template!(Word)), - gated!( - plugin, CrateLevel, template!(List: "name|name(args)"), - "compiler plugins are experimental and possibly buggy", + ( + sym::plugin, CrateLevel, template!(List: "name|name(args)"), + Gated( + Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None), + sym::plugin, + "compiler plugins are deprecated and will be removed in 1.44.0", + cfg_fn!(plugin) + ) ), // Testing: diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index d7fc74955bbbd..158f12839ae52 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -311,6 +311,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { if attr::contains_name(&i.attrs[..], sym::plugin_registrar) { gate_feature_post!(&self, plugin_registrar, i.span, "compiler plugins are experimental and possibly buggy"); + self.parse_sess.span_diagnostic.span_warn( + i.span, + "`#[plugin_registrar]` is deprecated and will be removed in 1.44.0", + ); } if attr::contains_name(&i.attrs[..], sym::start) { gate_feature_post!(&self, start, i.span, diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index c1bcb8a1aa262..1566a153ec03c 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -41,7 +41,7 @@ impl MetadataLoader for NoLlvmMetadataLoader { struct TheBackend; impl CodegenBackend for TheBackend { - fn metadata_loader(&self) -> Box { + fn metadata_loader(&self) -> Box { Box::new(NoLlvmMetadataLoader) } @@ -64,7 +64,7 @@ impl CodegenBackend for TheBackend { tcx: TyCtxt<'tcx>, _metadata: EncodedMetadata, _need_metadata_module: bool, - ) -> Box { + ) -> Box { use rustc::hir::def_id::LOCAL_CRATE; Box::new(tcx.crate_name(LOCAL_CRATE) as Symbol) @@ -72,7 +72,7 @@ impl CodegenBackend for TheBackend { fn join_codegen_and_link( &self, - ongoing_codegen: Box, + ongoing_codegen: Box, sess: &Session, _dep_graph: &DepGraph, outputs: &OutputFilenames, @@ -97,6 +97,6 @@ impl CodegenBackend for TheBackend { /// This is the entrypoint for a hot plugged rustc_codegen_llvm #[no_mangle] -pub fn __rustc_codegen_backend() -> Box { +pub fn __rustc_codegen_backend() -> Box { Box::new(TheBackend) } diff --git a/src/test/ui-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs index be1ec0614803b..2cae74e241130 100644 --- a/src/test/ui-fulldeps/gated-plugin.rs +++ b/src/test/ui-fulldeps/gated-plugin.rs @@ -1,6 +1,8 @@ +// ignore-tidy-linelength // aux-build:attr-plugin-test.rs #![plugin(attr_plugin_test)] -//~^ ERROR compiler plugins are experimental and possibly buggy +//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 fn main() {} diff --git a/src/test/ui-fulldeps/gated-plugin.stderr b/src/test/ui-fulldeps/gated-plugin.stderr index c5c1326c4f336..0c0256bde0f76 100644 --- a/src/test/ui-fulldeps/gated-plugin.stderr +++ b/src/test/ui-fulldeps/gated-plugin.stderr @@ -1,5 +1,5 @@ -error[E0658]: compiler plugins are experimental and possibly buggy - --> $DIR/gated-plugin.rs:3:1 +error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0 + --> $DIR/gated-plugin.rs:4:1 | LL | #![plugin(attr_plugin_test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,6 +7,14 @@ LL | #![plugin(attr_plugin_test)] = note: for more information, see https://github.com/rust-lang/rust/issues/29597 = help: add `#![feature(plugin)]` to the crate attributes to enable +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/gated-plugin.rs:4:1 + | +LL | #![plugin(attr_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui-fulldeps/macro-crate-rlib.rs b/src/test/ui-fulldeps/macro-crate-rlib.rs index 2962bb51fc418..27145396473fc 100644 --- a/src/test/ui-fulldeps/macro-crate-rlib.rs +++ b/src/test/ui-fulldeps/macro-crate-rlib.rs @@ -5,5 +5,6 @@ #![feature(plugin)] #![plugin(rlib_crate_test)] //~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 fn main() {} diff --git a/src/test/ui-fulldeps/macro-crate-rlib.stderr b/src/test/ui-fulldeps/macro-crate-rlib.stderr index a5a5456a316d1..c625d8f61c249 100644 --- a/src/test/ui-fulldeps/macro-crate-rlib.stderr +++ b/src/test/ui-fulldeps/macro-crate-rlib.stderr @@ -4,5 +4,13 @@ error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be av LL | #![plugin(rlib_crate_test)] | ^^^^^^^^^^^^^^^ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/macro-crate-rlib.rs:6:1 + | +LL | #![plugin(rlib_crate_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-plugin.rs b/src/test/ui/feature-gates/feature-gate-plugin.rs index 977a5556899ba..4afa9d4082c8a 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin.rs @@ -1,6 +1,7 @@ // Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate #![plugin(foo)] -//~^ ERROR compiler plugins are experimental and possibly buggy +//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-plugin.stderr b/src/test/ui/feature-gates/feature-gate-plugin.stderr index 0da9653c9af73..db4919f3e0909 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin.stderr +++ b/src/test/ui/feature-gates/feature-gate-plugin.stderr @@ -1,4 +1,4 @@ -error[E0658]: compiler plugins are experimental and possibly buggy +error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0 --> $DIR/feature-gate-plugin.rs:3:1 | LL | #![plugin(foo)] @@ -7,6 +7,14 @@ LL | #![plugin(foo)] = note: for more information, see https://github.com/rust-lang/rust/issues/29597 = help: add `#![feature(plugin)]` to the crate attributes to enable +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/feature-gate-plugin.rs:3:1 + | +LL | #![plugin(foo)] + | ^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs index 0e357f89d14a6..6ff67de86feb7 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs @@ -5,4 +5,6 @@ #[plugin_registrar] pub fn registrar() {} //~^ ERROR compiler plugins are experimental +//~| WARN `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 + fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr index 93473bfd27b45..1cf30b7a58e95 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr @@ -7,6 +7,12 @@ LL | pub fn registrar() {} = note: for more information, see https://github.com/rust-lang/rust/issues/29597 = help: add `#![feature(plugin_registrar)]` to the crate attributes to enable +warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 + --> $DIR/feature-gate-plugin_registrar.rs:6:1 + | +LL | pub fn registrar() {} + | ^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/invalid/invalid-plugin-attr.rs b/src/test/ui/invalid/invalid-plugin-attr.rs index 2cbd523386148..99f328137d4b2 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.rs +++ b/src/test/ui/invalid/invalid-plugin-attr.rs @@ -1,7 +1,10 @@ +// ignore-tidy-linelength + #![deny(unused_attributes)] #![feature(plugin)] #[plugin(bla)] //~ ERROR unused attribute //~^ ERROR should be an inner attribute +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 fn main() {} diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr index 36714c39b315a..06ac14dd4671a 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.stderr +++ b/src/test/ui/invalid/invalid-plugin-attr.stderr @@ -1,17 +1,25 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/invalid-plugin-attr.rs:6:1 + | +LL | #[plugin(bla)] + | ^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: unused attribute - --> $DIR/invalid-plugin-attr.rs:4:1 + --> $DIR/invalid-plugin-attr.rs:6:1 | LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/invalid-plugin-attr.rs:1:9 + --> $DIR/invalid-plugin-attr.rs:3:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/invalid-plugin-attr.rs:4:1 + --> $DIR/invalid-plugin-attr.rs:6:1 | LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/malformed/malformed-plugin-1.rs b/src/test/ui/malformed/malformed-plugin-1.rs index 28f6c8e7a6f67..b8b76753de8b0 100644 --- a/src/test/ui/malformed/malformed-plugin-1.rs +++ b/src/test/ui/malformed/malformed-plugin-1.rs @@ -1,4 +1,7 @@ +// ignore-tidy-linelength + #![feature(plugin)] #![plugin] //~ ERROR malformed `plugin` attribute +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr index a863cd4859656..14675350255ed 100644 --- a/src/test/ui/malformed/malformed-plugin-1.stderr +++ b/src/test/ui/malformed/malformed-plugin-1.stderr @@ -1,8 +1,16 @@ error: malformed `plugin` attribute input - --> $DIR/malformed-plugin-1.rs:2:1 + --> $DIR/malformed-plugin-1.rs:4:1 | LL | #![plugin] | ^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]` +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/malformed-plugin-1.rs:4:1 + | +LL | #![plugin] + | ^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-plugin-2.rs b/src/test/ui/malformed/malformed-plugin-2.rs index 8ec7a71da29b3..0eabf5203e1f3 100644 --- a/src/test/ui/malformed/malformed-plugin-2.rs +++ b/src/test/ui/malformed/malformed-plugin-2.rs @@ -1,4 +1,7 @@ +// ignore-tidy-linelength + #![feature(plugin)] #![plugin="bleh"] //~ ERROR malformed `plugin` attribute +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr index 6eb0c50ca9398..591b9473741b0 100644 --- a/src/test/ui/malformed/malformed-plugin-2.stderr +++ b/src/test/ui/malformed/malformed-plugin-2.stderr @@ -1,8 +1,16 @@ error: malformed `plugin` attribute input - --> $DIR/malformed-plugin-2.rs:2:1 + --> $DIR/malformed-plugin-2.rs:4:1 | LL | #![plugin="bleh"] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]` +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/malformed-plugin-2.rs:4:1 + | +LL | #![plugin="bleh"] + | ^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-plugin-3.rs b/src/test/ui/malformed/malformed-plugin-3.rs index c4713616b6258..fd3e72c09ba66 100644 --- a/src/test/ui/malformed/malformed-plugin-3.rs +++ b/src/test/ui/malformed/malformed-plugin-3.rs @@ -1,4 +1,7 @@ +// ignore-tidy-linelength + #![feature(plugin)] #![plugin(foo="bleh")] //~ ERROR malformed `plugin` attribute +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-3.stderr b/src/test/ui/malformed/malformed-plugin-3.stderr index f93fa0f65e85a..ae24f09ecf0cb 100644 --- a/src/test/ui/malformed/malformed-plugin-3.stderr +++ b/src/test/ui/malformed/malformed-plugin-3.stderr @@ -1,8 +1,16 @@ error[E0498]: malformed `plugin` attribute - --> $DIR/malformed-plugin-3.rs:2:1 + --> $DIR/malformed-plugin-3.rs:4:1 | LL | #![plugin(foo="bleh")] | ^^^^^^^^^^^^^^^^^^^^^^ malformed attribute +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/malformed-plugin-3.rs:4:1 + | +LL | #![plugin(foo="bleh")] + | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error diff --git a/src/test/ui/multiple-plugin-registrars.stderr b/src/test/ui/multiple-plugin-registrars.stderr index 0e8379841f960..0e022e3234c49 100644 --- a/src/test/ui/multiple-plugin-registrars.stderr +++ b/src/test/ui/multiple-plugin-registrars.stderr @@ -1,3 +1,15 @@ +warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 + --> $DIR/multiple-plugin-registrars.rs:7:1 + | +LL | pub fn one() {} + | ^^^^^^^^^^^^^^^ + +warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 + --> $DIR/multiple-plugin-registrars.rs:10:1 + | +LL | pub fn two() {} + | ^^^^^^^^^^^^^^^ + error: multiple plugin registration functions found | note: one is here From 1b8ec975fc15434b58d5d3db8304170c9c6ebf1a Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 3 Oct 2019 06:46:17 +0200 Subject: [PATCH 12/25] plugin_registrary: use normal deprecation instead of hard coded warning. --- src/libsyntax/feature_gate/builtin_attrs.rs | 12 +- src/libsyntax/feature_gate/check.rs | 4 - src/test/ui-fulldeps/gated-plugin.rs | 5 +- src/test/ui-fulldeps/gated-plugin.stderr | 8 +- src/test/ui-fulldeps/macro-crate-rlib.rs | 2 +- src/test/ui-fulldeps/macro-crate-rlib.stderr | 2 +- .../issue-43106-gating-of-builtin-attrs.rs | 7 +- ...issue-43106-gating-of-builtin-attrs.stderr | 442 ++++++++++-------- .../ui/feature-gates/feature-gate-plugin.rs | 2 +- .../feature-gates/feature-gate-plugin.stderr | 4 +- .../feature-gate-plugin_registrar.rs | 5 +- .../feature-gate-plugin_registrar.stderr | 23 +- src/test/ui/invalid/invalid-plugin-attr.rs | 4 +- .../ui/invalid/invalid-plugin-attr.stderr | 10 +- src/test/ui/malformed/malformed-plugin-1.rs | 4 +- .../ui/malformed/malformed-plugin-1.stderr | 6 +- src/test/ui/malformed/malformed-plugin-2.rs | 4 +- .../ui/malformed/malformed-plugin-2.stderr | 6 +- src/test/ui/malformed/malformed-plugin-3.rs | 4 +- .../ui/malformed/malformed-plugin-3.stderr | 6 +- src/test/ui/multiple-plugin-registrars.stderr | 18 +- 21 files changed, 313 insertions(+), 265 deletions(-) diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs index d1c2ffb2880bf..80a80ff0a0d47 100644 --- a/src/libsyntax/feature_gate/builtin_attrs.rs +++ b/src/libsyntax/feature_gate/builtin_attrs.rs @@ -278,13 +278,21 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), // Plugins: - ungated!(plugin_registrar, Normal, template!(Word)), + ( + sym::plugin_registrar, Normal, template!(Word), + Gated( + Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None), + sym::plugin_registrar, + "compiler plugins are deprecated", + cfg_fn!(plugin_registrar) + ) + ), ( sym::plugin, CrateLevel, template!(List: "name|name(args)"), Gated( Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None), sym::plugin, - "compiler plugins are deprecated and will be removed in 1.44.0", + "compiler plugins are deprecated", cfg_fn!(plugin) ) ), diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 158f12839ae52..d7fc74955bbbd 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -311,10 +311,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { if attr::contains_name(&i.attrs[..], sym::plugin_registrar) { gate_feature_post!(&self, plugin_registrar, i.span, "compiler plugins are experimental and possibly buggy"); - self.parse_sess.span_diagnostic.span_warn( - i.span, - "`#[plugin_registrar]` is deprecated and will be removed in 1.44.0", - ); } if attr::contains_name(&i.attrs[..], sym::start) { gate_feature_post!(&self, start, i.span, diff --git a/src/test/ui-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs index 2cae74e241130..0522c6d69a82f 100644 --- a/src/test/ui-fulldeps/gated-plugin.rs +++ b/src/test/ui-fulldeps/gated-plugin.rs @@ -1,8 +1,7 @@ -// ignore-tidy-linelength // aux-build:attr-plugin-test.rs #![plugin(attr_plugin_test)] -//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0 -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 +//~^ ERROR compiler plugins are deprecated +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui-fulldeps/gated-plugin.stderr b/src/test/ui-fulldeps/gated-plugin.stderr index 0c0256bde0f76..aa031fb7a63d2 100644 --- a/src/test/ui-fulldeps/gated-plugin.stderr +++ b/src/test/ui-fulldeps/gated-plugin.stderr @@ -1,5 +1,5 @@ -error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0 - --> $DIR/gated-plugin.rs:4:1 +error[E0658]: compiler plugins are deprecated + --> $DIR/gated-plugin.rs:3:1 | LL | #![plugin(attr_plugin_test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,8 +7,8 @@ LL | #![plugin(attr_plugin_test)] = note: for more information, see https://github.com/rust-lang/rust/issues/29597 = help: add `#![feature(plugin)]` to the crate attributes to enable -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 - --> $DIR/gated-plugin.rs:4:1 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/gated-plugin.rs:3:1 | LL | #![plugin(attr_plugin_test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute diff --git a/src/test/ui-fulldeps/macro-crate-rlib.rs b/src/test/ui-fulldeps/macro-crate-rlib.rs index 27145396473fc..b5038a58249d2 100644 --- a/src/test/ui-fulldeps/macro-crate-rlib.rs +++ b/src/test/ui-fulldeps/macro-crate-rlib.rs @@ -5,6 +5,6 @@ #![feature(plugin)] #![plugin(rlib_crate_test)] //~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui-fulldeps/macro-crate-rlib.stderr b/src/test/ui-fulldeps/macro-crate-rlib.stderr index c625d8f61c249..47d5ecb3742a8 100644 --- a/src/test/ui-fulldeps/macro-crate-rlib.stderr +++ b/src/test/ui-fulldeps/macro-crate-rlib.stderr @@ -4,7 +4,7 @@ error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be av LL | #![plugin(rlib_crate_test)] | ^^^^^^^^^^^^^^^ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 --> $DIR/macro-crate-rlib.rs:6:1 | LL | #![plugin(rlib_crate_test)] diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index 68ff95e420895..8c567ece1875b 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -32,9 +32,13 @@ // check-pass -#![feature(test)] +#![feature(test, plugin_registrar)] #![warn(unused_attributes, unknown_lints)] +// Exception, a gated and deprecated attribute. + +#![plugin_registrar] //~ WARN unused attribute + // UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES #![warn(x5400)] //~ WARN unknown lint: `x5400` @@ -43,7 +47,6 @@ #![deny(x5100)] //~ WARN unknown lint: `x5100` #![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs) #![macro_export] //~ WARN unused attribute -#![plugin_registrar] //~ WARN unused attribute // skipping testing of cfg // skipping testing of cfg_attr #![main] //~ WARN unused attribute diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index b2a6018b5354d..62a6d97dfe83b 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,5 +1,5 @@ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:9 | LL | #![warn(x5400)] | ^^^^^ @@ -11,197 +11,233 @@ LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:10 | LL | #![allow(x5300)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:42:11 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:46:11 | LL | #![forbid(x5200)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:47:9 | LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:101:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:104:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:104:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:107:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:107:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:110:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:110:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:119:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:138:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:157:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:176:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:460:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:460:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:463:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, `#[macro_use]` mod ... +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:17 + | +LL | mod inner { #![plugin_registrar] } + | ^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:5 + | +LL | #[plugin_registrar] struct S; + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:5 + | +LL | #[plugin_registrar] type T = S; + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:5 + | +LL | #[plugin_registrar] impl S { } + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:1 + | +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:1 + | +LL | #![plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + warning: use of deprecated attribute `crate_id`: no longer used. - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:87:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:90:1 | LL | #![crate_id = "10"] | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute - | - = note: `#[warn(deprecated)]` on by default warning: use of deprecated attribute `no_start`: no longer used. - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:92:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:95:1 | LL | #![no_start] | ^^^^^^^^^^^^ help: remove this attribute warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:90:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:93:12 | LL | #![feature(rust1)] | ^^^^^ @@ -209,7 +245,7 @@ LL | #![feature(rust1)] = note: `#[warn(stable_features)]` on by default warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ @@ -221,925 +257,919 @@ LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:200:17 | LL | mod inner { #![macro_export] } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:200:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 | LL | #[macro_export] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:206:5 | LL | #[macro_export] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:206:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5 | LL | #[macro_export] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:212:5 | LL | #[macro_export] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:194:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:1 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:17 | LL | mod inner { #![plugin_registrar] } | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:221:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:5 | LL | #[plugin_registrar] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:5 | LL | #[plugin_registrar] type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:5 | LL | #[plugin_registrar] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:1 | LL | #[plugin_registrar] | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:234:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:237:17 | LL | mod inner { #![main] } | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:239:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:242:5 | LL | #[main] struct S; | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:242:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:5 | LL | #[main] type T = S; | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:5 | LL | #[main] impl S { } | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:231:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:234:1 | LL | #[main] | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:255:17 | LL | mod inner { #![start] } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:257:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:260:5 | LL | #[start] struct S; | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:260:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:5 | LL | #[start] type T = S; | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:266:5 | LL | #[start] impl S { } | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:249:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:1 | LL | #[start] | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:319:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:319:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:322:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:322:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:325:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:325:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:328:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:17 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:338:5 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:338:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:5 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:5 | LL | #[automatically_derived] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:17 | LL | mod inner { #![no_link] } | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5 | LL | #[no_link] fn f() { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:5 | LL | #[no_link] struct S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5 | LL | #[no_link]type T = S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:5 | LL | #[no_link] impl S { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:1 | LL | #[no_link] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:17 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:5 | LL | #[should_panic] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:5 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:405:17 | LL | mod inner { #![ignore] } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:405:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 | LL | #[ignore] fn f() { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:5 | LL | #[ignore] struct S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 | LL | #[ignore] type T = S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:5 | LL | #[ignore] impl S { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:1 | LL | #[ignore] | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:17 | LL | mod inner { #![no_implicit_prelude] } | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:5 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:5 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:418:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:1 | LL | #[no_implicit_prelude] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:440:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:437:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:440:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:463:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:1 | LL | #[no_std] | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:1 | LL | #[no_std] | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:650:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:650:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:667:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:667:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:659:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:659:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:730:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:730:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:1 | LL | #[no_main] | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:1 | LL | #[no_main] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:768:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:768:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:1 - | -LL | #![macro_export] - | ^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:46:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:1 | LL | #![plugin_registrar] | ^^^^^^^^^^^^^^^^^^^^ @@ -1147,53 +1177,59 @@ LL | #![plugin_registrar] warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:49:1 | +LL | #![macro_export] + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:1 + | LL | #![main] | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 | LL | #![start] | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 | LL | #![repr()] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 | LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:61:1 | LL | #![no_link] | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 | LL | #![should_panic] | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:61:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:64:1 | LL | #![ignore] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:67:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:70:1 | LL | #![proc_macro_derive()] | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-plugin.rs b/src/test/ui/feature-gates/feature-gate-plugin.rs index 4afa9d4082c8a..8904ec0448ada 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin.rs @@ -1,7 +1,7 @@ // Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate #![plugin(foo)] -//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0 +//~^ ERROR compiler plugins are deprecated //~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-plugin.stderr b/src/test/ui/feature-gates/feature-gate-plugin.stderr index db4919f3e0909..d1eee8cc58895 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin.stderr +++ b/src/test/ui/feature-gates/feature-gate-plugin.stderr @@ -1,4 +1,4 @@ -error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0 +error[E0658]: compiler plugins are deprecated --> $DIR/feature-gate-plugin.rs:3:1 | LL | #![plugin(foo)] @@ -7,7 +7,7 @@ LL | #![plugin(foo)] = note: for more information, see https://github.com/rust-lang/rust/issues/29597 = help: add `#![feature(plugin)]` to the crate attributes to enable -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 --> $DIR/feature-gate-plugin.rs:3:1 | LL | #![plugin(foo)] diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs index 6ff67de86feb7..80e4aa76b4771 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs @@ -3,8 +3,9 @@ // the registration function isn't typechecked yet #[plugin_registrar] +//~^ ERROR compiler plugins are deprecated +//~| WARN use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated pub fn registrar() {} -//~^ ERROR compiler plugins are experimental -//~| WARN `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 +//~^ ERROR compiler plugins are experimental and possibly buggy fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr index 1cf30b7a58e95..1c4ccac1dcffb 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr @@ -1,5 +1,5 @@ error[E0658]: compiler plugins are experimental and possibly buggy - --> $DIR/feature-gate-plugin_registrar.rs:6:1 + --> $DIR/feature-gate-plugin_registrar.rs:8:1 | LL | pub fn registrar() {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -7,12 +7,23 @@ LL | pub fn registrar() {} = note: for more information, see https://github.com/rust-lang/rust/issues/29597 = help: add `#![feature(plugin_registrar)]` to the crate attributes to enable -warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 - --> $DIR/feature-gate-plugin_registrar.rs:6:1 +error[E0658]: compiler plugins are deprecated + --> $DIR/feature-gate-plugin_registrar.rs:5:1 | -LL | pub fn registrar() {} - | ^^^^^^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/29597 + = help: add `#![feature(plugin_registrar)]` to the crate attributes to enable + +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/feature-gate-plugin_registrar.rs:5:1 + | +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/invalid/invalid-plugin-attr.rs b/src/test/ui/invalid/invalid-plugin-attr.rs index 99f328137d4b2..3ba7389d5db69 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.rs +++ b/src/test/ui/invalid/invalid-plugin-attr.rs @@ -1,10 +1,8 @@ -// ignore-tidy-linelength - #![deny(unused_attributes)] #![feature(plugin)] #[plugin(bla)] //~ ERROR unused attribute //~^ ERROR should be an inner attribute -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr index 06ac14dd4671a..d14a7524bf2d9 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.stderr +++ b/src/test/ui/invalid/invalid-plugin-attr.stderr @@ -1,5 +1,5 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 - --> $DIR/invalid-plugin-attr.rs:6:1 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/invalid-plugin-attr.rs:4:1 | LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ help: remove this attribute @@ -7,19 +7,19 @@ LL | #[plugin(bla)] = note: `#[warn(deprecated)]` on by default error: unused attribute - --> $DIR/invalid-plugin-attr.rs:6:1 + --> $DIR/invalid-plugin-attr.rs:4:1 | LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/invalid-plugin-attr.rs:3:9 + --> $DIR/invalid-plugin-attr.rs:1:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/invalid-plugin-attr.rs:6:1 + --> $DIR/invalid-plugin-attr.rs:4:1 | LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/malformed/malformed-plugin-1.rs b/src/test/ui/malformed/malformed-plugin-1.rs index b8b76753de8b0..d4c1a2a16795b 100644 --- a/src/test/ui/malformed/malformed-plugin-1.rs +++ b/src/test/ui/malformed/malformed-plugin-1.rs @@ -1,7 +1,5 @@ -// ignore-tidy-linelength - #![feature(plugin)] #![plugin] //~ ERROR malformed `plugin` attribute -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr index 14675350255ed..d8416c409542b 100644 --- a/src/test/ui/malformed/malformed-plugin-1.stderr +++ b/src/test/ui/malformed/malformed-plugin-1.stderr @@ -1,11 +1,11 @@ error: malformed `plugin` attribute input - --> $DIR/malformed-plugin-1.rs:4:1 + --> $DIR/malformed-plugin-1.rs:2:1 | LL | #![plugin] | ^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]` -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 - --> $DIR/malformed-plugin-1.rs:4:1 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/malformed-plugin-1.rs:2:1 | LL | #![plugin] | ^^^^^^^^^^ help: remove this attribute diff --git a/src/test/ui/malformed/malformed-plugin-2.rs b/src/test/ui/malformed/malformed-plugin-2.rs index 0eabf5203e1f3..ba80d97a3c276 100644 --- a/src/test/ui/malformed/malformed-plugin-2.rs +++ b/src/test/ui/malformed/malformed-plugin-2.rs @@ -1,7 +1,5 @@ -// ignore-tidy-linelength - #![feature(plugin)] #![plugin="bleh"] //~ ERROR malformed `plugin` attribute -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr index 591b9473741b0..34383ba082812 100644 --- a/src/test/ui/malformed/malformed-plugin-2.stderr +++ b/src/test/ui/malformed/malformed-plugin-2.stderr @@ -1,11 +1,11 @@ error: malformed `plugin` attribute input - --> $DIR/malformed-plugin-2.rs:4:1 + --> $DIR/malformed-plugin-2.rs:2:1 | LL | #![plugin="bleh"] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]` -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 - --> $DIR/malformed-plugin-2.rs:4:1 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/malformed-plugin-2.rs:2:1 | LL | #![plugin="bleh"] | ^^^^^^^^^^^^^^^^^ help: remove this attribute diff --git a/src/test/ui/malformed/malformed-plugin-3.rs b/src/test/ui/malformed/malformed-plugin-3.rs index fd3e72c09ba66..d2bd8f9f8dc47 100644 --- a/src/test/ui/malformed/malformed-plugin-3.rs +++ b/src/test/ui/malformed/malformed-plugin-3.rs @@ -1,7 +1,5 @@ -// ignore-tidy-linelength - #![feature(plugin)] #![plugin(foo="bleh")] //~ ERROR malformed `plugin` attribute -//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0 +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-3.stderr b/src/test/ui/malformed/malformed-plugin-3.stderr index ae24f09ecf0cb..71f607d68a4af 100644 --- a/src/test/ui/malformed/malformed-plugin-3.stderr +++ b/src/test/ui/malformed/malformed-plugin-3.stderr @@ -1,11 +1,11 @@ error[E0498]: malformed `plugin` attribute - --> $DIR/malformed-plugin-3.rs:4:1 + --> $DIR/malformed-plugin-3.rs:2:1 | LL | #![plugin(foo="bleh")] | ^^^^^^^^^^^^^^^^^^^^^^ malformed attribute -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597 - --> $DIR/malformed-plugin-3.rs:4:1 +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/malformed-plugin-3.rs:2:1 | LL | #![plugin(foo="bleh")] | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute diff --git a/src/test/ui/multiple-plugin-registrars.stderr b/src/test/ui/multiple-plugin-registrars.stderr index 0e022e3234c49..3a7895a08c6ef 100644 --- a/src/test/ui/multiple-plugin-registrars.stderr +++ b/src/test/ui/multiple-plugin-registrars.stderr @@ -1,14 +1,16 @@ -warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 - --> $DIR/multiple-plugin-registrars.rs:7:1 +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/multiple-plugin-registrars.rs:6:1 | -LL | pub fn one() {} - | ^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default -warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 - --> $DIR/multiple-plugin-registrars.rs:10:1 +warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/multiple-plugin-registrars.rs:9:1 | -LL | pub fn two() {} - | ^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute error: multiple plugin registration functions found | From d1f95ef3c53df238afdeaee9c9fab35ab5dacc18 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 3 Oct 2019 09:33:28 +0200 Subject: [PATCH 13/25] --bless ui-fulldeps tests --- src/test/ui-fulldeps/issue-15778-fail.rs | 1 + src/test/ui-fulldeps/issue-15778-fail.stderr | 9 +++++++ src/test/ui-fulldeps/issue-15778-pass.stderr | 8 ++++++ src/test/ui-fulldeps/issue-40001.stderr | 8 ++++++ .../lint-group-plugin-deny-cmdline.rs | 2 ++ .../lint-group-plugin-deny-cmdline.stderr | 12 +++++++-- src/test/ui-fulldeps/lint-group-plugin.stderr | 8 ++++++ .../lint-plugin-cmdline-allow.stderr | 8 ++++++ src/test/ui-fulldeps/lint-plugin-deny-attr.rs | 1 + .../ui-fulldeps/lint-plugin-deny-attr.stderr | 12 +++++++-- .../ui-fulldeps/lint-plugin-deny-cmdline.rs | 1 + .../lint-plugin-deny-cmdline.stderr | 10 ++++++- .../ui-fulldeps/lint-plugin-forbid-attrs.rs | 1 + .../lint-plugin-forbid-attrs.stderr | 14 +++++++--- .../ui-fulldeps/lint-plugin-forbid-cmdline.rs | 2 +- .../lint-plugin-forbid-cmdline.stderr | 8 ++++++ src/test/ui-fulldeps/lint-plugin.stderr | 8 ++++++ .../lint-tool-cmdline-allow.stderr | 8 ++++++ src/test/ui-fulldeps/lint-tool-test.rs | 1 + src/test/ui-fulldeps/lint-tool-test.stderr | 26 ++++++++++++------- src/test/ui-fulldeps/llvm-pass-plugin.stderr | 8 ++++++ .../ui-fulldeps/lto-syntax-extension.stderr | 8 ++++++ .../outlive-expansion-phase.stderr | 8 ++++++ src/test/ui-fulldeps/plugin-args-1.stderr | 8 ++++++ src/test/ui-fulldeps/plugin-args-2.stderr | 8 ++++++ src/test/ui-fulldeps/plugin-args-3.stderr | 8 ++++++ .../ui-fulldeps/plugin-attr-register-deny.rs | 1 + .../plugin-attr-register-deny.stderr | 16 +++++++++--- src/test/ui-fulldeps/plugin-reexport.rs | 1 + src/test/ui-fulldeps/plugin-reexport.stderr | 12 +++++++-- .../ui-fulldeps/roman-numerals-macro.stderr | 8 ++++++ 31 files changed, 210 insertions(+), 24 deletions(-) create mode 100644 src/test/ui-fulldeps/issue-15778-pass.stderr create mode 100644 src/test/ui-fulldeps/issue-40001.stderr create mode 100644 src/test/ui-fulldeps/llvm-pass-plugin.stderr create mode 100644 src/test/ui-fulldeps/lto-syntax-extension.stderr create mode 100644 src/test/ui-fulldeps/outlive-expansion-phase.stderr create mode 100644 src/test/ui-fulldeps/plugin-args-1.stderr create mode 100644 src/test/ui-fulldeps/plugin-args-2.stderr create mode 100644 src/test/ui-fulldeps/plugin-args-3.stderr create mode 100644 src/test/ui-fulldeps/roman-numerals-macro.stderr diff --git a/src/test/ui-fulldeps/issue-15778-fail.rs b/src/test/ui-fulldeps/issue-15778-fail.rs index 75c52fdb4bd28..beecaadf95554 100644 --- a/src/test/ui-fulldeps/issue-15778-fail.rs +++ b/src/test/ui-fulldeps/issue-15778-fail.rs @@ -4,5 +4,6 @@ #![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/src/test/ui-fulldeps/issue-15778-fail.stderr b/src/test/ui-fulldeps/issue-15778-fail.stderr index d689286177644..3afdb1fbf807d 100644 --- a/src/test/ui-fulldeps/issue-15778-fail.stderr +++ b/src/test/ui-fulldeps/issue-15778-fail.stderr @@ -1,9 +1,18 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-15778-fail.rs:6:1 + | +LL | #![plugin(lint_for_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = 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() { } | |_________________^ | diff --git a/src/test/ui-fulldeps/issue-15778-pass.stderr b/src/test/ui-fulldeps/issue-15778-pass.stderr new file mode 100644 index 0000000000000..f81c314c23a2d --- /dev/null +++ b/src/test/ui-fulldeps/issue-15778-pass.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-15778-pass.rs:8:1 + | +LL | #![plugin(lint_for_crate_rpass)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/issue-40001.stderr b/src/test/ui-fulldeps/issue-40001.stderr new file mode 100644 index 0000000000000..186721e2bb9e6 --- /dev/null +++ b/src/test/ui-fulldeps/issue-40001.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/issue-40001.rs:6:1 + | +LL | #![plugin(issue_40001_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs index c9d8654a90974..9f8a879608c1f 100644 --- a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs @@ -3,7 +3,9 @@ // 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' diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr index cd0bff92bf112..28065bf3946c0 100644 --- a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr @@ -1,5 +1,13 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-group-plugin-deny-cmdline.rs:7:1 + | +LL | #![plugin(lint_group_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: item is named 'lintme' - --> $DIR/lint-group-plugin-deny-cmdline.rs:8:1 + --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ @@ -7,7 +15,7 @@ LL | fn lintme() { } = note: `-D test-lint` implied by `-D lint-me` error: item is named 'pleaselintme' - --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 + --> $DIR/lint-group-plugin-deny-cmdline.rs:12:1 | LL | fn pleaselintme() { } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-group-plugin.stderr b/src/test/ui-fulldeps/lint-group-plugin.stderr index 1af34b306e3a3..a93cae1a2b1ec 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin.stderr @@ -1,3 +1,11 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-group-plugin.rs:6:1 + | +LL | #![plugin(lint_group_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + warning: item is named 'lintme' --> $DIR/lint-group-plugin.rs:9:1 | diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr index c731796d4824d..2185929e893b7 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr @@ -1,3 +1,11 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-plugin-cmdline-allow.rs:8:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + warning: function is never used: `lintme` --> $DIR/lint-plugin-cmdline-allow.rs:10:1 | diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.rs b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs index 2d424af870707..04230a8e883b1 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.rs +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs @@ -3,6 +3,7 @@ #![feature(plugin)] #![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` #![deny(test_lint)] fn lintme() { } //~ ERROR item is named 'lintme' diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr index 5bfde8551ed37..a0cd9687f5bc0 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -1,11 +1,19 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-plugin-deny-attr.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: item is named 'lintme' - --> $DIR/lint-plugin-deny-attr.rs:8:1 + --> $DIR/lint-plugin-deny-attr.rs:9:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-plugin-deny-attr.rs:6:9 + --> $DIR/lint-plugin-deny-attr.rs:7:9 | LL | #![deny(test_lint)] | ^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs index 87324e85b3be7..c460cfd5f9451 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs @@ -4,6 +4,7 @@ #![feature(plugin)] #![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` fn lintme() { } //~ ERROR item is named 'lintme' diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr index e4257dfde6f90..3c64025e5eb23 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -1,5 +1,13 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-plugin-deny-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: item is named 'lintme' - --> $DIR/lint-plugin-deny-cmdline.rs:8:1 + --> $DIR/lint-plugin-deny-cmdline.rs:9:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index c7f7f2be99ed5..569f04d18ffd1 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -3,6 +3,7 @@ #![feature(plugin)] #![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` #![forbid(test_lint)] fn lintme() { } //~ ERROR item is named 'lintme' diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index 092d0eb7a81a4..c0c43855c92a1 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) - --> $DIR/lint-plugin-forbid-attrs.rs:10:9 + --> $DIR/lint-plugin-forbid-attrs.rs:11:9 | LL | #![forbid(test_lint)] | --------- `forbid` level set here @@ -7,14 +7,22 @@ LL | #![forbid(test_lint)] 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/issues/29597 + --> $DIR/lint-plugin-forbid-attrs.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: item is named 'lintme' - --> $DIR/lint-plugin-forbid-attrs.rs:8:1 + --> $DIR/lint-plugin-forbid-attrs.rs:9:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-plugin-forbid-attrs.rs:6:11 + --> $DIR/lint-plugin-forbid-attrs.rs:7:11 | LL | #![forbid(test_lint)] | ^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs index 91fe3b65be6fc..82313f6912067 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs @@ -4,7 +4,7 @@ #![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) overruled by outer forbid(test_lint) diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr index fc2906da5f5fc..99d013921911b 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -6,6 +6,14 @@ LL | #[allow(test_lint)] | = 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/issues/29597 + --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: item is named 'lintme' --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 | diff --git a/src/test/ui-fulldeps/lint-plugin.stderr b/src/test/ui-fulldeps/lint-plugin.stderr index beea00ba45367..2ca5eefe4376c 100644 --- a/src/test/ui-fulldeps/lint-plugin.stderr +++ b/src/test/ui-fulldeps/lint-plugin.stderr @@ -1,3 +1,11 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-plugin.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + warning: item is named 'lintme' --> $DIR/lint-plugin.rs:8:1 | diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr index b4919bc339d28..71c3dc929b2e5 100644 --- a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr @@ -2,6 +2,14 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore | = note: requested on the command line with `-A test_lint` +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-tool-cmdline-allow.rs:8:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + warning: item is named 'lintme' --> $DIR/lint-tool-cmdline-allow.rs:10:1 | diff --git a/src/test/ui-fulldeps/lint-tool-test.rs b/src/test/ui-fulldeps/lint-tool-test.rs index 8bd06d1f1e34f..216a8cb95e31e 100644 --- a/src/test/ui-fulldeps/lint-tool-test.rs +++ b/src/test/ui-fulldeps/lint-tool-test.rs @@ -4,6 +4,7 @@ #![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 diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr index 16fe6f6613b3f..c727cfc701541 100644 --- a/src/test/ui-fulldeps/lint-tool-test.stderr +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -1,5 +1,5 @@ warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint-tool-test.rs:8:23 + --> $DIR/lint-tool-test.rs:9:23 | LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` @@ -7,19 +7,19 @@ LL | #![cfg_attr(foo, warn(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. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint-tool-test.rs:11:9 + --> $DIR/lint-tool-test.rs:12: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. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint-tool-test.rs:25:9 + --> $DIR/lint-tool-test.rs:26: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:27:8 + --> $DIR/lint-tool-test.rs:28:8 | LL | #[deny(this_lint_does_not_exist)] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,32 +27,40 @@ LL | #[deny(this_lint_does_not_exist)] = note: `#[warn(unknown_lints)]` on by default warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint-tool-test.rs:8:23 + --> $DIR/lint-tool-test.rs:9:23 | LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lint-tool-test.rs:6:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: item is named 'lintme' - --> $DIR/lint-tool-test.rs:14:1 + --> $DIR/lint-tool-test.rs:15:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-tool-test.rs:11:9 + --> $DIR/lint-tool-test.rs:12: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:22:5 + --> $DIR/lint-tool-test.rs:23:5 | LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-tool-test.rs:11:9 + --> $DIR/lint-tool-test.rs:12:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/llvm-pass-plugin.stderr b/src/test/ui-fulldeps/llvm-pass-plugin.stderr new file mode 100644 index 0000000000000..ebc092671a77c --- /dev/null +++ b/src/test/ui-fulldeps/llvm-pass-plugin.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/llvm-pass-plugin.rs:6:1 + | +LL | #![plugin(llvm_pass_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/lto-syntax-extension.stderr b/src/test/ui-fulldeps/lto-syntax-extension.stderr new file mode 100644 index 0000000000000..509331ceb218f --- /dev/null +++ b/src/test/ui-fulldeps/lto-syntax-extension.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/lto-syntax-extension.rs:9:1 + | +LL | #![plugin(lto_syntax_extension_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/outlive-expansion-phase.stderr b/src/test/ui-fulldeps/outlive-expansion-phase.stderr new file mode 100644 index 0000000000000..68e143d86eeb2 --- /dev/null +++ b/src/test/ui-fulldeps/outlive-expansion-phase.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/outlive-expansion-phase.rs:6:1 + | +LL | #![plugin(outlive_expansion_phase)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/plugin-args-1.stderr b/src/test/ui-fulldeps/plugin-args-1.stderr new file mode 100644 index 0000000000000..0d01a859df8ef --- /dev/null +++ b/src/test/ui-fulldeps/plugin-args-1.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/plugin-args-1.rs:6:1 + | +LL | #![plugin(plugin_args)] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/plugin-args-2.stderr b/src/test/ui-fulldeps/plugin-args-2.stderr new file mode 100644 index 0000000000000..2bbabd2013817 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-args-2.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/plugin-args-2.rs:6:1 + | +LL | #![plugin(plugin_args())] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/plugin-args-3.stderr b/src/test/ui-fulldeps/plugin-args-3.stderr new file mode 100644 index 0000000000000..bf4108bd7f8df --- /dev/null +++ b/src/test/ui-fulldeps/plugin-args-3.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/plugin-args-3.rs:6:1 + | +LL | #![plugin(plugin_args(hello(there), how(are="you")))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.rs b/src/test/ui-fulldeps/plugin-attr-register-deny.rs index 8be73e330abf7..dd7c009388e2c 100644 --- a/src/test/ui-fulldeps/plugin-attr-register-deny.rs +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.rs @@ -3,6 +3,7 @@ #![feature(plugin)] #![plugin(attr_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` #![deny(unused_attributes)] #[baz] diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.stderr b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr index 64a67f6e16036..a045782a95f77 100644 --- a/src/test/ui-fulldeps/plugin-attr-register-deny.stderr +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr @@ -1,23 +1,31 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/plugin-attr-register-deny.rs:5:1 + | +LL | #![plugin(attr_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: unused attribute - --> $DIR/plugin-attr-register-deny.rs:14:5 + --> $DIR/plugin-attr-register-deny.rs:15:5 | LL | #[bar] | ^^^^^^ | note: lint level defined here - --> $DIR/plugin-attr-register-deny.rs:6:9 + --> $DIR/plugin-attr-register-deny.rs:7:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/plugin-attr-register-deny.rs:14:5 + --> $DIR/plugin-attr-register-deny.rs:15:5 | LL | #[bar] | ^^^^^^ error: unused attribute - --> $DIR/plugin-attr-register-deny.rs:11:1 + --> $DIR/plugin-attr-register-deny.rs:12:1 | LL | #[foo] | ^^^^^^ diff --git a/src/test/ui-fulldeps/plugin-reexport.rs b/src/test/ui-fulldeps/plugin-reexport.rs index 4d8ede1680830..e92b020c0b413 100644 --- a/src/test/ui-fulldeps/plugin-reexport.rs +++ b/src/test/ui-fulldeps/plugin-reexport.rs @@ -4,6 +4,7 @@ #![feature(plugin)] #![plugin(attr_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` pub use mac as reexport; //~ ERROR `mac` is private, and cannot be re-exported diff --git a/src/test/ui-fulldeps/plugin-reexport.stderr b/src/test/ui-fulldeps/plugin-reexport.stderr index 4ac64b8d04b87..52d27c32897a5 100644 --- a/src/test/ui-fulldeps/plugin-reexport.stderr +++ b/src/test/ui-fulldeps/plugin-reexport.stderr @@ -1,15 +1,23 @@ error[E0364]: `mac` is private, and cannot be re-exported - --> $DIR/plugin-reexport.rs:8:9 + --> $DIR/plugin-reexport.rs:9:9 | LL | pub use mac as reexport; | ^^^^^^^^^^^^^^^ | note: consider marking `mac` as `pub` in the imported module - --> $DIR/plugin-reexport.rs:8:9 + --> $DIR/plugin-reexport.rs:9:9 | LL | pub use mac as reexport; | ^^^^^^^^^^^^^^^ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/plugin-reexport.rs:6:1 + | +LL | #![plugin(attr_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error For more information about this error, try `rustc --explain E0364`. diff --git a/src/test/ui-fulldeps/roman-numerals-macro.stderr b/src/test/ui-fulldeps/roman-numerals-macro.stderr new file mode 100644 index 0000000000000..7ac619185a1e0 --- /dev/null +++ b/src/test/ui-fulldeps/roman-numerals-macro.stderr @@ -0,0 +1,8 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597 + --> $DIR/roman-numerals-macro.rs:6:1 + | +LL | #![plugin(roman_numerals)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: `#[warn(deprecated)]` on by default + From d1310dc6c989e191d85c73c943d4175fbf1dccb8 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 22 Sep 2019 18:38:02 +0300 Subject: [PATCH 14/25] proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygiene --- src/libproc_macro/bridge/mod.rs | 1 + src/libproc_macro/lib.rs | 9 ++++ src/libsyntax/ext/base.rs | 6 +++ src/libsyntax/ext/proc_macro_server.rs | 5 ++ src/libsyntax_pos/lib.rs | 6 +++ .../proc-macro/auxiliary/mixed-site-span.rs | 42 ++++++++++++++++ .../dollar-crate-issue-62325.stdout | 22 ++++----- src/test/ui/proc-macro/dollar-crate.stdout | 48 +++++++++--------- src/test/ui/proc-macro/mixed-site-span.rs | 26 ++++++++++ src/test/ui/proc-macro/mixed-site-span.stderr | 49 +++++++++++++++++++ 10 files changed, 179 insertions(+), 35 deletions(-) create mode 100644 src/test/ui/proc-macro/auxiliary/mixed-site-span.rs create mode 100644 src/test/ui/proc-macro/mixed-site-span.rs create mode 100644 src/test/ui/proc-macro/mixed-site-span.stderr diff --git a/src/libproc_macro/bridge/mod.rs b/src/libproc_macro/bridge/mod.rs index 3c48466fffa28..c26b59f473c36 100644 --- a/src/libproc_macro/bridge/mod.rs +++ b/src/libproc_macro/bridge/mod.rs @@ -148,6 +148,7 @@ macro_rules! with_api { fn debug($self: $S::Span) -> String; fn def_site() -> $S::Span; fn call_site() -> $S::Span; + fn mixed_site() -> $S::Span; fn source_file($self: $S::Span) -> $S::SourceFile; fn parent($self: $S::Span) -> Option<$S::Span>; fn source($self: $S::Span) -> $S::Span; diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index d5cdc266acb6a..e199670b561c2 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -271,6 +271,15 @@ impl Span { Span(bridge::client::Span::call_site()) } + /// A span that represents `macro_rules` hygiene, and sometimes resolves at the macro + /// definition site (local variables, labels, `$crate`) and sometimes at the macro + /// call site (everything else). + /// The span location is taken from the call-site. + #[unstable(feature = "proc_macro_mixed_site", issue = "65049")] + pub fn mixed_site() -> Span { + Span(bridge::client::Span::mixed_site()) + } + /// The original source file into which this span points. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn source_file(&self) -> SourceFile { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 54cfb80573e5c..583fb3f770183 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -953,6 +953,12 @@ impl<'a> ExtCtxt<'a> { span.with_call_site_ctxt(self.current_expansion.id) } + /// Equivalent of `Span::mixed_site` from the proc macro API, + /// except that the location is taken from the span passed as an argument. + pub fn with_mixed_site_ctxt(&self, span: Span) -> Span { + span.with_mixed_site_ctxt(self.current_expansion.id) + } + /// Returns span for the macro which originally caused the current expansion to happen. /// /// Stops backtracing at include! boundary. diff --git a/src/libsyntax/ext/proc_macro_server.rs b/src/libsyntax/ext/proc_macro_server.rs index dfec9ee28809a..021ec46d987cf 100644 --- a/src/libsyntax/ext/proc_macro_server.rs +++ b/src/libsyntax/ext/proc_macro_server.rs @@ -355,6 +355,7 @@ pub(crate) struct Rustc<'a> { sess: &'a ParseSess, def_site: Span, call_site: Span, + mixed_site: Span, } impl<'a> Rustc<'a> { @@ -364,6 +365,7 @@ impl<'a> Rustc<'a> { sess: cx.parse_sess, def_site: cx.with_def_site_ctxt(expn_data.def_site), call_site: cx.with_call_site_ctxt(expn_data.call_site), + mixed_site: cx.with_mixed_site_ctxt(expn_data.call_site), } } @@ -664,6 +666,9 @@ impl server::Span for Rustc<'_> { fn call_site(&mut self) -> Self::Span { self.call_site } + fn mixed_site(&mut self) -> Self::Span { + self.mixed_site + } fn source_file(&mut self, span: Self::Span) -> Self::SourceFile { self.sess.source_map().lookup_char_pos(span.lo()).file } diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 6e83e1d3f8d4f..30ee9b90515ee 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -526,6 +526,12 @@ impl Span { self.with_ctxt_from_mark(expn_id, Transparency::Transparent) } + /// Equivalent of `Span::mixed_site` from the proc macro API, + /// except that the location is taken from the `self` span. + pub fn with_mixed_site_ctxt(&self, expn_id: ExpnId) -> Span { + self.with_ctxt_from_mark(expn_id, Transparency::SemiTransparent) + } + /// Produces a span with the same location as `self` and context produced by a macro with the /// given ID and transparency, assuming that macro was defined directly and not produced by /// some other macro (which is the case for built-in and procedural macros). diff --git a/src/test/ui/proc-macro/auxiliary/mixed-site-span.rs b/src/test/ui/proc-macro/auxiliary/mixed-site-span.rs new file mode 100644 index 0000000000000..dea5ea04aa850 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/mixed-site-span.rs @@ -0,0 +1,42 @@ +// force-host +// no-prefer-dynamic + +#![feature(proc_macro_hygiene)] +#![feature(proc_macro_mixed_site)] +#![feature(proc_macro_quote)] + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn proc_macro_rules(input: TokenStream) -> TokenStream { + if input.is_empty() { + let id = |s| TokenTree::from(Ident::new(s, Span::mixed_site())); + let item_def = id("ItemDef"); + let local_def = id("local_def"); + let item_use = id("ItemUse"); + let local_use = id("local_use"); + let mut single_quote = Punct::new('\'', Spacing::Joint); + single_quote.set_span(Span::mixed_site()); + let label_use: TokenStream = [ + TokenTree::from(single_quote), + id("label_use"), + ].iter().cloned().collect(); + quote!( + struct $item_def; + let $local_def = 0; + + $item_use; // OK + $local_use; // ERROR + break $label_use; // ERROR + ) + } else { + let mut dollar_crate = input.into_iter().next().unwrap(); + dollar_crate.set_span(Span::mixed_site()); + quote!( + type A = $dollar_crate::ItemUse; + ) + } +} diff --git a/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout b/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout index 7ee8078b2c5d2..619b2fd5321ff 100644 --- a/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout +++ b/src/test/ui/proc-macro/dollar-crate-issue-62325.stdout @@ -59,54 +59,54 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct B (identity ! ($crate :: S)) ; PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "struct", - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Ident { ident: "B", - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "identity", - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Punct { ch: '!', spacing: Alone, - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "$crate", - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Punct { ch: ':', spacing: Joint, - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Punct { ch: ':', spacing: Alone, - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Ident { ident: "S", - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, ], - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, ], - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, Punct { ch: ';', spacing: Alone, - span: #8 bytes(LO..HI), + span: #10 bytes(LO..HI), }, ] diff --git a/src/test/ui/proc-macro/dollar-crate.stdout b/src/test/ui/proc-macro/dollar-crate.stdout index 4f7e000265eb0..5fdc6f8ee96ca 100644 --- a/src/test/ui/proc-macro/dollar-crate.stdout +++ b/src/test/ui/proc-macro/dollar-crate.stdout @@ -124,40 +124,40 @@ PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ; PRINT-BANG INPUT (DEBUG): TokenStream [ Ident { ident: "struct", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Ident { ident: "M", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "$crate", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ':', spacing: Joint, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ':', spacing: Alone, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Ident { ident: "S", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, ], - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ';', spacing: Alone, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, ] PRINT-ATTR INPUT (DISPLAY): struct A(::dollar_crate_external::S); @@ -165,40 +165,40 @@ PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ; PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "struct", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Ident { ident: "A", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "$crate", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ':', spacing: Joint, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ':', spacing: Alone, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Ident { ident: "S", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, ], - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ';', spacing: Alone, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, ] PRINT-DERIVE INPUT (DISPLAY): struct D(::dollar_crate_external::S); @@ -206,39 +206,39 @@ PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ($crate :: S) ; PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "struct", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Ident { ident: "D", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "$crate", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ':', spacing: Joint, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ':', spacing: Alone, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Ident { ident: "S", - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, ], - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, Punct { ch: ';', spacing: Alone, - span: #10 bytes(LO..HI), + span: #13 bytes(LO..HI), }, ] diff --git a/src/test/ui/proc-macro/mixed-site-span.rs b/src/test/ui/proc-macro/mixed-site-span.rs new file mode 100644 index 0000000000000..69c32a96ca055 --- /dev/null +++ b/src/test/ui/proc-macro/mixed-site-span.rs @@ -0,0 +1,26 @@ +// Proc macros using `mixed_site` spans exhibit usual properties of `macro_rules` hygiene. + +// aux-build:mixed-site-span.rs + +#![feature(proc_macro_hygiene)] + +#[macro_use] +extern crate mixed_site_span; + +struct ItemUse; + +fn main() { + 'label_use: loop { + let local_use = 1; + proc_macro_rules!(); + //~^ ERROR use of undeclared label `'label_use` + //~| ERROR cannot find value `local_use` in this scope + ItemDef; // OK + local_def; //~ ERROR cannot find value `local_def` in this scope + } +} + +macro_rules! pass_dollar_crate { + () => (proc_macro_rules!($crate);) //~ ERROR cannot find type `ItemUse` in crate `$crate` +} +pass_dollar_crate!(); diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr new file mode 100644 index 0000000000000..475e3e0ca359b --- /dev/null +++ b/src/test/ui/proc-macro/mixed-site-span.stderr @@ -0,0 +1,49 @@ +error[E0426]: use of undeclared label `'label_use` + --> $DIR/mixed-site-span.rs:15:9 + | +LL | proc_macro_rules!(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | undeclared label `'label_use` + | in this macro invocation + +error[E0425]: cannot find value `local_use` in this scope + --> $DIR/mixed-site-span.rs:15:9 + | +LL | proc_macro_rules!(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | not found in this scope + | in this macro invocation + +error[E0425]: cannot find value `local_def` in this scope + --> $DIR/mixed-site-span.rs:19:9 + | +LL | local_def; + | ^^^^^^^^^ not found in this scope + +error[E0412]: cannot find type `ItemUse` in crate `$crate` + --> $DIR/auxiliary/mixed-site-span.rs:14:1 + | +LL | / pub fn proc_macro_rules(input: TokenStream) -> TokenStream { +LL | | if input.is_empty() { +LL | | let id = |s| TokenTree::from(Ident::new(s, Span::mixed_site())); +LL | | let item_def = id("ItemDef"); +... | +LL | | } +LL | | } + | |_^ not found in `$crate` + | + ::: $DIR/mixed-site-span.rs:26:1 + | +LL | pass_dollar_crate!(); + | --------------------- in this macro invocation +help: possible candidate is found in another module, you can import it into scope + | +LL | use ItemUse; + | + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0412, E0425, E0426. +For more information about an error, try `rustc --explain E0412`. From e7e6dec06a050c5bc4e7a93e6700fad28570779a Mon Sep 17 00:00:00 2001 From: Felix S Klock II Date: Thu, 3 Oct 2019 10:46:01 +0200 Subject: [PATCH 15/25] Apply suggestions from code review Co-Authored-By: Mazdak Farrokhzad Co-Authored-By: Ralf Jung --- src/librustc_codegen_llvm/attributes.rs | 4 ++-- .../issue-64655-allow-unwind-when-calling-panic-directly.rs | 4 ++-- .../ui/extern/issue-64655-extern-rust-must-allow-unwind.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 4189904a8018c..73d43289d19c5 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -281,7 +281,7 @@ pub fn from_fn_attrs( // // However, in the long term we should either: // - fold this into final else (i.e. stop inspecting `id`) - // - or better still: whole-heartedly adopt Rust PR #63909. + // - adopt Rust PR #63909. // // see also Rust RFC 2753. @@ -294,7 +294,7 @@ pub fn from_fn_attrs( } else { // Anything else is either: // - // 1. A foreign item (like `extern "C" { fn foo(); }`), or + // 1. A foreign item using a non-Rust ABI (like `extern "C" { fn foo(); }`), or // // 2. A Rust item using a non-Rust ABI (like `extern "C" fn foo() { ... }`). // diff --git a/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs b/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs index ac715e4328fd7..63e373e5b59bb 100644 --- a/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs +++ b/src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs @@ -1,7 +1,7 @@ // run-pass // rust-lang/rust#64655: with panic=unwind, a panic from a subroutine -// should still run desstructors as it unwindws the stack. However, +// should still run destructors as it unwinds the stack. However, // bugs with how the nounwind LLVM attribute was applied led to this // simple case being mishandled *if* you had fat LTO turned on. @@ -54,7 +54,7 @@ fn main() { let wait = handle.join(); - // reinstate handler to ease observation of assertion failures. + // Reinstate handler to ease observation of assertion failures. std::panic::set_hook(old_hook); assert!(wait.is_err()); diff --git a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs index 18e441625ab9d..346d176ad3bcc 100644 --- a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs +++ b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs @@ -1,7 +1,7 @@ // run-pass // rust-lang/rust#64655: with panic=unwind, a panic from a subroutine -// should still run desstructors as it unwinds the stack. However, +// should still run destructors as it unwinds the stack. However, // bugs with how the nounwind LLVM attribute was applied led to this // simple case being mishandled *if* you had optimization *and* fat // LTO turned on. @@ -13,7 +13,7 @@ // This test takes the code from the above issue and adapts it to // better fit our test infrastructure: // -// * Instead of relying on println! to observe whether the destructor +// * Instead of relying on `println!` to observe whether the destructor // is run, we instead run the code in a spawned thread and // communicate the destructor's operation via a synchronous atomic // in static memory. From 5e7e8cd41f5591285bf764e3a8fc87ed89db21ba Mon Sep 17 00:00:00 2001 From: Felix S Klock II Date: Thu, 3 Oct 2019 11:08:28 +0200 Subject: [PATCH 16/25] Update attributes.rs Some comment refinements inspired by review feedback. --- src/librustc_codegen_llvm/attributes.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 73d43289d19c5..423a2df3523ed 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -281,7 +281,7 @@ pub fn from_fn_attrs( // // However, in the long term we should either: // - fold this into final else (i.e. stop inspecting `id`) - // - adopt Rust PR #63909. + // - or, adopt Rust PR #63909. // // see also Rust RFC 2753. @@ -302,9 +302,10 @@ pub fn from_fn_attrs( // UB otherwise. (At least for now; see also // rust-lang/rust#63909 and Rust RFC 2753.) // - // Items defined in Rust with non-Rust ABIs (case 2) are - // defined to not unwind. We insert shims to abort if an - // unwind happens to enforce this. + // Items defined in Rust with non-Rust ABIs (case 2) are also + // not supposed to unwind. Whether this should be enforced + // (versus stating it is UB) and *how* it would be enforced + // is currently under discussion; see rust-lang/rust#58794. // // In either case, we mark item as explicitly nounwind. false From 71e5f7893490d3fa4f9e55ebf5a13cffc2bb1607 Mon Sep 17 00:00:00 2001 From: Felix S Klock II Date: Thu, 3 Oct 2019 11:10:13 +0200 Subject: [PATCH 17/25] Update issue-64655-extern-rust-must-allow-unwind.rs placate tidy --- src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs index 346d176ad3bcc..4d521e4703960 100644 --- a/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs +++ b/src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs @@ -79,4 +79,3 @@ fn main() { assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 1); } - From 4396a1ccd43bd04e70936749077dda888e27ab82 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 20 Sep 2019 16:54:27 -0400 Subject: [PATCH 18/25] add regression test for #60218 --- src/test/ui/issues/issue-60218.rs | 19 +++++++++++++++++++ src/test/ui/issues/issue-60218.stderr | 15 +++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/test/ui/issues/issue-60218.rs create mode 100644 src/test/ui/issues/issue-60218.stderr diff --git a/src/test/ui/issues/issue-60218.rs b/src/test/ui/issues/issue-60218.rs new file mode 100644 index 0000000000000..4926691f3b568 --- /dev/null +++ b/src/test/ui/issues/issue-60218.rs @@ -0,0 +1,19 @@ +// Regression test for #60218 +// +// This was reported to cause ICEs. + +use std::iter::Map; + +pub trait Foo {} + +pub fn trigger_error(iterable: I, functor: F) +where + for<'t> &'t I: IntoIterator, +for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator, +for<'t> ::IntoIter, F> as Iterator>::Item: Foo, +{ +} + +fn main() { + trigger_error(vec![], |x: &u32| x) //~ ERROR E0277 +} diff --git a/src/test/ui/issues/issue-60218.stderr b/src/test/ui/issues/issue-60218.stderr new file mode 100644 index 0000000000000..a9970cc109699 --- /dev/null +++ b/src/test/ui/issues/issue-60218.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `for<'t> ::IntoIter, _> as std::iter::Iterator>::Item: Foo` is not satisfied + --> $DIR/issue-60218.rs:18:5 + | +LL | pub fn trigger_error(iterable: I, functor: F) + | ------------- +... +LL | for<'t> ::IntoIter, F> as Iterator>::Item: Foo, + | --- required by this bound in `trigger_error` +... +LL | trigger_error(vec![], |x: &u32| x) + | ^^^^^^^^^^^^^ the trait `for<'t> Foo` is not implemented for `::IntoIter, _> as std::iter::Iterator>::Item` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From 3a4921cde162af1ffbb2fbff4b395408eab1deab Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 27 Sep 2019 14:45:19 +0200 Subject: [PATCH 19/25] The crux of the bug fix. Update: review feedback Update: placate tidy --- src/librustc_resolve/late.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 33a85c6c77026..93c96b9f75ba2 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -468,6 +468,19 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> { } })); + // rust-lang/rust#61631: The type `Self` is essentially + // another type parameter. For ADTs, we consider it + // well-defined only after all of the ADT type parameters have + // been provided. Therefore, we do not allow use of `Self` + // anywhere in ADT type parameter defaults. + // + // (We however cannot ban `Self` for defaults on *all* generic + // lists; e.g. trait generics can usefully refer to `Self`, + // such as in the case of `trait Add`.) + if self.current_self_item.is_some() { // (`Some` if + only if we are in ADT's generics.) + default_ban_rib.bindings.insert(Ident::with_dummy_span(kw::SelfUpper), Res::Err); + } + // We also ban access to type parameters for use as the types of const parameters. let mut const_ty_param_ban_rib = Rib::new(TyParamAsConstParamTy); const_ty_param_ban_rib.bindings.extend(generics.params.iter() From a18d424c48e5b2e23cebf5ab5969a3254ab90a9e Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 27 Sep 2019 15:21:02 +0200 Subject: [PATCH 20/25] Allocate a new diagnostic for defaulted type parameters cannot use `Self` (Without this commit, you still get an error (a very similar one, at that), but it complains about use of forward declaration, which is confusing since people do not necessarily think of `Self` as being declared at all.) Update: incorporate review feedback. --- src/librustc_resolve/diagnostics.rs | 11 +++++++++++ src/librustc_resolve/error_codes.rs | 23 +++++++++++++++++++---- src/librustc_resolve/lib.rs | 12 ++++++++++-- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index c479912b4ef81..7f819486f5bd3 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -354,6 +354,17 @@ impl<'a> Resolver<'a> { span, "defaulted type parameters cannot be forward declared".to_string()); err } + ResolutionError::SelfInTyParamDefault => { + let mut err = struct_span_err!( + self.session, + span, + E0735, + "type parameters cannot use `Self` in their defaults" + ); + err.span_label( + span, "`Self` in type parameter default".to_string()); + err + } ResolutionError::ConstParamDependentOnTypeParam => { let mut err = struct_span_err!( self.session, diff --git a/src/librustc_resolve/error_codes.rs b/src/librustc_resolve/error_codes.rs index 9a39fcf422393..47346774180fe 100644 --- a/src/librustc_resolve/error_codes.rs +++ b/src/librustc_resolve/error_codes.rs @@ -8,9 +8,9 @@ Type parameter defaults can only use parameters that occur before them. Erroneous code example: ```compile_fail,E0128 -struct Foo { +struct Foo { field1: T, - filed2: U, + field2: U, } // error: type parameters with a default cannot use forward declared // identifiers @@ -20,9 +20,9 @@ Since type parameters are evaluated in-order, you may be able to fix this issue by doing: ``` -struct Foo { +struct Foo { field1: T, - filed2: U, + field2: U, } ``` @@ -1705,6 +1705,21 @@ fn const_id() -> T { // error: const parameter } ``` "##, + +E0735: r##" +Type parameter defaults cannot use `Self` on structs, enums, or unions. + +Erroneous code example: + +```compile_fail,E0735 +struct Foo> { + field1: Option, + field2: Option, +} +// error: type parameters cannot use `Self` in their defaults. +``` +"##, + ; // E0153, unused error code // E0157, unused error code diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index bf86a37433840..e7292b52ab3e8 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -214,6 +214,8 @@ enum ResolutionError<'a> { BindingShadowsSomethingUnacceptable(&'a str, Name, &'a NameBinding<'a>), /// Error E0128: type parameters with a default cannot use forward-declared identifiers. ForwardDeclaredTyParam, // FIXME(const_generics:defaults) + /// Error E0735: type parameters with a default cannot use `Self` + SelfInTyParamDefault, /// Error E0671: const parameter cannot depend on type parameter. ConstParamDependentOnTypeParam, } @@ -1536,7 +1538,7 @@ impl<'a> Resolver<'a> { if let Some(res) = ribs[i].bindings.get(&rib_ident).cloned() { // The ident resolves to a type parameter or local variable. return Some(LexicalScopeBinding::Res( - self.validate_res_from_ribs(i, res, record_used, path_span, ribs), + self.validate_res_from_ribs(i, rib_ident, res, record_used, path_span, ribs), )); } @@ -2122,6 +2124,7 @@ impl<'a> Resolver<'a> { fn validate_res_from_ribs( &mut self, rib_index: usize, + rib_ident: Ident, res: Res, record_used: bool, span: Span, @@ -2133,7 +2136,12 @@ impl<'a> Resolver<'a> { // An invalid forward use of a type parameter from a previous default. if let ForwardTyParamBanRibKind = all_ribs[rib_index].kind { if record_used { - self.report_error(span, ResolutionError::ForwardDeclaredTyParam); + let res_error = if rib_ident.name == kw::SelfUpper { + ResolutionError::SelfInTyParamDefault + } else { + ResolutionError::ForwardDeclaredTyParam + }; + self.report_error(span, res_error); } assert_eq!(res, Res::Err); return Res::Err; From e86af1bbeb610423a4d6c56e6da5ceb411d6b53c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 3 Oct 2019 14:11:31 +0200 Subject: [PATCH 21/25] Add long error explanation for E0556 --- src/libsyntax/error_codes.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs index 8a78daee6e49b..c0963026945b0 100644 --- a/src/libsyntax/error_codes.rs +++ b/src/libsyntax/error_codes.rs @@ -208,6 +208,25 @@ If you need the feature, make sure to use a nightly release of the compiler (but be warned that the feature may be removed or altered in the future). "##, +E0556: r##" +The `feature` attribute was badly formed. + +Erroneous code example: + +```compile_fail,E0556 +#![feature(foo_bar_baz, foo(bar), foo = "baz", foo)] // error! +#![feature] // error! +#![feature = "foo"] // error! +``` + +The `feature` attribute only accept a "feature flag" and can only be used on +nightly. Example: + +```ignore (only works in nightly) +#![feature(flag)] +``` +"##, + E0557: r##" A feature attribute named a feature that has been removed. @@ -457,7 +476,6 @@ features in the `-Z allow_features` flag. E0551, // incorrect meta item E0553, // multiple rustc_const_unstable attributes // E0555, // replaced with a generic attribute input check - E0556, // malformed feature, expected just one word E0584, // file for module `..` found at both .. and .. E0629, // missing 'feature' (rustc_const_unstable) // rustc_const_unstable attribute must be paired with stable/unstable From 1d49f9a10a4ed31ddafce65c2a57a2a177ac2cde Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 3 Oct 2019 14:11:39 +0200 Subject: [PATCH 22/25] update ui tests --- src/test/ui/gated-bad-feature.stderr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr index ff6780e66a8ce..79e59f76311fd 100644 --- a/src/test/ui/gated-bad-feature.stderr +++ b/src/test/ui/gated-bad-feature.stderr @@ -30,4 +30,5 @@ LL | #![feature = "foo"] error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0557`. +Some errors have detailed explanations: E0556, E0557. +For more information about an error, try `rustc --explain E0556`. From 126bf3b1dd483a8320239760536a8b7dd49b2f2b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 3 Oct 2019 09:21:15 -0400 Subject: [PATCH 23/25] typo: fix typo in E0392 See #64931. --- src/librustc_typeck/check/wfcheck.rs | 4 ++-- .../const-param-type-depends-on-type-param.stderr | 2 +- src/test/ui/error-codes/E0392.stderr | 2 +- src/test/ui/inner-static-type-parameter.stderr | 2 +- src/test/ui/issues/issue-17904-2.stderr | 2 +- src/test/ui/issues/issue-20413.stderr | 2 +- src/test/ui/issues/issue-36299.stderr | 4 ++-- src/test/ui/issues/issue-36638.stderr | 2 +- src/test/ui/issues/issue-37534.stderr | 2 +- .../region-bounds-on-objects-and-type-parameters.stderr | 2 +- src/test/ui/self/self_type_keyword.stderr | 2 +- src/test/ui/variance/variance-regions-unused-direct.stderr | 4 ++-- .../ui/variance/variance-regions-unused-indirect.stderr | 4 ++-- src/test/ui/variance/variance-unused-region-param.stderr | 4 ++-- src/test/ui/variance/variance-unused-type-param.stderr | 6 +++--- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index de1cc12aea37c..e736a55a5f51c 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1001,12 +1001,12 @@ fn report_bivariance(tcx: TyCtxt<'_>, span: Span, param_name: ast::Name) { // Help is available only in presence of lang items. let msg = if let Some(def_id) = suggested_marker_id { format!( - "consider removing `{}`, refering to it in a field, or using a marker such as `{}`", + "consider removing `{}`, referring to it in a field, or using a marker such as `{}`", param_name, tcx.def_path_str(def_id), ) } else { - format!( "consider removing `{}` or refering to it in a field", param_name) + format!( "consider removing `{}` or referring to it in a field", param_name) }; err.help(&msg); err.emit(); diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr index b50605ce0fe1a..db14f9c9bf695 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr @@ -18,7 +18,7 @@ error[E0392]: parameter `T` is never used LL | pub struct Dependent([(); X]); | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0392.stderr b/src/test/ui/error-codes/E0392.stderr index 25cd9984052fa..7b0bfe372757a 100644 --- a/src/test/ui/error-codes/E0392.stderr +++ b/src/test/ui/error-codes/E0392.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `T` is never used LL | enum Foo { Bar } | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to previous error diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr index e8281b916f6fa..dfc663e4a79f8 100644 --- a/src/test/ui/inner-static-type-parameter.stderr +++ b/src/test/ui/inner-static-type-parameter.stderr @@ -14,7 +14,7 @@ error[E0392]: parameter `T` is never used LL | enum Bar { What } | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17904-2.stderr b/src/test/ui/issues/issue-17904-2.stderr index 9d1d769158687..25f32b661031f 100644 --- a/src/test/ui/issues/issue-17904-2.stderr +++ b/src/test/ui/issues/issue-17904-2.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `T` is never used LL | struct Foo where T: Copy; | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 675b47a68ad2e..6ecb4e736acd9 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `T` is never used LL | struct NoData; | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/issue-20413.rs:8:1 diff --git a/src/test/ui/issues/issue-36299.stderr b/src/test/ui/issues/issue-36299.stderr index a092bab0e81f8..a9516b8e5e51b 100644 --- a/src/test/ui/issues/issue-36299.stderr +++ b/src/test/ui/issues/issue-36299.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `'a` is never used LL | struct Foo<'a, A> {} | ^^ unused parameter | - = help: consider removing `'a`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `A` is never used --> $DIR/issue-36299.rs:1:16 @@ -12,7 +12,7 @@ error[E0392]: parameter `A` is never used LL | struct Foo<'a, A> {} | ^ unused parameter | - = help: consider removing `A`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `A`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-36638.stderr b/src/test/ui/issues/issue-36638.stderr index 699dba0e3f832..fe48ea158de64 100644 --- a/src/test/ui/issues/issue-36638.stderr +++ b/src/test/ui/issues/issue-36638.stderr @@ -16,7 +16,7 @@ error[E0392]: parameter `Self` is never used LL | struct Foo(Self); | ^^^^ unused parameter | - = help: consider removing `Self`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `Self`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr index b5ef6ec594a9f..fadb9cdd1a3d1 100644 --- a/src/test/ui/issues/issue-37534.stderr +++ b/src/test/ui/issues/issue-37534.stderr @@ -20,7 +20,7 @@ error[E0392]: parameter `T` is never used LL | struct Foo { } | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 57a987f703851..751a4c1021ebb 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -27,7 +27,7 @@ error[E0392]: parameter `'c` is never used LL | struct Foo<'a,'b,'c> { | ^^ unused parameter | - = help: consider removing `'c`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'c`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 3 previous errors diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index 456077b65b83e..0af24dcedfbea 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -76,7 +76,7 @@ error[E0392]: parameter `'Self` is never used LL | struct Bar<'Self>; | ^^^^^ unused parameter | - = help: consider removing `'Self`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'Self`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 12 previous errors diff --git a/src/test/ui/variance/variance-regions-unused-direct.stderr b/src/test/ui/variance/variance-regions-unused-direct.stderr index 95fa841a75888..cf375ccae8730 100644 --- a/src/test/ui/variance/variance-regions-unused-direct.stderr +++ b/src/test/ui/variance/variance-regions-unused-direct.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `'a` is never used LL | struct Bivariant<'a>; | ^^ unused parameter | - = help: consider removing `'a`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `'d` is never used --> $DIR/variance-regions-unused-direct.rs:7:19 @@ -12,7 +12,7 @@ error[E0392]: parameter `'d` is never used LL | struct Struct<'a, 'd> { | ^^ unused parameter | - = help: consider removing `'d`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'d`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-regions-unused-indirect.stderr b/src/test/ui/variance/variance-regions-unused-indirect.stderr index c90bad8edd478..7c7ba69db2110 100644 --- a/src/test/ui/variance/variance-regions-unused-indirect.stderr +++ b/src/test/ui/variance/variance-regions-unused-indirect.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `'a` is never used LL | enum Foo<'a> { | ^^ unused parameter | - = help: consider removing `'a`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-indirect.rs:7:10 @@ -12,7 +12,7 @@ error[E0392]: parameter `'a` is never used LL | enum Bar<'a> { | ^^ unused parameter | - = help: consider removing `'a`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-unused-region-param.stderr b/src/test/ui/variance/variance-unused-region-param.stderr index bba301cdbfbcd..4cd31358031d7 100644 --- a/src/test/ui/variance/variance-unused-region-param.stderr +++ b/src/test/ui/variance/variance-unused-region-param.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `'a` is never used LL | struct SomeStruct<'a> { x: u32 } | ^^ unused parameter | - = help: consider removing `'a`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `'a` is never used --> $DIR/variance-unused-region-param.rs:4:15 @@ -12,7 +12,7 @@ error[E0392]: parameter `'a` is never used LL | enum SomeEnum<'a> { Nothing } | ^^ unused parameter | - = help: consider removing `'a`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-unused-type-param.stderr b/src/test/ui/variance/variance-unused-type-param.stderr index d2891015eb7f5..b648e3c1d5f52 100644 --- a/src/test/ui/variance/variance-unused-type-param.stderr +++ b/src/test/ui/variance/variance-unused-type-param.stderr @@ -4,7 +4,7 @@ error[E0392]: parameter `A` is never used LL | struct SomeStruct { x: u32 } | ^ unused parameter | - = help: consider removing `A`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `A`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `A` is never used --> $DIR/variance-unused-type-param.rs:9:15 @@ -12,7 +12,7 @@ error[E0392]: parameter `A` is never used LL | enum SomeEnum { Nothing } | ^ unused parameter | - = help: consider removing `A`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `A`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `T` is never used --> $DIR/variance-unused-type-param.rs:13:15 @@ -20,7 +20,7 @@ error[E0392]: parameter `T` is never used LL | enum ListCell { | ^ unused parameter | - = help: consider removing `T`, refering to it in a field, or using a marker such as `std::marker::PhantomData` + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error: aborting due to 3 previous errors From b9ed64268de50378b91f3ba7488329b7bd884e7d Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 2 Oct 2019 19:11:08 -0300 Subject: [PATCH 24/25] Make visit_projection iterative --- src/librustc/mir/visit.rs | 7 +- .../transform/check_consts/validation.rs | 18 +-- src/librustc_mir/transform/qualify_consts.rs | 121 +++++++++--------- 3 files changed, 76 insertions(+), 70 deletions(-) diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 7236b17999948..bfbeeebd1e230 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -734,9 +734,10 @@ macro_rules! make_mir_visitor { projection: & $($mutability)? [PlaceElem<'tcx>], context: PlaceContext, location: Location) { - if let [proj_base @ .., elem] = projection { - self.visit_projection(base, proj_base, context, location); - self.visit_projection_elem(base, proj_base, elem, context, location); + let mut cursor = projection; + while let [proj_base @ .., elem] = cursor { + cursor = proj_base; + self.visit_projection_elem(base, cursor, elem, context, location); } } diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 3045239d7a770..3a2a81f11913b 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -404,25 +404,25 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> { self.super_assign(dest, rvalue, location); } - fn visit_projection( + fn visit_projection_elem( &mut self, place_base: &PlaceBase<'tcx>, - proj: &[PlaceElem<'tcx>], + proj_base: &[PlaceElem<'tcx>], + elem: &PlaceElem<'tcx>, context: PlaceContext, location: Location, ) { trace!( - "visit_place_projection: proj={:?} context={:?} location={:?}", - proj, + "visit_projection_elem: place_base={:?} proj_base={:?} elem={:?} \ + context={:?} location={:?}", + place_base, + proj_base, + elem, context, location, ); - self.super_projection(place_base, proj, context, location); - let (elem, proj_base) = match proj.split_last() { - Some(x) => x, - None => return, - }; + self.super_projection_elem(place_base, proj_base, elem, context, location); match elem { ProjectionElem::Deref => { diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 2fa6b9d1a2936..fbcf9c8cb5eba 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1156,82 +1156,87 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } } - fn visit_projection( + fn visit_projection_elem( &mut self, place_base: &PlaceBase<'tcx>, - proj: &[PlaceElem<'tcx>], + proj_base: &[PlaceElem<'tcx>], + elem: &PlaceElem<'tcx>, context: PlaceContext, location: Location, ) { debug!( - "visit_place_projection: proj={:?} context={:?} location={:?}", - proj, context, location, + "visit_projection_elem: place_base={:?} proj_base={:?} elem={:?} \ + context={:?} location={:?}", + place_base, + proj_base, + elem, + context, + location, ); - self.super_projection(place_base, proj, context, location); - if let [proj_base @ .., elem] = proj { - match elem { - ProjectionElem::Deref => { - if context.is_mutating_use() { - // `not_const` errors out in const contexts - self.not_const(ops::MutDeref) - } - let base_ty = Place::ty_from(place_base, proj_base, self.body, self.tcx).ty; - match self.mode { - Mode::NonConstFn => {} - _ if self.suppress_errors => {} - _ => { - if let ty::RawPtr(_) = base_ty.kind { - if !self.tcx.features().const_raw_ptr_deref { - self.record_error(ops::RawPtrDeref); - emit_feature_err( - &self.tcx.sess.parse_sess, sym::const_raw_ptr_deref, - self.span, GateIssue::Language, - &format!( - "dereferencing raw pointers in {}s is unstable", - self.mode, - ), - ); - } + self.super_projection_elem(place_base, proj_base, elem, context, location); + + match elem { + ProjectionElem::Deref => { + if context.is_mutating_use() { + // `not_const` errors out in const contexts + self.not_const(ops::MutDeref) + } + let base_ty = Place::ty_from(place_base, proj_base, self.body, self.tcx).ty; + match self.mode { + Mode::NonConstFn => {} + _ if self.suppress_errors => {} + _ => { + if let ty::RawPtr(_) = base_ty.kind { + if !self.tcx.features().const_raw_ptr_deref { + self.record_error(ops::RawPtrDeref); + emit_feature_err( + &self.tcx.sess.parse_sess, sym::const_raw_ptr_deref, + self.span, GateIssue::Language, + &format!( + "dereferencing raw pointers in {}s is unstable", + self.mode, + ), + ); } } } } + } - ProjectionElem::ConstantIndex {..} | - ProjectionElem::Subslice {..} | - ProjectionElem::Field(..) | - ProjectionElem::Index(_) => { - let base_ty = Place::ty_from(place_base, proj_base, self.body, self.tcx).ty; - if let Some(def) = base_ty.ty_adt_def() { - if def.is_union() { - match self.mode { - Mode::ConstFn => { - if !self.tcx.features().const_fn_union - && !self.suppress_errors - { - self.record_error(ops::UnionAccess); - emit_feature_err( - &self.tcx.sess.parse_sess, sym::const_fn_union, - self.span, GateIssue::Language, - "unions in const fn are unstable", - ); - } - }, + ProjectionElem::ConstantIndex {..} | + ProjectionElem::Subslice {..} | + ProjectionElem::Field(..) | + ProjectionElem::Index(_) => { + let base_ty = Place::ty_from(place_base, proj_base, self.body, self.tcx).ty; + if let Some(def) = base_ty.ty_adt_def() { + if def.is_union() { + match self.mode { + Mode::ConstFn => { + if !self.tcx.features().const_fn_union + && !self.suppress_errors + { + self.record_error(ops::UnionAccess); + emit_feature_err( + &self.tcx.sess.parse_sess, sym::const_fn_union, + self.span, GateIssue::Language, + "unions in const fn are unstable", + ); + } + }, - | Mode::NonConstFn - | Mode::Static - | Mode::StaticMut - | Mode::Const - => {}, - } + | Mode::NonConstFn + | Mode::Static + | Mode::StaticMut + | Mode::Const + => {}, } } } + } - ProjectionElem::Downcast(..) => { - self.not_const(ops::Downcast) - } + ProjectionElem::Downcast(..) => { + self.not_const(ops::Downcast) } } } From e443e1bdf9f474f822008f88862fed630b50381f Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 27 Sep 2019 15:21:16 +0200 Subject: [PATCH 25/25] Regression tests. Update: incorporate review feedback. --- ...-type-param-can-reference-self-in-trait.rs | 20 +++++++++ ...e-param-can-reference-self-in-trait.stderr | 12 +++++ ...efault-type-param-cannot-reference-self.rs | 45 +++++++++++++++++++ ...lt-type-param-cannot-reference-self.stderr | 39 ++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs create mode 100644 src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr create mode 100644 src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.rs create mode 100644 src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr diff --git a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs new file mode 100644 index 0000000000000..cc93794e8fcdc --- /dev/null +++ b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs @@ -0,0 +1,20 @@ +#![crate_type="lib"] + +// rust-lang/rust#61631: The use of `Self` in the defaults of generic +// types in a *trait* definition are allowed. +// +// It *must* be accepted; we have used this pattern extensively since +// Rust 1.0 (see e.g. `trait Add`). +trait Tnobound

{} + +impl Tnobound for () { } + +// This variant is accepted at the definition site; but it will be +// rejected at every possible usage site (such as the one immediately +// below). Maybe one day we will attempt to catch it at the definition +// site, but today this is accepted due to compiler implementation +// limitations. +trait Tsized {} + +impl Tsized for () {} +//~^ ERROR the size for values of type `[()]` cannot be known at compilation time [E0277] diff --git a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr new file mode 100644 index 0000000000000..ea0664c48d4d8 --- /dev/null +++ b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr @@ -0,0 +1,12 @@ +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:19:6 + | +LL | impl Tsized for () {} + | ^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[()]` + = note: to learn more, visit + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.rs b/src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.rs new file mode 100644 index 0000000000000..b560cc2ce7060 --- /dev/null +++ b/src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.rs @@ -0,0 +1,45 @@ +#![crate_type="lib"] + +// rust-lang/rust#61631: Uses of `Self` in the defaults of generic +// types for ADT's are not allowed. We justify this because the `Self` +// type could be considered the "final" type parameter, that is only +// well-defined after all of the other type parameters on the ADT have +// been instantiated. +// +// These were previously were ICE'ing at the usage point anyway (see +// `demo_usages` below), so there should not be any backwards +// compatibility concern. + +struct Snobound<'a, P = Self> { x: Option<&'a P> } +//~^ ERROR type parameters cannot use `Self` in their defaults [E0735] + +enum Enobound<'a, P = Self> { A, B(Option<&'a P>) } +//~^ ERROR type parameters cannot use `Self` in their defaults [E0735] + +union Unobound<'a, P = Self> { x: i32, y: Option<&'a P> } +//~^ ERROR type parameters cannot use `Self` in their defaults [E0735] + +// Disallowing `Self` in defaults sidesteps need to check the bounds +// on the defaults in cases like these. + +struct Ssized<'a, P: Sized = [Self]> { x: Option<&'a P> } +//~^ ERROR type parameters cannot use `Self` in their defaults [E0735] + +enum Esized<'a, P: Sized = [Self]> { A, B(Option<&'a P>) } +//~^ ERROR type parameters cannot use `Self` in their defaults [E0735] + +union Usized<'a, P: Sized = [Self]> { x: i32, y: Option<&'a P> } +//~^ ERROR type parameters cannot use `Self` in their defaults [E0735] + +fn demo_usages() { + // An ICE means you only get the error from the first line of the + // demo; comment each out to observe the other ICEs when trying + // this out on older versions of Rust. + + let _ice: Snobound; + let _ice: Enobound; + let _ice: Unobound; + let _ice: Ssized; + let _ice: Esized; + let _ice: Usized; +} diff --git a/src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr b/src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr new file mode 100644 index 0000000000000..689ffbd0febc2 --- /dev/null +++ b/src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.stderr @@ -0,0 +1,39 @@ +error[E0735]: type parameters cannot use `Self` in their defaults + --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:13:25 + | +LL | struct Snobound<'a, P = Self> { x: Option<&'a P> } + | ^^^^ `Self` in type parameter default + +error[E0735]: type parameters cannot use `Self` in their defaults + --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:16:23 + | +LL | enum Enobound<'a, P = Self> { A, B(Option<&'a P>) } + | ^^^^ `Self` in type parameter default + +error[E0735]: type parameters cannot use `Self` in their defaults + --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:19:24 + | +LL | union Unobound<'a, P = Self> { x: i32, y: Option<&'a P> } + | ^^^^ `Self` in type parameter default + +error[E0735]: type parameters cannot use `Self` in their defaults + --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:25:31 + | +LL | struct Ssized<'a, P: Sized = [Self]> { x: Option<&'a P> } + | ^^^^ `Self` in type parameter default + +error[E0735]: type parameters cannot use `Self` in their defaults + --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:28:29 + | +LL | enum Esized<'a, P: Sized = [Self]> { A, B(Option<&'a P>) } + | ^^^^ `Self` in type parameter default + +error[E0735]: type parameters cannot use `Self` in their defaults + --> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:31:30 + | +LL | union Usized<'a, P: Sized = [Self]> { x: i32, y: Option<&'a P> } + | ^^^^ `Self` in type parameter default + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0735`.