Skip to content

Commit b5d1746

Browse files
committed
Auto merge of #157095 - JonathanBrouwer:rollup-eMYdzcn, r=JonathanBrouwer
Rollup of 12 pull requests Successful merges: - #156867 (Stop needing an alloca for `catch_unwind`) - #157050 (Couple of changes to help with moving LTO to the link phase) - #148345 (add inline to copy_within) - #156931 (Add splitting caveats to `{read,write}_volatile`) - #156980 (Add frame pointer annotations to the module) - #156991 ([AIX] Sync compiler and std with libc changes) - #157008 (Avoid some symbol interning) - #157038 (android: implement file locking by calling flock) - #157071 (Fix `cfg` typo in rustdoc book) - #157080 (Fix typo in Rustdoc release notes) - #157084 (Clean up error reporting for impl Drop enum casts) - #157091 (Remove minicore ping for myself)
2 parents dc375db + 6b29e58 commit b5d1746

41 files changed

Lines changed: 312 additions & 209 deletions

File tree

Some content is hidden

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

RELEASES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Rustdoc
5757
-----
5858
- [Deprecation notes are now rendered like any other documentation](https://github.com/rust-lang/rust/pull/149931). Previously they used the css `white-space: pre-wrap;` property and stripped any `<p>` elements from the rendered html, however this caused issues and unintuitive behavior. The new behavior should be more predictable, however some multi-line deprecation notes will now be rendered as as single lines. If this is undesirable, you can use the standard markdown method of forcing a linebreak, which is two spaces followed by a newline (`"\n"`).
5959
- [Don't emit rustdoc `missing_doc_code_examples` lint on impl items](https://github.com/rust-lang/rust/pull/154048)
60-
- [Seperate methods and associated functions in sidebar](https://github.com/rust-lang/rust/pull/154644)
60+
- [Separate methods and associated functions in sidebar](https://github.com/rust-lang/rust/pull/154644)
6161

6262
<a id="1.96.0-Compatibility-Notes"></a>
6363

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,8 +1365,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
13651365
{
13661366
fx.bcx.ins().call_indirect(f_sig, f, &[data]);
13671367

1368-
let layout = fx.layout_of(fx.tcx.types.i32);
1369-
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I32, 0), layout);
1368+
let layout = fx.layout_of(fx.tcx.types.bool);
1369+
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I8, 0), layout);
13701370
ret.write_cvalue(fx, ret_val);
13711371

13721372
fx.bcx.ins().jump(ret_block, &[]);
@@ -1399,8 +1399,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
13991399

14001400
fx.bcx.seal_block(fallthrough_block);
14011401
fx.bcx.switch_to_block(fallthrough_block);
1402-
let layout = fx.layout_of(fx.tcx.types.i32);
1403-
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I32, 0), layout);
1402+
let layout = fx.layout_of(fx.tcx.types.bool);
1403+
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I8, 0), layout);
14041404
ret.write_cvalue(fx, ret_val);
14051405
fx.bcx.ins().jump(ret_block, &[]);
14061406

