Skip to content

Commit 7a6a812

Browse files
committed
Auto merge of #2332 - rust-lang:slash_slash_at, r=oli-obk
More robust comment parsing fixes #2170 I haven't ported the entire test suite yet. Once we've done that, I will remove the old parsing system (or in fact, turn them into errors so that accidental usage of old-style comments will be detected)
2 parents cde87d1 + 6e10661 commit 7a6a812

File tree

273 files changed

+1062
-482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+1062
-482
lines changed

Cargo.lock

+194
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/compiletest.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use colored::*;
22
use regex::Regex;
33
use std::env;
44
use std::path::PathBuf;
5-
use ui_test::{Config, Mode, OutputConflictHandling};
5+
use ui_test::{color_eyre::Result, Config, Mode, OutputConflictHandling};
66

77
fn miri_path() -> PathBuf {
88
PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri")))
99
}
1010

11-
fn run_tests(mode: Mode, path: &str, target: Option<String>) {
11+
fn run_tests(mode: Mode, path: &str, target: Option<String>) -> Result<()> {
1212
let in_rustc_test_suite = option_env!("RUSTC_STAGE").is_some();
1313

1414
// Add some flags we always want.
@@ -108,7 +108,7 @@ regexes! {
108108
"sys/[a-z]+/" => "sys/PLATFORM/",
109109
}
110110

111-
fn ui(mode: Mode, path: &str) {
111+
fn ui(mode: Mode, path: &str) -> Result<()> {
112112
let target = get_target();
113113

114114
let msg = format!(
@@ -117,20 +117,24 @@ fn ui(mode: Mode, path: &str) {
117117
);
118118
eprintln!("{}", msg.green().bold());
119119

120-
run_tests(mode, path, target);
120+
run_tests(mode, path, target)
121121
}
122122

123123
fn get_target() -> Option<String> {
124124
env::var("MIRI_TEST_TARGET").ok()
125125
}
126126

127-
fn main() {
127+
fn main() -> Result<()> {
128+
ui_test::color_eyre::install()?;
129+
128130
// Add a test env var to do environment communication tests.
129131
env::set_var("MIRI_ENV_VAR_TEST", "0");
130132
// Let the tests know where to store temp files (they might run for a different target, which can make this hard to find).
131133
env::set_var("MIRI_TEMP", env::temp_dir());
132134

133-
ui(Mode::Pass, "tests/pass");
134-
ui(Mode::Panic, "tests/panic");
135-
ui(Mode::Fail, "tests/fail");
135+
ui(Mode::Pass, "tests/pass")?;
136+
ui(Mode::Panic, "tests/panic")?;
137+
ui(Mode::Fail, "tests/fail")?;
138+
139+
Ok(())
136140
}

tests/fail/alloc/deallocate-bad-alignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, Layout};
22

3-
// error-pattern: has size 1 and alignment 1, but gave size 1 and alignment 2
3+
//@error-pattern: has size 1 and alignment 1, but gave size 1 and alignment 2
44

55
fn main() {
66
unsafe {

tests/fail/alloc/deallocate-bad-size.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, Layout};
22

3-
// error-pattern: has size 1 and alignment 1, but gave size 2 and alignment 1
3+
//@error-pattern: has size 1 and alignment 1, but gave size 2 and alignment 1
44

55
fn main() {
66
unsafe {

tests/fail/alloc/deallocate-twice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, Layout};
22

3-
// error-pattern: dereferenced after this allocation got freed
3+
//@error-pattern: dereferenced after this allocation got freed
44

55
fn main() {
66
unsafe {

tests/fail/alloc/global_system_mixup.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Make sure we detect when the `Global` and `System` allocators are mixed
22
// (even when the default `Global` uses `System`).
3-
// error-pattern: which is Rust heap memory, using
3+
//@error-pattern: which is Rust heap memory, using
44

5-
// normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation"
6-
// normalize-stderr-test: "\| +\^+" -> "| ^"
7-
// normalize-stderr-test: "libc::free\([^()]*\)|unsafe \{ HeapFree\([^()]*\) \};" -> "FREE();"
5+
//@normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation"
6+
//@normalize-stderr-test: "\| +\^+" -> "| ^"
7+
//@normalize-stderr-test: "libc::free\([^()]*\)|unsafe \{ HeapFree\([^()]*\) \};" -> "FREE();"
88

99
#![feature(allocator_api, slice_ptr_get)]
1010

0 commit comments

Comments
 (0)