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

+3-3
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

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+3-3
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

+2
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

+1-1
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

+1-1
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

+1-1
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 {

src/shims/panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_target::spec::PanicStrategy;
1717
use rustc_target::spec::abi::Abi;
1818

1919
use crate::*;
20-
use helpers::check_arg_count;
20+
use self::helpers::check_arg_count;
2121

2222
/// Holds all of the relevant data for when unwinding hits a `try` frame.
2323
#[derive(Debug)]

src/shims/unix/foreign_items.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use crate::shims::alloc::EvalContextExt as _;
1111
use crate::shims::unix::*;
1212
use crate::*;
1313

14-
use shims::unix::android::foreign_items as android;
15-
use shims::unix::freebsd::foreign_items as freebsd;
16-
use shims::unix::linux::foreign_items as linux;
17-
use shims::unix::macos::foreign_items as macos;
18-
use shims::unix::solarish::foreign_items as solarish;
14+
use self::shims::unix::android::foreign_items as android;
15+
use self::shims::unix::freebsd::foreign_items as freebsd;
16+
use self::shims::unix::linux::foreign_items as linux;
17+
use self::shims::unix::macos::foreign_items as macos;
18+
use self::shims::unix::solarish::foreign_items as solarish;
1919

2020
pub fn is_dyn_sym(name: &str, target_os: &str) -> bool {
2121
match name {

src/shims/unix/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::shims::os_str::bytes_to_os_str;
1515
use crate::shims::unix::fd::FileDescriptionRef;
1616
use crate::shims::unix::*;
1717
use crate::*;
18-
use shims::time::system_time_to_duration;
18+
use self::shims::time::system_time_to_duration;
1919

2020
use self::fd::FlockOp;
2121

src/shims/unix/linux/foreign_items.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::machine::SIGRTMAX;
55
use crate::machine::SIGRTMIN;
66
use crate::shims::unix::*;
77
use crate::*;
8-
use shims::unix::linux::epoll::EvalContextExt as _;
9-
use shims::unix::linux::eventfd::EvalContextExt as _;
10-
use shims::unix::linux::mem::EvalContextExt as _;
11-
use shims::unix::linux::sync::futex;
8+
use self::shims::unix::linux::epoll::EvalContextExt as _;
9+
use self::shims::unix::linux::eventfd::EvalContextExt as _;
10+
use self::shims::unix::linux::mem::EvalContextExt as _;
11+
use self::shims::unix::linux::sync::futex;
1212

1313
pub fn is_dyn_sym(name: &str) -> bool {
1414
matches!(name, "statx")

src/shims/unix/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ mod linux;
1414
mod macos;
1515
mod solarish;
1616

17-
pub use env::UnixEnvVars;
18-
pub use fd::{FdTable, FileDescription};
19-
pub use fs::DirTable;
20-
pub use linux::epoll::EpollInterestTable;
17+
pub use self::env::UnixEnvVars;
18+
pub use self::fd::{FdTable, FileDescription};
19+
pub use self::fs::DirTable;
20+
pub use self::linux::epoll::EpollInterestTable;
2121
// All the Unix-specific extension traits
22-
pub use env::EvalContextExt as _;
23-
pub use fd::EvalContextExt as _;
24-
pub use fs::EvalContextExt as _;
25-
pub use mem::EvalContextExt as _;
26-
pub use sync::EvalContextExt as _;
27-
pub use thread::EvalContextExt as _;
28-
pub use unnamed_socket::EvalContextExt as _;
22+
pub use self::env::EvalContextExt as _;
23+
pub use self::fd::EvalContextExt as _;
24+
pub use self::fs::EvalContextExt as _;
25+
pub use self::mem::EvalContextExt as _;
26+
pub use self::sync::EvalContextExt as _;
27+
pub use self::thread::EvalContextExt as _;
28+
pub use self::unnamed_socket::EvalContextExt as _;
2929

3030
// Make up some constants.
3131
const UID: u32 = 1000;

src/shims/windows/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::io::ErrorKind;
55
use rustc_data_structures::fx::FxHashMap;
66

77
use crate::*;
8-
use helpers::windows_check_buffer_size;
8+
use self::helpers::windows_check_buffer_size;
99

1010
#[derive(Default)]
1111
pub struct WindowsEnvVars {

src/shims/windows/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_target::spec::abi::Abi;
1111
use crate::shims::os_str::bytes_to_os_str;
1212
use crate::shims::windows::*;
1313
use crate::*;
14-
use shims::windows::handle::{Handle, PseudoHandle};
14+
use self::shims::windows::handle::{Handle, PseudoHandle};
1515

1616
pub fn is_dyn_sym(name: &str) -> bool {
1717
// std does dynamic detection for these symbols

src/shims/windows/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ mod handle;
55
mod sync;
66
mod thread;
77

8-
pub use env::WindowsEnvVars;
8+
pub use self::env::WindowsEnvVars;
99
// All the Windows-specific extension traits
10-
pub use env::EvalContextExt as _;
11-
pub use handle::EvalContextExt as _;
12-
pub use sync::EvalContextExt as _;
13-
pub use thread::EvalContextExt as _;
10+
pub use self::env::EvalContextExt as _;
11+
pub use self::handle::EvalContextExt as _;
12+
pub use self::sync::EvalContextExt as _;
13+
pub use self::thread::EvalContextExt as _;

src/shims/windows/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_middle::ty::layout::LayoutOf;
22
use rustc_target::spec::abi::Abi;
33

44
use crate::*;
5-
use shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle};
5+
use self::shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle};
66

77
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
88

src/shims/x86/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_target::abi::Size;
99
use rustc_target::spec::abi::Abi;
1010

1111
use crate::*;
12-
use helpers::bool_to_simd_element;
12+
use self::helpers::bool_to_simd_element;
1313

1414
mod aesni;
1515
mod avx;

0 commit comments

Comments
 (0)