Skip to content

Commit 8fbc3f6

Browse files
committed
Auto merge of #125645 - RalfJung:unclear_local_imports, r=nnethercote
add unqualified_local_imports lint This lint helps deal with rust-lang/rustfmt#4709 by having the compiler detect imports of local items that are not syntactically distinguishable from imports from other cates. Making them syntactically distinguishable ensures rustfmt can consistently apply the desired import grouping.
2 parents 41021b6 + 743b3b8 commit 8fbc3f6

File tree

20 files changed

+47
-45
lines changed

20 files changed

+47
-45
lines changed

src/borrow_tracker/stacked_borrows/mod.rs

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

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

2929
pub type AllocState = Stacks;
3030

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ mod unimap;
1919
#[cfg(test)]
2020
mod exhaustive;
2121

22-
use perms::Permission;
23-
pub use tree::Tree;
22+
use self::perms::Permission;
23+
pub use self::tree::Tree;
2424

2525
pub type AllocState = Tree;
2626

src/borrow_tracker/tree_borrows/perms.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ enum PermissionPriv {
4747
/// rejects: all child accesses (UB).
4848
Disabled,
4949
}
50-
use PermissionPriv::*;
50+
use self::PermissionPriv::*;
5151

5252
impl PartialOrd for PermissionPriv {
5353
/// PermissionPriv is ordered by the reflexive transitive closure of

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/intrinsics/atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_middle::{mir, mir::BinOp, ty};
22

33
use crate::*;
4-
use helpers::check_arg_count;
4+
use self::helpers::check_arg_count;
55

66
pub enum AtomicOp {
77
/// The `bool` indicates whether the result of the operation should be negated (`UnOp::Not`,

src/intrinsics/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use rustc_span::{Symbol, sym};
1313
use rustc_target::abi::Size;
1414

1515
use crate::*;
16-
use atomic::EvalContextExt as _;
17-
use helpers::{ToHost, ToSoft, check_arg_count};
18-
use simd::EvalContextExt as _;
16+
use self::atomic::EvalContextExt as _;
17+
use self::helpers::{ToHost, ToSoft, check_arg_count};
18+
use self::simd::EvalContextExt as _;
1919

2020
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
2121
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
clippy::cast_lossless,
5252
clippy::cast_possible_truncation,
5353
)]
54+
#![cfg_attr(not(bootstrap), feature(unqualified_local_imports))]
55+
#![cfg_attr(not(bootstrap), warn(unqualified_local_imports))]
5456
// Needed for rustdoc from bootstrap (with `-Znormalize-docs`).
5557
#![recursion_limit = "256"]
5658

src/shims/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ffi::{OsStr, OsString};
33
use rustc_data_structures::fx::FxHashMap;
44

55
use crate::*;
6-
use shims::{unix::UnixEnvVars, windows::WindowsEnvVars};
6+
use self::shims::{unix::UnixEnvVars, windows::WindowsEnvVars};
77

88
#[derive(Default)]
99
pub enum EnvVars<'tcx> {

src/shims/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_target::{
1515
use super::alloc::EvalContextExt as _;
1616
use super::backtrace::EvalContextExt as _;
1717
use crate::*;
18-
use helpers::{ToHost, ToSoft};
18+
use self::helpers::{ToHost, ToSoft};
1919

2020
/// Type of dynamic symbols (for `dlsym` et al)
2121
#[derive(Debug, Copy, Clone)]

src/shims/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod panic;
1717
pub mod time;
1818
pub mod tls;
1919

20-
pub use unix::{DirTable, EpollInterestTable, FdTable};
20+
pub use self::unix::{DirTable, EpollInterestTable, FdTable};
2121

2222
/// What needs to be done after emulating an item (a shim or an intrinsic) is done.
2323
pub enum EmulateItemResult {

0 commit comments

Comments
 (0)