summaryrefslogtreecommitdiffstats
path: root/tests/ui-fulldeps
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/ui-fulldeps
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui-fulldeps')
-rw-r--r--tests/ui-fulldeps/auxiliary/issue-13560-1.rs3
-rw-r--r--tests/ui-fulldeps/auxiliary/issue-13560-2.rs3
-rw-r--r--tests/ui-fulldeps/auxiliary/issue-13560-3.rs6
-rw-r--r--tests/ui-fulldeps/auxiliary/issue-16822.rs20
-rw-r--r--tests/ui-fulldeps/auxiliary/issue-18502.rs21
-rw-r--r--tests/ui-fulldeps/auxiliary/issue-24106.rs13
-rw-r--r--tests/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs80
-rw-r--r--tests/ui-fulldeps/auxiliary/lint-for-crate.rs12
-rw-r--r--tests/ui-fulldeps/extern-mod-syntax.rs11
-rw-r--r--tests/ui-fulldeps/fluent-messages/invalid-escape.ftl1
-rw-r--r--tests/ui-fulldeps/fluent-messages/test.rs11
-rw-r--r--tests/ui-fulldeps/fluent-messages/test.stderr34
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs15
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr17
-rw-r--r--tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs11
-rw-r--r--tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr15
-rw-r--r--tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs15
-rw-r--r--tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr17
-rw-r--r--tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs54
-rw-r--r--tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr38
-rw-r--r--tests/ui-fulldeps/issue-11881.rs91
-rw-r--r--tests/ui-fulldeps/issue-13560.rs12
-rw-r--r--tests/ui-fulldeps/issue-15924.rs53
-rw-r--r--tests/ui-fulldeps/issue-16822.rs22
-rw-r--r--tests/ui-fulldeps/issue-18502.rs8
-rw-r--r--tests/ui-fulldeps/issue-24106.rs8
-rw-r--r--tests/ui-fulldeps/issue-2804.rs81
-rw-r--r--tests/ui-fulldeps/myriad-closures.rs39
-rw-r--r--tests/ui-fulldeps/pprust-expr-roundtrip.rs43
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs57
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr315
-rw-r--r--tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs43
-rw-r--r--tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr288
-rw-r--r--tests/ui-fulldeps/stable-mir/crate-info.rs129
-rw-r--r--tests/ui-fulldeps/std/issue-15149.rs57
-rw-r--r--tests/ui-fulldeps/std/issue-81357-unsound-file-methods.rs81
-rw-r--r--tests/ui-fulldeps/std/stdio-from.rs69
-rw-r--r--tests/ui-fulldeps/std/switch-stdout.rs51
38 files changed, 557 insertions, 1287 deletions
diff --git a/tests/ui-fulldeps/auxiliary/issue-13560-1.rs b/tests/ui-fulldeps/auxiliary/issue-13560-1.rs
deleted file mode 100644
index c3a2ae679..000000000
--- a/tests/ui-fulldeps/auxiliary/issue-13560-1.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "dylib"]
diff --git a/tests/ui-fulldeps/auxiliary/issue-13560-2.rs b/tests/ui-fulldeps/auxiliary/issue-13560-2.rs
deleted file mode 100644
index 39c261e11..000000000
--- a/tests/ui-fulldeps/auxiliary/issue-13560-2.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
diff --git a/tests/ui-fulldeps/auxiliary/issue-13560-3.rs b/tests/ui-fulldeps/auxiliary/issue-13560-3.rs
deleted file mode 100644
index e991bcc1a..000000000
--- a/tests/ui-fulldeps/auxiliary/issue-13560-3.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-#[macro_use] #[no_link] extern crate issue_13560_1 as t1;
-#[macro_use] extern crate issue_13560_2 as t2;
diff --git a/tests/ui-fulldeps/auxiliary/issue-16822.rs b/tests/ui-fulldeps/auxiliary/issue-16822.rs
deleted file mode 100644
index 9042dd391..000000000
--- a/tests/ui-fulldeps/auxiliary/issue-16822.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#![crate_type="lib"]
-
-use std::cell::RefCell;
-
-pub struct Window<Data>{
- pub data: RefCell<Data>
-}
-
-impl<Data: Update> Window<Data> {
- pub fn update(&self, e: i32) {
- match e {
- 1 => self.data.borrow_mut().update(),
- _ => {}
- }
- }
-}
-
-pub trait Update {
- fn update(&mut self);
-}
diff --git a/tests/ui-fulldeps/auxiliary/issue-18502.rs b/tests/ui-fulldeps/auxiliary/issue-18502.rs
deleted file mode 100644
index 4d4230607..000000000
--- a/tests/ui-fulldeps/auxiliary/issue-18502.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![crate_type="lib"]
-
-struct Foo;
-// This is the ICE trigger
-struct Formatter;
-
-trait Show {
- fn fmt(&self);
-}
-
-impl Show for Foo {
- fn fmt(&self) {}
-}
-
-fn bar<T>(f: extern "Rust" fn(&T), t: &T) { }
-
-// ICE requirement: this has to be marked as inline
-#[inline]
-pub fn baz() {
- bar(Show::fmt, &Foo);
-}
diff --git a/tests/ui-fulldeps/auxiliary/issue-24106.rs b/tests/ui-fulldeps/auxiliary/issue-24106.rs
deleted file mode 100644
index 2c6a60348..000000000
--- a/tests/ui-fulldeps/auxiliary/issue-24106.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#![crate_type="lib"]
-
-enum E { E0 = 0, E1 = 1 }
-const E0_U8: u8 = E::E0 as u8;
-const E1_U8: u8 = E::E1 as u8;
-
-pub fn go<T>() {
- match 0 {
- E0_U8 => (),
- E1_U8 => (),
- _ => (),
- }
-}
diff --git a/tests/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/tests/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs
deleted file mode 100644
index a3b570ad8..000000000
--- a/tests/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-extern crate rustc_driver;
-extern crate rustc_hir;
-extern crate rustc_lint;
-extern crate rustc_span;
-#[macro_use]
-extern crate rustc_session;
-extern crate rustc_ast;
-
-use rustc_ast::attr;
-use rustc_driver::plugin::Registry;
-use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass};
-use rustc_span::def_id::CRATE_DEF_ID;
-use rustc_span::symbol::Symbol;
-
-macro_rules! fake_lint_pass {
- ($struct:ident, $($attr:expr),*) => {
- struct $struct;
-
- impl LintPass for $struct {
- fn name(&self) -> &'static str {
- stringify!($struct)
- }
- }
-
- impl LateLintPass<'_> for $struct {
- fn check_crate(&mut self, cx: &LateContext) {
- let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
- let span = cx.tcx.def_span(CRATE_DEF_ID);
- $(
- if !cx.sess().contains_name(attrs, $attr) {
- cx.lint(CRATE_NOT_OKAY, |lint| {
- let msg = format!("crate is not marked with #![{}]", $attr);
- lint.build(&msg).set_span(span).emit();
- });
- }
- )*
- }
- }
-
- }
-}
-
-declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
-declare_lint!(CRATE_NOT_RED, Warn, "crate not marked with #![crate_red]");
-declare_lint!(CRATE_NOT_BLUE, Warn, "crate not marked with #![crate_blue]");
-declare_lint!(CRATE_NOT_GREY, Warn, "crate not marked with #![crate_grey]");
-declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]");
-
-fake_lint_pass! {
- PassOkay,
- Symbol::intern("crate_okay")
-}
-
-fake_lint_pass! {
- PassRedBlue,
- Symbol::intern("crate_red"), Symbol::intern("crate_blue")
-}
-
-fake_lint_pass! {
- PassGreyGreen,
- Symbol::intern("crate_grey"), Symbol::intern("crate_green")
-}
-
-#[no_mangle]
-fn __rustc_plugin_registrar(reg: &mut Registry) {
- reg.lint_store.register_lints(&[
- &CRATE_NOT_OKAY,
- &CRATE_NOT_RED,
- &CRATE_NOT_BLUE,
- &CRATE_NOT_GREY,
- &CRATE_NOT_GREEN,
- ]);
- reg.lint_store.register_late_pass(|_| Box::new(PassOkay));
- reg.lint_store.register_late_pass(|_| Box::new(PassRedBlue));
- reg.lint_store.register_late_pass(|_| Box::new(PassGreyGreen));
-}
diff --git a/tests/ui-fulldeps/auxiliary/lint-for-crate.rs b/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
index 073da688c..6304c07d2 100644
--- a/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
+++ b/tests/ui-fulldeps/auxiliary/lint-for-crate.rs
@@ -4,13 +4,13 @@
extern crate rustc_driver;
extern crate rustc_hir;
-#[macro_use]
extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;
extern crate rustc_ast;
extern crate rustc_span;
+use rustc_ast::attr;
use rustc_driver::plugin::Registry;
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_span::def_id::CRATE_DEF_ID;
@@ -28,12 +28,10 @@ impl<'tcx> LateLintPass<'tcx> for Pass {
fn check_crate(&mut self, cx: &LateContext) {
let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
let span = cx.tcx.def_span(CRATE_DEF_ID);
- if !cx.sess().contains_name(attrs, Symbol::intern("crate_okay")) {
- cx.lint(
- CRATE_NOT_OKAY,
- "crate is not marked with #![crate_okay]",
- |lint| lint.set_span(span)
- );
+ if !attr::contains_name(attrs, Symbol::intern("crate_okay")) {
+ cx.lint(CRATE_NOT_OKAY, "crate is not marked with #![crate_okay]", |lint| {
+ lint.set_span(span)
+ });
}
}
}
diff --git a/tests/ui-fulldeps/extern-mod-syntax.rs b/tests/ui-fulldeps/extern-mod-syntax.rs
deleted file mode 100644
index 230194c53..000000000
--- a/tests/ui-fulldeps/extern-mod-syntax.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-
-#![allow(unused_imports)]
-#![feature(rustc_private)]
-
-extern crate libc;
-use libc::c_void;
-
-pub fn main() {
- println!("Hello world!");
-}
diff --git a/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl b/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl
new file mode 100644
index 000000000..e28852ea0
--- /dev/null
+++ b/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl
@@ -0,0 +1 @@
+no_crate_bad_escape = don't use \n, \', or \"
diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs
index 66575eb8e..6ba13387b 100644
--- a/tests/ui-fulldeps/fluent-messages/test.rs
+++ b/tests/ui-fulldeps/fluent-messages/test.rs
@@ -1,4 +1,4 @@
-// normalize-stderr-test "note.*" -> "note: os-specific message"
+// normalize-stderr-test "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message"
#![feature(rustc_private)]
#![crate_type = "lib"]
@@ -92,3 +92,12 @@ mod missing_message_ref {
fluent_messages! { "./missing-message-ref.ftl" }
//~^ ERROR referenced message `message` does not exist
}
+
+mod bad_escape {
+ use super::fluent_messages;
+
+ fluent_messages! { "./invalid-escape.ftl" }
+ //~^ ERROR invalid escape `\n`
+ //~| ERROR invalid escape `\"`
+ //~| ERROR invalid escape `\'`
+}
diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr
index c7961ed22..2affe621c 100644
--- a/tests/ui-fulldeps/fluent-messages/test.stderr
+++ b/tests/ui-fulldeps/fluent-messages/test.stderr
@@ -1,18 +1,14 @@
-error: could not open Fluent resource
+error: could not open Fluent resource: os-specific message
--> $DIR/test.rs:24:24
|
LL | fluent_messages! { "/definitely_does_not_exist.ftl" }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: os-specific message
-error: could not open Fluent resource
+error: could not open Fluent resource: os-specific message
--> $DIR/test.rs:31:24
|
LL | fluent_messages! { "../definitely_does_not_exist.ftl" }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: os-specific message
error: could not parse Fluent resource
--> $DIR/test.rs:38:24
@@ -83,5 +79,29 @@ LL | fluent_messages! { "./missing-message-ref.ftl" }
|
= help: you may have meant to use a variable reference (`{$message}`)
-error: aborting due to 10 previous errors
+error: invalid escape `\n` in Fluent resource
+ --> $DIR/test.rs:99:24
+ |
+LL | fluent_messages! { "./invalid-escape.ftl" }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: Fluent does not interpret these escape sequences (<https://projectfluent.org/fluent/guide/special.html>)
+
+error: invalid escape `\"` in Fluent resource
+ --> $DIR/test.rs:99:24
+ |
+LL | fluent_messages! { "./invalid-escape.ftl" }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: Fluent does not interpret these escape sequences (<https://projectfluent.org/fluent/guide/special.html>)
+
+error: invalid escape `\'` in Fluent resource
+ --> $DIR/test.rs:99:24
+ |
+LL | fluent_messages! { "./invalid-escape.ftl" }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: Fluent does not interpret these escape sequences (<https://projectfluent.org/fluent/guide/special.html>)
+
+error: aborting due to 13 previous errors
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs b/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs
deleted file mode 100644
index 99f99ffcd..000000000
--- a/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// compile-flags: -Z unstable-options
-
-#![feature(rustc_attrs)]
-
-#[rustc_lint_diagnostics]
-//~^ ERROR attribute should be applied to a function
-struct Foo;
-
-impl Foo {
- #[rustc_lint_diagnostics(a)]
- //~^ ERROR malformed `rustc_lint_diagnostics`
- fn bar() {}
-}
-
-fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr b/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr
deleted file mode 100644
index e849ca282..000000000
--- a/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error: malformed `rustc_lint_diagnostics` attribute input
- --> $DIR/diagnostics_incorrect.rs:10:5
- |
-LL | #[rustc_lint_diagnostics(a)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_diagnostics]`
-
-error: attribute should be applied to a function definition
- --> $DIR/diagnostics_incorrect.rs:5:1
- |
-LL | #[rustc_lint_diagnostics]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |
-LL | struct Foo;
- | ----------- not a function definition
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs
deleted file mode 100644
index 7783dc40f..000000000
--- a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// compile-flags: -Z unstable-options
-
-#![feature(rustc_private)]
-#![feature(rustdoc_internals)]
-
-#![crate_type = "lib"]
-
-#![deny(rustc::existing_doc_keyword)]
-
-#[doc(keyword = "tadam")] //~ ERROR
-mod tadam {}
diff --git a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr
deleted file mode 100644
index 4e296fff6..000000000
--- a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: found non-existing keyword `tadam` used in `#[doc(keyword = \"...\")]`
- --> $DIR/existing_doc_keyword.rs:10:1
- |
-LL | #[doc(keyword = "tadam")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: only existing keywords are allowed in core/std
-note: the lint level is defined here
- --> $DIR/existing_doc_keyword.rs:8:9
- |
-LL | #![deny(rustc::existing_doc_keyword)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs b/tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs
deleted file mode 100644
index f478b7332..000000000
--- a/tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// compile-flags: -Z unstable-options
-
-#![feature(rustc_attrs)]
-
-#[rustc_lint_query_instability]
-//~^ ERROR attribute should be applied to a function
-struct Foo;
-
-impl Foo {
- #[rustc_lint_query_instability(a)]
- //~^ ERROR malformed `rustc_lint_query_instability`
- fn bar() {}
-}
-
-fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr b/tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr
deleted file mode 100644
index 3f78b39ed..000000000
--- a/tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error: malformed `rustc_lint_query_instability` attribute input
- --> $DIR/query_stability_incorrect.rs:10:5
- |
-LL | #[rustc_lint_query_instability(a)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_query_instability]`
-
-error: attribute should be applied to a function definition
- --> $DIR/query_stability_incorrect.rs:5:1
- |
-LL | #[rustc_lint_query_instability]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |
-LL | struct Foo;
- | ----------- not a function definition
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs
deleted file mode 100644
index 6ce67dcaf..000000000
--- a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// compile-flags: -Z unstable-options
-// NOTE: This test doesn't actually require `fulldeps`
-// so we could instead use it as a `ui` test.
-//
-// Considering that all other `internal-lints` are tested here
-// this seems like the cleaner solution though.
-#![feature(rustc_attrs)]
-#![deny(rustc::pass_by_value)]
-#![allow(unused)]
-
-#[rustc_pass_by_value]
-struct TyCtxt<'tcx> {
- inner: &'tcx (),
-}
-
-impl<'tcx> TyCtxt<'tcx> {
- fn by_value(self) {} // OK
- fn by_ref(&self) {} //~ ERROR passing `TyCtxt<'tcx>` by reference
-}
-
-struct TyS<'tcx> {
- inner: &'tcx (),
-}
-
-#[rustc_pass_by_value]
-type Ty<'tcx> = &'tcx TyS<'tcx>;
-
-impl<'tcx> TyS<'tcx> {
- fn by_value(self: Ty<'tcx>) {}
- fn by_ref(self: &Ty<'tcx>) {} //~ ERROR passing `Ty<'tcx>` by reference
-}
-
-#[rustc_pass_by_value]
-struct Foo;
-
-impl Foo {
- fn with_ref(&self) {} //~ ERROR passing `Foo` by reference
-}
-
-#[rustc_pass_by_value]
-struct WithParameters<T, const N: usize, M = u32> {
- slice: [T; N],
- m: M,
-}
-
-impl<T> WithParameters<T, 1> {
- fn with_ref(&self) {} //~ ERROR passing `WithParameters<T, 1>` by reference
-}
-
-impl<T> WithParameters<T, 1, u8> {
- fn with_ref(&self) {} //~ ERROR passing `WithParameters<T, 1, u8>` by reference
-}
-
-fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr
deleted file mode 100644
index fb39ed60b..000000000
--- a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr
+++ /dev/null
@@ -1,38 +0,0 @@
-error: passing `TyCtxt<'tcx>` by reference
- --> $DIR/rustc_pass_by_value_self.rs:18:15
- |
-LL | fn by_ref(&self) {}
- | ^^^^^ help: try passing by value: `TyCtxt<'tcx>`
- |
-note: the lint level is defined here
- --> $DIR/rustc_pass_by_value_self.rs:8:9
- |
-LL | #![deny(rustc::pass_by_value)]
- | ^^^^^^^^^^^^^^^^^^^^
-
-error: passing `Ty<'tcx>` by reference
- --> $DIR/rustc_pass_by_value_self.rs:30:21
- |
-LL | fn by_ref(self: &Ty<'tcx>) {}
- | ^^^^^^^^^ help: try passing by value: `Ty<'tcx>`
-
-error: passing `Foo` by reference
- --> $DIR/rustc_pass_by_value_self.rs:37:17
- |
-LL | fn with_ref(&self) {}
- | ^^^^^ help: try passing by value: `Foo`
-
-error: passing `WithParameters<T, 1>` by reference
- --> $DIR/rustc_pass_by_value_self.rs:47:17
- |
-LL | fn with_ref(&self) {}
- | ^^^^^ help: try passing by value: `WithParameters<T, 1>`
-
-error: passing `WithParameters<T, 1, u8>` by reference
- --> $DIR/rustc_pass_by_value_self.rs:51:17
- |
-LL | fn with_ref(&self) {}
- | ^^^^^ help: try passing by value: `WithParameters<T, 1, u8>`
-
-error: aborting due to 5 previous errors
-
diff --git a/tests/ui-fulldeps/issue-11881.rs b/tests/ui-fulldeps/issue-11881.rs
deleted file mode 100644
index f6360db9b..000000000
--- a/tests/ui-fulldeps/issue-11881.rs
+++ /dev/null
@@ -1,91 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-#![allow(dead_code)]
-#![allow(unused_imports)]
-
-use std::fmt;
-use std::io::prelude::*;
-use std::io::Cursor;
-use std::slice;
-use std::marker::PhantomData;
-
-trait Encoder {
- type Error;
-}
-
-trait Encodable<S: Encoder> {
- fn encode(&self, s: &mut S) -> Result<(), S::Error>;
-}
-
-struct JsonEncoder<'a>(PhantomData<&'a mut ()>);
-
-impl Encoder for JsonEncoder<'_> {
- type Error = ();
-}
-
-struct AsJson<'a, T> {
- inner: &'a T,
-}
-
-impl<'a, T: for<'r> Encodable<JsonEncoder<'r>>> fmt::Display for AsJson<'a, T> {
- /// Encodes a json value into a string
- fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
- Ok(())
- }
-}
-
-fn as_json<T>(t: &T) -> AsJson<'_, T> {
- AsJson { inner: t }
-}
-
-struct OpaqueEncoder(Vec<u8>);
-
-impl Encoder for OpaqueEncoder {
- type Error = ();
-}
-
-
-struct Foo {
- baz: bool,
-}
-
-impl<S: Encoder> Encodable<S> for Foo {
- fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
- Ok(())
- }
-}
-
-struct Bar {
- froboz: usize,
-}
-
-impl<S: Encoder> Encodable<S> for Bar {
- fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
- Ok(())
- }
-}
-
-enum WireProtocol {
- JSON,
- Opaque,
- // ...
-}
-
-fn encode_json<T: for<'a> Encodable<JsonEncoder<'a>>>(val: &T, wr: &mut Cursor<Vec<u8>>) {
- write!(wr, "{}", as_json(val));
-}
-
-fn encode_opaque<T: Encodable<OpaqueEncoder>>(val: &T, wr: Vec<u8>) {
- let mut encoder = OpaqueEncoder(wr);
- val.encode(&mut encoder);
-}
-
-pub fn main() {
- let target = Foo { baz: false };
- let proto = WireProtocol::JSON;
- match proto {
- WireProtocol::JSON => encode_json(&target, &mut Cursor::new(Vec::new())),
- WireProtocol::Opaque => encode_opaque(&target, Vec::new()),
- }
-}
diff --git a/tests/ui-fulldeps/issue-13560.rs b/tests/ui-fulldeps/issue-13560.rs
deleted file mode 100644
index 5f7d647e2..000000000
--- a/tests/ui-fulldeps/issue-13560.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-// aux-build:issue-13560-1.rs
-// aux-build:issue-13560-2.rs
-// aux-build:issue-13560-3.rs
-
-// Regression test for issue #13560, the test itself is all in the dependent
-// libraries. The fail which previously failed to compile is the one numbered 3.
-
-extern crate issue_13560_2 as t2;
-extern crate issue_13560_3 as t3;
-
-fn main() {}
diff --git a/tests/ui-fulldeps/issue-15924.rs b/tests/ui-fulldeps/issue-15924.rs
deleted file mode 100644
index d8b3914d0..000000000
--- a/tests/ui-fulldeps/issue-15924.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// run-pass
-
-#![allow(unused_imports)]
-#![allow(unused_must_use)]
-// pretty-expanded FIXME #23616
-
-use std::fmt;
-use std::marker::PhantomData;
-
-trait Encoder {
- type Error;
-}
-
-trait Encodable<S: Encoder> {
- fn encode(&self, s: &mut S) -> Result<(), S::Error>;
-}
-
-impl<S: Encoder> Encodable<S> for i32 {
- fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
- Ok(())
- }
-}
-
-struct JsonEncoder<'a>(PhantomData<&'a mut ()>);
-
-impl Encoder for JsonEncoder<'_> {
- type Error = ();
-}
-
-fn encode_json<T: for<'r> Encodable<JsonEncoder<'r>>>(
- object: &T,
-) -> Result<String, ()> {
- let s = String::new();
- {
- let mut encoder = JsonEncoder(PhantomData);
- object.encode(&mut encoder)?;
- }
- Ok(s)
-}
-
-struct Foo<T: for<'a> Encodable<JsonEncoder<'a>>> {
- v: T,
-}
-
-impl<T: for<'a> Encodable<JsonEncoder<'a>>> Drop for Foo<T> {
- fn drop(&mut self) {
- encode_json(&self.v);
- }
-}
-
-fn main() {
- let _ = Foo { v: 10 };
-}
diff --git a/tests/ui-fulldeps/issue-16822.rs b/tests/ui-fulldeps/issue-16822.rs
deleted file mode 100644
index c611c33af..000000000
--- a/tests/ui-fulldeps/issue-16822.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-// aux-build:issue-16822.rs
-
-extern crate issue_16822 as lib;
-
-use std::cell::RefCell;
-
-struct App {
- i: isize
-}
-
-impl lib::Update for App {
- fn update(&mut self) {
- self.i += 1;
- }
-}
-
-fn main(){
- let app = App { i: 5 };
- let window = lib::Window { data: RefCell::new(app) };
- window.update(1);
-}
diff --git a/tests/ui-fulldeps/issue-18502.rs b/tests/ui-fulldeps/issue-18502.rs
deleted file mode 100644
index 2082ae7a9..000000000
--- a/tests/ui-fulldeps/issue-18502.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-// aux-build:issue-18502.rs
-
-extern crate issue_18502 as fmt;
-
-fn main() {
- ::fmt::baz();
-}
diff --git a/tests/ui-fulldeps/issue-24106.rs b/tests/ui-fulldeps/issue-24106.rs
deleted file mode 100644
index 45f0bd5b6..000000000
--- a/tests/ui-fulldeps/issue-24106.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-// aux-build:issue-24106.rs
-
-extern crate issue_24106;
-
-fn main() {
- issue_24106::go::<()>();
-}
diff --git a/tests/ui-fulldeps/issue-2804.rs b/tests/ui-fulldeps/issue-2804.rs
deleted file mode 100644
index 571028c5e..000000000
--- a/tests/ui-fulldeps/issue-2804.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-// run-pass
-
-#![allow(non_camel_case_types)]
-#![allow(dead_code)]
-
-use std::collections::{BTreeMap, HashMap};
-use std::option;
-
-#[derive(Clone, Debug)]
-enum Json {
- I64(i64),
- U64(u64),
- F64(f64),
- String(String),
- Boolean(bool),
- Array(Array),
- Object(Object),
- Null,
-}
-
-type Array = Vec<Json>;
-type Object = BTreeMap<String, Json>;
-
-enum object {
- bool_value(bool),
- int_value(i64),
-}
-
-fn lookup(table: Object, key: String, default: String) -> String
-{
- match table.get(&key) {
- option::Option::Some(&Json::String(ref s)) => {
- s.to_string()
- }
- option::Option::Some(value) => {
- println!("{} was expected to be a string but is a {:?}", key, value);
- default
- }
- option::Option::None => {
- default
- }
- }
-}
-
-fn add_interface(_store: isize, managed_ip: String, data: Json) -> (String, object)
-{
- match &data {
- &Json::Object(ref interface) => {
- let name = lookup(interface.clone(),
- "ifDescr".to_string(),
- "".to_string());
- let label = format!("{}-{}", managed_ip, name);
-
- (label, object::bool_value(false))
- }
- _ => {
- println!("Expected dict for {} interfaces, found {:?}", managed_ip, data);
- ("gnos:missing-interface".to_string(), object::bool_value(true))
- }
- }
-}
-
-fn add_interfaces(store: isize, managed_ip: String, device: HashMap<String, Json>)
--> Vec<(String, object)> {
- match device["interfaces"] {
- Json::Array(ref interfaces) =>
- {
- interfaces.iter().map(|interface| {
- add_interface(store, managed_ip.clone(), (*interface).clone())
- }).collect()
- }
- _ =>
- {
- println!("Expected list for {} interfaces, found {:?}", managed_ip,
- device["interfaces"]);
- Vec::new()
- }
- }
-}
-
-pub fn main() {}
diff --git a/tests/ui-fulldeps/myriad-closures.rs b/tests/ui-fulldeps/myriad-closures.rs
deleted file mode 100644
index 310351f50..000000000
--- a/tests/ui-fulldeps/myriad-closures.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-// This test case tests whether we can handle code bases that contain a high
-// number of closures, something that needs special handling in the MingGW
-// toolchain.
-// See https://github.com/rust-lang/rust/issues/34793 for more information.
-
-// Make sure we don't optimize anything away:
-// compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals
-
-// Expand something exponentially
-macro_rules! go_bacterial {
- ($mac:ident) => ($mac!());
- ($mac:ident 1 $($t:tt)*) => (
- go_bacterial!($mac $($t)*);
- go_bacterial!($mac $($t)*);
- )
-}
-
-macro_rules! mk_closure {
- () => ((move || {})())
-}
-
-macro_rules! mk_fn {
- () => {
- {
- fn function() {
- // Make 16 closures
- go_bacterial!(mk_closure 1 1 1 1);
- }
- let _ = function();
- }
- }
-}
-
-fn main() {
- // Make 2^8 functions, each containing 16 closures,
- // resulting in 2^12 closures overall.
- go_bacterial!(mk_fn 1 1 1 1 1 1 1 1);
-}
diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
index e417a6a83..ae375dfab 100644
--- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs
+++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
@@ -73,11 +73,10 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
let mut g = |e| f(expr(e));
- for kind in 0..=19 {
+ for kind in 0..=18 {
match kind {
- 0 => iter_exprs(depth - 1, &mut |e| g(ExprKind::Box(e))),
- 1 => iter_exprs(depth - 1, &mut |e| g(ExprKind::Call(e, thin_vec![]))),
- 2 => {
+ 0 => iter_exprs(depth - 1, &mut |e| g(ExprKind::Call(e, thin_vec![]))),
+ 1 => {
let seg = PathSegment::from_ident(Ident::from_str("x"));
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::MethodCall(Box::new(MethodCall {
@@ -90,26 +89,26 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
}))
)});
}
- 3..=8 => {
+ 2..=7 => {
let op = Spanned {
span: DUMMY_SP,
node: match kind {
- 3 => BinOpKind::Add,
- 4 => BinOpKind::Mul,
- 5 => BinOpKind::Shl,
- 6 => BinOpKind::And,
- 7 => BinOpKind::Or,
- 8 => BinOpKind::Lt,
+ 2 => BinOpKind::Add,
+ 3 => BinOpKind::Mul,
+ 4 => BinOpKind::Shl,
+ 5 => BinOpKind::And,
+ 6 => BinOpKind::Or,
+ 7 => BinOpKind::Lt,
_ => unreachable!(),
},
};
iter_exprs(depth - 1, &mut |e| g(ExprKind::Binary(op, e, make_x())));
iter_exprs(depth - 1, &mut |e| g(ExprKind::Binary(op, make_x(), e)));
}
- 9 => {
+ 8 => {
iter_exprs(depth - 1, &mut |e| g(ExprKind::Unary(UnOp::Deref, e)));
}
- 10 => {
+ 9 => {
let block = P(Block {
stmts: ThinVec::new(),
id: DUMMY_NODE_ID,
@@ -120,7 +119,7 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
});
iter_exprs(depth - 1, &mut |e| g(ExprKind::If(e, block.clone(), None)));
}
- 11 => {
+ 10 => {
let decl = P(FnDecl { inputs: thin_vec![], output: FnRetTy::Default(DUMMY_SP) });
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::Closure(Box::new(Closure {
@@ -136,14 +135,14 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
})))
});
}
- 12 => {
+ 11 => {
iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(e, make_x(), DUMMY_SP)));
iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(make_x(), e, DUMMY_SP)));
}
- 13 => {
+ 12 => {
iter_exprs(depth - 1, &mut |e| g(ExprKind::Field(e, Ident::from_str("f"))));
}
- 14 => {
+ 13 => {
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::Range(Some(e), Some(make_x()), RangeLimits::HalfOpen))
});
@@ -151,16 +150,16 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
g(ExprKind::Range(Some(make_x()), Some(e), RangeLimits::HalfOpen))
});
}
- 15 => {
+ 14 => {
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, e))
});
}
- 16 => {
+ 15 => {
g(ExprKind::Ret(None));
iter_exprs(depth - 1, &mut |e| g(ExprKind::Ret(Some(e))));
}
- 17 => {
+ 16 => {
let path = Path::from_ident(Ident::from_str("S"));
g(ExprKind::Struct(P(StructExpr {
qself: None,
@@ -169,10 +168,10 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
rest: StructRest::Base(make_x()),
})));
}
- 18 => {
+ 17 => {
iter_exprs(depth - 1, &mut |e| g(ExprKind::Try(e)));
}
- 19 => {
+ 18 => {
let pat =
P(Pat { id: DUMMY_NODE_ID, kind: PatKind::Wild, span: DUMMY_SP, tokens: None });
iter_exprs(depth - 1, &mut |e| g(ExprKind::Let(pat.clone(), e, DUMMY_SP)))
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
index 01e6434b0..6cc7bab37 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
@@ -50,7 +50,7 @@ enum DiagnosticOnEnum {
#[derive(Diagnostic)]
#[diag(no_crate_example, code = "E0123")]
#[diag = "E0123"]
-//~^ ERROR `#[diag = ...]` is not a valid attribute
+//~^ ERROR expected parentheses: #[diag(...)]
struct WrongStructAttrStyle {}
#[derive(Diagnostic)]
@@ -62,8 +62,7 @@ struct InvalidStructAttr {}
#[derive(Diagnostic)]
#[diag("E0123")]
-//~^ ERROR `#[diag("...")]` is not a valid attribute
-//~^^ ERROR diagnostic slug not specified
+//~^ ERROR diagnostic slug not specified
struct InvalidLitNestedAttr {}
#[derive(Diagnostic)]
@@ -73,27 +72,25 @@ struct InvalidNestedStructAttr {}
#[derive(Diagnostic)]
#[diag(nonsense("foo"), code = "E0123", slug = "foo")]
-//~^ ERROR `#[diag(nonsense(...))]` is not a valid attribute
-//~^^ ERROR diagnostic slug not specified
+//~^ ERROR diagnostic slug must be the first argument
+//~| ERROR diagnostic slug not specified
struct InvalidNestedStructAttr1 {}
#[derive(Diagnostic)]
#[diag(nonsense = "...", code = "E0123", slug = "foo")]
-//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
-//~| ERROR `#[diag(slug = ...)]` is not a valid attribute
+//~^ ERROR unknown argument
//~| ERROR diagnostic slug not specified
struct InvalidNestedStructAttr2 {}
#[derive(Diagnostic)]
#[diag(nonsense = 4, code = "E0123", slug = "foo")]
-//~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
-//~| ERROR `#[diag(slug = ...)]` is not a valid attribute
+//~^ ERROR unknown argument
//~| ERROR diagnostic slug not specified
struct InvalidNestedStructAttr3 {}
#[derive(Diagnostic)]
#[diag(no_crate_example, code = "E0123", slug = "foo")]
-//~^ ERROR `#[diag(slug = ...)]` is not a valid attribute
+//~^ ERROR unknown argument
struct InvalidNestedStructAttr4 {}
#[derive(Diagnostic)]
@@ -118,7 +115,7 @@ struct CodeSpecifiedTwice {}
#[derive(Diagnostic)]
#[diag(no_crate_example, no_crate::example, code = "E0456")]
-//~^ ERROR `#[diag(no_crate::example)]` is not a valid attribute
+//~^ ERROR diagnostic slug must be the first argument
struct SlugSpecifiedTwice {}
#[derive(Diagnostic)]
@@ -232,7 +229,7 @@ struct SuggestWithoutCode {
#[diag(no_crate_example, code = "E0123")]
struct SuggestWithBadKey {
#[suggestion(nonsense = "bar")]
- //~^ ERROR `#[suggestion(nonsense = ...)]` is not a valid attribute
+ //~^ ERROR invalid nested attribute
//~| ERROR suggestion without `code = "..."`
suggestion: (Span, Applicability),
}
@@ -241,7 +238,7 @@ struct SuggestWithBadKey {
#[diag(no_crate_example, code = "E0123")]
struct SuggestWithShorthandMsg {
#[suggestion(msg = "bar")]
- //~^ ERROR `#[suggestion(msg = ...)]` is not a valid attribute
+ //~^ ERROR invalid nested attribute
//~| ERROR suggestion without `code = "..."`
suggestion: (Span, Applicability),
}
@@ -514,10 +511,23 @@ struct OptUnitField {
}
#[derive(Diagnostic)]
+#[diag(no_crate_example)]
+struct BoolField {
+ #[primary_span]
+ spans: Span,
+ #[help]
+ foo: bool,
+ #[help(no_crate_help)]
+ //~^ ERROR the `#[help(...)]` attribute can only be applied to fields of type
+ // only allow plain 'bool' fields
+ bar: Option<bool>,
+}
+
+#[derive(Diagnostic)]
#[diag(no_crate_example, code = "E0123")]
struct LabelWithTrailingPath {
#[label(no_crate_label, foo)]
- //~^ ERROR `#[label(foo)]` is not a valid attribute
+ //~^ ERROR a diagnostic slug must be the first argument to the attribute
span: Span,
}
@@ -525,7 +535,7 @@ struct LabelWithTrailingPath {
#[diag(no_crate_example, code = "E0123")]
struct LabelWithTrailingNameValue {
#[label(no_crate_label, foo = "...")]
- //~^ ERROR `#[label(foo = ...)]` is not a valid attribute
+ //~^ ERROR invalid nested attribute
span: Span,
}
@@ -533,7 +543,7 @@ struct LabelWithTrailingNameValue {
#[diag(no_crate_example, code = "E0123")]
struct LabelWithTrailingList {
#[label(no_crate_label, foo("..."))]
- //~^ ERROR `#[label(foo(...))]` is not a valid attribute
+ //~^ ERROR invalid nested attribute
span: Span,
}
@@ -630,8 +640,8 @@ struct MissingCodeInSuggestion {
//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
//~| ERROR cannot find attribute `multipart_suggestion` in this scope
#[multipart_suggestion()]
-//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
-//~| ERROR cannot find attribute `multipart_suggestion` in this scope
+//~^ ERROR cannot find attribute `multipart_suggestion` in this scope
+//~| ERROR unexpected end of input, unexpected token in nested attribute, expected ident
struct MultipartSuggestion {
#[multipart_suggestion(no_crate_suggestion)]
//~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute
@@ -685,7 +695,7 @@ struct RawIdentDiagnosticArg {
#[diag(no_crate_example)]
struct SubdiagnosticBad {
#[subdiagnostic(bad)]
- //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ //~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic`
note: Note,
}
@@ -701,7 +711,7 @@ struct SubdiagnosticBadStr {
#[diag(no_crate_example)]
struct SubdiagnosticBadTwice {
#[subdiagnostic(bad, bad)]
- //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ //~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic`
note: Note,
}
@@ -709,7 +719,7 @@ struct SubdiagnosticBadTwice {
#[diag(no_crate_example)]
struct SubdiagnosticBadLitStr {
#[subdiagnostic("bad")]
- //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ //~^ ERROR `eager` is the only supported nested attribute for `subdiagnostic`
note: Note,
}
@@ -784,14 +794,15 @@ struct SuggestionsNoItem {
struct SuggestionsInvalidItem {
#[suggestion(code(foo))]
//~^ ERROR `code(...)` must contain only string literals
+ //~| ERROR unexpected token
sub: Span,
}
-#[derive(Diagnostic)]
+#[derive(Diagnostic)] //~ ERROR cannot find value `__code_34` in this scope
#[diag(no_crate_example)]
struct SuggestionsInvalidLiteral {
#[suggestion(code = 3)]
- //~^ ERROR `code = "..."`/`code(...)` must contain only string literals
+ //~^ ERROR expected string literal
sub: Span,
}
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index fc0cd8419..a2f3bb527 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -20,11 +20,11 @@ LL | Bar,
|
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[diag = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:52:1
+error: expected parentheses: #[diag(...)]
+ --> $DIR/diagnostic-derive.rs:52:8
|
LL | #[diag = "E0123"]
- | ^^^^^^^^^^^^^^^^^
+ | ^
error: `#[nonsense(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:57:1
@@ -44,35 +44,24 @@ LL | | struct InvalidStructAttr {}
|
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[diag("...")]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:64:8
- |
-LL | #[diag("E0123")]
- | ^^^^^^^
- |
- = help: a diagnostic slug is required as the first argument
-
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:64:1
|
LL | / #[diag("E0123")]
LL | |
-LL | |
LL | | struct InvalidLitNestedAttr {}
| |______________________________^
|
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[diag(nonsense(...))]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:75:8
+error: diagnostic slug must be the first argument
+ --> $DIR/diagnostic-derive.rs:74:16
|
LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^^^^
- |
- = help: a diagnostic slug is required as the first argument
+ | ^
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:75:1
+ --> $DIR/diagnostic-derive.rs:74:1
|
LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
LL | |
@@ -82,120 +71,102 @@ LL | | struct InvalidNestedStructAttr1 {}
|
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[diag(nonsense = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:81:8
- |
-LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^^^^^
- |
- = help: only `code` is a valid nested attributes following the slug
-
-error: `#[diag(slug = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:81:42
+error: unknown argument
+ --> $DIR/diagnostic-derive.rs:80:8
|
LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^
+ | ^^^^^^^^
|
- = help: only `code` is a valid nested attributes following the slug
+ = note: only the `code` parameter is valid after the slug
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:81:1
+ --> $DIR/diagnostic-derive.rs:80:1
|
LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")]
LL | |
LL | |
-LL | |
LL | | struct InvalidNestedStructAttr2 {}
| |__________________________________^
|
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[diag(nonsense = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:88:8
- |
-LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^
-
-error: `#[diag(slug = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:88:38
+error: unknown argument
+ --> $DIR/diagnostic-derive.rs:86:8
|
LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^
+ | ^^^^^^^^
|
- = help: only `code` is a valid nested attributes following the slug
+ = note: only the `code` parameter is valid after the slug
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:88:1
+ --> $DIR/diagnostic-derive.rs:86:1
|
LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")]
LL | |
LL | |
-LL | |
LL | | struct InvalidNestedStructAttr3 {}
| |__________________________________^
|
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
-error: `#[diag(slug = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:95:42
+error: unknown argument
+ --> $DIR/diagnostic-derive.rs:92:42
|
LL | #[diag(no_crate_example, code = "E0123", slug = "foo")]
- | ^^^^^^^^^^^^
+ | ^^^^
|
- = help: only `code` is a valid nested attributes following the slug
+ = note: only the `code` parameter is valid after the slug
error: `#[suggestion = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:102:5
+ --> $DIR/diagnostic-derive.rs:99:5
|
LL | #[suggestion = "bar"]
| ^^^^^^^^^^^^^^^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:109:8
+ --> $DIR/diagnostic-derive.rs:106:8
|
LL | #[diag(no_crate_example, code = "E0456")]
| ^^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:108:8
+ --> $DIR/diagnostic-derive.rs:105:8
|
LL | #[diag(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:109:33
+ --> $DIR/diagnostic-derive.rs:106:26
|
LL | #[diag(no_crate_example, code = "E0456")]
- | ^^^^^^^
+ | ^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:108:33
+ --> $DIR/diagnostic-derive.rs:105:26
|
LL | #[diag(no_crate_example, code = "E0123")]
- | ^^^^^^^
+ | ^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:115:49
+ --> $DIR/diagnostic-derive.rs:112:42
|
LL | #[diag(no_crate_example, code = "E0456", code = "E0457")]
- | ^^^^^^^
+ | ^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:115:33
+ --> $DIR/diagnostic-derive.rs:112:26
|
LL | #[diag(no_crate_example, code = "E0456", code = "E0457")]
- | ^^^^^^^
+ | ^^^^
-error: `#[diag(no_crate::example)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:120:26
+error: diagnostic slug must be the first argument
+ --> $DIR/diagnostic-derive.rs:117:43
|
LL | #[diag(no_crate_example, no_crate::example, code = "E0456")]
- | ^^^^^^^^^^^^^^^^^
- |
- = help: diagnostic slug must be the first argument
+ | ^
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:125:1
+ --> $DIR/diagnostic-derive.rs:122:1
|
LL | struct KindNotProvided {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -203,7 +174,7 @@ LL | struct KindNotProvided {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:128:1
+ --> $DIR/diagnostic-derive.rs:125:1
|
LL | / #[diag(code = "E0456")]
LL | |
@@ -213,31 +184,31 @@ LL | | struct SlugNotProvided {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/diagnostic-derive.rs:139:5
+ --> $DIR/diagnostic-derive.rs:136:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: `#[nonsense]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:147:5
+ --> $DIR/diagnostic-derive.rs:144:5
|
LL | #[nonsense]
| ^^^^^^^^^^^
error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/diagnostic-derive.rs:164:5
+ --> $DIR/diagnostic-derive.rs:161:5
|
LL | #[label(no_crate_label)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: `name` doesn't refer to a field on this type
- --> $DIR/diagnostic-derive.rs:172:46
+ --> $DIR/diagnostic-derive.rs:169:46
|
LL | #[suggestion(no_crate_suggestion, code = "{name}")]
| ^^^^^^^^
error: invalid format string: expected `'}'` but string was terminated
- --> $DIR/diagnostic-derive.rs:177:10
+ --> $DIR/diagnostic-derive.rs:174:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ expected `'}'` in format string
@@ -246,7 +217,7 @@ LL | #[derive(Diagnostic)]
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: invalid format string: unmatched `}` found
- --> $DIR/diagnostic-derive.rs:187:10
+ --> $DIR/diagnostic-derive.rs:184:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ unmatched `}` in format string
@@ -255,47 +226,47 @@ LL | #[derive(Diagnostic)]
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/diagnostic-derive.rs:207:5
+ --> $DIR/diagnostic-derive.rs:204:5
|
LL | #[label(no_crate_label)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:226:5
+ --> $DIR/diagnostic-derive.rs:223:5
|
LL | #[suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `#[suggestion(nonsense = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:234:18
+error: invalid nested attribute
+ --> $DIR/diagnostic-derive.rs:231:18
|
LL | #[suggestion(nonsense = "bar")]
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^
|
= help: only `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:234:5
+ --> $DIR/diagnostic-derive.rs:231:5
|
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `#[suggestion(msg = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:243:18
+error: invalid nested attribute
+ --> $DIR/diagnostic-derive.rs:240:18
|
LL | #[suggestion(msg = "bar")]
- | ^^^^^^^^^^^
+ | ^^^
|
= help: only `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:243:5
+ --> $DIR/diagnostic-derive.rs:240:5
|
LL | #[suggestion(msg = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: wrong field type for suggestion
- --> $DIR/diagnostic-derive.rs:266:5
+ --> $DIR/diagnostic-derive.rs:263:5
|
LL | / #[suggestion(no_crate_suggestion, code = "This is suggested code")]
LL | |
@@ -305,75 +276,79 @@ LL | | suggestion: Applicability,
= help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:282:24
+ --> $DIR/diagnostic-derive.rs:279:24
|
LL | suggestion: (Span, Span, Applicability),
| ^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:282:18
+ --> $DIR/diagnostic-derive.rs:279:18
|
LL | suggestion: (Span, Span, Applicability),
| ^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:290:33
+ --> $DIR/diagnostic-derive.rs:287:33
|
LL | suggestion: (Applicability, Applicability, Span),
| ^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:290:18
+ --> $DIR/diagnostic-derive.rs:287:18
|
LL | suggestion: (Applicability, Applicability, Span),
| ^^^^^^^^^^^^^
error: `#[label = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:297:5
+ --> $DIR/diagnostic-derive.rs:294:5
|
LL | #[label = "bar"]
| ^^^^^^^^^^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:448:53
+ --> $DIR/diagnostic-derive.rs:445:5
|
LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:450:24
+ --> $DIR/diagnostic-derive.rs:447:24
|
LL | suggestion: (Span, Applicability),
| ^^^^^^^^^^^^^
error: invalid applicability
- --> $DIR/diagnostic-derive.rs:456:53
+ --> $DIR/diagnostic-derive.rs:453:69
|
LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^
-error: `#[label(foo)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:519:29
+error: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()`
+ --> $DIR/diagnostic-derive.rs:520:5
|
-LL | #[label(no_crate_label, foo)]
- | ^^^
+LL | #[help(no_crate_help)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: a diagnostic slug must be the first argument to the attribute
+ --> $DIR/diagnostic-derive.rs:529:32
|
- = help: a diagnostic slug must be the first argument to the attribute
+LL | #[label(no_crate_label, foo)]
+ | ^
-error: `#[label(foo = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:527:29
+error: invalid nested attribute
+ --> $DIR/diagnostic-derive.rs:537:29
|
LL | #[label(no_crate_label, foo = "...")]
- | ^^^^^^^^^^^
+ | ^^^
-error: `#[label(foo(...))]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:535:29
+error: invalid nested attribute
+ --> $DIR/diagnostic-derive.rs:545:29
|
LL | #[label(no_crate_label, foo("..."))]
- | ^^^^^^^^^^
+ | ^^^
error: `#[primary_span]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:547:5
+ --> $DIR/diagnostic-derive.rs:557:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
@@ -381,13 +356,13 @@ LL | #[primary_span]
= help: the `primary_span` field attribute is not valid for lint diagnostics
error: `#[error(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:567:1
+ --> $DIR/diagnostic-derive.rs:577:1
|
LL | #[error(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:567:1
+ --> $DIR/diagnostic-derive.rs:577:1
|
LL | / #[error(no_crate_example, code = "E0123")]
LL | |
@@ -399,13 +374,13 @@ LL | | struct ErrorAttribute {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: `#[warn_(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:574:1
+ --> $DIR/diagnostic-derive.rs:584:1
|
LL | #[warn_(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:574:1
+ --> $DIR/diagnostic-derive.rs:584:1
|
LL | / #[warn_(no_crate_example, code = "E0123")]
LL | |
@@ -417,13 +392,13 @@ LL | | struct WarnAttribute {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: `#[lint(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:581:1
+ --> $DIR/diagnostic-derive.rs:591:1
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:581:1
+ --> $DIR/diagnostic-derive.rs:591:1
|
LL | / #[lint(no_crate_example, code = "E0123")]
LL | |
@@ -435,19 +410,19 @@ LL | | struct LintAttributeOnSessionDiag {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: `#[lint(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:588:1
+ --> $DIR/diagnostic-derive.rs:598:1
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[lint(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:588:1
+ --> $DIR/diagnostic-derive.rs:598:1
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
- --> $DIR/diagnostic-derive.rs:588:1
+ --> $DIR/diagnostic-derive.rs:598:1
|
LL | / #[lint(no_crate_example, code = "E0123")]
LL | |
@@ -460,19 +435,19 @@ LL | | struct LintAttributeOnLintDiag {}
= help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]`
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:598:53
+ --> $DIR/diagnostic-derive.rs:608:53
|
LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")]
- | ^^^^^^^^^^^^
+ | ^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:598:39
+ --> $DIR/diagnostic-derive.rs:608:39
|
LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")]
- | ^^^^^^^^^^^^
+ | ^^^^
error: wrong types for suggestion
- --> $DIR/diagnostic-derive.rs:607:24
+ --> $DIR/diagnostic-derive.rs:617:24
|
LL | suggestion: (Span, usize),
| ^^^^^
@@ -480,7 +455,7 @@ LL | suggestion: (Span, usize),
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
error: wrong types for suggestion
- --> $DIR/diagnostic-derive.rs:615:17
+ --> $DIR/diagnostic-derive.rs:625:17
|
LL | suggestion: (Span,),
| ^^^^^^^
@@ -488,13 +463,13 @@ LL | suggestion: (Span,),
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:622:5
+ --> $DIR/diagnostic-derive.rs:632:5
|
LL | #[suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[multipart_suggestion(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:629:1
+ --> $DIR/diagnostic-derive.rs:639:1
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -502,23 +477,21 @@ LL | #[multipart_suggestion(no_crate_suggestion)]
= help: consider creating a `Subdiagnostic` instead
error: `#[multipart_suggestion(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:632:1
- |
-LL | #[multipart_suggestion()]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: consider creating a `Subdiagnostic` instead
-
-error: `#[multipart_suggestion(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:636:5
+ --> $DIR/diagnostic-derive.rs:646:5
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider creating a `Subdiagnostic` instead
+error: unexpected end of input, unexpected token in nested attribute, expected ident
+ --> $DIR/diagnostic-derive.rs:642:24
+ |
+LL | #[multipart_suggestion()]
+ | ^
+
error: `#[suggestion(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:644:1
+ --> $DIR/diagnostic-derive.rs:654:1
|
LL | #[suggestion(no_crate_suggestion, code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -526,45 +499,39 @@ LL | #[suggestion(no_crate_suggestion, code = "...")]
= help: `#[label]` and `#[suggestion]` can only be applied to fields
error: `#[label]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:653:1
+ --> $DIR/diagnostic-derive.rs:663:1
|
LL | #[label]
| ^^^^^^^^
|
= help: `#[label]` and `#[suggestion]` can only be applied to fields
-error: `#[subdiagnostic(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:687:5
+error: `eager` is the only supported nested attribute for `subdiagnostic`
+ --> $DIR/diagnostic-derive.rs:697:7
|
LL | #[subdiagnostic(bad)]
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = help: `eager` is the only supported nested attribute for `subdiagnostic`
+ | ^^^^^^^^^^^^^^^^^^
error: `#[subdiagnostic = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:695:5
+ --> $DIR/diagnostic-derive.rs:705:5
|
LL | #[subdiagnostic = "bad"]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: `#[subdiagnostic(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:703:5
+error: `eager` is the only supported nested attribute for `subdiagnostic`
+ --> $DIR/diagnostic-derive.rs:713:7
|
LL | #[subdiagnostic(bad, bad)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: `eager` is the only supported nested attribute for `subdiagnostic`
+ | ^^^^^^^^^^^^^^^^^^^^^^^
-error: `#[subdiagnostic(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:711:5
+error: `eager` is the only supported nested attribute for `subdiagnostic`
+ --> $DIR/diagnostic-derive.rs:721:7
|
LL | #[subdiagnostic("bad")]
- | ^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: `eager` is the only supported nested attribute for `subdiagnostic`
+ | ^^^^^^^^^^^^^^^^^^^^
error: `#[subdiagnostic(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:719:5
+ --> $DIR/diagnostic-derive.rs:729:5
|
LL | #[subdiagnostic(eager)]
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -572,25 +539,31 @@ LL | #[subdiagnostic(eager)]
= help: eager subdiagnostics are not supported on lints
error: expected at least one string literal for `code(...)`
- --> $DIR/diagnostic-derive.rs:777:18
+ --> $DIR/diagnostic-derive.rs:787:23
|
LL | #[suggestion(code())]
- | ^^^^^^
+ | ^
error: `code(...)` must contain only string literals
- --> $DIR/diagnostic-derive.rs:785:23
+ --> $DIR/diagnostic-derive.rs:795:23
+ |
+LL | #[suggestion(code(foo))]
+ | ^^^
+
+error: unexpected token
+ --> $DIR/diagnostic-derive.rs:795:23
|
LL | #[suggestion(code(foo))]
| ^^^
-error: `code = "..."`/`code(...)` must contain only string literals
- --> $DIR/diagnostic-derive.rs:793:18
+error: expected string literal
+ --> $DIR/diagnostic-derive.rs:804:25
|
LL | #[suggestion(code = 3)]
- | ^^^^^^^^
+ | ^
error: `#[suggestion(...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:808:5
+ --> $DIR/diagnostic-derive.rs:819:5
|
LL | #[suggestion(no_crate_suggestion, code = "")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -606,61 +579,69 @@ LL | #[nonsense(no_crate_example, code = "E0123")]
| ^^^^^^^^
error: cannot find attribute `nonsense` in this scope
- --> $DIR/diagnostic-derive.rs:147:7
+ --> $DIR/diagnostic-derive.rs:144:7
|
LL | #[nonsense]
| ^^^^^^^^
error: cannot find attribute `error` in this scope
- --> $DIR/diagnostic-derive.rs:567:3
+ --> $DIR/diagnostic-derive.rs:577:3
|
LL | #[error(no_crate_example, code = "E0123")]
| ^^^^^
error: cannot find attribute `warn_` in this scope
- --> $DIR/diagnostic-derive.rs:574:3
+ --> $DIR/diagnostic-derive.rs:584:3
|
LL | #[warn_(no_crate_example, code = "E0123")]
| ^^^^^ help: a built-in attribute with a similar name exists: `warn`
error: cannot find attribute `lint` in this scope
- --> $DIR/diagnostic-derive.rs:581:3
+ --> $DIR/diagnostic-derive.rs:591:3
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^ help: a built-in attribute with a similar name exists: `link`
error: cannot find attribute `lint` in this scope
- --> $DIR/diagnostic-derive.rs:588:3
+ --> $DIR/diagnostic-derive.rs:598:3
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^ help: a built-in attribute with a similar name exists: `link`
error: cannot find attribute `multipart_suggestion` in this scope
- --> $DIR/diagnostic-derive.rs:629:3
+ --> $DIR/diagnostic-derive.rs:639:3
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^
error: cannot find attribute `multipart_suggestion` in this scope
- --> $DIR/diagnostic-derive.rs:632:3
+ --> $DIR/diagnostic-derive.rs:642:3
|
LL | #[multipart_suggestion()]
| ^^^^^^^^^^^^^^^^^^^^
error: cannot find attribute `multipart_suggestion` in this scope
- --> $DIR/diagnostic-derive.rs:636:7
+ --> $DIR/diagnostic-derive.rs:646:7
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^
error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated`
- --> $DIR/diagnostic-derive.rs:70:8
+ --> $DIR/diagnostic-derive.rs:69:8
|
LL | #[diag(nonsense, code = "E0123")]
| ^^^^^^^^ not found in `crate::fluent_generated`
+error[E0425]: cannot find value `__code_34` in this scope
+ --> $DIR/diagnostic-derive.rs:801:10
+ |
+LL | #[derive(Diagnostic)]
+ | ^^^^^^^^^^ not found in this scope
+ |
+ = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
- --> $DIR/diagnostic-derive.rs:341:10
+ --> $DIR/diagnostic-derive.rs:338:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
index c882f7792..1d928ca93 100644
--- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
+++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
@@ -82,7 +82,7 @@ struct F {
#[derive(Subdiagnostic)]
#[label(bug = "...")]
-//~^ ERROR `#[label(bug = ...)]` is not a valid attribute
+//~^ ERROR invalid nested attribute
//~| ERROR diagnostic slug must be first argument
struct G {
#[primary_span]
@@ -92,8 +92,7 @@ struct G {
#[derive(Subdiagnostic)]
#[label("...")]
-//~^ ERROR `#[label("...")]` is not a valid attribute
-//~| ERROR diagnostic slug must be first argument
+//~^ ERROR unexpected literal in nested attribute, expected ident
struct H {
#[primary_span]
span: Span,
@@ -102,7 +101,7 @@ struct H {
#[derive(Subdiagnostic)]
#[label(slug = 4)]
-//~^ ERROR `#[label(slug = ...)]` is not a valid attribute
+//~^ ERROR invalid nested attribute
//~| ERROR diagnostic slug must be first argument
struct J {
#[primary_span]
@@ -112,7 +111,7 @@ struct J {
#[derive(Subdiagnostic)]
#[label(slug("..."))]
-//~^ ERROR `#[label(slug(...))]` is not a valid attribute
+//~^ ERROR invalid nested attribute
//~| ERROR diagnostic slug must be first argument
struct K {
#[primary_span]
@@ -132,7 +131,7 @@ struct L {
#[derive(Subdiagnostic)]
#[label()]
-//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
+//~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident
struct M {
#[primary_span]
span: Span,
@@ -141,7 +140,7 @@ struct M {
#[derive(Subdiagnostic)]
#[label(no_crate_example, code = "...")]
-//~^ ERROR `#[label(code = ...)]` is not a valid attribute
+//~^ ERROR invalid nested attribute
struct N {
#[primary_span]
span: Span,
@@ -150,7 +149,7 @@ struct N {
#[derive(Subdiagnostic)]
#[label(no_crate_example, applicability = "machine-applicable")]
-//~^ ERROR `#[label(applicability = ...)]` is not a valid attribute
+//~^ ERROR invalid nested attribute
struct O {
#[primary_span]
span: Span,
@@ -222,7 +221,7 @@ enum T {
enum U {
#[label(code = "...")]
//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
- //~| ERROR `#[label(code = ...)]` is not a valid attribute
+ //~| ERROR invalid nested attribute
A {
#[primary_span]
span: Span,
@@ -323,7 +322,7 @@ struct AD {
#[derive(Subdiagnostic)]
#[label(no_crate_example, no_crate::example)]
-//~^ ERROR `#[label(no_crate::example)]` is not a valid attribute
+//~^ ERROR a diagnostic slug must be the first argument to the attribute
struct AE {
#[primary_span]
span: Span,
@@ -537,7 +536,7 @@ struct BA {
#[derive(Subdiagnostic)]
#[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
-//~| ERROR `#[multipart_suggestion(code = ...)]` is not a valid attribute
+//~| ERROR invalid nested attribute
struct BBa {
var: String,
}
@@ -554,7 +553,7 @@ struct BBb {
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
struct BBc {
#[suggestion_part()]
- //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
+ //~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident
span1: Span,
}
@@ -574,10 +573,11 @@ struct BD {
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
span1: Span,
#[suggestion_part()]
- //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
+ //~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident
span2: Span,
#[suggestion_part(foo = "bar")]
- //~^ ERROR `#[suggestion_part(foo = ...)]` is not a valid attribute
+ //~^ ERROR `code` is the only valid nested attribute
+ //~| ERROR expected `,`
span4: Span,
#[suggestion_part(code = "...")]
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
@@ -669,6 +669,7 @@ enum BL {
struct BM {
#[suggestion_part(code("foo"))]
//~^ ERROR expected exactly one string literal for `code = ...`
+ //~| ERROR unexpected token
span: Span,
r#type: String,
}
@@ -678,6 +679,7 @@ struct BM {
struct BN {
#[suggestion_part(code("foo", "bar"))]
//~^ ERROR expected exactly one string literal for `code = ...`
+ //~| ERROR unexpected token
span: Span,
r#type: String,
}
@@ -687,6 +689,7 @@ struct BN {
struct BO {
#[suggestion_part(code(3))]
//~^ ERROR expected exactly one string literal for `code = ...`
+ //~| ERROR unexpected token
span: Span,
r#type: String,
}
@@ -701,10 +704,13 @@ struct BP {
}
#[derive(Subdiagnostic)]
+//~^ ERROR cannot find value `__code_29` in this scope
+//~| NOTE in this expansion
+//~| NOTE not found in this scope
#[multipart_suggestion(no_crate_example)]
struct BQ {
#[suggestion_part(code = 3)]
- //~^ ERROR `code = "..."`/`code(...)` must contain only string literals
+ //~^ ERROR expected string literal
span: Span,
r#type: String,
}
@@ -779,7 +785,7 @@ struct SuggestionStyleInvalid1 {
#[derive(Subdiagnostic)]
#[suggestion(no_crate_example, code = "", style = 42)]
-//~^ ERROR `#[suggestion(style = ...)]` is not a valid attribute
+//~^ ERROR expected `= "xxx"`
struct SuggestionStyleInvalid2 {
#[primary_span]
sub: Span,
@@ -787,7 +793,7 @@ struct SuggestionStyleInvalid2 {
#[derive(Subdiagnostic)]
#[suggestion(no_crate_example, code = "", style)]
-//~^ ERROR `#[suggestion(style)]` is not a valid attribute
+//~^ ERROR a diagnostic slug must be the first argument to the attribute
struct SuggestionStyleInvalid3 {
#[primary_span]
sub: Span,
@@ -795,7 +801,8 @@ struct SuggestionStyleInvalid3 {
#[derive(Subdiagnostic)]
#[suggestion(no_crate_example, code = "", style("foo"))]
-//~^ ERROR `#[suggestion(style(...))]` is not a valid attribute
+//~^ ERROR expected `= "xxx"`
+//~| ERROr expected `,`
struct SuggestionStyleInvalid4 {
#[primary_span]
sub: Span,
diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
index 343134af6..4211b91f0 100644
--- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
@@ -26,11 +26,11 @@ error: `#[label = ...]` is not a valid attribute
LL | #[label = "..."]
| ^^^^^^^^^^^^^^^^
-error: `#[label(bug = ...)]` is not a valid attribute
+error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:84:9
|
LL | #[label(bug = "...")]
- | ^^^^^^^^^^^
+ | ^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:84:1
@@ -38,110 +38,104 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute
LL | #[label(bug = "...")]
| ^^^^^^^^^^^^^^^^^^^^^
-error: `#[label("...")]` is not a valid attribute
+error: unexpected literal in nested attribute, expected ident
--> $DIR/subdiagnostic-derive.rs:94:9
|
LL | #[label("...")]
| ^^^^^
-error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:94:1
- |
-LL | #[label("...")]
- | ^^^^^^^^^^^^^^^
-
-error: `#[label(slug = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:104:9
+error: invalid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:103:9
|
LL | #[label(slug = 4)]
- | ^^^^^^^^
+ | ^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:104:1
+ --> $DIR/subdiagnostic-derive.rs:103:1
|
LL | #[label(slug = 4)]
| ^^^^^^^^^^^^^^^^^^
-error: `#[label(slug(...))]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:114:9
+error: invalid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:113:9
|
LL | #[label(slug("..."))]
- | ^^^^^^^^^^^
+ | ^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:114:1
+ --> $DIR/subdiagnostic-derive.rs:113:1
|
LL | #[label(slug("..."))]
| ^^^^^^^^^^^^^^^^^^^^^
-error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:134:1
+error: unexpected end of input, unexpected token in nested attribute, expected ident
+ --> $DIR/subdiagnostic-derive.rs:133:9
|
LL | #[label()]
- | ^^^^^^^^^^
+ | ^
-error: `#[label(code = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:143:27
+error: invalid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:142:27
|
LL | #[label(no_crate_example, code = "...")]
- | ^^^^^^^^^^^^
+ | ^^^^
-error: `#[label(applicability = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:152:27
+error: invalid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:151:27
|
LL | #[label(no_crate_example, applicability = "machine-applicable")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^
error: unsupported type attribute for subdiagnostic enum
- --> $DIR/subdiagnostic-derive.rs:161:1
+ --> $DIR/subdiagnostic-derive.rs:160:1
|
LL | #[foo]
| ^^^^^^
error: `#[bar]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:175:5
+ --> $DIR/subdiagnostic-derive.rs:174:5
|
LL | #[bar]
| ^^^^^^
error: `#[bar = ...]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:187:5
+ --> $DIR/subdiagnostic-derive.rs:186:5
|
LL | #[bar = "..."]
| ^^^^^^^^^^^^^^
error: `#[bar = ...]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:199:5
+ --> $DIR/subdiagnostic-derive.rs:198:5
|
LL | #[bar = 4]
| ^^^^^^^^^^
error: `#[bar(...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:211:5
+ --> $DIR/subdiagnostic-derive.rs:210:5
|
LL | #[bar("...")]
| ^^^^^^^^^^^^^
-error: `#[label(code = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:223:13
+error: invalid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:222:13
|
LL | #[label(code = "...")]
- | ^^^^^^^^^^^^
+ | ^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
- --> $DIR/subdiagnostic-derive.rs:223:5
+ --> $DIR/subdiagnostic-derive.rs:222:5
|
LL | #[label(code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^
error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
- --> $DIR/subdiagnostic-derive.rs:252:5
+ --> $DIR/subdiagnostic-derive.rs:251:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: label without `#[primary_span]` field
- --> $DIR/subdiagnostic-derive.rs:249:1
+ --> $DIR/subdiagnostic-derive.rs:248:1
|
LL | / #[label(no_crate_example)]
LL | |
@@ -153,13 +147,13 @@ LL | | }
| |_^
error: `#[applicability]` is only valid on suggestions
- --> $DIR/subdiagnostic-derive.rs:262:5
+ --> $DIR/subdiagnostic-derive.rs:261:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: `#[bar]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:272:5
+ --> $DIR/subdiagnostic-derive.rs:271:5
|
LL | #[bar]
| ^^^^^^
@@ -167,13 +161,13 @@ LL | #[bar]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: `#[bar = ...]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:283:5
+ --> $DIR/subdiagnostic-derive.rs:282:5
|
LL | #[bar = "..."]
| ^^^^^^^^^^^^^^
error: `#[bar(...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:294:5
+ --> $DIR/subdiagnostic-derive.rs:293:5
|
LL | #[bar("...")]
| ^^^^^^^^^^^^^
@@ -181,7 +175,7 @@ LL | #[bar("...")]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: unexpected unsupported untagged union
- --> $DIR/subdiagnostic-derive.rs:310:1
+ --> $DIR/subdiagnostic-derive.rs:309:1
|
LL | / union AC {
LL | |
@@ -190,76 +184,74 @@ LL | | b: u64,
LL | | }
| |_^
-error: `#[label(no_crate::example)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:325:27
+error: a diagnostic slug must be the first argument to the attribute
+ --> $DIR/subdiagnostic-derive.rs:324:44
|
LL | #[label(no_crate_example, no_crate::example)]
- | ^^^^^^^^^^^^^^^^^
- |
- = help: a diagnostic slug must be the first argument to the attribute
+ | ^
error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:338:5
+ --> $DIR/subdiagnostic-derive.rs:337:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:335:5
+ --> $DIR/subdiagnostic-derive.rs:334:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: subdiagnostic kind not specified
- --> $DIR/subdiagnostic-derive.rs:344:8
+ --> $DIR/subdiagnostic-derive.rs:343:8
|
LL | struct AG {
| ^^
error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:381:46
+ --> $DIR/subdiagnostic-derive.rs:380:46
|
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
- | ^^^^^^^^^^^^
+ | ^^^^
|
note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:381:32
+ --> $DIR/subdiagnostic-derive.rs:380:32
|
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
- | ^^^^^^^^^^^^
+ | ^^^^
error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:399:5
+ --> $DIR/subdiagnostic-derive.rs:398:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:396:5
+ --> $DIR/subdiagnostic-derive.rs:395:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: the `#[applicability]` attribute can only be applied to fields of type `Applicability`
- --> $DIR/subdiagnostic-derive.rs:409:5
+ --> $DIR/subdiagnostic-derive.rs:408:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: suggestion without `code = "..."`
- --> $DIR/subdiagnostic-derive.rs:422:1
+ --> $DIR/subdiagnostic-derive.rs:421:1
|
LL | #[suggestion(no_crate_example)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: invalid applicability
- --> $DIR/subdiagnostic-derive.rs:432:46
+ --> $DIR/subdiagnostic-derive.rs:431:62
|
LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")]
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^
error: suggestion without `#[primary_span]` field
- --> $DIR/subdiagnostic-derive.rs:450:1
+ --> $DIR/subdiagnostic-derive.rs:449:1
|
LL | / #[suggestion(no_crate_example, code = "...")]
LL | |
@@ -269,25 +261,25 @@ LL | | }
| |_^
error: unsupported type attribute for subdiagnostic enum
- --> $DIR/subdiagnostic-derive.rs:464:1
+ --> $DIR/subdiagnostic-derive.rs:463:1
|
LL | #[label]
| ^^^^^^^^
error: `var` doesn't refer to a field on this type
- --> $DIR/subdiagnostic-derive.rs:484:39
+ --> $DIR/subdiagnostic-derive.rs:483:39
|
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: `var` doesn't refer to a field on this type
- --> $DIR/subdiagnostic-derive.rs:503:43
+ --> $DIR/subdiagnostic-derive.rs:502:43
|
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: `#[suggestion_part]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:526:5
+ --> $DIR/subdiagnostic-derive.rs:525:5
|
LL | #[suggestion_part]
| ^^^^^^^^^^^^^^^^^^
@@ -295,7 +287,7 @@ LL | #[suggestion_part]
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead
error: `#[suggestion_part(...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:529:5
+ --> $DIR/subdiagnostic-derive.rs:528:5
|
LL | #[suggestion_part(code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -303,7 +295,7 @@ LL | #[suggestion_part(code = "...")]
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions
error: suggestion without `#[primary_span]` field
- --> $DIR/subdiagnostic-derive.rs:523:1
+ --> $DIR/subdiagnostic-derive.rs:522:1
|
LL | / #[suggestion(no_crate_example, code = "...")]
LL | |
@@ -314,16 +306,16 @@ LL | | var: String,
LL | | }
| |_^
-error: `#[multipart_suggestion(code = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:538:42
+error: invalid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:537:42
|
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
- | ^^^^^^^^^^^^
+ | ^^^^
|
= help: only `style` and `applicability` are valid nested attributes
error: multipart suggestion without any `#[suggestion_part(...)]` fields
- --> $DIR/subdiagnostic-derive.rs:538:1
+ --> $DIR/subdiagnostic-derive.rs:537:1
|
LL | / #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
LL | |
@@ -334,19 +326,19 @@ LL | | }
| |_^
error: `#[suggestion_part(...)]` attribute without `code = "..."`
- --> $DIR/subdiagnostic-derive.rs:548:5
+ --> $DIR/subdiagnostic-derive.rs:547:5
|
LL | #[suggestion_part]
| ^^^^^^^^^^^^^^^^^^
-error: `#[suggestion_part(...)]` attribute without `code = "..."`
- --> $DIR/subdiagnostic-derive.rs:556:5
+error: unexpected end of input, unexpected token in nested attribute, expected ident
+ --> $DIR/subdiagnostic-derive.rs:555:23
|
LL | #[suggestion_part()]
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^
error: `#[primary_span]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:565:5
+ --> $DIR/subdiagnostic-derive.rs:564:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
@@ -354,7 +346,7 @@ LL | #[primary_span]
= help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`
error: multipart suggestion without any `#[suggestion_part(...)]` fields
- --> $DIR/subdiagnostic-derive.rs:562:1
+ --> $DIR/subdiagnostic-derive.rs:561:1
|
LL | / #[multipart_suggestion(no_crate_example)]
LL | |
@@ -366,24 +358,16 @@ LL | | }
| |_^
error: `#[suggestion_part(...)]` attribute without `code = "..."`
- --> $DIR/subdiagnostic-derive.rs:573:5
+ --> $DIR/subdiagnostic-derive.rs:572:5
|
LL | #[suggestion_part]
| ^^^^^^^^^^^^^^^^^^
-error: `#[suggestion_part(...)]` attribute without `code = "..."`
- --> $DIR/subdiagnostic-derive.rs:576:5
- |
-LL | #[suggestion_part()]
- | ^^^^^^^^^^^^^^^^^^^^
-
-error: `#[suggestion_part(foo = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:579:23
+error: `code` is the only valid nested attribute
+ --> $DIR/subdiagnostic-derive.rs:578:23
|
LL | #[suggestion_part(foo = "bar")]
- | ^^^^^^^^^^^
- |
- = help: `code` is the only valid nested attribute
+ | ^^^
error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:582:5
@@ -397,17 +381,29 @@ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of
LL | #[suggestion_part()]
| ^^^^^^^^^^^^^^^^^^^^
+error: unexpected end of input, unexpected token in nested attribute, expected ident
+ --> $DIR/subdiagnostic-derive.rs:575:23
+ |
+LL | #[suggestion_part()]
+ | ^
+
+error: expected `,`
+ --> $DIR/subdiagnostic-derive.rs:578:27
+ |
+LL | #[suggestion_part(foo = "bar")]
+ | ^
+
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:593:37
|
LL | #[suggestion_part(code = "...", code = ",,,")]
- | ^^^^^^^^^^^^
+ | ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:593:23
|
LL | #[suggestion_part(code = "...", code = ",,,")]
- | ^^^^^^^^^^^^
+ | ^^^^
error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
--> $DIR/subdiagnostic-derive.rs:622:5
@@ -416,49 +412,67 @@ LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: expected exactly one string literal for `code = ...`
- --> $DIR/subdiagnostic-derive.rs:670:23
+ --> $DIR/subdiagnostic-derive.rs:670:34
|
LL | #[suggestion_part(code("foo"))]
- | ^^^^^^^^^^^
+ | ^
+
+error: unexpected token
+ --> $DIR/subdiagnostic-derive.rs:670:28
+ |
+LL | #[suggestion_part(code("foo"))]
+ | ^^^^^
error: expected exactly one string literal for `code = ...`
- --> $DIR/subdiagnostic-derive.rs:679:23
+ --> $DIR/subdiagnostic-derive.rs:680:41
+ |
+LL | #[suggestion_part(code("foo", "bar"))]
+ | ^
+
+error: unexpected token
+ --> $DIR/subdiagnostic-derive.rs:680:28
|
LL | #[suggestion_part(code("foo", "bar"))]
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^
error: expected exactly one string literal for `code = ...`
- --> $DIR/subdiagnostic-derive.rs:688:23
+ --> $DIR/subdiagnostic-derive.rs:690:30
|
LL | #[suggestion_part(code(3))]
- | ^^^^^^^
+ | ^
+
+error: unexpected token
+ --> $DIR/subdiagnostic-derive.rs:690:28
+ |
+LL | #[suggestion_part(code(3))]
+ | ^
error: expected exactly one string literal for `code = ...`
- --> $DIR/subdiagnostic-derive.rs:697:23
+ --> $DIR/subdiagnostic-derive.rs:700:29
|
LL | #[suggestion_part(code())]
- | ^^^^^^
+ | ^
-error: `code = "..."`/`code(...)` must contain only string literals
- --> $DIR/subdiagnostic-derive.rs:706:23
+error: expected string literal
+ --> $DIR/subdiagnostic-derive.rs:712:30
|
LL | #[suggestion_part(code = 3)]
- | ^^^^^^^^
+ | ^
error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:748:61
+ --> $DIR/subdiagnostic-derive.rs:754:1
|
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:748:43
+ --> $DIR/subdiagnostic-derive.rs:754:1
|
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[suggestion_hidden(...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:757:1
+ --> $DIR/subdiagnostic-derive.rs:763:1
|
LL | #[suggestion_hidden(no_crate_example, code = "")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -466,7 +480,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "")]
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: `#[suggestion_hidden(...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:765:1
+ --> $DIR/subdiagnostic-derive.rs:771:1
|
LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -474,35 +488,39 @@ LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: invalid suggestion style
- --> $DIR/subdiagnostic-derive.rs:773:51
+ --> $DIR/subdiagnostic-derive.rs:779:51
|
LL | #[suggestion(no_crate_example, code = "", style = "foo")]
| ^^^^^
|
= help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
-error: `#[suggestion(style = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:781:43
+error: expected `= "xxx"`
+ --> $DIR/subdiagnostic-derive.rs:787:49
|
LL | #[suggestion(no_crate_example, code = "", style = 42)]
- | ^^^^^^^^^^
+ | ^
-error: `#[suggestion(style)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:789:43
+error: a diagnostic slug must be the first argument to the attribute
+ --> $DIR/subdiagnostic-derive.rs:795:48
|
LL | #[suggestion(no_crate_example, code = "", style)]
- | ^^^^^
+ | ^
+
+error: expected `= "xxx"`
+ --> $DIR/subdiagnostic-derive.rs:803:48
|
- = help: a diagnostic slug must be the first argument to the attribute
+LL | #[suggestion(no_crate_example, code = "", style("foo"))]
+ | ^
-error: `#[suggestion(style(...))]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:797:43
+error: expected `,`
+ --> $DIR/subdiagnostic-derive.rs:803:48
|
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
- | ^^^^^^^^^^^^
+ | ^
error: `#[primary_span]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:808:5
+ --> $DIR/subdiagnostic-derive.rs:815:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
@@ -511,7 +529,7 @@ LL | #[primary_span]
= help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead
error: suggestion without `#[primary_span]` field
- --> $DIR/subdiagnostic-derive.rs:805:1
+ --> $DIR/subdiagnostic-derive.rs:812:1
|
LL | / #[suggestion(no_crate_example, code = "")]
LL | |
@@ -529,59 +547,67 @@ LL | #[foo]
| ^^^
error: cannot find attribute `foo` in this scope
- --> $DIR/subdiagnostic-derive.rs:161:3
+ --> $DIR/subdiagnostic-derive.rs:160:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:175:7
+ --> $DIR/subdiagnostic-derive.rs:174:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:187:7
+ --> $DIR/subdiagnostic-derive.rs:186:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:199:7
+ --> $DIR/subdiagnostic-derive.rs:198:7
|
LL | #[bar = 4]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:211:7
+ --> $DIR/subdiagnostic-derive.rs:210:7
|
LL | #[bar("...")]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:272:7
+ --> $DIR/subdiagnostic-derive.rs:271:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:283:7
+ --> $DIR/subdiagnostic-derive.rs:282:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
- --> $DIR/subdiagnostic-derive.rs:294:7
+ --> $DIR/subdiagnostic-derive.rs:293:7
|
LL | #[bar("...")]
| ^^^
error[E0425]: cannot find value `slug` in module `crate::fluent_generated`
- --> $DIR/subdiagnostic-derive.rs:124:9
+ --> $DIR/subdiagnostic-derive.rs:123:9
|
LL | #[label(slug)]
| ^^^^ not found in `crate::fluent_generated`
-error: aborting due to 81 previous errors
+error[E0425]: cannot find value `__code_29` in this scope
+ --> $DIR/subdiagnostic-derive.rs:706:10
+ |
+LL | #[derive(Subdiagnostic)]
+ | ^^^^^^^^^^^^^ not found in this scope
+ |
+ = note: this error originates in the derive macro `Subdiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 86 previous errors
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs
new file mode 100644
index 000000000..dfde8c97e
--- /dev/null
+++ b/tests/ui-fulldeps/stable-mir/crate-info.rs
@@ -0,0 +1,129 @@
+// run-pass
+// Test that users are able to use stable mir APIs to retrieve information of the current crate
+
+// ignore-stage1
+// ignore-cross-compile
+// ignore-remote
+// edition: 2021
+
+#![feature(rustc_private)]
+
+extern crate rustc_driver;
+extern crate rustc_hir;
+extern crate rustc_interface;
+extern crate rustc_middle;
+extern crate rustc_smir;
+
+use rustc_driver::{Callbacks, Compilation, RunCompiler};
+use rustc_hir::def::DefKind;
+use rustc_interface::{interface, Queries};
+use rustc_middle::ty::TyCtxt;
+use rustc_smir::{rustc_internal, stable_mir};
+use std::io::Write;
+
+const CRATE_NAME: &str = "input";
+
+/// This function uses the Stable MIR APIs to get information about the test crate.
+fn test_stable_mir(tcx: TyCtxt<'_>) {
+ // Get the local crate using stable_mir API.
+ let local = stable_mir::local_crate();
+ assert_eq!(&local.name, CRATE_NAME);
+
+ assert_eq!(stable_mir::entry_fn(), None);
+
+ // Find items in the local crate.
+ let items = stable_mir::all_local_items();
+ assert!(get_item(tcx, &items, (DefKind::Fn, "foo_bar")).is_some());
+ assert!(get_item(tcx, &items, (DefKind::Fn, "foo::bar")).is_some());
+
+ // Find the `std` crate.
+ assert!(stable_mir::find_crate("std").is_some());
+
+ let bar = get_item(tcx, &items, (DefKind::Fn, "bar")).unwrap();
+ let body = bar.body();
+ assert_eq!(body.blocks.len(), 1);
+ let block = &body.blocks[0];
+ assert_eq!(block.statements.len(), 1);
+ match &block.statements[0] {
+ stable_mir::mir::Statement::Assign(..) => {}
+ other => panic!("{other:?}"),
+ }
+ match &block.terminator {
+ stable_mir::mir::Terminator::Return => {}
+ other => panic!("{other:?}"),
+ }
+}
+
+// Use internal API to find a function in a crate.
+fn get_item<'a>(
+ tcx: TyCtxt,
+ items: &'a stable_mir::CrateItems,
+ item: (DefKind, &str),
+) -> Option<&'a stable_mir::CrateItem> {
+ items.iter().find(|crate_item| {
+ let def_id = rustc_internal::item_def_id(crate_item);
+ tcx.def_kind(def_id) == item.0 && tcx.def_path_str(def_id) == item.1
+ })
+}
+
+/// This test will generate and analyze a dummy crate using the stable mir.
+/// For that, it will first write the dummy crate into a file.
+/// It will invoke the compiler using a custom Callback implementation, which will
+/// invoke Stable MIR APIs after the compiler has finished its analysis.
+fn main() {
+ let path = "input.rs";
+ generate_input(&path).unwrap();
+ let args = vec![
+ "rustc".to_string(),
+ "--crate-type=lib".to_string(),
+ "--crate-name".to_string(),
+ CRATE_NAME.to_string(),
+ path.to_string(),
+ ];
+ rustc_driver::catch_fatal_errors(|| {
+ RunCompiler::new(&args, &mut SMirCalls {}).run().unwrap();
+ })
+ .unwrap();
+}
+
+struct SMirCalls {}
+
+impl Callbacks for SMirCalls {
+ /// Called after analysis. Return value instructs the compiler whether to
+ /// continue the compilation afterwards (defaults to `Compilation::Continue`)
+ fn after_analysis<'tcx>(
+ &mut self,
+ _compiler: &interface::Compiler,
+ queries: &'tcx Queries<'tcx>,
+ ) -> Compilation {
+ queries.global_ctxt().unwrap().enter(|tcx| {
+ test_stable_mir(tcx);
+ });
+ // No need to keep going.
+ Compilation::Stop
+ }
+}
+
+fn generate_input(path: &str) -> std::io::Result<()> {
+ let mut file = std::fs::File::create(path)?;
+ write!(
+ file,
+ r#"
+ mod foo {{
+ pub fn bar(i: i32) -> i64 {{
+ i as i64
+ }}
+ }}
+
+ pub fn bar(x: i32) -> i32 {{
+ x
+ }}
+
+ pub fn foo_bar(x: i32, y: i32) -> i64 {{
+ let x_64 = foo::bar(x);
+ let y_64 = foo::bar(y);
+ x_64.wrapping_add(y_64)
+ }}"#
+ )?;
+ Ok(())
+}
diff --git a/tests/ui-fulldeps/std/issue-15149.rs b/tests/ui-fulldeps/std/issue-15149.rs
deleted file mode 100644
index 064472f57..000000000
--- a/tests/ui-fulldeps/std/issue-15149.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-// run-pass
-
-#![allow(unused_variables)]
-// no-prefer-dynamic
-// ignore-cross-compile
-
-use std::env;
-use std::ffi::OsStr;
-use std::fs;
-use std::path::PathBuf;
-use std::process;
-use std::str;
-
-fn main() {
- // If we're the child, make sure we were invoked correctly
- let args: Vec<String> = env::args().collect();
- if args.len() > 1 && args[1] == "child" {
- // FIXME: This should check the whole `args[0]` instead of just
- // checking that it ends_with the executable name. This
- // is needed because of Windows, which has a different behavior.
- // See #15149 for more info.
- let my_path = env::current_exe().unwrap();
- return assert_eq!(my_path.file_stem(), Some(OsStr::new("mytest")));
- }
-
- test();
-}
-
-fn test() {
- // If we're the parent, copy our own binary to a new directory.
- let my_path = env::current_exe().unwrap();
- let my_dir = my_path.parent().unwrap();
-
- let child_dir = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap());
- let child_dir = child_dir.join("issue-15140-child");
- fs::create_dir_all(&child_dir).unwrap();
-
- let child_path = child_dir.join(&format!("mytest{}", env::consts::EXE_SUFFIX));
- fs::copy(&my_path, &child_path).unwrap();
-
- // Append the new directory to our own PATH.
- let path = {
- let mut paths: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap()).collect();
- paths.push(child_dir.to_path_buf());
- env::join_paths(paths).unwrap()
- };
-
- let child_output =
- process::Command::new("mytest").env("PATH", &path).arg("child").output().unwrap();
-
- assert!(
- child_output.status.success(),
- "child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
- str::from_utf8(&child_output.stdout).unwrap(),
- str::from_utf8(&child_output.stderr).unwrap()
- );
-}
diff --git a/tests/ui-fulldeps/std/issue-81357-unsound-file-methods.rs b/tests/ui-fulldeps/std/issue-81357-unsound-file-methods.rs
deleted file mode 100644
index fdf1150f8..000000000
--- a/tests/ui-fulldeps/std/issue-81357-unsound-file-methods.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-// run-fail
-// only-windows
-
-fn main() {
- use std::fs;
- use std::io::prelude::*;
- use std::os::windows::prelude::*;
- use std::ptr;
- use std::sync::Arc;
- use std::thread;
- use std::time::Duration;
-
- const FILE_FLAG_OVERLAPPED: u32 = 0x40000000;
-
- fn create_pipe_server(path: &str) -> fs::File {
- let mut path0 = path.as_bytes().to_owned();
- path0.push(0);
- extern "system" {
- fn CreateNamedPipeA(
- lpName: *const u8,
- dwOpenMode: u32,
- dwPipeMode: u32,
- nMaxInstances: u32,
- nOutBufferSize: u32,
- nInBufferSize: u32,
- nDefaultTimeOut: u32,
- lpSecurityAttributes: *mut u8,
- ) -> RawHandle;
- }
-
- unsafe {
- let h = CreateNamedPipeA(path0.as_ptr(), 3, 0, 1, 0, 0, 0, ptr::null_mut());
- assert_ne!(h as isize, -1);
- fs::File::from_raw_handle(h)
- }
- }
-
- let path = "\\\\.\\pipe\\repro";
- let mut server = create_pipe_server(path);
-
- let client = Arc::new(
- fs::OpenOptions::new().custom_flags(FILE_FLAG_OVERLAPPED).read(true).open(path).unwrap(),
- );
-
- let spawn_read = |is_first: bool| {
- thread::spawn({
- let f = client.clone();
- move || {
- let mut buf = [0xcc; 1];
- let mut f = f.as_ref();
- f.read(&mut buf).unwrap();
- if is_first {
- assert_ne!(buf[0], 0xcc);
- } else {
- let b = buf[0]; // capture buf[0]
- thread::sleep(Duration::from_millis(200));
-
- // Check the buffer hasn't been written to after read.
- dbg!(buf[0], b);
- assert_eq!(buf[0], b);
- }
- }
- })
- };
-
- let t1 = spawn_read(true);
- thread::sleep(Duration::from_millis(20));
- let t2 = spawn_read(false);
- thread::sleep(Duration::from_millis(100));
- let _ = server.write(b"x");
- thread::sleep(Duration::from_millis(100));
- let _ = server.write(b"y");
-
- // This is run fail because we need to test for the `abort`.
- // That failing to run is the success case.
- if t1.join().is_err() || t2.join().is_err() {
- return;
- } else {
- panic!("success");
- }
-}
diff --git a/tests/ui-fulldeps/std/stdio-from.rs b/tests/ui-fulldeps/std/stdio-from.rs
deleted file mode 100644
index fef9f27fc..000000000
--- a/tests/ui-fulldeps/std/stdio-from.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-// run-pass
-// ignore-cross-compile
-
-use std::env;
-use std::fs::File;
-use std::io;
-use std::io::{Read, Write};
-use std::process::{Command, Stdio};
-use std::path::PathBuf;
-
-fn main() {
- if env::args().len() > 1 {
- child().unwrap()
- } else {
- parent().unwrap()
- }
-}
-
-fn parent() -> io::Result<()> {
- let td = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap());
- let input = td.join("stdio-from-input");
- let output = td.join("stdio-from-output");
-
- File::create(&input)?.write_all(b"foo\n")?;
-
- // Set up this chain:
- // $ me <file | me | me >file
- // ... to duplicate each line 8 times total.
-
- let mut child1 = Command::new(env::current_exe()?)
- .arg("first")
- .stdin(File::open(&input)?) // tests File::into()
- .stdout(Stdio::piped())
- .spawn()?;
-
- let mut child3 = Command::new(env::current_exe()?)
- .arg("third")
- .stdin(Stdio::piped())
- .stdout(File::create(&output)?) // tests File::into()
- .spawn()?;
-
- // Started out of order so we can test both `ChildStdin` and `ChildStdout`.
- let mut child2 = Command::new(env::current_exe()?)
- .arg("second")
- .stdin(child1.stdout.take().unwrap()) // tests ChildStdout::into()
- .stdout(child3.stdin.take().unwrap()) // tests ChildStdin::into()
- .spawn()?;
-
- assert!(child1.wait()?.success());
- assert!(child2.wait()?.success());
- assert!(child3.wait()?.success());
-
- let mut data = String::new();
- File::open(&output)?.read_to_string(&mut data)?;
- for line in data.lines() {
- assert_eq!(line, "foo");
- }
- assert_eq!(data.lines().count(), 8);
- Ok(())
-}
-
-fn child() -> io::Result<()> {
- // double everything
- let mut input = vec![];
- io::stdin().read_to_end(&mut input)?;
- io::stdout().write_all(&input)?;
- io::stdout().write_all(&input)?;
- Ok(())
-}
diff --git a/tests/ui-fulldeps/std/switch-stdout.rs b/tests/ui-fulldeps/std/switch-stdout.rs
deleted file mode 100644
index e9501a809..000000000
--- a/tests/ui-fulldeps/std/switch-stdout.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-// run-pass
-
-use std::env;
-use std::fs::File;
-use std::io::{Read, Write};
-use std::path::PathBuf;
-
-#[cfg(unix)]
-fn switch_stdout_to(file: File) {
- use std::os::unix::prelude::*;
-
- extern "C" {
- fn dup2(old: i32, new: i32) -> i32;
- }
-
- unsafe {
- assert_eq!(dup2(file.as_raw_fd(), 1), 1);
- }
-}
-
-#[cfg(windows)]
-fn switch_stdout_to(file: File) {
- use std::os::windows::prelude::*;
-
- extern "system" {
- fn SetStdHandle(nStdHandle: u32, handle: *mut u8) -> i32;
- }
-
- const STD_OUTPUT_HANDLE: u32 = (-11i32) as u32;
-
- unsafe {
- let rc = SetStdHandle(STD_OUTPUT_HANDLE, file.into_raw_handle() as *mut _);
- assert!(rc != 0);
- }
-}
-
-fn main() {
- let path = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap());
- let path = path.join("switch-stdout-output");
- let f = File::create(&path).unwrap();
-
- println!("foo");
- std::io::stdout().flush().unwrap();
- switch_stdout_to(f);
- println!("bar");
- std::io::stdout().flush().unwrap();
-
- let mut contents = String::new();
- File::open(&path).unwrap().read_to_string(&mut contents).unwrap();
- assert_eq!(contents, "bar\n");
-}