Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e4194c7
Deduplicate higher-ranked lifetime capture errors in impl Trait
JohnTitor Oct 12, 2025
d60e7cf
callconv: adapt mips padding logic to mips64
chenx97 Oct 30, 2025
c906b2a
tidy: Detect outdated workspaces in workspace list
jamie-osec Nov 28, 2025
8f55c15
Remove -Zoom=panic
bjorn3 Oct 15, 2025
a1f4caf
Restrict spe_acc to PowerPC SPE targets
pmur Dec 4, 2025
4c6544b
Run clippy both with and without default features on the GCC backend
GuillaumeGomez Dec 9, 2025
50e9839
Don't suggest wrapping attr in unsafe if it may come from proc macro
mu001999 Dec 8, 2025
4501327
Fix clippy lint in `cg_gcc`
GuillaumeGomez Dec 9, 2025
20fabb4
Use return type `Span` on async fns instead of whole fn def `Span`
estebank Nov 4, 2025
76f02cf
Add test for `dyn Trait` in `async fn` return type
estebank Nov 4, 2025
7868d20
Account for `async fn` with `dyn Trait` return type in `impl Trait` s…
estebank Nov 4, 2025
fabf574
Add test for `type Alias = dyn Trait` in return type
estebank Nov 4, 2025
60b227a
Recognize `type Alias = dyn Trait` in `fn` return types
estebank Nov 4, 2025
e2168b1
Point at async fn return type instead of body in E0746
estebank Nov 5, 2025
8c63852
Provide boxing suggestion for `type Alias = dyn Trait` return type
estebank Nov 5, 2025
f7eaaf7
Account for async fn in traits and impls
estebank Nov 5, 2025
06500aa
Add message when running clippy with `--no-default-features` for cg_gcc
GuillaumeGomez Dec 9, 2025
6cd44a4
Make typo in field and name suggestions verbose
estebank Dec 9, 2025
0488690
Use `let`...`else` instead of `match foo { ... _ => return };` and `i…
estebank Dec 9, 2025
d440210
Add a regression test for issue 145748
ShoyuVanilla Dec 9, 2025
fc3d61e
compiletest: tidy up `adb_path`/`adb_test_dir` handling
jieyouxu Dec 10, 2025
e70f5b4
Rollup merge of #147602 - JohnTitor:dedup-lifetime-capture-errors, r=…
Zalathar Dec 10, 2025
3af369e
Rollup merge of #147725 - bjorn3:remove_oom_panic, r=Amanieu
Zalathar Dec 10, 2025
01c5168
Rollup merge of #148294 - chenx97:mips64-padding-aggregate-args, r=wo…
Zalathar Dec 10, 2025
1ac8131
Rollup merge of #148491 - estebank:issue-147894, r=jackh726
Zalathar Dec 10, 2025
93c44b4
Rollup merge of #149417 - clubby789:stale-workspace-list, r=Mark-Simu…
Zalathar Dec 10, 2025
5ee02e5
Rollup merge of #149458 - GuillaumeGomez:clippy-cg_gcc, r=kobzol
Zalathar Dec 10, 2025
fffa948
Rollup merge of #149679 - pmur:murp/ppc-inline-improvements, r=Amanieu
Zalathar Dec 10, 2025
12bb304
Rollup merge of #149781 - mu001999-contrib:fix/149756, r=jdonszelmann
Zalathar Dec 10, 2025
4190b77
Rollup merge of #149795 - estebank:let-else-std, r=workingjubilee
Zalathar Dec 10, 2025
b1023ec
Rollup merge of #149816 - estebank:verbose-typo-suggestion, r=Jonatha…
Zalathar Dec 10, 2025
76abd73
Rollup merge of #149824 - ShoyuVanilla:issue-145748, r=Kivooeo
Zalathar Dec 10, 2025
4490292
Rollup merge of #149826 - jieyouxu:compiletest-adb, r=Zalathar
Zalathar Dec 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
5 changes: 2 additions & 3 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let output = match coro {
Some(coro) => {
let fn_def_id = self.local_def_id(fn_node_id);
self.lower_coroutine_fn_ret_ty(&decl.output, fn_def_id, coro, kind, fn_span)
self.lower_coroutine_fn_ret_ty(&decl.output, fn_def_id, coro, kind)
}
None => match &decl.output {
FnRetTy::Ty(ty) => {
Expand Down Expand Up @@ -1755,9 +1755,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn_def_id: LocalDefId,
coro: CoroutineKind,
fn_kind: FnDeclKind,
fn_span: Span,
) -> hir::FnRetTy<'hir> {
let span = self.lower_span(fn_span);
let span = self.lower_span(output.span());

let (opaque_ty_node_id, allowed_features) = match coro {
CoroutineKind::Async { return_impl_trait_id, .. } => (return_impl_trait_id, None),
Expand Down
19 changes: 16 additions & 3 deletions compiler/rustc_attr_parsing/src/safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,28 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
Some(unsafe_since) => path_span.edition() >= unsafe_since,
};

let mut not_from_proc_macro = true;
if diag_span.from_expansion()
&& let Ok(mut snippet) = self.sess.source_map().span_to_snippet(diag_span)
{
snippet.retain(|c| !c.is_whitespace());
if snippet.contains("!(") || snippet.starts_with("#[") && snippet.ends_with("]")
{
not_from_proc_macro = false;
}
}

if emit_error {
self.stage.emit_err(
self.sess,
crate::session_diagnostics::UnsafeAttrOutsideUnsafe {
span: path_span,
suggestion:
suggestion: not_from_proc_macro.then(|| {
crate::session_diagnostics::UnsafeAttrOutsideUnsafeSuggestion {
left: diag_span.shrink_to_lo(),
right: diag_span.shrink_to_hi(),
},
}
}),
},
);
} else {
Expand All @@ -81,7 +93,8 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
span: path_span,
kind: AttributeLintKind::UnsafeAttrOutsideUnsafe {
attribute_name_span: path_span,
sugg_spans: (diag_span.shrink_to_lo(), diag_span.shrink_to_hi()),
sugg_spans: not_from_proc_macro
.then(|| (diag_span.shrink_to_lo(), diag_span.shrink_to_hi())),
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ pub(crate) struct UnsafeAttrOutsideUnsafe {
#[label]
pub span: Span,
#[subdiagnostic]
pub suggestion: UnsafeAttrOutsideUnsafeSuggestion,
pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
}

#[derive(Subdiagnostic)]
Expand Down
39 changes: 2 additions & 37 deletions compiler/rustc_codegen_cranelift/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use rustc_ast::expand::allocator::{
AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name,
};
use rustc_codegen_ssa::base::{allocator_kind_for_codegen, allocator_shim_contents};
use rustc_session::config::OomStrategy;
use rustc_symbol_mangling::mangle_internal_symbol;

use crate::prelude::*;
Expand All @@ -15,16 +14,11 @@ use crate::prelude::*;
pub(crate) fn codegen(tcx: TyCtxt<'_>, module: &mut dyn Module) -> bool {
let Some(kind) = allocator_kind_for_codegen(tcx) else { return false };
let methods = allocator_shim_contents(tcx, kind);
codegen_inner(tcx, module, &methods, tcx.sess.opts.unstable_opts.oom);
codegen_inner(tcx, module, &methods);
true
}

fn codegen_inner(
tcx: TyCtxt<'_>,
module: &mut dyn Module,
methods: &[AllocatorMethod],
oom_strategy: OomStrategy,
) {
fn codegen_inner(tcx: TyCtxt<'_>, module: &mut dyn Module, methods: &[AllocatorMethod]) {
let usize_ty = module.target_config().pointer_type();

for method in methods {
Expand Down Expand Up @@ -65,35 +59,6 @@ fn codegen_inner(
);
}

{
let sig = Signature {
call_conv: module.target_config().default_call_conv,
params: vec![],
returns: vec![AbiParam::new(types::I8)],
};
let func_id = module
.declare_function(
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
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);
let value = bcx.ins().iconst(types::I8, oom_strategy.should_panic() as i64);
bcx.ins().return_(&[value]);
bcx.seal_all_blocks();
bcx.finalize();
}
module.define_function(func_id, &mut ctx).unwrap();
}

{
let sig = Signature {
call_conv: module.target_config().default_call_conv,
Expand Down
39 changes: 1 addition & 38 deletions compiler/rustc_codegen_gcc/src/allocator.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#[cfg(feature = "master")]
use gccjit::FnAttribute;
use gccjit::{Context, FunctionType, RValue, ToRValue, Type};
use gccjit::{Context, FunctionType, ToRValue, Type};
use rustc_ast::expand::allocator::{
AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name,
};
use rustc_middle::bug;
use rustc_middle::ty::TyCtxt;
use rustc_session::config::OomStrategy;
use rustc_symbol_mangling::mangle_internal_symbol;

use crate::GccContext;
Expand Down Expand Up @@ -59,14 +58,6 @@ pub(crate) unsafe fn codegen(
create_wrapper_function(tcx, context, &from_name, Some(&to_name), &types, output);
}

create_const_value_function(
tcx,
context,
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
i8,
context.new_rvalue_from_int(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as i32),
);

create_wrapper_function(
tcx,
context,
Expand All @@ -77,34 +68,6 @@ pub(crate) unsafe fn codegen(
);
}

fn create_const_value_function(
tcx: TyCtxt<'_>,
context: &Context<'_>,
name: &str,
output: Type<'_>,
value: RValue<'_>,
) {
let func = context.new_function(None, FunctionType::Exported, output, &[], name, false);

#[cfg(feature = "master")]
{
func.add_attribute(FnAttribute::Visibility(symbol_visibility_to_gcc(
tcx.sess.default_visibility(),
)));

// FIXME(antoyo): cg_llvm sets AlwaysInline, but AlwaysInline is different in GCC and using
// it here will causes linking errors when using LTO.
func.add_attribute(FnAttribute::Inline);
}

if tcx.sess.must_emit_unwind_tables() {
// TODO(antoyo): emit unwind tables.
}

let block = func.new_block("entry");
block.end_with_return(None, value);
}

fn create_wrapper_function(
tcx: TyCtxt<'_>,
context: &Context<'_>,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,11 @@ impl<'gcc, 'tcx> BackendTypes for Builder<'_, 'gcc, 'tcx> {
}

fn set_rvalue_location<'a, 'gcc, 'tcx>(
bx: &mut Builder<'a, 'gcc, 'tcx>,
_bx: &mut Builder<'a, 'gcc, 'tcx>,
rvalue: RValue<'gcc>,
) -> RValue<'gcc> {
if let Some(location) = bx.location {
#[cfg(feature = "master")]
#[cfg(feature = "master")]
if let Some(location) = _bx.location {
rvalue.set_location(location);
}
rvalue
Expand Down
44 changes: 2 additions & 42 deletions compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{DebugInfo, OomStrategy};
use rustc_session::config::DebugInfo;
use rustc_symbol_mangling::mangle_internal_symbol;

use crate::attributes::llfn_attrs_from_instance;
use crate::builder::SBuilder;
use crate::declare::declare_simple_fn;
use crate::llvm::{self, FALSE, FromGeneric, TRUE, Type, Value};
use crate::llvm::{self, FromGeneric, TRUE, Type};
use crate::{SimpleCx, attributes, debuginfo};

pub(crate) unsafe fn codegen(
Expand All @@ -28,7 +28,6 @@ pub(crate) unsafe fn codegen(
64 => cx.type_i64(),
tws => bug!("Unsupported target word size for int: {}", tws),
};
let i8 = cx.type_i8();
let i8p = cx.type_ptr();

for method in methods {
Expand Down Expand Up @@ -87,17 +86,6 @@ pub(crate) unsafe fn codegen(
);
}

// __rust_alloc_error_handler_should_panic_v2
create_const_value_function(
tcx,
&cx,
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
&i8,
unsafe {
llvm::LLVMConstInt(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as u64, FALSE)
},
);

// __rust_no_alloc_shim_is_unstable_v2
create_wrapper_function(
tcx,
Expand All @@ -117,34 +105,6 @@ pub(crate) unsafe fn codegen(
}
}

fn create_const_value_function(
tcx: TyCtxt<'_>,
cx: &SimpleCx<'_>,
name: &str,
output: &Type,
value: &Value,
) {
let ty = cx.type_func(&[], output);
let llfn = declare_simple_fn(
&cx,
name,
llvm::CallConv::CCallConv,
llvm::UnnamedAddr::Global,
llvm::Visibility::from_generic(tcx.sess.default_visibility()),
ty,
);

attributes::apply_to_llfn(
llfn,
llvm::AttributePlace::Function,
&[llvm::AttributeKind::AlwaysInline.create_attr(cx.llcx)],
);

let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };
let mut bx = SBuilder::build(&cx, llbb);
bx.ret(value);
}

fn create_wrapper_function(
tcx: TyCtxt<'_>,
cx: &SimpleCx<'_>,
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_ssa/src/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use rustc_middle::middle::exported_symbols::{
use rustc_middle::query::LocalCrate;
use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, Ty, TyCtxt};
use rustc_middle::util::Providers;
use rustc_session::config::{CrateType, OomStrategy};
use rustc_session::config::CrateType;
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::spec::{Arch, Os, TlsModel};
use tracing::debug;
Expand Down Expand Up @@ -493,7 +493,6 @@ pub(crate) fn allocator_shim_symbols(
.map(move |method| mangle_internal_symbol(tcx, global_fn_name(method.name).as_str()))
.chain([
mangle_internal_symbol(tcx, global_fn_name(ALLOC_ERROR_HANDLER).as_str()),
mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
])
.map(move |symbol_name| {
Expand Down
Loading
Loading