summaryrefslogtreecommitdiffstats
path: root/tests/ui-fulldeps
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
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')
-rw-r--r--tests/ui-fulldeps/missing-rustc-driver-error.stderr12
-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
-rw-r--r--tests/ui-fulldeps/stable-mir/crate-info.rs39
9 files changed, 84 insertions, 30 deletions
diff --git a/tests/ui-fulldeps/missing-rustc-driver-error.stderr b/tests/ui-fulldeps/missing-rustc-driver-error.stderr
index ad03ba010..939e888e5 100644
--- a/tests/ui-fulldeps/missing-rustc-driver-error.stderr
+++ b/tests/ui-fulldeps/missing-rustc-driver-error.stderr
@@ -10,15 +10,7 @@ error: crate `indexmap` required to be available in rlib format, but was not fou
error: crate `hashbrown` required to be available in rlib format, but was not found in this form
-error: crate `ahash` required to be available in rlib format, but was not found in this form
+error: crate `equivalent` required to be available in rlib format, but was not found in this form
-error: crate `once_cell` required to be available in rlib format, but was not found in this form
-
-error: crate `getrandom` required to be available in rlib format, but was not found in this form
-
-error: crate `cfg_if` required to be available in rlib format, but was not found in this form
-
-error: crate `libc` required to be available in rlib format, but was not found in this form
-
-error: aborting due to 10 previous errors
+error: aborting due to 6 previous errors
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
diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs
index a3db2e9ef..f55d7d599 100644
--- a/tests/ui-fulldeps/stable-mir/crate-info.rs
+++ b/tests/ui-fulldeps/stable-mir/crate-info.rs
@@ -7,18 +7,22 @@
// edition: 2021
#![feature(rustc_private)]
+#![feature(assert_matches)]
extern crate rustc_driver;
extern crate rustc_hir;
extern crate rustc_interface;
extern crate rustc_middle;
+extern crate rustc_session;
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_session::EarlyErrorHandler;
use rustc_smir::{rustc_internal, stable_mir};
+use std::assert_matches::assert_matches;
use std::io::Write;
const CRATE_NAME: &str = "input";
@@ -63,6 +67,36 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
other => panic!("{other:?}"),
}
+ let types = get_item(tcx, &items, (DefKind::Fn, "types")).unwrap();
+ let body = types.body();
+ assert_eq!(body.locals.len(), 6);
+ assert_matches!(
+ body.locals[0].kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
+ );
+ assert_matches!(
+ body.locals[1].kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
+ );
+ assert_matches!(
+ body.locals[2].kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Char)
+ );
+ assert_matches!(
+ body.locals[3].kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Int(stable_mir::ty::IntTy::I32))
+ );
+ assert_matches!(
+ body.locals[4].kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Uint(stable_mir::ty::UintTy::U64))
+ );
+ assert_matches!(
+ body.locals[5].kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Float(
+ stable_mir::ty::FloatTy::F64
+ ))
+ );
+
let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap();
let body = drop.body();
assert_eq!(body.blocks.len(), 2);
@@ -121,6 +155,7 @@ impl Callbacks for SMirCalls {
/// continue the compilation afterwards (defaults to `Compilation::Continue`)
fn after_analysis<'tcx>(
&mut self,
+ _handler: &EarlyErrorHandler,
_compiler: &interface::Compiler,
queries: &'tcx Queries<'tcx>,
) -> Compilation {
@@ -153,6 +188,10 @@ fn generate_input(path: &str) -> std::io::Result<()> {
x_64.wrapping_add(y_64)
}}
+ pub fn types(b: bool, _: char, _: i32, _: u64, _: f64) -> bool {{
+ b
+ }}
+
pub fn drop(_: String) {{}}
pub fn assert(x: i32) -> i32 {{