Skip to content

Commit bbfdd06

Browse files
committed
fix unclear_local_imports in Miri
1 parent 16d58ab commit bbfdd06

File tree

28 files changed

+61
-59
lines changed

28 files changed

+61
-59
lines changed

src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use crate::borrow_tracker::{
2121
use crate::concurrency::data_race::{NaReadType, NaWriteType};
2222
use crate::*;
2323

24-
use diagnostics::{RetagCause, RetagInfo};
25-
pub use item::{Item, Permission};
26-
pub use stack::Stack;
24+
use self::diagnostics::{RetagCause, RetagInfo};
25+
pub use self::item::{Item, Permission};
26+
pub use self::stack::Stack;
2727

2828
pub type AllocState = Stacks;
2929

src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ pub(super) struct TbError<'node> {
297297
impl TbError<'_> {
298298
/// Produce a UB error.
299299
pub fn build<'tcx>(self) -> InterpError<'tcx> {
300-
use TransitionError::*;
300+
use self::TransitionError::*;
301301
let cause = self.access_cause;
302302
let accessed = self.accessed_info;
303303
let conflicting = self.conflicting_info;

src/tools/miri/src/borrow_tracker/tree_borrows/exhaustive.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ macro_rules! precondition {
1414
}
1515
};
1616
}
17+
#[cfg_attr(not(bootstrap), allow(unclear_local_imports))]
1718
pub(crate) use precondition;
1819

1920
// Trivial impls of `Exhaustive` for the standard types with 0, 1 and 2 elements respectively.

src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ mod unimap;
2323
#[cfg(test)]
2424
mod exhaustive;
2525

26-
use perms::Permission;
27-
pub use tree::Tree;
26+
use self::perms::Permission;
27+
pub use self::tree::Tree;
2828

2929
pub type AllocState = Tree;
3030

src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum PermissionPriv {
3636
/// rejects: all child accesses (UB).
3737
Disabled,
3838
}
39-
use PermissionPriv::*;
39+
use self::PermissionPriv::*;
4040

4141
impl PartialOrd for PermissionPriv {
4242
/// PermissionPriv is ordered by the reflexive transitive closure of
@@ -483,14 +483,14 @@ mod propagation_optimization_checks {
483483

484484
impl Exhaustive for AccessKind {
485485
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {
486-
use AccessKind::*;
486+
use self::AccessKind::*;
487487
Box::new(vec![Read, Write].into_iter())
488488
}
489489
}
490490

491491
impl Exhaustive for AccessRelatedness {
492492
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {
493-
use AccessRelatedness::*;
493+
use self::AccessRelatedness::*;
494494
Box::new(vec![This, StrictChildAccess, AncestorAccess, DistantAccess].into_iter())
495495
}
496496
}
@@ -499,7 +499,7 @@ mod propagation_optimization_checks {
499499
// For any kind of access, if we do it twice the second should be a no-op.
500500
// Even if the protector has disappeared.
501501
fn all_transitions_idempotent() {
502-
use transition::*;
502+
use self::transition::*;
503503
for old in PermissionPriv::exhaustive() {
504504
for (old_protected, new_protected) in <(bool, bool)>::exhaustive() {
505505
// Protector can't appear out of nowhere: either the permission was
@@ -525,7 +525,7 @@ mod propagation_optimization_checks {
525525
#[test]
526526
#[rustfmt::skip]
527527
fn foreign_read_is_noop_after_foreign_write() {
528-
use transition::*;
528+
use self::transition::*;
529529
let old_access = AccessKind::Write;
530530
let new_access = AccessKind::Read;
531531
for old in PermissionPriv::exhaustive() {

src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ impl AccessRelatedness {
793793
/// for the child node. This function assumes that we propagate away from the initial
794794
/// access.
795795
pub fn for_child(self) -> Self {
796-
use AccessRelatedness::*;
796+
use self::AccessRelatedness::*;
797797
match self {
798798
AncestorAccess | This => AncestorAccess,
799799
StrictChildAccess | DistantAccess => DistantAccess,

src/tools/miri/src/borrow_tracker/tree_borrows/tree/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ mod spurious_read {
135135

136136
impl Exhaustive for PtrSelector {
137137
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {
138-
use PtrSelector::*;
138+
use self::PtrSelector::*;
139139
Box::new(vec![X, Y, Other].into_iter())
140140
}
141141
}
@@ -152,7 +152,7 @@ mod spurious_read {
152152

153153
impl Exhaustive for RelPosXY {
154154
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {
155-
use RelPosXY::*;
155+
use self::RelPosXY::*;
156156
Box::new(vec![MutuallyForeign, XChildY].into_iter())
157157
}
158158
}
@@ -178,7 +178,7 @@ mod spurious_read {
178178
/// or an `AncestorAccess` relative to `y`, but it doesn't really matter
179179
/// because `DistantAccess.is_foreign() == AncestorAccess.is_foreign()`).
180180
fn rel_pair(self, xy_rel: RelPosXY) -> (AccessRelatedness, AccessRelatedness) {
181-
use AccessRelatedness::*;
181+
use self::AccessRelatedness::*;
182182
match xy_rel {
183183
RelPosXY::MutuallyForeign =>
184184
match self {

src/tools/miri/src/concurrency/data_race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
12661266
place: &MPlaceTy<'tcx, Provenance>,
12671267
atomic: AtomicRwOrd,
12681268
) -> InterpResult<'tcx> {
1269-
use AtomicRwOrd::*;
1269+
use self::AtomicRwOrd::*;
12701270
let acquire = matches!(atomic, Acquire | AcqRel | SeqCst);
12711271
let release = matches!(atomic, Release | AcqRel | SeqCst);
12721272
let this = self.eval_context_mut();

src/tools/miri/src/concurrency/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ pub mod thread;
77
mod vector_clock;
88
pub mod weak_memory;
99

10-
pub use vector_clock::VClock;
10+
pub use self::vector_clock::VClock;

src/tools/miri/src/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct RacingOp {
5959

6060
impl fmt::Display for TerminationInfo {
6161
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
62-
use TerminationInfo::*;
62+
use self::TerminationInfo::*;
6363
match self {
6464
Exit { code, .. } => write!(f, "the evaluated program completed with exit code {code}"),
6565
Abort(msg) => write!(f, "{msg}"),
@@ -212,7 +212,7 @@ pub fn report_error<'tcx>(
212212

213213
let (title, helps) = if let MachineStop(info) = e.kind() {
214214
let info = info.downcast_ref::<TerminationInfo>().expect("invalid MachineStop payload");
215-
use TerminationInfo::*;
215+
use self::TerminationInfo::*;
216216
let title = match info {
217217
Exit { code, leak_check } => return Some((*code, *leak_check)),
218218
Abort(_) => Some("abnormal termination"),
@@ -579,7 +579,7 @@ pub fn report_msg<'tcx>(
579579

580580
impl<'tcx> MiriMachine<'tcx> {
581581
pub fn emit_diagnostic(&self, e: NonHaltingDiagnostic) {
582-
use NonHaltingDiagnostic::*;
582+
use self::NonHaltingDiagnostic::*;
583583

584584
let stacktrace = Frame::generate_stacktrace_from_stack(self.threads.active_thread_stack());
585585
let (stacktrace, _was_pruned) = prune_stacktrace(stacktrace, self);

0 commit comments

Comments
 (0)