Skip to content

Rollup of 13 pull requests #142278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
c10a629
Merge pull request #4370 from Noratrieb/fix-for-real
RalfJung Jun 1, 2025
1a1d180
Preparing for merge from rustc
Jun 3, 2025
08cad5a
Merge from rustc
Jun 3, 2025
2d8ccc5
Merge pull request #4373 from rust-lang/rustup-2025-06-03
RalfJung Jun 3, 2025
80a95b7
native-lib: allow multiple libraries and/or dirs
nia-e Jun 2, 2025
beff63b
Preparing for merge from rustc
Jun 4, 2025
db72088
Merge from rustc
Jun 4, 2025
9a7255e
Merge pull request #4375 from rust-lang/rustup-2025-06-04
RalfJung Jun 4, 2025
d55a99a
Merge pull request #4372 from nia-e/multiple-native-libs
oli-obk Jun 4, 2025
869baea
Preparing for merge from rustc
Jun 5, 2025
bd898e3
Merge from rustc
Jun 5, 2025
412628d
Merge pull request #4377 from rust-lang/rustup-2025-06-05
RalfJung Jun 5, 2025
8c410ca
Preparing for merge from rustc
Jun 6, 2025
09a9795
Merge from rustc
Jun 6, 2025
5ff78d6
Merge pull request #4380 from rust-lang/rustup-2025-06-06
oli-obk Jun 6, 2025
b1652dc
use File::lock to implement flock, and add a test for File::lock
RalfJung Jun 5, 2025
dc14e73
Delete unused variant and document AttributeKind
mejrs Apr 27, 2025
5fdacfe
Force exhaustive handling of every parsed attribute
mejrs Apr 27, 2025
94df54b
Merge pull request #4378 from RalfJung/flock
RalfJung Jun 6, 2025
24921a1
Preparing for merge from rustc
Jun 7, 2025
bc4a305
Merge from rustc
Jun 7, 2025
e6ddcf4
fmt
Jun 7, 2025
0784b5b
Merge pull request #4381 from rust-lang/rustup-2025-06-07
RalfJung Jun 7, 2025
cd7533a
Stabilize the `keylocker_x86` flag, and the `kl` and `widekl` target …
sayantn May 7, 2025
370a7fa
Preparing for merge from rustc
Jun 8, 2025
963dd5e
Merge from rustc
Jun 8, 2025
638c414
Merge pull request #4385 from rust-lang/rustup-2025-06-08
RalfJung Jun 8, 2025
db95049
Preparing for merge from rustc
Jun 9, 2025
f742bbf
Merge from rustc
Jun 9, 2025
4fe6e99
Merge pull request #4388 from rust-lang/rustup-2025-06-09
RalfJung Jun 9, 2025
4e8d583
Add `-Zmiri-tree-borrows-no-precise-interior-mut` flag
Jun 2, 2025
420e034
Merge pull request #4376 from yoctocell/tb-interior-mut-flag
RalfJung Jun 9, 2025
cbdbd81
Change __rust_no_alloc_shim_is_unstable to be a function
dpaoliello May 15, 2025
3ed1787
Detect when attribute is provided by missing `derive` macro
estebank Dec 28, 2024
1cdd33e
core::ptr: deduplicate more method docs
lolbinarycat Jun 6, 2025
a9401ea
platform-support.md: Mention specific Linux kernel version or later
teohhanhui Jun 9, 2025
eb420d1
update lockfile
RalfJung Jun 9, 2025
3fce086
Make E0621 missing lifetime suggestion verbose
estebank Jun 4, 2025
1b9d7ea
Mark `core::slice::memchr` as `#[doc(hidden)]`
aDotInTheVoid Jun 9, 2025
fea6a22
Specify the behavior of `file!`
epage Dec 17, 2024
643a9d2
tests: Change "fastcall" to "system" in some tests
workingjubilee Jun 6, 2025
518eb0d
rustdoc-json: Rearrange deck chairs in ABI testing
workingjubilee Jun 2, 2025
856c997
rustdoc: Refractor `clean_ty_generics`
aDotInTheVoid Jun 10, 2025
5906998
tests: Copy dont-shuffle-bswaps per tested opt level
workingjubilee Jun 7, 2025
c7fd742
tests: Revise dont-shuffle-bswaps-opt3 per tested arch
workingjubilee Jun 7, 2025
54a5adc
Rollup merge of #134442 - epage:change, r=workingjubilee
workingjubilee Jun 10, 2025
22a8fb7
Rollup merge of #134841 - estebank:serde-attr-4, r=wesleywiser
workingjubilee Jun 10, 2025
958f255
Rollup merge of #140372 - mejrs:attrs, r=jdonszelmann
workingjubilee Jun 10, 2025
77f5853
Rollup merge of #140766 - sayantn:stabilize-keylocker, r=traviscross,…
workingjubilee Jun 10, 2025
9791588
Rollup merge of #141061 - dpaoliello:shimasfn, r=bjorn3
workingjubilee Jun 10, 2025
eba68a2
Rollup merge of #142042 - estebank:explicit-lifetime-verbose-suggesti…
workingjubilee Jun 10, 2025
5bc4ed3
Rollup merge of #142101 - lolbinarycat:core-dedup-ptr-docs-139190-pt2…
workingjubilee Jun 10, 2025
9dcc34b
Rollup merge of #142176 - workingjubilee:dont-shuffle-bswaps-per-arch…
workingjubilee Jun 10, 2025
a5a7977
Rollup merge of #142258 - teohhanhui:docs/platform-support-linux-kern…
workingjubilee Jun 10, 2025
ec6d6b9
Rollup merge of #142260 - RalfJung:miri-sync, r=RalfJung
workingjubilee Jun 10, 2025
ee1e72c
Rollup merge of #142262 - aDotInTheVoid:nomemchr, r=Noratrieb
workingjubilee Jun 10, 2025
6650df6
Rollup merge of #142272 - workingjubilee:change-some-abi-tests, r=aDo…
workingjubilee Jun 10, 2025
b44b5c2
Rollup merge of #142275 - aDotInTheVoid:gen-ty-of, r=fmease
workingjubilee Jun 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,6 @@ dependencies = [
"tempfile",
"tikv-jemalloc-sys",
"ui_test",
"windows-sys 0.59.0",
]

