compiletest: Support matching on diagnostics without a span

This commit is contained in:
Vadim Petrochenkov 2025-03-23 15:50:51 +03:00
parent 7d49ae9731
commit 8d5109aa6e
116 changed files with 371 additions and 105 deletions

View file

@ -202,6 +202,9 @@ several ways to match the message with the line (see the examples below):
* `~|`: Associates the error level and message with the *same* line as the
*previous comment*. This is more convenient than using multiple carets when
there are multiple messages associated with the same line.
* `~?`: Used to match error levels and messages with errors not having line
information. These can be placed on any line in the test file, but are
conventionally placed at the end.
Example:
@ -270,10 +273,23 @@ fn main() {
//~| ERROR this pattern has 1 field, but the corresponding tuple struct has 3 fields [E0023]
```
#### Error without line information
Use `//~?` to match an error without line information.
`//~?` is precise and will not match errors if their line information is available.
It should be preferred to using `error-pattern`, which is imprecise and non-exhaustive.
```rust,ignore
//@ compile-flags: --print yyyy
//~? ERROR unknown print request: `yyyy`
```
### `error-pattern`
The `error-pattern` [directive](directives.md) can be used for messages that don't
have a specific span.
The `error-pattern` [directive](directives.md) can be used for runtime messages, which don't
have a specific span, or for compile time messages if imprecise matching is required due to
multi-line platform specific diagnostics.
Let's think about this test:
@ -300,7 +316,9 @@ fn main() {
}
```
But for strict testing, try to use the `ERROR` annotation as much as possible.
But for strict testing, try to use the `ERROR` annotation as much as possible,
including `//~?` annotations for diagnostics without span.
For compile time diagnostics `error-pattern` should very rarely be necessary.
### Error levels
@ -353,7 +371,7 @@ would be a `.mir.stderr` and `.thir.stderr` file with the different outputs of
the different revisions.
> Note: cfg revisions also work inside the source code with `#[cfg]` attributes.
>
>
> By convention, the `FALSE` cfg is used to have an always-false config.
## Controlling pass/fail expectations

View file

@ -9,8 +9,6 @@ use std::sync::OnceLock;
use regex::Regex;
use tracing::*;
use self::WhichLine::*;
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum ErrorKind {
Help,
@ -50,7 +48,7 @@ impl fmt::Display for ErrorKind {
#[derive(Debug)]
pub struct Error {
pub line_num: usize,
pub line_num: Option<usize>,
/// What kind of message we expect (e.g., warning, error, suggestion).
/// `None` if not specified or unknown message kind.
pub kind: Option<ErrorKind>,
@ -63,17 +61,14 @@ impl Error {
format!(
"{: <10}line {: >3}: {}",
self.kind.map(|kind| kind.to_string()).unwrap_or_default().to_uppercase(),
self.line_num,
self.line_num_str(),
self.msg.cyan(),
)
}
}
#[derive(PartialEq, Debug)]
enum WhichLine {
ThisLine,
FollowPrevious(usize),
AdjustBackward(usize),
pub fn line_num_str(&self) -> String {
self.line_num.map_or("?".to_string(), |line_num| line_num.to_string())
}
}
/// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"
@ -105,12 +100,10 @@ pub fn load_errors(testfile: &Path, revision: Option<&str>) -> Vec<Error> {
.filter(|(_, line)| line.is_ok())
.filter_map(|(line_num, line)| {
parse_expected(last_nonfollow_error, line_num + 1, &line.unwrap(), revision).map(
|(which, error)| {
match which {
FollowPrevious(_) => {}
_ => last_nonfollow_error = Some(error.line_num),
|(follow_prev, error)| {
if !follow_prev {
last_nonfollow_error = error.line_num;
}
error
},
)
@ -123,18 +116,19 @@ fn parse_expected(
line_num: usize,
line: &str,
test_revision: Option<&str>,
) -> Option<(WhichLine, Error)> {
) -> Option<(bool, Error)> {
// Matches comments like:
// //~
// //~|
// //~^
// //~^^^^^
// //~?
// //[rev1]~
// //[rev1,rev2]~^^
static RE: OnceLock<Regex> = OnceLock::new();
let captures = RE
.get_or_init(|| Regex::new(r"//(?:\[(?P<revs>[\w\-,]+)])?~(?P<adjust>\||\^*)").unwrap())
.get_or_init(|| Regex::new(r"//(?:\[(?P<revs>[\w\-,]+)])?~(?P<adjust>\?|\||\^*)").unwrap())
.captures(line)?;
match (test_revision, captures.name("revs")) {
@ -151,11 +145,6 @@ fn parse_expected(
(Some(_), None) | (None, None) => {}
}
let (follow, adjusts) = match &captures["adjust"] {
"|" => (true, 0),
circumflexes => (false, circumflexes.len()),
};
// Get the part of the comment after the sigil (e.g. `~^^` or ~|).
let whole_match = captures.get(0).unwrap();
let (_, mut msg) = line.split_at(whole_match.end());
@ -170,28 +159,24 @@ fn parse_expected(
let msg = msg.trim().to_owned();
let (which, line_num) = if follow {
assert_eq!(adjusts, 0, "use either //~| or //~^, not both.");
let line_num = last_nonfollow_error.expect(
"encountered //~| without \
preceding //~^ line.",
);
(FollowPrevious(line_num), line_num)
let line_num_adjust = &captures["adjust"];
let (follow_prev, line_num) = if line_num_adjust == "|" {
(true, Some(last_nonfollow_error.expect("encountered //~| without preceding //~^ line")))
} else if line_num_adjust == "?" {
(false, None)
} else {
let which = if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine };
let line_num = line_num - adjusts;
(which, line_num)
(false, Some(line_num - line_num_adjust.len()))
};
debug!(
"line={} tag={:?} which={:?} kind={:?} msg={:?}",
"line={:?} tag={:?} follow_prev={:?} kind={:?} msg={:?}",
line_num,
whole_match.as_str(),
which,
follow_prev,
kind,
msg
);
Some((which, Error { line_num, kind, msg }))
Some((follow_prev, Error { line_num, kind, msg }))
}
#[cfg(test)]

View file

@ -2,7 +2,9 @@
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::OnceLock;
use regex::Regex;
use serde::Deserialize;
use crate::errors::{Error, ErrorKind};
@ -213,36 +215,24 @@ fn push_expected_errors(
// also ensure that `//~ ERROR E123` *always* works. The
// assumption is that these multi-line error messages are on their
// way out anyhow.
let with_code = |span: &DiagnosticSpan, text: &str| {
match diagnostic.code {
Some(ref code) =>
// FIXME(#33000) -- it'd be better to use a dedicated
// UI harness than to include the line/col number like
// this, but some current tests rely on it.
//
// Note: Do NOT include the filename. These can easily
// cause false matches where the expected message
// appears in the filename, and hence the message
// changes but the test still passes.
{
format!(
"{}:{}: {}:{}: {} [{}]",
span.line_start,
span.column_start,
span.line_end,
span.column_end,
text,
code.code.clone()
)
}
None =>
// FIXME(#33000) -- it'd be better to use a dedicated UI harness
{
format!(
"{}:{}: {}:{}: {}",
span.line_start, span.column_start, span.line_end, span.column_end, text
)
let with_code = |span: Option<&DiagnosticSpan>, text: &str| {
// FIXME(#33000) -- it'd be better to use a dedicated
// UI harness than to include the line/col number like
// this, but some current tests rely on it.
//
// Note: Do NOT include the filename. These can easily
// cause false matches where the expected message
// appears in the filename, and hence the message
// changes but the test still passes.
let span_str = match span {
Some(DiagnosticSpan { line_start, column_start, line_end, column_end, .. }) => {
format!("{line_start}:{column_start}: {line_end}:{column_end}")
}
None => format!("?:?: ?:?"),
};
match &diagnostic.code {
Some(code) => format!("{span_str}: {text} [{}]", code.code),
None => format!("{span_str}: {text}"),
}
};
@ -251,19 +241,41 @@ fn push_expected_errors(
// more structured shortly anyhow.
let mut message_lines = diagnostic.message.lines();
if let Some(first_line) = message_lines.next() {
for span in primary_spans {
let msg = with_code(span, first_line);
let ignore = |s| {
static RE: OnceLock<Regex> = OnceLock::new();
RE.get_or_init(|| {
Regex::new(r"aborting due to \d+ previous errors?|\d+ warnings? emitted").unwrap()
})
.is_match(s)
};
if primary_spans.is_empty() && !ignore(first_line) {
let msg = with_code(None, first_line);
let kind = ErrorKind::from_str(&diagnostic.level).ok();
expected_errors.push(Error { line_num: span.line_start, kind, msg });
expected_errors.push(Error { line_num: None, kind, msg });
} else {
for span in primary_spans {
let msg = with_code(Some(span), first_line);
let kind = ErrorKind::from_str(&diagnostic.level).ok();
expected_errors.push(Error { line_num: Some(span.line_start), kind, msg });
}
}
}
for next_line in message_lines {
for span in primary_spans {
if primary_spans.is_empty() {
expected_errors.push(Error {
line_num: span.line_start,
line_num: None,
kind: None,
msg: with_code(span, next_line),
msg: with_code(None, next_line),
});
} else {
for span in primary_spans {
expected_errors.push(Error {
line_num: Some(span.line_start),
kind: None,
msg: with_code(Some(span), next_line),
});
}
}
}
@ -272,7 +284,7 @@ fn push_expected_errors(
if let Some(ref suggested_replacement) = span.suggested_replacement {
for (index, line) in suggested_replacement.lines().enumerate() {
expected_errors.push(Error {
line_num: span.line_start + index,
line_num: Some(span.line_start + index),
kind: Some(ErrorKind::Suggestion),
msg: line.to_string(),
});
@ -290,7 +302,7 @@ fn push_expected_errors(
// Add notes for any labels that appear in the message.
for span in spans_in_this_file.iter().filter(|span| span.label.is_some()) {
expected_errors.push(Error {
line_num: span.line_start,
line_num: Some(span.line_start),
kind: Some(ErrorKind::Note),
msg: span.label.clone().unwrap(),
});
@ -309,7 +321,7 @@ fn push_backtrace(
) {
if Path::new(&expansion.span.file_name) == Path::new(&file_name) {
expected_errors.push(Error {
line_num: expansion.span.line_start,
line_num: Some(expansion.span.line_start),
kind: Some(ErrorKind::Note),
msg: format!("in this expansion of {}", expansion.macro_decl_name),
});

View file

@ -747,7 +747,7 @@ impl<'test> TestCx<'test> {
self.error(&format!(
"{}:{}: unexpected {}: '{}'",
file_name,
actual_error.line_num,
actual_error.line_num_str(),
actual_error
.kind
.as_ref()
@ -767,7 +767,7 @@ impl<'test> TestCx<'test> {
self.error(&format!(
"{}:{}: expected {} not found: {}",
file_name,
expected_error.line_num,
expected_error.line_num_str(),
expected_error.kind.as_ref().map_or("message".into(), |k| k.to_string()),
expected_error.msg
));

View file

@ -182,7 +182,7 @@ impl TestCx<'_> {
} else if explicit && !expected_errors.is_empty() {
let msg = format!(
"line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead",
expected_errors[0].line_num,
expected_errors[0].line_num_str(),
expected_errors[0].kind.unwrap_or(ErrorKind::Error),
);
self.fatal(&msg);

View file

@ -2,3 +2,5 @@
/// Foo
pub struct Xo;
//~? ERROR `--output-format=html` is not supported for the `--show-coverage` option

View file

@ -19,3 +19,7 @@
//~| NOTE see issue #44136
//~| NOTE no longer functions
//~| NOTE `doc(plugins)` is now a no-op
//~? WARN the `passes` flag no longer functions
//~? NOTE see issue #44136
//~? HELP you may want to use --document-private-items

View file

@ -1 +1,3 @@
//@ compile-flags:-Z unstable-options --show-coverage --output-format=doctest
//~? ERROR `--output-format=doctest` is not supported for the `--show-coverage` option

View file

@ -5,3 +5,5 @@
//@ check-pass
pub fn f() {}
//~? WARN `--generate-link-to-definition` option can only be used with HTML output format

View file

@ -13,3 +13,5 @@
#![deny(rustdoc::bare_urls)]
#![doc=include_str!("auxiliary/include-str-bare-urls.md")]
//~? ERROR this URL is not a hyperlink

View file

@ -12,3 +12,5 @@
pub fn foo() {}
//~^ WARN
//~^^ WARN
//~? WARN no documentation found for this crate's top-level module

View file

@ -8,3 +8,5 @@
/// </script>
pub struct Bar;
//~? ERROR unopened HTML tag `script`

View file

@ -5,3 +5,5 @@ pub fn foo() {
INVALID_FUNC();
//~^ ERROR could not resolve path
}
//~? ERROR Compilation failed, aborting rustdoc

View file

@ -1 +1,3 @@
//@ compile-flags: -Z unstable-options --scrape-examples-target-crate foobar
//~? ERROR must use --scrape-examples-output-path and --scrape-examples-target-crate together

View file

@ -1 +1,3 @@
//@ compile-flags: -Z unstable-options --scrape-examples-output-path ex.calls
//~? ERROR must use --scrape-examples-output-path and --scrape-examples-target-crate together

View file

@ -1 +1,3 @@
//@ compile-flags: --output ./foo
//~? ERROR cannot use both 'out-dir' and 'output' at once

View file

@ -58,3 +58,8 @@ pub fn main() {
global_asm!(".intel_syntax noprefix", "nop");
//[x86_64]~^ WARN avoid using `.intel_syntax`
// Global assembly errors don't have line numbers, so no error on ARM.
//[arm_llvm_18]~? ERROR unknown directive
//[arm_llvm_18]~? ERROR unknown directive
//[arm]~? ERROR unknown directive
//[arm]~? ERROR unknown directive

View file

@ -37,3 +37,5 @@
//@ [emscripten_wasm_eh_]compile-flags: --cfg emscripten_wasm_eh
fn main() {}
//~? ERROR unexpected `--cfg

View file

@ -36,3 +36,5 @@
//@ [unsafe_attr]compile-flags: --check-cfg=unsafe(cfg(foo))
fn main() {}
//~? ERROR invalid `--check-cfg` argument

View file

@ -5,3 +5,5 @@
// the path of the dylib.
fn main() {}
//~? ERROR couldn't load codegen backend /non-existing-one.so

View file

@ -34,3 +34,5 @@ fn main() {
let z = foo(double, 2);
assert_eq!(z, 4);
}
//~? WARN skipping const checks

View file

@ -10,3 +10,5 @@ const fn bar(x: usize) -> usize {
}
fn main() {}
//~? WARN skipping const checks

View file

@ -24,3 +24,5 @@ fn main() {
assert_eq!(Y, 4);
assert_eq!(Z, 4);
}
//~? WARN skipping const checks

View file

@ -19,3 +19,6 @@ fn main() {
post_monomorphization_error::stdarch_intrinsic::<2>();
//~^ NOTE the above error was encountered while instantiating
}
//~? ERROR evaluation of `post_monomorphization_error::ValidateConstImm::<2, 0, 1>::VALID` failed
//~? NOTE erroneous constant encountered

View file

@ -13,3 +13,5 @@ static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn
//~| NOTE calling a function with calling convention C using calling convention Rust
fn main() {}
//~? WARN skipping const checks

View file

@ -28,3 +28,5 @@ fn main() {
// this test only causes errors due to the line below, so post-monomorphization
let y = <String as Bar<Vec<u32>, String>>::F;
}
//~? WARN skipping const checks

View file

@ -9,3 +9,5 @@ static TEST_BAD: &mut i32 = {
//~^ ERROR could not evaluate static initializer
//~| NOTE calling non-const function `Box::<i32>::new`
};
//~? WARN skipping const checks

View file

@ -31,3 +31,5 @@ const REF_IMMUT: &u8 = &MY_STATIC;
const READ_IMMUT: u8 = *REF_IMMUT;
fn main() {}
//~? WARN skipping const checks

View file

@ -11,3 +11,5 @@ static TEST_BAD: () = {
//~^ ERROR could not evaluate static initializer
//~| NOTE inline assembly is not supported
};
//~? WARN skipping const checks

View file

@ -114,3 +114,5 @@ fn main() {
}
*OH_YES = 99; //~ ERROR cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
}
//~? WARN skipping const checks

View file

@ -9,3 +9,5 @@ static C: () = foo();
//~| NOTE calling non-const function `foo`
fn main() {}
//~? WARN skipping const checks

View file

@ -21,3 +21,5 @@ static PTR_INT_TRANSMUTE: () = unsafe {
// their `PartialEq` impl is non-`const`.
fn main() {}
//~? WARN skipping const checks

View file

@ -38,3 +38,5 @@ static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
//~^ ERROR mutable pointer in final value
fn main() {}
//~? WARN skipping const checks

View file

@ -23,3 +23,5 @@ static TEST_BAD_REF: () = {
};
fn main() {}
//~? WARN skipping const checks

View file

@ -4,3 +4,5 @@
//@ compile-flags: -Z dump-dep-graph
fn main() {}
//~? ERROR can't dump dependency graph without `-Z query-dep-graph`

View file

@ -2,3 +2,5 @@
//@ compile-flags: -Car=foo
fn main() {}
//~? WARN `-C ar`: this option is deprecated and does nothing

View file

@ -6,3 +6,9 @@
//@[no_val] compile-flags: -Cinline-threshold
fn main() {}
//[good_val]~? WARN `-C inline-threshold`: this option is deprecated and does nothing
//[bad_val]~? WARN `-C inline-threshold`: this option is deprecated and does nothing
//[bad_val]~? ERROR incorrect value `asd` for codegen option `inline-threshold`
//[no_val]~? WARN `-C inline-threshold`: this option is deprecated and does nothing
//[no_val]~? ERROR codegen option `inline-threshold` requires a number

View file

@ -2,3 +2,5 @@
//@ compile-flags: -Cno-stack-check
fn main() {}
//~? WARN `-C no-stack-check`: this option is deprecated and does nothing

View file

@ -51,3 +51,6 @@ fn main() {
let x: &Bottom = &t; //~ ERROR mismatched types
//~^ error recursion limit
}
//~? ERROR reached the recursion limit finding the struct tail for `K`
//~? ERROR reached the recursion limit finding the struct tail for `Bottom`

View file

@ -28,3 +28,5 @@ pub fn check_async() {
let _recovery_witness: () = 0; //~ ERROR mismatched types
}
//~? ERROR macro expansion ends with an incomplete expression

View file

@ -39,3 +39,5 @@ pub fn check_async() {
let _recovery_witness: () = 0; //~ ERROR mismatched types
}
//~? ERROR macro expansion ends with an incomplete expression

View file

@ -2,3 +2,5 @@
extern crate bad_main_functions;
pub use bad_main_functions::boilerplate as main;
//~? ERROR `main` function has wrong type

View file

@ -6,3 +6,5 @@
//@ compile-flags: --target x86_64_unknown-linux-musl
fn main() {}
//~? ERROR Error loading target specification: Could not find specification for target "x86_64_unknown-linux-musl"

View file

@ -7,3 +7,5 @@
extern "C" {}
fn main() {}
//[in_flag]~? ERROR unknown linking modifier `link-arg`

View file

@ -7,3 +7,5 @@
extern "C" {}
fn main() {}
//[in_flag]~? ERROR linking modifier `as-needed` is unstable

View file

@ -2,3 +2,5 @@
//@ failure-status: 1
fn main() {
}
//~? ERROR incorrect value `invalid-value` for unstable option `fmt-debug`

View file

@ -15,3 +15,5 @@ struct Foo { //~ ERROR has infinite size
struct Bar<T>([T; 1]);
fn main() {}
//~? ERROR reached the recursion limit finding the struct tail for `Take`

View file

@ -3,3 +3,6 @@
//@ [bad] compile-flags: -Cinstrument-coverage=bad-value
fn main() {}
//[blank]~? ERROR incorrect value `` for codegen option `instrument-coverage`
//[bad]~? ERROR incorrect value `bad-value` for codegen option `instrument-coverage`

View file

@ -17,3 +17,5 @@
//@ [bad] compile-flags: -Zcoverage-options=bad
fn main() {}
//[bad]~? ERROR incorrect value `bad` for unstable option `coverage-options`

View file

@ -15,3 +15,7 @@
#[lang = "sized"]
trait Sized {}
//[BADFLAGS]~? ERROR incorrect value `leaf` for unstable option `branch-protection`
//[BADFLAGSPC]~? ERROR incorrect value `pc` for unstable option `branch-protection`
//[BADTARGET]~? ERROR `-Zbranch-protection` is only supported on aarch64

View file

@ -2,3 +2,5 @@
//@ compile-flags: -Cpasses=unknown-pass
fn main() {}
//~? ERROR failed to run LLVM passes: unknown pass name 'unknown-pass'

View file

@ -1,2 +1,5 @@
// issue: 113981
pub fn main() {}
//~? ERROR invalid character '$' in crate name: `need_crate_arg_ignore_tidy$x`

View file

@ -1 +1,3 @@
//@ compile-flags: --print yyyy
//~? ERROR unknown print request: `yyyy`

View file

@ -3,3 +3,5 @@ mod auxiliary {
}
fn main() {}
//~? ERROR file not found for module `baz`

View file

@ -59,3 +59,5 @@ fn ice() {
// use `start`
fn main() {}
//~? ERROR requires `copy` lang_item

View file

@ -9,3 +9,8 @@
// Tests various illegal values for the "modifier" part of an `-l` flag.
fn main() {}
//[blank]~? ERROR invalid linking modifier syntax, expected '+' or '-' prefix
//[no-prefix]~? ERROR invalid linking modifier syntax, expected '+' or '-' prefix
//[prefix-only]~? ERROR unknown linking modifier ``
//[unknown]~? ERROR unknown linking modifier `ferris`

View file

@ -1,3 +1,5 @@
//@ compile-flags:-lstatic:+whole-archive,-whole-archive=foo
fn main() {}
//~? ERROR multiple `whole-archive` modifiers in a single `-l` option

View file

@ -3,3 +3,5 @@
//@ only-msvc
//@ normalize-stderr: "(?:.|\n)*(⦺ⅈ⽯⭏⽽◃⡽⚞)(?:.|\n)*" -> "$1"
pub fn main() {}
//~? ERROR linking with `

View file

@ -8,3 +8,6 @@
// ignore-tidy-linelength
fn main() {}
//[one]~? ERROR some `-C link-self-contained` components were both enabled and disabled: linker
//[many]~? ERROR some `-C link-self-contained` components were both enabled and disabled: crto, linker

View file

@ -22,3 +22,5 @@ fn main() {
println!("{:p}", &dep1::collision);
}
}
//~? ERROR symbol `collision` is already defined

View file

@ -19,3 +19,5 @@ extern "C" {
pub fn lib_main() {
unsafe { f(42); }
}
//~? ERROR Dlltool could not create import library with

View file

@ -10,3 +10,5 @@ extern "C" {
pub fn lib_main() {
unsafe { f(42); }
}
//~? ERROR Error calling dlltool 'does_not_exist.exe': program not found

View file

@ -31,3 +31,5 @@ fn main() {
// WARN see in the stderr file, the warning points to the included file.
include!("expansion-time-include.rs");
}
//~? WARN include macro expected single expression in source

View file

@ -27,3 +27,10 @@ fn main() {
foo();
bar();
}
//~? WARN lint `private_no_mangle_fns` has been removed
//~? WARN lint `private_no_mangle_statics` has been removed
//~? WARN lint `private_no_mangle_fns` has been removed
//~? WARN lint `private_no_mangle_statics` has been removed
//~? WARN lint `private_no_mangle_fns` has been removed
//~? WARN lint `private_no_mangle_statics` has been removed

View file

@ -1,3 +1,5 @@
//@ compile-flags: -C lto -C embed-bitcode=no
fn main() {}
//~? ERROR options `-C embed-bitcode=no` and `-C lto` are incompatible

View file

@ -1,6 +1,6 @@
//@ error-pattern include macro expected single expression
fn main() {
include!("include-single-expr-helper.rs");
include!("include-single-expr-helper-1.rs");
}
//~? ERROR include macro expected single expression

View file

@ -51,3 +51,5 @@ fn main() {
foo(true, &mut S(13), S(14), S(15));
foo(false, &mut S(13), S(14), S(15));
}
//~? ERROR stop_after_dataflow ended compilation

View file

@ -20,3 +20,5 @@ fn foo() -> Option<i32> {
}
fn main() {}
//~? ERROR stop_after_dataflow ended compilation

View file

@ -30,3 +30,5 @@ fn foo() {
}
fn main() {}
//~? ERROR stop_after_dataflow ended compilation

View file

@ -26,3 +26,5 @@ fn foo() -> i32 {
}
fn main() {}
//~? ERROR stop_after_dataflow ended compilation

View file

@ -49,3 +49,5 @@ fn main() {
foo(true, &mut S(13), S(14), S(15));
foo(false, &mut S(13), S(14), S(15));
}
//~? ERROR stop_after_dataflow ended compilation

View file

@ -22,3 +22,5 @@ fn main() {
foo(&mut S(13));
foo(&mut S(13));
}
//~? ERROR stop_after_dataflow ended compilation

View file

@ -19,3 +19,6 @@
//@[mixed] error-pattern: warning: MIR pass `ThisPassDoesNotExist` is unknown and will be ignored
fn main() {}
//[empty]~? ERROR incorrect value `` for unstable option `mir-enable-passes`
//[unprefixed]~? ERROR incorrect value `CheckAlignment` for unstable option `mir-enable-passes`

View file

@ -16,3 +16,5 @@ fn oom(_: core::alloc::Layout) -> ! {
}
extern crate alloc;
//~? ERROR no global memory allocator found but one is required

View file

@ -1,2 +1,4 @@
mod foo;
fn main() {}
//~? ERROR file not found for module `missing`

View file

@ -1,2 +1,4 @@
mod foo_inline;
fn main() {}
//~? ERROR file not found for module `missing`

View file

@ -6,3 +6,5 @@
#[panic_handler] //~ ERROR `panic_impl` lang item must be applied to a function
#[no_mangle]
static X: u32 = 42;
//~? ERROR `#[panic_handler]` function required, but not found

View file

@ -6,3 +6,6 @@
include!("auxiliary/issue-94340-inc.rs");
fn main() {}
//~? ERROR an inner attribute is not permitted in this context
//~? ERROR an inner attribute is not permitted in this context

View file

@ -3,3 +3,5 @@ mod unclosed_delim_mod;
fn main() {
let _: usize = unclosed_delim_mod::new();
}
//~? ERROR mismatched closing delimiter: `}`

View file

@ -1,2 +1,5 @@
//@ compile-flags: -Z patchable-function-entry=1,2
fn main() {}
//~? ERROR incorrect value `1,2` for unstable option `patchable-function-entry`

View file

@ -2,3 +2,5 @@
//@ needs-llvm-components: x86
fn main() {}
//~? ERROR only Apple targets currently support deployment version info

View file

@ -1,6 +1,4 @@
//@ compile-flags: -Z span-debug
//@ error-pattern:custom inner attributes are unstable
//@ error-pattern:inner macro attributes are unstable
//@ proc-macro: test-macros.rs
#![no_std] // Don't load unnecessary hygiene information from std
@ -15,3 +13,6 @@ mod module_with_attrs;
//~| ERROR custom inner attributes are unstable
fn main() {}
//~? ERROR custom inner attributes are unstable
//~? ERROR inner macro attributes are unstable

View file

@ -19,7 +19,7 @@ LL | #![print_attr]
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: non-inline modules in proc macro input are unstable
--> $DIR/inner-attr-non-inline-mod.rs:13:1
--> $DIR/inner-attr-non-inline-mod.rs:11:1
|
LL | mod module_with_attrs;
| ^^^^^^^^^^^^^^^^^^^^^^
@ -29,7 +29,7 @@ LL | mod module_with_attrs;
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: custom inner attributes are unstable
--> $DIR/inner-attr-non-inline-mod.rs:13:1
--> $DIR/inner-attr-non-inline-mod.rs:11:1
|
LL | mod module_with_attrs;
| ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -4,35 +4,35 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "deny",
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "unused_attributes",
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Ident {
ident: "mod",
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Ident {
ident: "module_with_attrs",
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Brace,
@ -40,38 +40,38 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustfmt",
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Punct {
ch: ':',
spacing: Joint,
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Punct {
ch: ':',
spacing: Alone,
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
Ident {
ident: "skip",
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0),
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
},
]

View file

@ -18,3 +18,5 @@ mod second {
}
fn main() {}
//~? ERROR using an old version of `rental`

View file

@ -5,3 +5,5 @@ fn main() {
let _ = "" + 1; //~ ERROR E0369
parse_error::Canonical.foo(); // ok, `parse_error.rs` had parse errors
}
//~? ERROR expected one of `+`, `,`, `::`, `=`, or `>`, found `From`

View file

@ -30,3 +30,5 @@ fn main() {
(CONSTANT.file(), CONSTANT.line(), CONSTANT.column()),
);
}
//~? WARN skipping const checks

View file

@ -9,3 +9,5 @@ extern crate rmeta_meta;
fn main() {
rmeta_meta::missing_optimized_mir();
}
//~? ERROR missing optimized MIR for an item in the crate `rmeta_meta`

View file

@ -2,3 +2,5 @@
//@ check-fail
fn main() {}
//~? ERROR incorrect value `default` for unstable option `on-broken-pipe`

View file

@ -2,3 +2,5 @@
//@ check-fail
fn main() {}
//~? ERROR unstable option `on-broken-pipe` requires either `kill`, `error`, or `inherit`

View file

@ -2,3 +2,5 @@
//@ check-fail
fn main() {}
//~? ERROR incorrect value `wrong` for unstable option `on-broken-pipe`

View file

@ -1,2 +1,5 @@
//@ rustc-env:RUST_MIN_STACK=banana
fn main() {}
//~? ERROR `RUST_MIN_STACK` should be a number of bytes, but was "banana"

View file

@ -6,3 +6,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`

View file

@ -7,3 +7,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`

View file

@ -10,3 +10,6 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR cfi sanitizer is not supported for this target
//~? ERROR `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`

View file

@ -7,3 +7,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`

View file

@ -6,3 +6,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`

View file

@ -6,3 +6,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`

View file

@ -4,3 +4,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR sanitizer is incompatible with statically linked libc

View file

@ -6,3 +6,5 @@
#![feature(no_core)]
#![no_core]
#![no_main]
//~? ERROR `-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`

Some files were not shown because too many files have changed in this diff Show more