Skip to content

Commit f701778

Browse files
committed
[SOL] Adjustments after Rust 1.89 upgrade
1 parent 2b9074d commit f701778

File tree

113 files changed

+1226
-3010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1226
-3010
lines changed

Cargo.lock

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,12 +3144,14 @@ dependencies = [
31443144

31453145
[[package]]
31463146
name = "rustc-build-sysroot"
3147-
version = "0.5.3"
3148-
source = "git+https://github.com/anza-xyz/rustc-build-sysroot?tag=solana-tools-v1.51#34e8960e38904f424f410d4673a0b669af75ef4e"
3147+
version = "0.5.11"
3148+
source = "registry+https://github.com/rust-lang/crates.io-index"
3149+
checksum = "3b881c015c729b43105bbd3702a9bdecee28fafaa21126d1d62e454ec011a4b7"
31493150
dependencies = [
31503151
"anyhow",
31513152
"rustc_version",
31523153
"tempfile",
3154+
"toml 0.8.23",
31533155
"walkdir",
31543156
]
31553157

@@ -5394,7 +5396,20 @@ dependencies = [
53945396
"serde",
53955397
"serde_spanned",
53965398
"toml_datetime",
5397-
"toml_edit",
5399+
"toml_edit 0.19.15",
5400+
]
5401+
5402+
[[package]]
5403+
name = "toml"
5404+
version = "0.8.23"
5405+
source = "registry+https://github.com/rust-lang/crates.io-index"
5406+
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
5407+
dependencies = [
5408+
"indexmap",
5409+
"serde",
5410+
"serde_spanned",
5411+
"toml_datetime",
5412+
"toml_edit 0.22.27",
53985413
]
53995414

54005415
[[package]]
@@ -5419,6 +5434,26 @@ dependencies = [
54195434
"winnow 0.5.40",
54205435
]
54215436

5437+
[[package]]
5438+
name = "toml_edit"
5439+
version = "0.22.27"
5440+
source = "registry+https://github.com/rust-lang/crates.io-index"
5441+
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
5442+
dependencies = [
5443+
"indexmap",
5444+
"serde",
5445+
"serde_spanned",
5446+
"toml_datetime",
5447+
"toml_write",
5448+
"winnow 0.7.11",
5449+
]
5450+
5451+
[[package]]
5452+
name = "toml_write"
5453+
version = "0.1.2"
5454+
source = "registry+https://github.com/rust-lang/crates.io-index"
5455+
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
5456+
54225457
[[package]]
54235458
name = "tracing"
54245459
version = "0.1.37"

compiler/rustc_codegen_llvm/src/allocator.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,16 @@ pub(crate) unsafe fn codegen(
8181
let llval = llvm::LLVMConstInt(i8, val as u64, False);
8282
llvm::set_initializer(ll_g, llval);
8383

84-
if tcx.sess.target.arch != "sbf" {
85-
// __rust_no_alloc_shim_is_unstable_v2
86-
create_wrapper_function(
87-
tcx,
88-
&cx,
89-
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
90-
None,
91-
&[],
92-
None,
93-
false,
94-
);
95-
}
84+
// __rust_no_alloc_shim_is_unstable_v2
85+
create_wrapper_function(
86+
tcx,
87+
&cx,
88+
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
89+
None,
90+
&[],
91+
None,
92+
false,
93+
);
9694
}
9795

9896
if tcx.sess.opts.debuginfo != DebugInfo::None {

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ impl<'ll> CodegenCx<'ll, '_> {
864864
// and we use it to implement intrinsics like `raw_eq` and `compare_bytes`
865865
if base_name == "memcmp" {
866866
let fn_ty = self
867-
.type_func(&[self.type_ptr(), self.type_ptr(), self.type_isize()], self.type_int());
867+
.type_func(&[self.type_ptr(), self.type_ptr(), self.type_isize()], self.type_i32());
868868
let f = self.declare_cfn("memcmp", llvm::UnnamedAddr::No, fn_ty);
869869

870870
return (fn_ty, f);

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
472472
} else {
473473
let n = self.const_usize(layout.size().bytes());
474474
let cmp = self.call_intrinsic("memcmp", &[], &[a, b, n]);
475-
self.icmp(IntPredicate::IntEQ, cmp, self.const_int(self.type_int(), 0))
475+
self.icmp(IntPredicate::IntEQ, cmp, self.const_int(self.type_i32(), 0))
476476
}
477477
}
478478

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
557557
let (arg_argc, arg_argv) = get_argc_argv(&mut bx);
558558

559559
let EntryFnType::Main { sigpipe } = entry_type;
560-
let (start_fn, start_ty, args, instance) = if !is_bpf {
560+
let (start_fn, start_ty, args, instance) = {
561561
let start_def_id = cx.tcx().require_lang_item(LangItem::Start, DUMMY_SP);
562562
let start_instance = ty::Instance::expect_resolve(
563563
cx.tcx(),
@@ -578,18 +578,6 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
578578
vec![rust_main, arg_argc, arg_argv, arg_sigpipe],
579579
Some(start_instance),
580580
)
581-
} else {
582-
debug!("using user-defined start fn");
583-
let start_ty = cx.type_func(&[], cx.type_void());
584-
(rust_main, start_ty, Vec::new(), None)
585-
};
586-
587-
let result = if is_bpf {
588-
let args = Vec::new();
589-
bx.call(start_ty, None, None, start_fn, &args, None, instance);
590-
bx.const_i32(0)
591-
} else {
592-
bx.call(start_ty, None, None, start_fn, &args, None, instance)
593581
};
594582

595583
let result = bx.call(start_ty, None, None, start_fn, &args, None, instance);

compiler/rustc_middle/src/mir/consts.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -576,34 +576,14 @@ impl<'tcx> TyCtxt<'tcx> {
576576
pub fn span_as_caller_location(self, span: Span) -> ConstValue<'tcx> {
577577
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
578578
let caller = self.sess.source_map().lookup_char_pos(topmost.lo());
579-
let file_name = if self.sess.target.arch == "bpf" {
580-
let file_name = caller.file.name.prefer_remapped().to_string_lossy();
581-
let mut path = Path::new(&file_name);
582-
let components = path.components().collect::<Vec<_>>();
583-
let len = components.len();
584-
let mut buf = PathBuf::new();
585-
if len > 3 {
586-
buf.push(components[len - 3].as_os_str());
587-
buf.push(components[len - 2].as_os_str());
588-
buf.push(components[len - 1].as_os_str());
589-
path = buf.as_path();
590-
}
591-
if let Some(path_str) = path.to_str() {
592-
Symbol::intern(&path_str)
593-
} else {
594-
Symbol::intern(&file_name)
595-
}
596-
} else {
579+
self.const_caller_location(
597580
Symbol::intern(
598581
&caller
599582
.file
600583
.name
601584
.for_scope(self.sess, RemapPathScopeComponents::MACRO)
602-
.to_string_lossy())
603-
};
604-
605-
self.const_caller_location(
606-
file_name,
585+
.to_string_lossy(),
586+
),
607587
caller.line as u32,
608588
caller.col_display as u32 + 1,
609589
)

compiler/rustc_target/src/callconv/sbf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFCallingConv.td
2-
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
2+
use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
33

44
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
55
let size = ret.layout.size;

compiler/rustc_target/src/spec/base/sbf_base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::abi::Endian;
1+
use rustc_abi::Endian;
22
use crate::spec::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions, SymbolVisibility};
33

44
const V0_LINKER_SCRIPT: &str = r"
@@ -108,7 +108,7 @@ pub(crate) fn opts(version: &'static str) -> TargetOptions {
108108

109109
TargetOptions {
110110
allow_asm: true,
111-
c_int_width: "64".into(),
111+
c_int_width: 64,
112112
default_visibility: Some(SymbolVisibility::Hidden),
113113
dll_prefix: "".into(),
114114
dynamic_linking: true,

0 commit comments

Comments
 (0)