Skip to content

Commit 321a3f0

Browse files
committed
avoid using macro_use
1 parent 5cbb61f commit 321a3f0

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

cargo-miri/src/main.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#![allow(clippy::useless_format, clippy::derive_partial_eq_without_eq, rustc::internal)]
22

3-
#[macro_use]
4-
mod util;
5-
63
mod arg;
74
mod phases;
85
mod setup;
6+
mod util;
97

108
use std::{env, iter};
119

1210
use crate::phases::*;
11+
use crate::util::show_error;
1312

1413
/// Returns `true` if our flags look like they may be for rustdoc, i.e., this is cargo calling us to
1514
/// be rustdoc. It's hard to be sure as cargo does not have a RUSTDOC_WRAPPER or an env var that

cargo-miri/src/util.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ use serde::{Deserialize, Serialize};
1111

1212
pub use crate::arg::*;
1313

14-
pub fn show_error(msg: &impl std::fmt::Display) -> ! {
14+
pub fn show_error_(msg: &impl std::fmt::Display) -> ! {
1515
eprintln!("fatal error: {msg}");
1616
std::process::exit(1)
1717
}
1818

1919
macro_rules! show_error {
20-
($($tt:tt)*) => { crate::util::show_error(&format_args!($($tt)*)) };
20+
($($tt:tt)*) => { crate::util::show_error_(&format_args!($($tt)*)) };
2121
}
22+
pub(crate) use show_error;
2223

2324
/// The information to run a crate with the given environment.
2425
#[derive(Clone, Serialize, Deserialize)]

src/bin/miri.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
)]
99

1010
// Some "regular" crates we want to share with rustc
11-
#[macro_use]
1211
extern crate tracing;
1312

1413
// The rustc crates we need
@@ -26,6 +25,8 @@ use std::num::NonZero;
2625
use std::path::PathBuf;
2726
use std::str::FromStr;
2827

28+
use tracing::debug;
29+
2930
use rustc_data_structures::sync::Lrc;
3031
use rustc_driver::Compilation;
3132
use rustc_hir::{self as hir, Node};

src/borrow_tracker/stacked_borrows/stack.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use std::ops::Range;
33

44
use rustc_data_structures::fx::FxHashSet;
5+
use tracing::trace;
56

67
use crate::borrow_tracker::{
78
stacked_borrows::{Item, Permission},

src/concurrency/init_once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use super::sync::EvalContextExtPriv as _;
77
use super::vector_clock::VClock;
88
use crate::*;
99

10-
declare_id!(InitOnceId);
10+
super::sync::declare_id!(InitOnceId);
1111

1212
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
1313
/// The current status of a one time initialization.

src/concurrency/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
pub mod data_race;
2+
pub mod init_once;
23
mod range_object_map;
3-
#[macro_use]
44
pub mod sync;
5-
pub mod init_once;
65
pub mod thread;
76
mod vector_clock;
87
pub mod weak_memory;

src/concurrency/sync.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ macro_rules! declare_id {
6161
}
6262
};
6363
}
64+
pub(super) use declare_id;
6465

6566
declare_id!(MutexId);
6667

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353

5454
// Some "regular" crates we want to share with rustc
5555
extern crate either;
56-
#[macro_use]
5756
extern crate tracing;
5857

5958
// The rustc crates we need
@@ -64,7 +63,6 @@ extern crate rustc_data_structures;
6463
extern crate rustc_errors;
6564
extern crate rustc_hir;
6665
extern crate rustc_index;
67-
#[macro_use]
6866
extern crate rustc_middle;
6967
extern crate rustc_session;
7068
extern crate rustc_span;
@@ -91,6 +89,8 @@ mod range_map;
9189
mod shims;
9290

9391
// Establish a "crate-wide prelude": we often import `crate::*`.
92+
use rustc_middle::{bug, span_bug};
93+
use tracing::{info, trace};
9494

9595
// Make all those symbols available in the same place as our own.
9696
#[doc(no_inline)]

0 commit comments

Comments
 (0)