From c12ab08c14b1f607c4799893bcb2752c6fed34b4 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 10 Mar 2026 16:12:05 +1100 Subject: [PATCH] Move `Spanned`. It's defined in `rustc_span::source_map` which doesn't make any sense because it has nothing to do with source maps. This commit moves it to the crate root, a more sensible spot for something this basic. --- compiler/rustc_ast/src/ast.rs | 5 +++-- compiler/rustc_ast/src/mut_visit.rs | 3 +-- compiler/rustc_ast/src/visit.rs | 3 +-- compiler/rustc_ast_lowering/src/expr.rs | 3 +-- compiler/rustc_ast_lowering/src/pat.rs | 3 +-- compiler/rustc_ast_passes/src/feature_gate.rs | 3 +-- compiler/rustc_ast_pretty/src/pprust/state.rs | 6 ++++-- compiler/rustc_borrowck/src/diagnostics/mod.rs | 3 +-- compiler/rustc_borrowck/src/type_check/mod.rs | 3 +-- .../src/deriving/generic/ty.rs | 3 +-- compiler/rustc_codegen_cranelift/src/abi/mod.rs | 2 +- compiler/rustc_codegen_cranelift/src/common.rs | 3 +-- .../rustc_codegen_cranelift/src/intrinsics/mod.rs | 3 +-- compiler/rustc_codegen_gcc/src/context.rs | 3 +-- compiler/rustc_codegen_llvm/src/context.rs | 3 +-- compiler/rustc_codegen_ssa/src/mir/block.rs | 3 +-- compiler/rustc_const_eval/src/interpret/step.rs | 2 +- compiler/rustc_errors/src/diagnostic.rs | 3 +-- compiler/rustc_expand/src/build.rs | 3 +-- compiler/rustc_hir/src/hir.rs | 3 +-- compiler/rustc_hir_analysis/src/check/check.rs | 2 +- compiler/rustc_hir_analysis/src/check/region.rs | 8 ++++---- compiler/rustc_hir_pretty/src/lib.rs | 4 ++-- compiler/rustc_hir_typeck/src/errors.rs | 3 +-- compiler/rustc_hir_typeck/src/expr.rs | 3 +-- .../rustc_hir_typeck/src/fn_ctxt/suggestions.rs | 3 +-- compiler/rustc_hir_typeck/src/op.rs | 3 +-- compiler/rustc_lint/src/builtin.rs | 3 +-- compiler/rustc_lint/src/invalid_from_utf8.rs | 3 +-- compiler/rustc_lint/src/unused.rs | 2 +- compiler/rustc_middle/src/mir/mod.rs | 3 +-- compiler/rustc_middle/src/mir/syntax.rs | 3 +-- compiler/rustc_middle/src/queries.rs | 3 +-- compiler/rustc_middle/src/query/erase.rs | 3 +-- compiler/rustc_middle/src/query/on_disk_cache.rs | 3 +-- compiler/rustc_middle/src/ty/codec.rs | 3 +-- compiler/rustc_middle/src/ty/structural_impls.rs | 2 +- .../src/builder/custom/parse/instruction.rs | 3 +-- .../rustc_mir_build/src/builder/expr/as_rvalue.rs | 3 +-- compiler/rustc_mir_build/src/builder/expr/into.rs | 3 +-- compiler/rustc_mir_build/src/builder/expr/stmt.rs | 2 +- .../rustc_mir_build/src/builder/matches/test.rs | 3 +-- compiler/rustc_mir_build/src/builder/scope.rs | 3 +-- compiler/rustc_mir_transform/src/coroutine.rs | 3 +-- .../rustc_mir_transform/src/elaborate_drop.rs | 3 +-- .../src/function_item_references.rs | 3 +-- compiler/rustc_mir_transform/src/inline.rs | 2 +- compiler/rustc_mir_transform/src/lib.rs | 3 +-- .../rustc_mir_transform/src/mentioned_items.rs | 2 +- .../rustc_mir_transform/src/promote_consts.rs | 3 +-- compiler/rustc_mir_transform/src/shim.rs | 3 +-- compiler/rustc_monomorphize/src/collector.rs | 3 +-- .../src/mono_checks/move_check.rs | 3 +-- compiler/rustc_parse/src/parser/diagnostics.rs | 3 +-- compiler/rustc_parse/src/parser/expr.rs | 9 ++++----- compiler/rustc_parse/src/parser/item.rs | 4 ++-- compiler/rustc_parse/src/parser/pat.rs | 3 +-- compiler/rustc_passes/src/abi_test.rs | 3 +-- compiler/rustc_passes/src/layout_test.rs | 3 +-- compiler/rustc_resolve/src/diagnostics.rs | 6 ++++-- compiler/rustc_resolve/src/errors.rs | 3 +-- compiler/rustc_resolve/src/late.rs | 3 +-- compiler/rustc_span/src/lib.rs | 14 ++++++++++++++ compiler/rustc_span/src/source_map.rs | 15 --------------- .../clippy/clippy_lints/src/bool_comparison.rs | 3 +-- .../clippy_lints/src/casts/manual_dangling_ptr.rs | 2 +- .../src/floating_point_arithmetic/custom_abs.rs | 2 +- .../src/floating_point_arithmetic/expm1.rs | 2 +- .../src/floating_point_arithmetic/hypot.rs | 2 +- .../src/floating_point_arithmetic/ln1p.rs | 2 +- .../src/floating_point_arithmetic/log_division.rs | 2 +- .../src/floating_point_arithmetic/mul_add.rs | 2 +- .../src/floating_point_arithmetic/powi.rs | 2 +- .../src/floating_point_arithmetic/radians.rs | 2 +- src/tools/clippy/clippy_lints/src/len_zero.rs | 3 +-- .../clippy_lints/src/loops/manual_slice_fill.rs | 3 +-- src/tools/clippy/clippy_lints/src/loops/utils.rs | 2 +- src/tools/clippy/clippy_lints/src/manual_strip.rs | 3 +-- .../src/matches/match_like_matches.rs | 2 +- .../case_sensitive_file_extension_comparisons.rs | 2 +- .../clippy/clippy_lints/src/methods/get_first.rs | 2 +- .../clippy_lints/src/methods/get_last_with_len.rs | 2 +- .../clippy_lints/src/methods/manual_contains.rs | 2 +- .../clippy_lints/src/methods/open_options.rs | 2 +- .../clippy_lints/src/methods/suspicious_splitn.rs | 2 +- .../src/methods/vec_resize_to_zero.rs | 3 +-- .../src/missing_asserts_for_indexing.rs | 3 +-- .../src/operators/const_comparisons.rs | 3 +-- .../src/operators/float_equality_without_abs.rs | 2 +- .../clippy_lints/src/operators/manual_div_ceil.rs | 2 +- src/tools/clippy/clippy_lints/src/precedence.rs | 2 +- src/tools/clippy/clippy_lints/src/ranges.rs | 3 +-- src/tools/clippy/clippy_lints/src/strings.rs | 2 +- .../src/suspicious_operation_groupings.rs | 2 +- src/tools/clippy/clippy_lints/src/swap.rs | 3 +-- .../src/lint_without_lint_pass.rs | 3 +-- src/tools/rustfmt/src/patterns.rs | 2 +- src/tools/rustfmt/src/spanned.rs | 4 ++-- tests/ui-fulldeps/pprust-expr-roundtrip.rs | 3 +-- 99 files changed, 128 insertions(+), 183 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 5258f179d95d..74cc1ec17e6f 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -30,8 +30,9 @@ use rustc_data_structures::tagged_ptr::Tag; use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable}; pub use rustc_span::AttrId; -use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym}; +use rustc_span::{ + ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym, +}; use thin_vec::{ThinVec, thin_vec}; use crate::attr::data_structures::CfgEntry; diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index be8e1d22c9db..881b6ff107b5 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -11,8 +11,7 @@ use std::panic; use rustc_data_structures::flat_map_in_place::FlatMapInPlace; -use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span, Symbol}; +use rustc_span::{Ident, Span, Spanned, Symbol}; use smallvec::{SmallVec, smallvec}; use thin_vec::ThinVec; diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index c3c1c518d849..bdf290f9a9e6 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -15,8 +15,7 @@ pub use rustc_ast_ir::visit::VisitorResult; pub use rustc_ast_ir::{try_visit, visit_opt, walk_list, walk_visitable_list}; -use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span, Symbol}; +use rustc_span::{Ident, Span, Spanned, Symbol}; use thin_vec::ThinVec; use crate::ast::*; diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 4a2992038003..305df4065196 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -13,8 +13,7 @@ use rustc_middle::span_bug; use rustc_middle::ty::TyCtxt; use rustc_session::errors::report_lit_error; -use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{ByteSymbol, DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym}; +use rustc_span::{ByteSymbol, DUMMY_SP, DesugaringKind, Ident, Span, Spanned, Symbol, respan, sym}; use thin_vec::{ThinVec, thin_vec}; use visit::{Visitor, walk_expr}; diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index e066bce95158..c1c13977e103 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -6,8 +6,7 @@ use rustc_hir::definitions::DefPathData; use rustc_hir::{self as hir, LangItem, Target}; use rustc_middle::span_bug; -use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{DesugaringKind, Ident, Span}; +use rustc_span::{DesugaringKind, Ident, Span, Spanned, respan}; use super::errors::{ ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding, diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 72679d745665..ea8521a83140 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -7,8 +7,7 @@ use rustc_hir::attrs::AttributeKind; use rustc_session::Session; use rustc_session::parse::{feature_err, feature_warn}; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span, Symbol, sym}; +use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, sym}; use thin_vec::ThinVec; use crate::errors; diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index c85d6f454321..4ba5dc541342 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -20,9 +20,11 @@ RangeEnd, RangeSyntax, Safety, SelfKind, Term, attr, }; use rustc_span::edition::Edition; -use rustc_span::source_map::{SourceMap, Spanned}; +use rustc_span::source_map::SourceMap; use rustc_span::symbol::IdentPrinter; -use rustc_span::{BytePos, CharPos, DUMMY_SP, FileName, Ident, Pos, Span, Symbol, kw, sym}; +use rustc_span::{ + BytePos, CharPos, DUMMY_SP, FileName, Ident, Pos, Span, Spanned, Symbol, kw, sym, +}; use crate::pp::Breaks::{Consistent, Inconsistent}; use crate::pp::{self, BoxMarker, Breaks}; diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index af8f723ff378..cb11d35c44b6 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -23,8 +23,7 @@ use rustc_middle::{bug, span_bug}; use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult, MoveOutIndex}; use rustc_span::def_id::LocalDefId; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym}; +use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Spanned, Symbol, sym}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::traits::call_kind::{CallDesugaringKind, call_kind}; use rustc_trait_selection::infer::InferCtxtExt; diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 29d38af472c2..9aa8f7a2067a 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -32,8 +32,7 @@ use rustc_mir_dataflow::move_paths::MoveData; use rustc_mir_dataflow::points::DenseLocationMap; use rustc_span::def_id::CRATE_DEF_ID; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, sym}; +use rustc_span::{Span, Spanned, sym}; use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints; use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput}; diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs b/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs index 1458553d4925..e7972c5436e1 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs @@ -4,8 +4,7 @@ pub(crate) use Ty::*; use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfKind, TyKind}; use rustc_expand::base::ExtCtxt; -use rustc_span::source_map::respan; -use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw}; +use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, respan}; use thin_vec::ThinVec; /// A path, e.g., `::std::option::Option::` (global). Has support diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs index 97a19b8976d3..13f5ad5157ce 100644 --- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs @@ -20,7 +20,7 @@ use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_session::Session; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_target::callconv::{FnAbi, PassMode}; use rustc_target::spec::Arch; use smallvec::{SmallVec, smallvec}; diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index b11f42408f58..b22afca847aa 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -6,8 +6,7 @@ use rustc_middle::ty::layout::{ self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers, }; -use rustc_span::Symbol; -use rustc_span::source_map::Spanned; +use rustc_span::{Spanned, Symbol}; use rustc_target::callconv::FnAbi; use rustc_target::spec::{Arch, HasTargetSpec, Target}; diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs index ab9a11305baa..da8569dac746 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs @@ -24,8 +24,7 @@ macro_rules! intrinsic_args { use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::layout::ValidityRequirement; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; -use rustc_span::source_map::Spanned; -use rustc_span::{Symbol, sym}; +use rustc_span::{Spanned, Symbol, sym}; use rustc_target::spec::PanicStrategy; pub(crate) use self::llvm::codegen_llvm_intrinsic_call; diff --git a/compiler/rustc_codegen_gcc/src/context.rs b/compiler/rustc_codegen_gcc/src/context.rs index ada3d73f612e..5423ee5390fe 100644 --- a/compiler/rustc_codegen_gcc/src/context.rs +++ b/compiler/rustc_codegen_gcc/src/context.rs @@ -21,8 +21,7 @@ use rustc_session::Session; #[cfg(feature = "master")] use rustc_session::config::DebugInfo; -use rustc_span::source_map::respan; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Span, respan}; use rustc_target::spec::{HasTargetSpec, HasX86AbiOpt, Target, TlsModel, X86Abi}; #[cfg(feature = "master")] diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 2760683dad9d..28aa12cc83dc 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -25,8 +25,7 @@ use rustc_session::config::{ BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, FunctionReturn, PAuthKey, PacRet, }; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span, Symbol}; +use rustc_span::{DUMMY_SP, Span, Spanned, Symbol}; use rustc_symbol_mangling::mangle_internal_symbol; use rustc_target::spec::{ Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel, diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index cf643931717b..d4c10689f65c 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -12,8 +12,7 @@ use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt}; use rustc_middle::{bug, span_bug}; use rustc_session::config::OptLevel; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; use rustc_target::callconv::{ArgAbi, ArgAttributes, CastTarget, FnAbi, PassMode}; use tracing::{debug, info}; diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 083fd97aec4d..2dee1157e2a1 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -10,7 +10,7 @@ use rustc_index::IndexSlice; use rustc_middle::ty::{self, Instance, Ty}; use rustc_middle::{bug, mir, span_bug}; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_target::callconv::FnAbi; use tracing::field::Empty; use tracing::{info, instrument, trace}; diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 631ed54cc024..2764a009237b 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -11,8 +11,7 @@ use rustc_error_messages::{DiagArgMap, DiagArgName, DiagArgValue, IntoDiagArg}; use rustc_lint_defs::{Applicability, LintExpectationId}; use rustc_macros::{Decodable, Encodable}; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span, Symbol}; +use rustc_span::{DUMMY_SP, Span, Spanned, Symbol}; use tracing::debug; use crate::{ diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs index 19a2d65762e8..3680f24707df 100644 --- a/compiler/rustc_expand/src/build.rs +++ b/compiler/rustc_expand/src/build.rs @@ -5,8 +5,7 @@ self as ast, AnonConst, AttrItem, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, MgcaDisambiguation, PatKind, UnOp, attr, token, tokenstream, }; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym}; +use rustc_span::{DUMMY_SP, Ident, Span, Spanned, Symbol, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use crate::base::ExtCtxt; diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 45a363b97722..7cce0eda4dda 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -23,9 +23,8 @@ use rustc_index::IndexVec; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; use rustc_span::def_id::LocalDefId; -use rustc_span::source_map::Spanned; use rustc_span::{ - BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, Span, Symbol, kw, sym, + BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, sym, }; use rustc_target::asm::InlineAsmRegOrRegClass; use smallvec::SmallVec; diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 4157b110fbf6..83b4833b51b0 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -24,7 +24,7 @@ TypeVisitable, TypeVisitableExt, fold_regions, }; use rustc_session::lint::builtin::UNINHABITED_STATIC; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_target::spec::{AbiMap, AbiMapping}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::traits; diff --git a/compiler/rustc_hir_analysis/src/check/region.rs b/compiler/rustc_hir_analysis/src/check/region.rs index 0c611e6c4c9e..8865638e3af2 100644 --- a/compiler/rustc_hir_analysis/src/check/region.rs +++ b/compiler/rustc_hir_analysis/src/check/region.rs @@ -18,7 +18,7 @@ use rustc_middle::middle::region::*; use rustc_middle::ty::TyCtxt; use rustc_session::lint; -use rustc_span::source_map; +use rustc_span::Spanned; use tracing::debug; #[derive(Debug, Copy, Clone)] @@ -181,7 +181,7 @@ fn resolve_cond<'tcx>(visitor: &mut ScopeResolutionVisitor<'tcx>, cond: &'tcx hi // operands will be terminated). Any temporaries that would need to be dropped will be // dropped before we leave this operator's scope; terminating them here would be redundant. hir::ExprKind::Binary( - source_map::Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. }, + Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. }, _, _, ) => false, @@ -264,7 +264,7 @@ fn resolve_expr<'tcx>( // scopes, meaning that temporaries cannot outlive them. // This ensures fixed size stacks. hir::ExprKind::Binary( - source_map::Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. }, + Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. }, left, right, ) => { @@ -293,7 +293,7 @@ fn resolve_expr<'tcx>( // This is purely an optimization to reduce the number of // terminating scopes. hir::ExprKind::Binary( - source_map::Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. }, + Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. }, .., ) => false, // otherwise: mark it as terminating diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index e806d72d3dd2..82540a932741 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -23,8 +23,8 @@ GenericParam, GenericParamKind, HirId, ImplicitSelfKind, LifetimeParamKind, Node, PatKind, PreciseCapturingArg, RangeEnd, Term, TyFieldPath, TyPatKind, }; -use rustc_span::source_map::{SourceMap, Spanned}; -use rustc_span::{DUMMY_SP, FileName, Ident, Span, Symbol, kw, sym}; +use rustc_span::source_map::SourceMap; +use rustc_span::{DUMMY_SP, FileName, Ident, Span, Spanned, Symbol, kw, sym}; pub fn id_to_string(cx: &dyn rustc_hir::intravisit::HirTyCtxt<'_>, hir_id: HirId) -> String { to_string(&cx, |s| s.print_node(cx.hir_node(hir_id))) diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index 5c6a66403019..6eef15684697 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -14,8 +14,7 @@ use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_middle::ty::{self, Ty}; use rustc_span::edition::{Edition, LATEST_STABLE_EDITION}; -use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span, Symbol}; +use rustc_span::{Ident, Span, Spanned, Symbol}; use crate::FnCtxt; diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 2de101a1e452..e35129f58351 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -34,8 +34,7 @@ use rustc_session::parse::feature_err; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::hygiene::DesugaringKind; -use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span, Symbol, kw, sym}; +use rustc_span::{Ident, Span, Spanned, Symbol, kw, sym}; use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt}; use tracing::{debug, instrument, trace}; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 801f5acf9d2f..a2f4c57bd442 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -23,8 +23,7 @@ suggest_constraining_type_params, }; use rustc_session::errors::ExprParenthesesNeeded; -use rustc_span::source_map::Spanned; -use rustc_span::{ExpnKind, Ident, MacroKind, Span, Symbol, sym}; +use rustc_span::{ExpnKind, Ident, MacroKind, Span, Spanned, Symbol, sym}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::traits::DefIdOrName; use rustc_trait_selection::infer::InferCtxtExt; diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs index 4b325a7ad14a..cf61728f7c2a 100644 --- a/compiler/rustc_hir_typeck/src/op.rs +++ b/compiler/rustc_hir_typeck/src/op.rs @@ -13,8 +13,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, IsSuggestable, Ty, TyCtxt, TypeVisitableExt}; use rustc_session::errors::ExprParenthesesNeeded; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, Symbol, sym}; +use rustc_span::{Span, Spanned, Symbol, sym}; use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::traits::{FulfillmentError, Obligation, ObligationCtxt}; use tracing::debug; diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 54c8c75b88fc..af590d98c301 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -39,8 +39,7 @@ use rustc_session::lint::fcw; use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass}; use rustc_span::edition::Edition; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Ident, InnerSpan, Span, Symbol, kw, sym}; +use rustc_span::{DUMMY_SP, Ident, InnerSpan, Span, Spanned, Symbol, kw, sym}; use rustc_target::asm::InlineAsmArch; use rustc_trait_selection::infer::{InferCtxtExt, TyCtxtInferExt}; use rustc_trait_selection::traits; diff --git a/compiler/rustc_lint/src/invalid_from_utf8.rs b/compiler/rustc_lint/src/invalid_from_utf8.rs index 41b670c92c4c..f095d0a6a2f4 100644 --- a/compiler/rustc_lint/src/invalid_from_utf8.rs +++ b/compiler/rustc_lint/src/invalid_from_utf8.rs @@ -3,8 +3,7 @@ use rustc_ast::LitKind; use rustc_hir::{Expr, ExprKind}; use rustc_session::{declare_lint, declare_lint_pass}; -use rustc_span::source_map::Spanned; -use rustc_span::sym; +use rustc_span::{Spanned, sym}; use crate::lints::InvalidFromUtf8Diag; use crate::{LateContext, LateLintPass, LintContext}; diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 03a566efc8a5..2864cf9032a1 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -600,7 +600,7 @@ fn check_unused_delims_expr( && !value.span.from_expansion() && (ctx != UnusedDelimsCtx::LetScrutineeExpr || !matches!(inner.kind, ast::ExprKind::Binary( - rustc_span::source_map::Spanned { node, .. }, + rustc_span::Spanned { node, .. }, _, _, ) if node.is_lazy())) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 8ac532ff4863..2dd205e8468d 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -24,8 +24,7 @@ use rustc_index::{Idx, IndexSlice, IndexVec}; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; use rustc_serialize::{Decodable, Encodable}; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span, Symbol}; +use rustc_span::{DUMMY_SP, Span, Spanned, Symbol}; use tracing::{debug, trace}; pub use self::query::*; diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index c3da2f039485..455089f285d1 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -11,8 +11,7 @@ use rustc_index::IndexVec; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; use rustc_span::def_id::LocalDefId; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, Symbol}; +use rustc_span::{Span, Spanned, Symbol}; use rustc_target::asm::InlineAsmRegOrRegClass; use smallvec::SmallVec; diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 2636fc7024ca..c20a389f56b9 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -96,8 +96,7 @@ }; use rustc_session::lint::LintExpectationId; use rustc_span::def_id::LOCAL_CRATE; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, LocalExpnId, Span, Symbol}; +use rustc_span::{DUMMY_SP, LocalExpnId, Span, Spanned, Symbol}; use rustc_target::spec::PanicStrategy; use crate::infer::canonical::{self, Canonical}; diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs index 4d4833b4943e..a02f6f89b9b9 100644 --- a/compiler/rustc_middle/src/query/erase.rs +++ b/compiler/rustc_middle/src/query/erase.rs @@ -10,8 +10,7 @@ use std::mem::MaybeUninit; use rustc_ast::tokenstream::TokenStream; -use rustc_span::ErrorGuaranteed; -use rustc_span::source_map::Spanned; +use rustc_span::{ErrorGuaranteed, Spanned}; use crate::mir::interpret::EvalToValTreeResult; use crate::mir::mono::{MonoItem, NormalizationErrorInMono}; diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index 8db48fc2f995..6968e5b7d6d8 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -17,10 +17,9 @@ use rustc_span::hygiene::{ ExpnId, HygieneDecodeContext, HygieneEncodeContext, SyntaxContext, SyntaxContextKey, }; -use rustc_span::source_map::Spanned; use rustc_span::{ BlobDecoder, BytePos, ByteSymbol, CachingSourceMapView, ExpnData, ExpnHash, RelativeBytePos, - SourceFile, Span, SpanDecoder, SpanEncoder, StableSourceFileId, Symbol, + SourceFile, Span, SpanDecoder, SpanEncoder, Spanned, StableSourceFileId, Symbol, }; use crate::dep_graph::{DepNodeIndex, QuerySideEffect, SerializedDepNodeIndex}; diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index d1987f51f6e0..6652c5a758da 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -15,8 +15,7 @@ use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::Const; use rustc_serialize::{Decodable, Encodable}; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, SpanDecoder, SpanEncoder}; +use rustc_span::{Span, SpanDecoder, SpanEncoder, Spanned}; use crate::arena::ArenaAllocatable; use crate::infer::canonical::{CanonicalVarKind, CanonicalVarKinds}; diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 04985dd3acde..68e43bbbea20 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -8,7 +8,7 @@ use rustc_abi::TyAndLayout; use rustc_hir::def::Namespace; use rustc_hir::def_id::LocalDefId; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_type_ir::{ConstKind, TypeFolder, VisitorResult, try_visit}; use super::{GenericArg, GenericArgKind, Pattern, Region}; diff --git a/compiler/rustc_mir_build/src/builder/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/builder/custom/parse/instruction.rs index 13082d408ec0..a47a2e08c9f4 100644 --- a/compiler/rustc_mir_build/src/builder/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/builder/custom/parse/instruction.rs @@ -4,8 +4,7 @@ use rustc_middle::thir::*; use rustc_middle::ty; use rustc_middle::ty::cast::mir_cast_kind; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; use super::{PResult, ParseCtxt, parse_by_kind}; use crate::builder::custom::ParseError; diff --git a/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs index 0f206c1f01ec..a1b41510f1e1 100644 --- a/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs @@ -11,8 +11,7 @@ use rustc_middle::ty::cast::{CastTy, mir_cast_kind}; use rustc_middle::ty::util::IntTypeExt; use rustc_middle::ty::{self, Ty, UpvarArgs}; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Span, Spanned}; use tracing::debug; use crate::builder::expr::as_place::PlaceBase; diff --git a/compiler/rustc_mir_build/src/builder/expr/into.rs b/compiler/rustc_mir_build/src/builder/expr/into.rs index 24d184121ffd..446b2939e370 100644 --- a/compiler/rustc_mir_build/src/builder/expr/into.rs +++ b/compiler/rustc_mir_build/src/builder/expr/into.rs @@ -10,8 +10,7 @@ use rustc_middle::span_bug; use rustc_middle::thir::*; use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty}; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, sym}; +use rustc_span::{DUMMY_SP, Spanned, sym}; use rustc_trait_selection::infer::InferCtxtExt; use tracing::{debug, instrument}; diff --git a/compiler/rustc_mir_build/src/builder/expr/stmt.rs b/compiler/rustc_mir_build/src/builder/expr/stmt.rs index 3d603afbaa4a..99e16d182a97 100644 --- a/compiler/rustc_mir_build/src/builder/expr/stmt.rs +++ b/compiler/rustc_mir_build/src/builder/expr/stmt.rs @@ -2,7 +2,7 @@ use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::thir::*; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use tracing::debug; use crate::builder::scope::{BreakableTarget, LintLevel}; diff --git a/compiler/rustc_mir_build/src/builder/matches/test.rs b/compiler/rustc_mir_build/src/builder/matches/test.rs index 5c3173a7b148..d8911870d3ad 100644 --- a/compiler/rustc_mir_build/src/builder/matches/test.rs +++ b/compiler/rustc_mir_build/src/builder/matches/test.rs @@ -14,8 +14,7 @@ use rustc_middle::ty::util::IntTypeExt; use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt}; use rustc_span::def_id::DefId; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span, Symbol, sym}; +use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, sym}; use tracing::{debug, instrument}; use crate::builder::Builder; diff --git a/compiler/rustc_mir_build/src/builder/scope.rs b/compiler/rustc_mir_build/src/builder/scope.rs index b10df60e0f75..91610e768d01 100644 --- a/compiler/rustc_mir_build/src/builder/scope.rs +++ b/compiler/rustc_mir_build/src/builder/scope.rs @@ -94,8 +94,7 @@ use rustc_middle::{bug, span_bug}; use rustc_pattern_analysis::rustc::RustcPatCtxt; use rustc_session::lint::Level; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Span, Spanned}; use tracing::{debug, instrument}; use super::matches::BuiltMatchTree; diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index c83b10a5e583..332196e3afee 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -83,8 +83,7 @@ Analysis, Results, ResultsCursor, ResultsVisitor, visit_reachable_results, }; use rustc_span::def_id::{DefId, LocalDefId}; -use rustc_span::source_map::dummy_spanned; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Span, dummy_spanned}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::infer::TyCtxtInferExt as _; use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode, ObligationCtxt}; diff --git a/compiler/rustc_mir_transform/src/elaborate_drop.rs b/compiler/rustc_mir_transform/src/elaborate_drop.rs index e17629215b79..1fe745a5d519 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drop.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drop.rs @@ -9,8 +9,7 @@ use rustc_middle::ty::util::IntTypeExt; use rustc_middle::ty::{self, GenericArg, GenericArgsRef, Ty, TyCtxt}; use rustc_middle::{bug, span_bug, traits}; -use rustc_span::DUMMY_SP; -use rustc_span::source_map::{Spanned, dummy_spanned}; +use rustc_span::{DUMMY_SP, Spanned, dummy_spanned}; use tracing::{debug, instrument}; use crate::patch::MirPatch; diff --git a/compiler/rustc_mir_transform/src/function_item_references.rs b/compiler/rustc_mir_transform/src/function_item_references.rs index 2ae8f43cf6c8..0216e0d4cfbc 100644 --- a/compiler/rustc_mir_transform/src/function_item_references.rs +++ b/compiler/rustc_mir_transform/src/function_item_references.rs @@ -5,8 +5,7 @@ use rustc_middle::mir::*; use rustc_middle::ty::{self, EarlyBinder, GenericArgsRef, Ty, TyCtxt}; use rustc_session::lint::builtin::FUNCTION_ITEM_REFERENCES; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, sym}; +use rustc_span::{Span, Spanned, sym}; use crate::errors; diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 9069f279e981..afcea3236dbd 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -15,7 +15,7 @@ use rustc_middle::mir::*; use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TyCtxt, TypeFlags, TypeVisitableExt}; use rustc_session::config::{DebugInfo, OptLevel}; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use tracing::{debug, instrument, trace, trace_span}; use crate::cost_checker::{CostChecker, is_call_like}; diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 6bf4221d9ab7..094aae499c4b 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -27,8 +27,7 @@ use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt}; use rustc_middle::util::Providers; use rustc_middle::{bug, query, span_bug}; -use rustc_span::source_map::Spanned; -use rustc_span::{DUMMY_SP, sym}; +use rustc_span::{DUMMY_SP, Spanned, sym}; use tracing::debug; #[macro_use] diff --git a/compiler/rustc_mir_transform/src/mentioned_items.rs b/compiler/rustc_mir_transform/src/mentioned_items.rs index a9f2c32171c3..c98ca2f4da52 100644 --- a/compiler/rustc_mir_transform/src/mentioned_items.rs +++ b/compiler/rustc_mir_transform/src/mentioned_items.rs @@ -3,7 +3,7 @@ use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::{self, TyCtxt}; use rustc_session::Session; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; pub(super) struct MentionedItems; diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs index 3f5a630a2174..a47b3ce64ed2 100644 --- a/compiler/rustc_mir_transform/src/promote_consts.rs +++ b/compiler/rustc_mir_transform/src/promote_consts.rs @@ -23,8 +23,7 @@ use rustc_middle::mir::*; use rustc_middle::ty::{self, GenericArgs, List, Ty, TyCtxt, TypeVisitableExt}; use rustc_middle::{bug, mir, span_bug}; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; use tracing::{debug, instrument}; /// A `MirPass` for promotion. diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index 1abbfed1a822..4fd0629befec 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -12,8 +12,7 @@ self, CoroutineArgs, CoroutineArgsExt, EarlyBinder, GenericArgs, Ty, TyCtxt, }; use rustc_middle::{bug, span_bug}; -use rustc_span::source_map::{Spanned, dummy_spanned}; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Span, Spanned, dummy_spanned}; use tracing::{debug, instrument}; use crate::deref_separator::deref_finder; diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 3aa55cc8eb9f..e56c6dc32ff1 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -236,8 +236,7 @@ use rustc_middle::util::Providers; use rustc_middle::{bug, span_bug}; use rustc_session::config::{DebugInfo, EntryFnType}; -use rustc_span::source_map::{Spanned, dummy_spanned, respan}; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Span, Spanned, dummy_spanned, respan}; use tracing::{debug, instrument, trace}; use crate::collector::autodiff::collect_autodiff_fn; diff --git a/compiler/rustc_monomorphize/src/mono_checks/move_check.rs b/compiler/rustc_monomorphize/src/mono_checks/move_check.rs index a8f3104c0d98..a24b0443d39c 100644 --- a/compiler/rustc_monomorphize/src/mono_checks/move_check.rs +++ b/compiler/rustc_monomorphize/src/mono_checks/move_check.rs @@ -6,8 +6,7 @@ use rustc_middle::mir::{self, Location, traversal}; use rustc_middle::ty::{self, AssocTag, Instance, Ty, TyCtxt, TypeFoldable}; use rustc_session::lint::builtin::LARGE_ASSIGNMENTS; -use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span, sym}; +use rustc_span::{Ident, Span, Spanned, sym}; use tracing::{debug, trace}; use crate::errors::LargeAssignmentsLint; diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 284e651d94ad..47ac91feefd4 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -16,9 +16,8 @@ pluralize, }; use rustc_session::errors::ExprParenthesesNeeded; -use rustc_span::source_map::Spanned; use rustc_span::symbol::used_keywords; -use rustc_span::{BytePos, DUMMY_SP, Ident, Span, SpanSnippetError, Symbol, kw, sym}; +use rustc_span::{BytePos, DUMMY_SP, Ident, Span, SpanSnippetError, Spanned, Symbol, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::{debug, trace}; diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 4297086983b4..adfc68f4bb22 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -25,8 +25,7 @@ use rustc_session::lint::BuiltinLintDiag; use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP; use rustc_span::edition::Edition; -use rustc_span::source_map::{self, Spanned}; -use rustc_span::{BytePos, ErrorGuaranteed, Ident, Pos, Span, Symbol, kw, sym}; +use rustc_span::{BytePos, ErrorGuaranteed, Ident, Pos, Span, Spanned, Symbol, kw, respan, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::instrument; @@ -296,12 +295,12 @@ pub(super) fn parse_expr_assoc_rest_with( let span = self.mk_expr_sp(&lhs, lhs_span, op_span, rhs.span); lhs = match op { AssocOp::Binary(ast_op) => { - let binary = self.mk_binary(source_map::respan(cur_op_span, ast_op), lhs, rhs); + let binary = self.mk_binary(respan(cur_op_span, ast_op), lhs, rhs); self.mk_expr(span, binary) } AssocOp::Assign => self.mk_expr(span, ExprKind::Assign(lhs, rhs, cur_op_span)), AssocOp::AssignOp(aop) => { - let aopexpr = self.mk_assign_op(source_map::respan(cur_op_span, aop), lhs, rhs); + let aopexpr = self.mk_assign_op(respan(cur_op_span, aop), lhs, rhs); self.mk_expr(span, aopexpr) } AssocOp::Cast | AssocOp::Range(_) => { @@ -409,7 +408,7 @@ pub(super) fn check_assoc_op(&self) -> Option> { } _ => return None, }; - Some(source_map::respan(span, op)) + Some(respan(span, op)) } /// Checks if this expression is a successfully parsed statement. diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index db5be5feaeb6..0f4927432f6f 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -13,7 +13,7 @@ use rustc_session::lint::builtin::VARARGS_WITHOUT_PATTERN; use rustc_span::edit_distance::edit_distance; use rustc_span::edition::Edition; -use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, source_map, sym}; +use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, respan, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::debug; @@ -3557,7 +3557,7 @@ fn parse_self_param(&mut self) -> PResult<'a, Option> { _ => return Ok(None), }; - let eself = source_map::respan(eself_lo.to(eself_hi), eself); + let eself = respan(eself_lo.to(eself_hi), eself); Ok(Some(Param::from_self(AttrVec::default(), eself, eself_ident))) } diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 528b69abbf1a..7ee7781f6be0 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -12,8 +12,7 @@ use rustc_ast_pretty::pprust; use rustc_errors::{Applicability, Diag, DiagArgValue, PResult, StashKey}; use rustc_session::errors::ExprParenthesesNeeded; -use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{BytePos, ErrorGuaranteed, Ident, Span, kw, sym}; +use rustc_span::{BytePos, ErrorGuaranteed, Ident, Span, Spanned, kw, respan, sym}; use thin_vec::{ThinVec, thin_vec}; use super::{ForceCollect, Parser, PathStyle, Restrictions, Trailing, UsePreAttrPos}; diff --git a/compiler/rustc_passes/src/abi_test.rs b/compiler/rustc_passes/src/abi_test.rs index 3da0978e5ff8..7d1ee1ffbc36 100644 --- a/compiler/rustc_passes/src/abi_test.rs +++ b/compiler/rustc_passes/src/abi_test.rs @@ -5,8 +5,7 @@ use rustc_middle::span_bug; use rustc_middle::ty::layout::{FnAbiError, LayoutError}; use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt}; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; use rustc_target::callconv::FnAbi; use super::layout_test::ensure_wf; diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs index 68834cf7d55a..f4f5ae6c1683 100644 --- a/compiler/rustc_passes/src/layout_test.rs +++ b/compiler/rustc_passes/src/layout_test.rs @@ -6,8 +6,7 @@ use rustc_middle::span_bug; use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutError, LayoutOfHelpers}; use rustc_middle::ty::{self, Ty, TyCtxt}; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::infer::TyCtxtInferExt; use rustc_trait_selection::traits; diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 1b1198af41c0..12cc5649c41d 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -32,8 +32,10 @@ use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; -use rustc_span::source_map::{SourceMap, Spanned}; -use rustc_span::{BytePos, Ident, RemapPathScopeComponents, Span, Symbol, SyntaxContext, kw, sym}; +use rustc_span::source_map::SourceMap; +use rustc_span::{ + BytePos, Ident, RemapPathScopeComponents, Span, Spanned, Symbol, SyntaxContext, kw, sym, +}; use thin_vec::{ThinVec, thin_vec}; use tracing::{debug, instrument}; diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 63ffdbc37f7d..7ab85e5a205f 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -5,8 +5,7 @@ EmissionGuarantee, IntoDiagArg, Level, MultiSpan, Subdiagnostic, msg, }; use rustc_macros::{Diagnostic, Subdiagnostic}; -use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span, Symbol}; +use rustc_span::{Ident, Span, Spanned, Symbol}; use crate::Res; use crate::late::PatternSource; diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 1e2daff6d97c..453fe9d7a8e0 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -37,8 +37,7 @@ use rustc_session::config::{CrateType, ResolveDocLinks}; use rustc_session::lint; use rustc_session::parse::feature_err; -use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{BytePos, DUMMY_SP, Ident, Span, Symbol, kw, sym}; +use rustc_span::{BytePos, DUMMY_SP, Ident, Span, Spanned, Symbol, kw, respan, sym}; use smallvec::{SmallVec, smallvec}; use thin_vec::ThinVec; use tracing::{debug, instrument, trace}; diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index a1d43d986384..d7d2ecb5bbe7 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -90,6 +90,20 @@ #[cfg(test)] mod tests; +#[derive(Clone, Encodable, Decodable, Debug, Copy, PartialEq, Hash, HashStable_Generic)] +pub struct Spanned { + pub node: T, + pub span: Span, +} + +pub fn respan(sp: Span, t: T) -> Spanned { + Spanned { node: t, span: sp } +} + +pub fn dummy_spanned(t: T) -> Spanned { + respan(DUMMY_SP, t) +} + /// Per-session global variables: this struct is stored in thread-local storage /// in such a way that it is accessible without any kind of handle to all /// threads within the compilation session, but is not accessible outside the diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 35694be9e492..ec335e7b4339 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -15,7 +15,6 @@ use rustc_data_structures::sync::{IntoDynSyncSend, MappedReadGuard, ReadGuard, RwLock}; use rustc_data_structures::unhash::UnhashMap; -use rustc_macros::{Decodable, Encodable}; use tracing::{debug, instrument, trace}; use crate::*; @@ -74,20 +73,6 @@ fn deref(&self) -> &Self::Target { impl !DerefMut for MonotonicVec {} } -#[derive(Clone, Encodable, Decodable, Debug, Copy, PartialEq, Hash, HashStable_Generic)] -pub struct Spanned { - pub node: T, - pub span: Span, -} - -pub fn respan(sp: Span, t: T) -> Spanned { - Spanned { node: t, span: sp } -} - -pub fn dummy_spanned(t: T) -> Spanned { - respan(DUMMY_SP, t) -} - // _____________________________________________________________________________ // SourceFile, MultiByteChar, FileName, FileLines // diff --git a/src/tools/clippy/clippy_lints/src/bool_comparison.rs b/src/tools/clippy/clippy_lints/src/bool_comparison.rs index 722095909a6f..feeefefc3b8f 100644 --- a/src/tools/clippy/clippy_lints/src/bool_comparison.rs +++ b/src/tools/clippy/clippy_lints/src/bool_comparison.rs @@ -6,8 +6,7 @@ use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints/src/casts/manual_dangling_ptr.rs b/src/tools/clippy/clippy_lints/src/casts/manual_dangling_ptr.rs index 56779e8ce3d9..55b0945f0962 100644 --- a/src/tools/clippy/clippy_lints/src/casts/manual_dangling_ptr.rs +++ b/src/tools/clippy/clippy_lints/src/casts/manual_dangling_ptr.rs @@ -6,7 +6,7 @@ use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind, GenericArg, Mutability, QPath, Ty, TyKind}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::MANUAL_DANGLING_PTR; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/custom_abs.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/custom_abs.rs index d12a32e15881..6578cf20e637 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/custom_abs.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/custom_abs.rs @@ -7,7 +7,7 @@ use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp}; use rustc_lint::LateContext; use rustc_span::SyntaxContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::SUBOPTIMAL_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/expm1.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/expm1.rs index 9a4c97569308..bf376a51fec9 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/expm1.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/expm1.rs @@ -6,7 +6,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::IMPRECISE_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/hypot.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/hypot.rs index 49f8ba4bf825..8d3bd8084db8 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/hypot.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/hypot.rs @@ -6,7 +6,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::IMPRECISE_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/ln1p.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/ln1p.rs index 4c9aa96b5042..f37737c71aee 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/ln1p.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/ln1p.rs @@ -4,7 +4,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::IMPRECISE_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/log_division.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/log_division.rs index e3419ffad72a..947935369de1 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/log_division.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/log_division.rs @@ -4,7 +4,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::SUBOPTIMAL_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/mul_add.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/mul_add.rs index e0a6498f62fd..888d5b7b762a 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/mul_add.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/mul_add.rs @@ -5,7 +5,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::SUBOPTIMAL_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/powi.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/powi.rs index a61a2a82c023..b0b65b357d7a 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/powi.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/powi.rs @@ -6,7 +6,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::SUBOPTIMAL_FLOPS; diff --git a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/radians.rs b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/radians.rs index 2021f00a97e8..8480626133fd 100644 --- a/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/radians.rs +++ b/src/tools/clippy/clippy_lints/src/floating_point_arithmetic/radians.rs @@ -6,7 +6,7 @@ use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use std::f32::consts as f32_consts; use std::f64::consts as f64_consts; diff --git a/src/tools/clippy/clippy_lints/src/len_zero.rs b/src/tools/clippy/clippy_lints/src/len_zero.rs index d683abd3d33b..f906bba423b3 100644 --- a/src/tools/clippy/clippy_lints/src/len_zero.rs +++ b/src/tools/clippy/clippy_lints/src/len_zero.rs @@ -13,8 +13,7 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::{self, Ty}; use rustc_session::impl_lint_pass; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, Symbol}; +use rustc_span::{Span, Spanned, Symbol}; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints/src/loops/manual_slice_fill.rs b/src/tools/clippy/clippy_lints/src/loops/manual_slice_fill.rs index a2ff60a3d8ac..5d09f755bcd1 100644 --- a/src/tools/clippy/clippy_lints/src/loops/manual_slice_fill.rs +++ b/src/tools/clippy/clippy_lints/src/loops/manual_slice_fill.rs @@ -13,8 +13,7 @@ use rustc_hir::def::Res; use rustc_hir::{Expr, ExprKind, Pat}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; -use rustc_span::sym; +use rustc_span::{Spanned, sym}; use super::MANUAL_SLICE_FILL; diff --git a/src/tools/clippy/clippy_lints/src/loops/utils.rs b/src/tools/clippy/clippy_lints/src/loops/utils.rs index 2c37e2679d97..86f4e606a176 100644 --- a/src/tools/clippy/clippy_lints/src/loops/utils.rs +++ b/src/tools/clippy/clippy_lints/src/loops/utils.rs @@ -8,7 +8,7 @@ use rustc_lint::LateContext; use rustc_middle::hir::nested_filter; use rustc_middle::ty::{self, Ty}; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_span::symbol::{Symbol, sym}; #[derive(Debug, PartialEq, Eq)] diff --git a/src/tools/clippy/clippy_lints/src/manual_strip.rs b/src/tools/clippy/clippy_lints/src/manual_strip.rs index 526163244596..e0a60e3747a0 100644 --- a/src/tools/clippy/clippy_lints/src/manual_strip.rs +++ b/src/tools/clippy/clippy_lints/src/manual_strip.rs @@ -15,8 +15,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext as _}; use rustc_middle::ty; use rustc_session::impl_lint_pass; -use rustc_span::source_map::Spanned; -use rustc_span::{Symbol, SyntaxContext}; +use rustc_span::{Spanned, Symbol, SyntaxContext}; use std::iter; declare_clippy_lint! { diff --git a/src/tools/clippy/clippy_lints/src/matches/match_like_matches.rs b/src/tools/clippy/clippy_lints/src/matches/match_like_matches.rs index 347560b14eea..3a16c2ed8790 100644 --- a/src/tools/clippy/clippy_lints/src/matches/match_like_matches.rs +++ b/src/tools/clippy/clippy_lints/src/matches/match_like_matches.rs @@ -10,7 +10,7 @@ use rustc_hir::{Arm, BorrowKind, Expr, ExprKind, Pat, PatKind, QPath}; use rustc_lint::{LateContext, LintContext}; use rustc_middle::ty; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::MATCH_LIKE_MATCHES_MACRO; diff --git a/src/tools/clippy/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs b/src/tools/clippy/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs index b4b10e972f6d..23a0046dec76 100644 --- a/src/tools/clippy/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs +++ b/src/tools/clippy/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs @@ -8,7 +8,7 @@ use rustc_hir::{Expr, ExprKind, LangItem}; use rustc_lint::LateContext; use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS; diff --git a/src/tools/clippy/clippy_lints/src/methods/get_first.rs b/src/tools/clippy/clippy_lints/src/methods/get_first.rs index 414c4e0cd381..cb5d1ec374fc 100644 --- a/src/tools/clippy/clippy_lints/src/methods/get_first.rs +++ b/src/tools/clippy/clippy_lints/src/methods/get_first.rs @@ -7,7 +7,7 @@ use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::GET_FIRST; diff --git a/src/tools/clippy/clippy_lints/src/methods/get_last_with_len.rs b/src/tools/clippy/clippy_lints/src/methods/get_last_with_len.rs index 171079f52d9a..14e40328a416 100644 --- a/src/tools/clippy/clippy_lints/src/methods/get_last_with_len.rs +++ b/src/tools/clippy/clippy_lints/src/methods/get_last_with_len.rs @@ -5,7 +5,7 @@ use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; use rustc_middle::ty; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::GET_LAST_WITH_LEN; diff --git a/src/tools/clippy/clippy_lints/src/methods/manual_contains.rs b/src/tools/clippy/clippy_lints/src/methods/manual_contains.rs index d2906b2776f8..f1d399e1bbd2 100644 --- a/src/tools/clippy/clippy_lints/src/methods/manual_contains.rs +++ b/src/tools/clippy/clippy_lints/src/methods/manual_contains.rs @@ -9,7 +9,7 @@ use rustc_hir::{BinOpKind, Body, Expr, ExprKind, HirId, QPath}; use rustc_lint::LateContext; use rustc_middle::ty; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::MANUAL_CONTAINS; diff --git a/src/tools/clippy/clippy_lints/src/methods/open_options.rs b/src/tools/clippy/clippy_lints/src/methods/open_options.rs index 1b520a9edb56..042558d645e6 100644 --- a/src/tools/clippy/clippy_lints/src/methods/open_options.rs +++ b/src/tools/clippy/clippy_lints/src/methods/open_options.rs @@ -8,7 +8,7 @@ use rustc_lint::LateContext; use rustc_middle::ty::Ty; use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::{NONSENSICAL_OPEN_OPTIONS, SUSPICIOUS_OPEN_OPTIONS}; diff --git a/src/tools/clippy/clippy_lints/src/methods/suspicious_splitn.rs b/src/tools/clippy/clippy_lints/src/methods/suspicious_splitn.rs index be1481ebb996..98b7834178f2 100644 --- a/src/tools/clippy/clippy_lints/src/methods/suspicious_splitn.rs +++ b/src/tools/clippy/clippy_lints/src/methods/suspicious_splitn.rs @@ -3,7 +3,7 @@ use rustc_hir::{Expr, ExprKind}; use rustc_lint::LateContext; use rustc_span::Symbol; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::SUSPICIOUS_SPLITN; diff --git a/src/tools/clippy/clippy_lints/src/methods/vec_resize_to_zero.rs b/src/tools/clippy/clippy_lints/src/methods/vec_resize_to_zero.rs index 5debaab2067b..8979f9973d6f 100644 --- a/src/tools/clippy/clippy_lints/src/methods/vec_resize_to_zero.rs +++ b/src/tools/clippy/clippy_lints/src/methods/vec_resize_to_zero.rs @@ -5,8 +5,7 @@ use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind}; use rustc_lint::LateContext; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, sym}; +use rustc_span::{Span, Spanned, sym}; use super::VEC_RESIZE_TO_ZERO; diff --git a/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs b/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs index 2773f537efc6..b5becbdeb30d 100644 --- a/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs +++ b/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs @@ -15,8 +15,7 @@ use rustc_hir::{Block, Body, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; -use rustc_span::source_map::Spanned; -use rustc_span::{Span, Symbol, sym}; +use rustc_span::{Span, Spanned, Symbol, sym}; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints/src/operators/const_comparisons.rs b/src/tools/clippy/clippy_lints/src/operators/const_comparisons.rs index 56001a185771..e5a5b46b7b2e 100644 --- a/src/tools/clippy/clippy_lints/src/operators/const_comparisons.rs +++ b/src/tools/clippy/clippy_lints/src/operators/const_comparisons.rs @@ -7,8 +7,7 @@ use rustc_lint::LateContext; use rustc_middle::ty::layout::HasTyCtxt; use rustc_middle::ty::{Ty, TypeckResults}; -use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::{Span, Spanned}; use clippy_utils::SpanlessEq; use clippy_utils::diagnostics::span_lint_and_note; diff --git a/src/tools/clippy/clippy_lints/src/operators/float_equality_without_abs.rs b/src/tools/clippy/clippy_lints/src/operators/float_equality_without_abs.rs index 97b3c0d02e84..6c6221525b57 100644 --- a/src/tools/clippy/clippy_lints/src/operators/float_equality_without_abs.rs +++ b/src/tools/clippy/clippy_lints/src/operators/float_equality_without_abs.rs @@ -6,7 +6,7 @@ use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; use rustc_middle::ty; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::FLOAT_EQUALITY_WITHOUT_ABS; diff --git a/src/tools/clippy/clippy_lints/src/operators/manual_div_ceil.rs b/src/tools/clippy/clippy_lints/src/operators/manual_div_ceil.rs index 6751532ecbc7..a0f61f6d36c4 100644 --- a/src/tools/clippy/clippy_lints/src/operators/manual_div_ceil.rs +++ b/src/tools/clippy/clippy_lints/src/operators/manual_div_ceil.rs @@ -9,7 +9,7 @@ use rustc_hir::{Expr, ExprKind}; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use super::MANUAL_DIV_CEIL; diff --git a/src/tools/clippy/clippy_lints/src/precedence.rs b/src/tools/clippy/clippy_lints/src/precedence.rs index 034fe8edc715..1f0371c78200 100644 --- a/src/tools/clippy/clippy_lints/src/precedence.rs +++ b/src/tools/clippy/clippy_lints/src/precedence.rs @@ -5,7 +5,7 @@ use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass, Lint}; use rustc_session::declare_lint_pass; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints/src/ranges.rs b/src/tools/clippy/clippy_lints/src/ranges.rs index 61087ad88457..39019c646bd5 100644 --- a/src/tools/clippy/clippy_lints/src/ranges.rs +++ b/src/tools/clippy/clippy_lints/src/ranges.rs @@ -14,8 +14,7 @@ use rustc_lint::{LateContext, LateLintPass, Lint}; use rustc_middle::ty::{self, ClauseKind, GenericArgKind, PredicatePolarity, Ty}; use rustc_session::impl_lint_pass; -use rustc_span::source_map::Spanned; -use rustc_span::{DesugaringKind, Span}; +use rustc_span::{DesugaringKind, Span, Spanned}; use std::cmp::Ordering; declare_clippy_lint! { diff --git a/src/tools/clippy/clippy_lints/src/strings.rs b/src/tools/clippy/clippy_lints/src/strings.rs index ab11c37b5041..61b5842ea542 100644 --- a/src/tools/clippy/clippy_lints/src/strings.rs +++ b/src/tools/clippy/clippy_lints/src/strings.rs @@ -11,7 +11,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::ty; use rustc_session::declare_lint_pass; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs b/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs index 9fa4d2c142b5..44e35b8dc71b 100644 --- a/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs +++ b/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs @@ -8,7 +8,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::declare_lint_pass; use rustc_span::Span; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_span::symbol::Ident; declare_clippy_lint! { diff --git a/src/tools/clippy/clippy_lints/src/swap.rs b/src/tools/clippy/clippy_lints/src/swap.rs index 0c78ed84adc4..01482b2475f7 100644 --- a/src/tools/clippy/clippy_lints/src/swap.rs +++ b/src/tools/clippy/clippy_lints/src/swap.rs @@ -14,9 +14,8 @@ use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::ty; use rustc_session::declare_lint_pass; -use rustc_span::source_map::Spanned; use rustc_span::symbol::Ident; -use rustc_span::{Span, SyntaxContext}; +use rustc_span::{Span, Spanned, SyntaxContext}; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints_internal/src/lint_without_lint_pass.rs b/src/tools/clippy/clippy_lints_internal/src/lint_without_lint_pass.rs index f56b6f31550b..cab1422c3000 100644 --- a/src/tools/clippy/clippy_lints_internal/src/lint_without_lint_pass.rs +++ b/src/tools/clippy/clippy_lints_internal/src/lint_without_lint_pass.rs @@ -12,9 +12,8 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::hir::nested_filter; use rustc_session::{declare_tool_lint, impl_lint_pass}; -use rustc_span::Span; -use rustc_span::source_map::Spanned; use rustc_span::symbol::Symbol; +use rustc_span::{Span, Spanned}; declare_tool_lint! { /// ### What it does diff --git a/src/tools/rustfmt/src/patterns.rs b/src/tools/rustfmt/src/patterns.rs index df2a8dc5c6fd..0a9ff4771b0e 100644 --- a/src/tools/rustfmt/src/patterns.rs +++ b/src/tools/rustfmt/src/patterns.rs @@ -361,7 +361,7 @@ pub(crate) fn rewrite_range_pat( shape: Shape, lhs: &Option>, rhs: &Option>, - end_kind: &rustc_span::source_map::Spanned, + end_kind: &rustc_span::Spanned, span: Span, ) -> RewriteResult { let infix = match end_kind.node { diff --git a/src/tools/rustfmt/src/spanned.rs b/src/tools/rustfmt/src/spanned.rs index 020651e2daac..143fb1dea222 100644 --- a/src/tools/rustfmt/src/spanned.rs +++ b/src/tools/rustfmt/src/spanned.rs @@ -1,7 +1,7 @@ use std::cmp::max; use rustc_ast::ast; -use rustc_span::{Span, source_map}; +use rustc_span::Span; use crate::macros::MacroArg; use crate::patterns::RangeOperand; @@ -18,7 +18,7 @@ fn span(&self) -> Span { } } -impl Spanned for source_map::Spanned { +impl Spanned for rustc_span::Spanned { fn span(&self) -> Span { self.span } diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs index 8d7425186680..84f9a09990fd 100644 --- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs @@ -38,9 +38,8 @@ use rustc_ast::*; use rustc_ast_pretty::pprust; use rustc_session::parse::ParseSess; -use rustc_span::source_map::Spanned; use rustc_span::symbol::Ident; -use rustc_span::DUMMY_SP; +use rustc_span::{DUMMY_SP, Spanned}; use thin_vec::{thin_vec, ThinVec}; // Helper functions for building exprs