@@ -1409,8 +1409,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
14091409
fx.bcx.set_cold_block(catch_block);
14101410
let exception = fx.bcx.append_block_param(catch_block, pointer_ty(fx.tcx));
14111411
fx.bcx.ins().call_indirect(catch_fn_sig, catch_fn, &[data, exception]);
1412-
let layout = fx.layout_of(fx.tcx.types.i32);
1413-
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I32, 1), layout);
1412+
let layout = fx.layout_of(fx.tcx.types.bool);
1413+
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I8, 1), layout);
14141414
ret.write_cvalue(fx, ret_val);
14151415
fx.bcx.ins().jump(ret_block, &[]);
14161416
}

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ fn try_intrinsic<'a, 'b, 'gcc, 'tcx>(
13641364
bx.call(fn_type, None, None, try_func, &[data], None, None);
13651365
// Return 0 unconditionally from the intrinsic call;
13661366
// we can never unwind.
1367-
OperandValue::Immediate(bx.const_i32(0)).store(bx, dest);
1367+
OperandValue::Immediate(bx.const_bool(false)).store(bx, dest);
13681368
} else {
13691369
if wants_msvc_seh(bx.sess()) {
13701370
unimplemented!();
@@ -1421,7 +1421,7 @@ fn codegen_gnu_try<'gcc, 'tcx>(
14211421
let current_block = bx.block;
14221422

14231423
bx.switch_to_block(then);
1424-
bx.ret(bx.const_i32(0));
1424+
bx.ret(bx.const_bool(false));
14251425

14261426
// Type indicator for the exception being thrown.
14271427
//
@@ -1435,7 +1435,7 @@ fn codegen_gnu_try<'gcc, 'tcx>(
14351435
let ptr = bx.cx.context.new_call(None, eh_pointer_builtin, &[zero]);
14361436
let catch_ty = bx.type_func(&[bx.type_i8p(), bx.type_i8p()], bx.type_void());
14371437
bx.call(catch_ty, None, None, catch_func, &[data, ptr], None, None);
1438-
bx.ret(bx.const_i32(1));
1438+
bx.ret(bx.const_bool(true));
14391439

14401440
// NOTE: the blocks must be filled before adding the try/catch, otherwise gcc will not
14411441
// generate a try/catch.
@@ -1468,7 +1468,7 @@ fn get_rust_try_fn<'a, 'gcc, 'tcx>(
14681468
// Define the type up front for the signature of the rust_try function.
14691469
let tcx = cx.tcx;
14701470
let i8p = Ty::new_mut_ptr(tcx, tcx.types.i8);
1471-
// `unsafe fn(*mut i8) -> ()`
1471+
// `unsafe fn(*mut Data) -> ()`
14721472
let try_fn_ty = Ty::new_fn_ptr(
14731473
tcx,
14741474
ty::Binder::dummy(tcx.mk_fn_sig_rust_abi(
@@ -1477,7 +1477,7 @@ fn get_rust_try_fn<'a, 'gcc, 'tcx>(
14771477
rustc_hir::Safety::Unsafe,
14781478
)),
14791479
);
1480-
// `unsafe fn(*mut i8, *mut i8) -> ()`
1480+
// `unsafe fn(*mut Data, *mut i8) -> ()`
14811481
let catch_fn_ty = Ty::new_fn_ptr(
14821482
tcx,
14831483
ty::Binder::dummy(tcx.mk_fn_sig_rust_abi(
@@ -1486,10 +1486,10 @@ fn get_rust_try_fn<'a, 'gcc, 'tcx>(
14861486
rustc_hir::Safety::Unsafe,
14871487
)),
14881488
);
1489-
// `unsafe fn(unsafe fn(*mut i8) -> (), *mut i8, unsafe fn(*mut i8, *mut i8) -> ()) -> i32`
1489+
// `unsafe fn(unsafe fn(*mut Data) -> (), *mut Data, unsafe fn(*mut Data, *mut i8) -> ()) -> bool`
14901490
let rust_fn_sig = ty::Binder::dummy(cx.tcx.mk_fn_sig_rust_abi(
14911491
[try_fn_ty, i8p, catch_fn_ty],
1492-
tcx.types.i32,
1492+
tcx.types.bool,
14931493
rustc_hir::Safety::Unsafe,
14941494
));
14951495
let rust_try = gen_fn(cx, "__rust_try", rust_fn_sig, codegen);

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,7 @@ fn new_context<'gcc, 'tcx>(tcx: TyCtxt<'tcx>) -> Context<'gcc> {
339339
}
340340

341341
impl ExtraBackendMethods for GccCodegenBackend {
342-
fn supports_parallel(&self) -> bool {
343-
false
344-
}
342+
type Module = GccContext;
345343

346344
fn codegen_allocator(
347345
&self,
@@ -424,6 +422,10 @@ impl WriteBackendMethods for GccCodegenBackend {
424422
type ModuleBuffer = ModuleBuffer;
425423
type ThinData = ();
426424

425+
fn supports_parallel(&self) -> bool {
426+
false
427+
}
428+
427429
fn target_machine_factory(
428430
&self,
429431
_sess: &Session,

compiler/rustc_codegen_llvm/src/attributes.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ pub(crate) fn uwtable_attr(llcx: &llvm::Context, use_sync_unwind: Option<bool>)
171171
llvm::CreateUWTableAttr(llcx, async_unwind)
172172
}
173173

174-
pub(crate) fn frame_pointer_type_attr<'ll>(
175-
cx: &SimpleCx<'ll>,
176-
sess: &Session,
177-
) -> Option<&'ll Attribute> {
174+
pub(crate) fn frame_pointer(sess: &Session) -> FramePointer {
178175
let mut fp = sess.target.frame_pointer;
179176
let opts = &sess.opts;
180177
// "mcount" function relies on stack pointer.
@@ -183,6 +180,14 @@ pub(crate) fn frame_pointer_type_attr<'ll>(
183180
fp.ratchet(FramePointer::Always);
184181
}
185182
fp.ratchet(opts.cg.force_frame_pointers);
183+
fp
184+
}
185+
186+
pub(crate) fn frame_pointer_type_attr<'ll>(
187+
cx: &SimpleCx<'ll>,
188+
sess: &Session,
189+
) -> Option<&'ll Attribute> {
190+
let fp = frame_pointer(sess);
186191
let attr_value = match fp {
187192
FramePointer::Always => "all",
188193
FramePointer::NonLeaf => "non-leaf",

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ use rustc_session::config::{
2828
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, sym};
2929
use rustc_symbol_mangling::mangle_internal_symbol;
3030
use rustc_target::spec::{
31-
Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
31+
Arch, CfgAbi, Env, FramePointer, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport,
32+
Target, TlsModel,
3233
};
3334
use smallvec::SmallVec;
3435

@@ -489,6 +490,20 @@ pub(crate) unsafe fn create_module<'ll>(
489490
}
490491
}
491492

493+
let fp = attributes::frame_pointer(sess);
494+
if fp != FramePointer::MayOmit {
495+
llvm::add_module_flag_u32(
496+
llmod,
497+
llvm::ModuleFlagMergeBehavior::Max,
498+
"frame-pointer",
499+
match fp {
500+
FramePointer::Always => llvm::FramePointerKind::All as u32,
501+
FramePointer::NonLeaf => llvm::FramePointerKind::NonLeaf as u32,
502+
FramePointer::MayOmit => llvm::FramePointerKind::None as u32,
503+
},
504+
);
505+
}
506+
492507
if sess.opts.unstable_opts.indirect_branch_cs_prefix {
493508
llvm::add_module_flag_u32(
494509
llmod,
@@ -960,11 +975,7 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
960975
fn intrinsic_call_expects_place_always(&self, name: Symbol) -> bool {
961976
matches!(
962977
name,
963-
sym::autodiff
964-
| sym::catch_unwind
965-
| sym::volatile_load
966-
| sym::unaligned_volatile_load
967-
| sym::black_box
978+
sym::autodiff | sym::volatile_load | sym::unaligned_volatile_load | sym::black_box
968979
)
969980
}
970981
}

0 commit comments

Comments
 (0)