[[package]]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/expand/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn alloc_error_handler_name(alloc_error_handler_kind: AllocatorKind) -> &'st
}
}

pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable";
pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable_v2";

pub enum AllocatorTy {
Layout,
Expand Down
44 changes: 24 additions & 20 deletions compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ impl OptimizeAttr {
}
}

#[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic, PrintAttribute)]
pub enum DiagnosticAttribute {
// tidy-alphabetical-start
DoNotRecommend,
OnUnimplemented,
// tidy-alphabetical-end
}

#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable_Generic, PrintAttribute)]
pub enum ReprAttr {
ReprInt(IntType),
Expand Down Expand Up @@ -160,40 +152,52 @@ impl Deprecation {
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
pub enum AttributeKind {
// tidy-alphabetical-start
/// Represents `#[rustc_allow_const_fn_unstable]`.
AllowConstFnUnstable(ThinVec<Symbol>),

/// Represents `#[allow_internal_unstable]`.
AllowInternalUnstable(ThinVec<(Symbol, Span)>),

/// Represents `#[rustc_default_body_unstable]`.
BodyStability {
stability: DefaultBodyStability,
/// Span of the `#[rustc_default_body_unstable(...)]` attribute
span: Span,
},

/// Represents `#[rustc_confusables]`.
Confusables {
symbols: ThinVec<Symbol>,
// FIXME(jdonszelmann): remove when target validation code is moved
first_span: Span,
},

/// Represents `#[rustc_const_stable]` and `#[rustc_const_unstable]`.
ConstStability {
stability: PartialConstStability,
/// Span of the `#[rustc_const_stable(...)]` or `#[rustc_const_unstable(...)]` attribute
span: Span,
},

/// Represents `#[rustc_const_stable_indirect]`.
ConstStabilityIndirect,
Deprecation {
deprecation: Deprecation,
span: Span,
},
Diagnostic(DiagnosticAttribute),
DocComment {
style: AttrStyle,
kind: CommentKind,
span: Span,
comment: Symbol,
},

/// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
Deprecation { deprecation: Deprecation, span: Span },

/// Represents [`#[doc]`](https://doc.rust-lang.org/stable/rustdoc/write-documentation/the-doc-attribute.html).
DocComment { style: AttrStyle, kind: CommentKind, span: Span, comment: Symbol },

/// Represents `#[rustc_macro_transparency]`.
MacroTransparency(Transparency),

/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
Repr(ThinVec<(ReprAttr, Span)>),

/// Represents `#[stable]`, `#[unstable]` and `#[rustc_allowed_through_unstable_modules]`.
Stability {
stability: Stability,
/// Span of the `#[stable(...)]` or `#[unstable(...)]` attribute
/// Span of the attribute.
span: Span,
},
// tidy-alphabetical-end
Expand Down
40 changes: 28 additions & 12 deletions compiler/rustc_codegen_cranelift/src/allocator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Allocator shim
// Adapted from rustc

use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
use rustc_ast::expand::allocator::{
ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE,
alloc_error_handler_name, default_fn_name, global_fn_name,
Expand Down Expand Up @@ -97,16 +98,31 @@ fn codegen_inner(
data.define(Box::new([val]));
module.define_data(data_id, &data).unwrap();

let data_id = module
.declare_data(
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
Linkage::Export,
false,
false,
)
.unwrap();
let mut data = DataDescription::new();
data.set_align(1);
data.define(Box::new([0]));
module.define_data(data_id, &data).unwrap();
{
let sig = Signature {
call_conv: module.target_config().default_call_conv,
params: vec![],
returns: vec![],
};
let func_id = module
.declare_function(
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
Linkage::Export,
&sig,
)
.unwrap();

let mut ctx = Context::new();
ctx.func.signature = sig;
let mut func_ctx = FunctionBuilderContext::new();
let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);

let block = bcx.create_block();
bcx.switch_to_block(block);
bcx.ins().return_(&[]);
bcx.seal_all_blocks();
bcx.finalize();

module.define_function(func_id, &mut ctx).unwrap();
}
}
78 changes: 42 additions & 36 deletions compiler/rustc_codegen_gcc/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) unsafe fn codegen(
let from_name = mangle_internal_symbol(tcx, &global_fn_name(method.name));
let to_name = mangle_internal_symbol(tcx, &default_fn_name(method.name));

create_wrapper_function(tcx, context, &from_name, &to_name, &types, output);
create_wrapper_function(tcx, context, &from_name, Some(&to_name), &types, output);
}
}

Expand All @@ -66,7 +66,7 @@ pub(crate) unsafe fn codegen(
tcx,
context,
&mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)),
Some(&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind))),
&[usize, usize],
None,
);
Expand All @@ -81,21 +81,21 @@ pub(crate) unsafe fn codegen(
let value = context.new_rvalue_from_int(i8, value as i32);
global.global_set_initializer_rvalue(value);

let name = mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE);
let global = context.new_global(None, GlobalKind::Exported, i8, name);
#[cfg(feature = "master")]
global.add_attribute(VarAttribute::Visibility(symbol_visibility_to_gcc(
tcx.sess.default_visibility(),
)));
let value = context.new_rvalue_from_int(i8, 0);
global.global_set_initializer_rvalue(value);
create_wrapper_function(
tcx,
context,
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
None,
&[],
None,
);
}

