1
Fork 0

Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-dead

Remove many `#[macro_use] extern crate foo` items

This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined.

r? `@fee1-dead`
This commit is contained in:
Matthias Krüger 2024-04-30 15:04:08 +02:00 committed by GitHub
commit 784316eadc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
320 changed files with 375 additions and 287 deletions

View file

@ -15,6 +15,7 @@ use rustc_data_structures::stable_hasher::{StableOrd, ToStableHashKey};
use rustc_errors::emitter::HumanReadableErrorType;
use rustc_errors::{ColorConfig, DiagArgValue, DiagCtxtFlags, IntoDiagArg};
use rustc_feature::UnstableFeatures;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION};
use rustc_span::source_map::FilePathMapping;
use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm};
@ -32,6 +33,7 @@ use std::iter;
use std::path::{Path, PathBuf};
use std::str::{self, FromStr};
use std::sync::LazyLock;
use tracing::debug;
mod cfg;
pub mod sigpipe;

View file

@ -10,6 +10,7 @@ use rustc_hir::def_id::{
CrateNum, DefId, LocalDefId, StableCrateId, StableCrateIdMap, LOCAL_CRATE,
};
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use rustc_target::spec::abi::Abi;

View file

@ -6,7 +6,7 @@ use rustc_errors::{
codes::*, Diag, DiagCtxt, DiagMessage, Diagnostic, EmissionGuarantee, ErrorGuaranteed, Level,
MultiSpan,
};
use rustc_macros::Diagnostic;
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{Span, Symbol};
use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple};

View file

@ -1,13 +1,12 @@
//! A module for searching for libraries
use rustc_fs_util::try_canonicalize;
use crate::search_paths::{PathKind, SearchPath};
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
use smallvec::{smallvec, SmallVec};
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use crate::search_paths::{PathKind, SearchPath};
use rustc_fs_util::fix_windows_verbatim_for_gcc;
use tracing::debug;
#[derive(Clone)]
pub struct FileSearch<'a> {

View file

@ -6,13 +6,8 @@
#![feature(iter_intersperse)]
#![allow(internal_features)]
#[macro_use]
extern crate rustc_macros;
pub mod errors;
#[macro_use]
extern crate tracing;
pub mod utils;
pub use lint::{declare_lint, declare_lint_pass, declare_tool_lint, impl_lint_pass};
pub use rustc_lint_defs as lint;

View file

@ -1,5 +1,6 @@
use crate::filesearch::make_target_lib_path;
use crate::EarlyDiagCtxt;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_target::spec::TargetTriple;
use std::path::{Path, PathBuf};

View file

@ -1,6 +1,7 @@
use crate::session::Session;
use rustc_data_structures::profiling::VerboseTimingGuard;
use rustc_fs_util::try_canonicalize;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use std::{
path::{Path, PathBuf},
sync::OnceLock,

View file

@ -1,3 +1,4 @@
use rustc_macros::{current_rustc_version, Decodable, Encodable, HashStable_Generic};
use std::fmt::{self, Display};
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]