Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8a0e640

Browse files
compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_build
Completely abandon usage of rustc_target in these crates, as they need no special knowledge of rustc's target tuples.
1 parent eca1702 commit 8a0e640

File tree

15 files changed

+23
-23
lines changed

15 files changed

+23
-23
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,11 +3751,11 @@ dependencies = [
37513751
name = "rustc_hir_pretty"
37523752
version = "0.0.0"
37533753
dependencies = [
3754+
"rustc_abi",
37543755
"rustc_ast",
37553756
"rustc_ast_pretty",
37563757
"rustc_hir",
37573758
"rustc_span",
3758-
"rustc_target",
37593759
]
37603760

37613761
[[package]]
@@ -3940,14 +3940,14 @@ dependencies = [
39403940
name = "rustc_lint_defs"
39413941
version = "0.0.0"
39423942
dependencies = [
3943+
"rustc_abi",
39433944
"rustc_ast",
39443945
"rustc_data_structures",
39453946
"rustc_error_messages",
39463947
"rustc_hir",
39473948
"rustc_macros",
39483949
"rustc_serialize",
39493950
"rustc_span",
3950-
"rustc_target",
39513951
"serde",
39523952
]
39533953

@@ -4056,6 +4056,7 @@ version = "0.0.0"
40564056
dependencies = [
40574057
"either",
40584058
"itertools",
4059+
"rustc_abi",
40594060
"rustc_apfloat",
40604061
"rustc_arena",
40614062
"rustc_ast",
@@ -4071,7 +4072,6 @@ dependencies = [
40714072
"rustc_pattern_analysis",
40724073
"rustc_session",
40734074
"rustc_span",
4074-
"rustc_target",
40754075
"rustc_trait_selection",
40764076
"tracing",
40774077
]

compiler/rustc_hir_pretty/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ edition = "2021"
55

66
[dependencies]
77
# tidy-alphabetical-start
8+
rustc_abi = { path = "../rustc_abi" }
89
rustc_ast = { path = "../rustc_ast" }
910
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
1011
rustc_hir = { path = "../rustc_hir" }
1112
rustc_span = { path = "../rustc_span" }
12-
rustc_target = { path = "../rustc_target" }
1313
# tidy-alphabetical-end

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use std::cell::Cell;
1010
use std::vec;
1111

12+
use rustc_abi::ExternAbi;
1213
use rustc_ast::util::parser::{self, AssocOp, Fixity};
1314
use rustc_ast_pretty::pp::Breaks::{Consistent, Inconsistent};
1415
use rustc_ast_pretty::pp::{self, Breaks};
@@ -20,7 +21,6 @@ use rustc_hir::{
2021
use rustc_span::FileName;
2122
use rustc_span::source_map::SourceMap;
2223
use rustc_span::symbol::{Ident, Symbol, kw};
23-
use rustc_target::spec::abi::Abi;
2424
use {rustc_ast as ast, rustc_hir as hir};
2525

2626
pub fn id_to_string(map: &dyn rustc_hir::intravisit::Map<'_>, hir_id: HirId) -> String {
@@ -2240,7 +2240,7 @@ impl<'a> State<'a> {
22402240

22412241
fn print_ty_fn(
22422242
&mut self,
2243-
abi: Abi,
2243+
abi: ExternAbi,
22442244
safety: hir::Safety,
22452245
decl: &hir::FnDecl<'_>,
22462246
name: Option<Symbol>,
@@ -2276,7 +2276,7 @@ impl<'a> State<'a> {
22762276

22772277
self.print_safety(header.safety);
22782278

2279-
if header.abi != Abi::Rust {
2279+
if header.abi != ExternAbi::Rust {
22802280
self.word_nbsp("extern");
22812281
self.word_nbsp(header.abi.to_string());
22822282
}

compiler/rustc_lint_defs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ edition = "2021"
55

66
[dependencies]
77
# tidy-alphabetical-start
8+
rustc_abi = { path = "../rustc_abi" }
89
rustc_ast = { path = "../rustc_ast" }
910
rustc_data_structures = { path = "../rustc_data_structures" }
1011
rustc_error_messages = { path = "../rustc_error_messages" }
1112
rustc_hir = { path = "../rustc_hir" }
1213
rustc_macros = { path = "../rustc_macros" }
1314
rustc_serialize = { path = "../rustc_serialize" }
1415
rustc_span = { path = "../rustc_span" }
15-
rustc_target = { path = "../rustc_target" }
1616
serde = { version = "1.0.125", features = ["derive"] }
1717
# tidy-alphabetical-end

compiler/rustc_lint_defs/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![warn(unreachable_pub)]
33
// tidy-alphabetical-end
44

5+
use rustc_abi::ExternAbi;
56
use rustc_ast::node_id::NodeId;
67
use rustc_ast::{AttrId, Attribute};
78
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
@@ -15,7 +16,6 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1516
pub use rustc_span::edition::Edition;
1617
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
1718
use rustc_span::{Span, Symbol, sym};
18-
use rustc_target::spec::abi::Abi;
1919
use serde::{Deserialize, Serialize};
2020

2121
pub use self::Level::*;
@@ -602,7 +602,7 @@ pub enum BuiltinLintDiag {
602602
path: String,
603603
since_kind: DeprecatedSinceKind,
604604
},
605-
MissingAbi(Span, Abi),
605+
MissingAbi(Span, ExternAbi),
606606
UnusedDocComment(Span),
607607
UnusedBuiltinAttribute {
608608
attr_name: Symbol,

compiler/rustc_mir_build/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ edition = "2021"
77
# tidy-alphabetical-start
88
either = "1.5.0"
99
itertools = "0.12"
10+
11+
rustc_abi = { path = "../rustc_abi" }
1012
rustc_apfloat = "0.2.0"
1113
rustc_arena = { path = "../rustc_arena" }
1214
rustc_ast = { path = "../rustc_ast" }
@@ -22,7 +24,6 @@ rustc_middle = { path = "../rustc_middle" }
2224
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
2325
rustc_session = { path = "../rustc_session" }
2426
rustc_span = { path = "../rustc_span" }
25-
rustc_target = { path = "../rustc_target" }
2627
rustc_trait_selection = { path = "../rustc_trait_selection" }
2728
tracing = "0.1"
2829
# tidy-alphabetical-end

compiler/rustc_mir_build/src/build/custom/parse/instruction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc_abi::{FieldIdx, VariantIdx};
12
use rustc_middle::mir::interpret::Scalar;
23
use rustc_middle::mir::tcx::PlaceTy;
34
use rustc_middle::mir::*;
@@ -6,7 +7,6 @@ use rustc_middle::ty;
67
use rustc_middle::ty::cast::mir_cast_kind;
78
use rustc_span::Span;
89
use rustc_span::source_map::Spanned;
9-
use rustc_target::abi::{FieldIdx, VariantIdx};
1010

1111
use super::{PResult, ParseCtxt, parse_by_kind};
1212
use crate::build::custom::ParseError;

compiler/rustc_mir_build/src/build/expr/as_constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! See docs in build/expr/mod.rs
22
3+
use rustc_abi::Size;
34
use rustc_ast as ast;
45
use rustc_hir::LangItem;
56
use rustc_middle::mir::interpret::{
@@ -11,7 +12,6 @@ use rustc_middle::ty::{
1112
self, CanonicalUserType, CanonicalUserTypeAnnotation, Ty, TyCtxt, UserTypeAnnotationIndex,
1213
};
1314
use rustc_middle::{bug, mir, span_bug};
14-
use rustc_target::abi::Size;
1515
use tracing::{instrument, trace};
1616

1717
use crate::build::{Builder, parse_float_into_constval};

compiler/rustc_mir_build/src/build/expr/as_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use std::assert_matches::assert_matches;
44
use std::iter;
55

6+
use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
67
use rustc_hir::def_id::LocalDefId;
78
use rustc_middle::hir::place::{Projection as HirProjection, ProjectionKind as HirProjectionKind};
89
use rustc_middle::middle::region;
@@ -12,7 +13,6 @@ use rustc_middle::thir::*;
1213
use rustc_middle::ty::{self, AdtDef, CanonicalUserTypeAnnotation, Ty, Variance};
1314
use rustc_middle::{bug, span_bug};
1415
use rustc_span::Span;
15-
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
1616
use tracing::{debug, instrument, trace};
1717

1818
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! See docs in `build/expr/mod.rs`.
22
3+
use rustc_abi::{BackendRepr, FieldIdx, Primitive};
34
use rustc_hir::lang_items::LangItem;
45
use rustc_index::{Idx, IndexVec};
56
use rustc_middle::bug;
@@ -13,7 +14,6 @@ use rustc_middle::ty::util::IntTypeExt;
1314
use rustc_middle::ty::{self, Ty, UpvarArgs};
1415
use rustc_span::source_map::Spanned;
1516
use rustc_span::{DUMMY_SP, Span};
16-
use rustc_target::abi::{BackendRepr, FieldIdx, Primitive};
1717
use tracing::debug;
1818

1919
use crate::build::expr::as_place::PlaceBase;

0 commit comments

Comments
 (0)