fn create_wrapper_function(
tcx: TyCtxt<'_>,
context: &Context<'_>,
from_name: &str,
to_name: &str,
to_name: Option<&str>,
types: &[Type<'_>],
output: Option<Type<'_>>,
) {
Expand Down Expand Up @@ -124,34 +124,40 @@ fn create_wrapper_function(
// TODO(antoyo): emit unwind tables.
}

let args: Vec<_> = types
.iter()
.enumerate()
.map(|(index, typ)| context.new_parameter(None, *typ, format!("param{}", index)))
.collect();
let callee = context.new_function(
None,
FunctionType::Extern,
output.unwrap_or(void),
&args,
to_name,
false,
);
#[cfg(feature = "master")]
callee.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));

let block = func.new_block("entry");

let args = args
.iter()
.enumerate()
.map(|(i, _)| func.get_param(i as i32).to_rvalue())
.collect::<Vec<_>>();
let ret = context.new_call(None, callee, &args);
//llvm::LLVMSetTailCall(ret, True);
if output.is_some() {
block.end_with_return(None, ret);
if let Some(to_name) = to_name {
let args: Vec<_> = types
.iter()
.enumerate()
.map(|(index, typ)| context.new_parameter(None, *typ, format!("param{}", index)))
.collect();
let callee = context.new_function(
None,
FunctionType::Extern,
output.unwrap_or(void),
&args,
to_name,
false,
);
#[cfg(feature = "master")]
callee.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));

