Skip to content

Commit 93fb6ef

Browse files
Rollup merge of #132444 - workingjubilee:rustdoc-my-abi, r=GuillaumeGomez
rustdoc: Directly use rustc_abi instead of reexports rustc_target reexports a lot of things that are in rustc_abi, but that will be over soon and now is probably a good time to switch. Uses of rustc_target remain where they inquire about the target tuple.
2 parents 2896483 + a8d4d23 commit 93fb6ef

5 files changed

Lines changed: 19 additions & 20 deletions

File tree

‎src/librustdoc/clean/types.rs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::sync::{Arc, OnceLock as OnceCell};
55
use std::{fmt, iter};
66

77
use arrayvec::ArrayVec;
8+
use rustc_abi::{ExternAbi,VariantIdx};
89
use rustc_ast::MetaItemInner;
910
use rustc_ast_pretty::pprust;
1011
use rustc_attr::{ConstStability,Deprecation,Stability,StableSince};
@@ -26,8 +27,6 @@ use rustc_session::Session;
2627
use rustc_span::hygiene::MacroKind;
2728
use rustc_span::symbol::{Ident,Symbol, kw, sym};
2829
use rustc_span::{DUMMY_SP,FileName,Loc};
29-
use rustc_target::abi::VariantIdx;
30-
use rustc_target::spec::abi::Abi;
3130
use thin_vec::ThinVec;
3231
use tracing::{debug, trace};
3332
use{rustc_ast as ast, rustc_hir as hir};
@@ -656,7 +655,7 @@ impl Item {
656655
let def_id = self.def_id().unwrap();
657656
let abi = tcx.fn_sig(def_id).skip_binder().abi();
658657
hir::FnHeader{
659-
safety:if abi == Abi::RustIntrinsic{
658+
safety:if abi == ExternAbi::RustIntrinsic{
660659
intrinsic_operation_unsafety(tcx, def_id.expect_local())
661660
}else{
662661
safety
@@ -2342,7 +2341,7 @@ pub(crate) struct BareFunctionDecl {
23422341
pub(crate)safety: hir::Safety,
23432342
pub(crate)generic_params:Vec<GenericParamDef>,
23442343
pub(crate)decl:FnDecl,
2345-
pub(crate)abi:Abi,
2344+
pub(crate)abi:ExternAbi,
23462345
}
23472346

23482347
#[derive(Clone,Debug)]

‎src/librustdoc/html/format.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fmt::{self, Display, Write};
1313
use std::iter::{self, once};
1414

1515
use itertools::Itertools;
16+
use rustc_abi::ExternAbi;
1617
use rustc_attr::{ConstStability,StabilityLevel,StableSince};
1718
use rustc_data_structures::captures::Captures;
1819
use rustc_data_structures::fx::FxHashSet;
@@ -23,7 +24,6 @@ use rustc_metadata::creader::{CStore, LoadedMacro};
2324
use rustc_middle::ty::{self,TyCtxt,TypingMode};
2425
use rustc_span::symbol::kw;
2526
use rustc_span::{Symbol, sym};
26-
use rustc_target::spec::abi::Abi;
2727
use tracing::{debug, trace};
2828

2929
usesuper::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length};
@@ -1787,11 +1787,11 @@ impl clean::AssocItemConstraint {
17871787
}
17881788
}
17891789

1790-
pub(crate)fnprint_abi_with_space(abi:Abi) -> implDisplay{
1790+
pub(crate)fnprint_abi_with_space(abi:ExternAbi) -> implDisplay{
17911791
display_fn(move |f| {
17921792
let quot = if f.alternate(){"\""}else{"&quot;"};
17931793
match abi {
1794-
Abi::Rust => Ok(()),
1794+
ExternAbi::Rust => Ok(()),
17951795
abi => write!(f,"extern {0}{1}{0} ", quot, abi.name()),
17961796
}
17971797
})

‎src/librustdoc/html/render/print_item.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::rc::Rc;
55

66
use itertools::Itertools;
77
use rinja::Template;
8+
use rustc_abi::VariantIdx;
89
use rustc_data_structures::captures::Captures;
910
use rustc_data_structures::fx::{FxHashMap,FxIndexSet};
1011
use rustc_hir as hir;
@@ -14,7 +15,6 @@ use rustc_index::IndexVec;
1415
use rustc_middle::ty::{self,TyCtxt};
1516
use rustc_span::hygiene::MacroKind;
1617
use rustc_span::symbol::{Symbol, kw, sym};
17-
use rustc_target::abi::VariantIdx;
1818
use tracing::{debug, info};
1919

2020
usesuper::type_layout::document_type_layout;

‎src/librustdoc/html/render/type_layout.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use std::fmt;
22

33
use rinja::Template;
4+
use rustc_abi::{Primitive,TagEncoding,Variants};
45
use rustc_data_structures::captures::Captures;
56
use rustc_hir::def_id::DefId;
67
use rustc_middle::span_bug;
78
use rustc_middle::ty::layout::LayoutError;
89
use rustc_middle::ty::{self};
910
use rustc_span::symbol::Symbol;
10-
use rustc_target::abi::{Primitive,TagEncoding,Variants};
1111

1212
usecrate::html::format::display_fn;
1313
usecrate::html::render::Context;

‎src/librustdoc/json/conversions.rs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
55
#![allow(rustc::default_hash_types)]
66

7+
use rustc_abi::ExternAbi;
78
use rustc_ast::ast;
89
use rustc_attr::DeprecatedSince;
910
use rustc_hir::def::{CtorKind,DefKind};
1011
use rustc_hir::def_id::DefId;
1112
use rustc_metadata::rendered_const;
1213
use rustc_middle::{bug, ty};
1314
use rustc_span::{Pos,Symbol, sym};
14-
use rustc_target::spec::abi::AbiasRustcAbi;
1515
use rustdoc_json_types::*;
1616

1717
usesuper::FullItemId;
@@ -421,17 +421,17 @@ pub(crate) fn from_fn_header(header: &rustc_hir::FnHeader) -> FunctionHeader {
421421
}
422422
}
423423

424-
fnconvert_abi(a:RustcAbi) -> Abi{
424+
fnconvert_abi(a:ExternAbi) -> Abi{
425425
match a {
426-
RustcAbi::Rust => Abi::Rust,
427-
RustcAbi::C{ unwind } => Abi::C{ unwind },
428-
RustcAbi::Cdecl{ unwind } => Abi::Cdecl{ unwind },
429-
RustcAbi::Stdcall{ unwind } => Abi::Stdcall{ unwind },
430-
RustcAbi::Fastcall{ unwind } => Abi::Fastcall{ unwind },
431-
RustcAbi::Aapcs{ unwind } => Abi::Aapcs{ unwind },
432-
RustcAbi::Win64{ unwind } => Abi::Win64{ unwind },
433-
RustcAbi::SysV64{ unwind } => Abi::SysV64{ unwind },
434-
RustcAbi::System{ unwind } => Abi::System{ unwind },
426+
ExternAbi::Rust => Abi::Rust,
427+
ExternAbi::C{ unwind } => Abi::C{ unwind },
428+
ExternAbi::Cdecl{ unwind } => Abi::Cdecl{ unwind },
429+
ExternAbi::Stdcall{ unwind } => Abi::Stdcall{ unwind },
430+
ExternAbi::Fastcall{ unwind } => Abi::Fastcall{ unwind },
431+
ExternAbi::Aapcs{ unwind } => Abi::Aapcs{ unwind },
432+
ExternAbi::Win64{ unwind } => Abi::Win64{ unwind },
433+
ExternAbi::SysV64{ unwind } => Abi::SysV64{ unwind },
434+
ExternAbi::System{ unwind } => Abi::System{ unwind },
435435
_ => Abi::Other(a.to_string()),
436436
}
437437
}

0 commit comments

Comments
 (0)