summaryrefslogtreecommitdiffstats
path: root/tests/ui-fulldeps/session-diagnostic
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /tests/ui-fulldeps/session-diagnostic
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui-fulldeps/session-diagnostic')
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr2
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs4
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr8
-rw-r--r--tests/ui-fulldeps/session-diagnostic/example.ftl2
-rw-r--r--tests/ui-fulldeps/session-diagnostic/invalid-variable.rs21
-rw-r--r--tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs12
-rw-r--r--tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr14
7 files changed, 43 insertions, 20 deletions
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
index e4b8958b4..8c876213a 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
@@ -23,7 +23,7 @@ LL | arg: NotIntoDiagnosticArg,
|
= help: normalized in stderr
note: required by a bound in `Diagnostic::set_arg`
- --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:964:5
+ --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:960:5
error: aborting due to 2 previous errors
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
index 39e34d73f..ffbefce48 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
@@ -538,7 +538,7 @@ struct LabelWithTrailingPath {
#[diag(no_crate_example, code = "E0123")]
struct LabelWithTrailingNameValue {
#[label(no_crate_label, foo = "...")]
- //~^ ERROR invalid nested attribute
+ //~^ ERROR only `no_span` is a valid nested attribute
span: Span,
}
@@ -546,7 +546,7 @@ struct LabelWithTrailingNameValue {
#[diag(no_crate_example, code = "E0123")]
struct LabelWithTrailingList {
#[label(no_crate_label, foo("..."))]
- //~^ ERROR invalid nested attribute
+ //~^ ERROR only `no_span` is a valid nested attribute
span: Span,
}
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index 801e4b579..1398f9c96 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -243,7 +243,7 @@ error: invalid nested attribute
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^
|
- = help: only `style`, `code` and `applicability` are valid nested attributes
+ = help: only `no_span`, `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
--> $DIR/diagnostic-derive.rs:234:5
@@ -257,7 +257,7 @@ error: invalid nested attribute
LL | #[suggestion(msg = "bar")]
| ^^^
|
- = help: only `style`, `code` and `applicability` are valid nested attributes
+ = help: only `no_span`, `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
--> $DIR/diagnostic-derive.rs:243:5
@@ -335,13 +335,13 @@ error: a diagnostic slug must be the first argument to the attribute
LL | #[label(no_crate_label, foo)]
| ^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/diagnostic-derive.rs:540:29
|
LL | #[label(no_crate_label, foo = "...")]
| ^^^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/diagnostic-derive.rs:548:29
|
LL | #[label(no_crate_label, foo("..."))]
diff --git a/tests/ui-fulldeps/session-diagnostic/example.ftl b/tests/ui-fulldeps/session-diagnostic/example.ftl
index cb2d476d8..1d1ba8e1b 100644
--- a/tests/ui-fulldeps/session-diagnostic/example.ftl
+++ b/tests/ui-fulldeps/session-diagnostic/example.ftl
@@ -3,3 +3,5 @@ no_crate_example = this is an example message used in testing
.help = with a help
.suggestion = with a suggestion
.label = with a label
+
+no_crate_bad_reference = {$r} does not exist
diff --git a/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs
new file mode 100644
index 000000000..57798dda3
--- /dev/null
+++ b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs
@@ -0,0 +1,21 @@
+// run-fail
+// compile-flags: --test
+// test that messages referencing non-existent fields cause test failures
+
+#![feature(rustc_private)]
+#![crate_type = "lib"]
+
+extern crate rustc_driver;
+extern crate rustc_fluent_macro;
+extern crate rustc_macros;
+extern crate rustc_errors;
+use rustc_fluent_macro::fluent_messages;
+use rustc_macros::Diagnostic;
+use rustc_errors::{SubdiagnosticMessage, DiagnosticMessage};
+extern crate rustc_session;
+
+fluent_messages! { "./example.ftl" }
+
+#[derive(Diagnostic)]
+#[diag(no_crate_bad_reference)]
+struct BadRef;
diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
index 1bfbb6001..38af5b0f9 100644
--- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
+++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
@@ -85,7 +85,7 @@ struct F {
#[derive(Subdiagnostic)]
#[label(bug = "...")]
-//~^ ERROR invalid nested attribute
+//~^ ERROR only `no_span` is a valid nested attribute
//~| ERROR diagnostic slug must be first argument
struct G {
#[primary_span]
@@ -104,7 +104,7 @@ struct H {
#[derive(Subdiagnostic)]
#[label(slug = 4)]
-//~^ ERROR invalid nested attribute
+//~^ ERROR only `no_span` is a valid nested attribute
//~| ERROR diagnostic slug must be first argument
struct J {
#[primary_span]
@@ -114,7 +114,7 @@ struct J {
#[derive(Subdiagnostic)]
#[label(slug("..."))]
-//~^ ERROR invalid nested attribute
+//~^ ERROR only `no_span` is a valid nested attribute
//~| ERROR diagnostic slug must be first argument
struct K {
#[primary_span]
@@ -143,7 +143,7 @@ struct M {
#[derive(Subdiagnostic)]
#[label(no_crate_example, code = "...")]
-//~^ ERROR invalid nested attribute
+//~^ ERROR only `no_span` is a valid nested attribute
struct N {
#[primary_span]
span: Span,
@@ -152,7 +152,7 @@ struct N {
#[derive(Subdiagnostic)]
#[label(no_crate_example, applicability = "machine-applicable")]
-//~^ ERROR invalid nested attribute
+//~^ ERROR only `no_span` is a valid nested attribute
struct O {
#[primary_span]
span: Span,
@@ -224,7 +224,7 @@ enum T {
enum U {
#[label(code = "...")]
//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
- //~| ERROR invalid nested attribute
+ //~| ERROR only `no_span` is a valid nested attribute
A {
#[primary_span]
span: Span,
diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
index fca4f5068..5ddc8edd7 100644
--- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
@@ -26,7 +26,7 @@ error: `#[label = ...]` is not a valid attribute
LL | #[label = "..."]
| ^^^^^^^^^^^^^^^^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/subdiagnostic-derive.rs:87:9
|
LL | #[label(bug = "...")]
@@ -44,7 +44,7 @@ error: unexpected literal in nested attribute, expected ident
LL | #[label("...")]
| ^^^^^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/subdiagnostic-derive.rs:106:9
|
LL | #[label(slug = 4)]
@@ -56,7 +56,7 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute
LL | #[label(slug = 4)]
| ^^^^^^^^^^^^^^^^^^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/subdiagnostic-derive.rs:116:9
|
LL | #[label(slug("..."))]
@@ -74,13 +74,13 @@ error: unexpected end of input, unexpected token in nested attribute, expected i
LL | #[label()]
| ^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/subdiagnostic-derive.rs:145:27
|
LL | #[label(no_crate_example, code = "...")]
| ^^^^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/subdiagnostic-derive.rs:154:27
|
LL | #[label(no_crate_example, applicability = "machine-applicable")]
@@ -116,7 +116,7 @@ error: `#[bar(...)]` is not a valid attribute
LL | #[bar("...")]
| ^^^^^^^^^^^^^
-error: invalid nested attribute
+error: only `no_span` is a valid nested attribute
--> $DIR/subdiagnostic-derive.rs:225:13
|
LL | #[label(code = "...")]
@@ -312,7 +312,7 @@ error: invalid nested attribute
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
| ^^^^
|
- = help: only `style` and `applicability` are valid nested attributes
+ = help: only `no_span`, `style` and `applicability` are valid nested attributes
error: multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:540:1