let args = args
.iter()
.enumerate()
.map(|(i, _)| func.get_param(i as i32).to_rvalue())
.collect::<Vec<_>>();
let ret = context.new_call(None, callee, &args);
//llvm::LLVMSetTailCall(ret, True);
if output.is_some() {
block.end_with_return(None, ret);
} else {
block.add_eval(None, ret);
block.end_with_void_return(None);
}
} else {
assert!(output.is_none());
block.end_with_void_return(None);
}

Expand Down
74 changes: 42 additions & 32 deletions compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) unsafe fn codegen(
let from_name = mangle_internal_symbol(tcx, &global_fn_name(method.name));
let to_name = mangle_internal_symbol(tcx, &default_fn_name(method.name));

create_wrapper_function(tcx, &cx, &from_name, &to_name, &args, output, false);
create_wrapper_function(tcx, &cx, &from_name, Some(&to_name), &args, output, false);
}
}

Expand All @@ -66,7 +66,7 @@ pub(crate) unsafe fn codegen(
tcx,
&cx,
&mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)),
Some(&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind))),
&[usize, usize], // size, align
None,
true,
Expand All @@ -81,11 +81,16 @@ pub(crate) unsafe fn codegen(
let llval = llvm::LLVMConstInt(i8, val as u64, False);
llvm::set_initializer(ll_g, llval);

let name = mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE);
let ll_g = cx.declare_global(&name, i8);
llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility()));
let llval = llvm::LLVMConstInt(i8, 0, False);
llvm::set_initializer(ll_g, llval);
// __rust_no_alloc_shim_is_unstable_v2
create_wrapper_function(
tcx,
&cx,
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
None,
&[],
None,
false,
);
}

if tcx.sess.opts.debuginfo != DebugInfo::None {
Expand All @@ -99,7 +104,7 @@ fn create_wrapper_function(
tcx: TyCtxt<'_>,
cx: &SimpleCx<'_>,
from_name: &str,
to_name: &str,
to_name: Option<&str>,
args: &[&Type],
output: Option<&Type>,
no_return: bool,
Expand Down Expand Up @@ -128,33 +133,38 @@ fn create_wrapper_function(
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[uwtable]);
}

let callee = declare_simple_fn(
&cx,
to_name,
llvm::CallConv::CCallConv,
llvm::UnnamedAddr::Global,
llvm::Visibility::Hidden,
ty,
);
if let Some(no_return) = no_return {
// -> ! DIFlagNoReturn
attributes::apply_to_llfn(callee, llvm::AttributePlace::Function, &[no_return]);
}
llvm::set_visibility(callee, llvm::Visibility::Hidden);

let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };

let mut bx = SBuilder::build(&cx, llbb);
let args = args
.iter()
.enumerate()
.map(|(i, _)| llvm::get_param(llfn, i as c_uint))
.collect::<Vec<_>>();
let ret = bx.call(ty, callee, &args, None);
llvm::LLVMSetTailCall(ret, True);
if output.is_some() {
bx.ret(ret);

if let Some(to_name) = to_name {
let callee = declare_simple_fn(
&cx,
to_name,
llvm::CallConv::CCallConv,
llvm::UnnamedAddr::Global,
llvm::Visibility::Hidden,
ty,
);
if let Some(no_return) = no_return {
// -> ! DIFlagNoReturn
attributes::apply_to_llfn(callee, llvm::AttributePlace::Function, &[no_return]);
}
llvm::set_visibility(callee, llvm::Visibility::Hidden);

let args = args
.iter()
.enumerate()
.map(|(i, _)| llvm::get_param(llfn, i as c_uint))
.collect::<Vec<_>>();
let ret = bx.call(ty, callee, &args, None);
llvm::LLVMSetTailCall(ret, True);
if output.is_some() {
bx.ret(ret);
} else {
bx.ret_void()
}
} else {
assert!(output.is_none());
bx.ret_void()
}
}
Loading
Loading