Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
eda3ca4
document EMIT_MIR_FOR_EACH_PANIC_STRATEGY
tshepang Aug 27, 2026
a041b11
Make docblock `<code>` elements inline so they behave better
GuillaumeGomez Oct 1, 2026
4621dfe
Implement `Fn` traits for functions of any ABI
Jules-Bertholet Jul 29, 2026
ef45c82
Document that `rustc_codegen_gcc` now uses Josh
Kobzol Oct 19, 2026
9a62a8d
ci: Ignore `unpinned-uses` for `josh-sync/rustc-pull`
hashcatHitman Oct 7, 2026
2aece4b
ci: Pin `actions/cache` to 4.3.0 hash
hashcatHitman Oct 7, 2026
cc5cff8
ci: Pin `actions/checkout` to 7.0.1 hash
hashcatHitman Oct 7, 2026
3d1d5a0
ci: Pin `actions/github-script` to 7.1.0 hash
hashcatHitman Oct 7, 2026
0f9d598
ci: Disable credential persistence
hashcatHitman Oct 22, 2026
afeff76
ci: Prefer shell expansion over template expansion
hashcatHitman Oct 22, 2026
e6c00a8
ci: Disable all permissions by default
hashcatHitman Oct 22, 2026
a50f326
ci: Grant minimum required permissions
hashcatHitman Oct 22, 2026
f327db7
Merge pull request #3045 from hashcatHitman/ref-version-mismatch_and_…
Kobzol Oct 26, 2026
af54de2
Fix alloctests for panic=abort
bjorn3 Oct 28, 2026
0b2bf3e
Move `llvm::Context` into a new submodule
Zalathar Oct 31, 2026
d0eb8f9
Use an invariant lifetime brand for LLVM modules
Zalathar Oct 31, 2026
53b5ab3
Respect `--color=never` when printing `--explain` output to the terminal
Zalathar Oct 31, 2026
1d6ca72
Remove useless test
GuillaumeGomez Oct 31, 2026
9f832e0
reflow src/tests/directives.md
tshepang Oct 31, 2026
1dcce6b
improve tests/directives.md
tshepang Oct 31, 2026
4e0f172
Improve test
GuillaumeGomez Oct 31, 2026
08059b7
Move tests in the right folder in `tests/rustdoc-html`
GuillaumeGomez Oct 31, 2026
99b62e4
that made me think files should have this name
tshepang Oct 31, 2026
73da0c1
reflow src/rustdoc-internals/rustdoc-html-test-suite.md
tshepang Oct 31, 2026
2e541c3
sembr src/traits/canonicalization.md
tshepang Oct 31, 2026
63fdb59
improve traits/canonicalization.md
tshepang Oct 31, 2026
4496185
reflow src/traits/canonicalization.md
tshepang Oct 31, 2026
8f09efb
fix sembr tool fail
tshepang Oct 31, 2026
2f7cf45
sembr src/type-inference.md
tshepang Oct 31, 2026
eaeddd6
improve type-inference.md
tshepang Oct 31, 2026
8ce5ef2
reflow src/type-inference.md
tshepang Oct 31, 2026
b22380e
double space is very common... I do not remember seeing more
tshepang Oct 31, 2026
70a37c2
binding not needed
tshepang Oct 31, 2026
0a70cc5
sembr src/ty-module/early-binder.md
tshepang Oct 31, 2026
0ca475b
improve ty-module/early-binder.md
tshepang Oct 31, 2026
321fc64
sembr src/ty-module/early-binder.md
tshepang Oct 31, 2026
3fa40ce
reflow src/ty-module/early-binder.md
tshepang Oct 31, 2026
a0dbfe0
sembr src/traits/resolution.md
tshepang Oct 31, 2026
b4ac055
improve traits/resolution.md
tshepang Oct 31, 2026
8abb3a5
reflow src/traits/resolution.md
tshepang Oct 31, 2026
c2eb43d
Merge pull request #3081 from rust-lang/tshepang/misc
tshepang Oct 31, 2026
f2c076c
Merge pull request #3077 from Kobzol/cg-gcc-josh
tshepang Oct 31, 2026
8dcc6f8
reflow src/tests/ci.md
tshepang Oct 31, 2026
ed64975
improve tests/ci.md
tshepang Oct 31, 2026
aaa958a
Merge pull request #3082 from rust-lang/tshepang/misc
tshepang Oct 31, 2026
c0a9ead
impl Eq for AllocRange
RalfJung Oct 31, 2026
43272c7
Merge pull request #2983 from rust-lang/tshepang-patch-2
tshepang Oct 31, 2026
ff0d714
rustdoc: notable trait badge color attribute
notriddle Aug 2, 2026
930372b
Fix RISC-V inline ASM `clobber_abi` when extra target features are en…
beetrees Oct 5, 2026
dd9fc74
Rollup merge of #160186 - Jules-Bertholet:fn-traits-any-abi, r=workin…
jhpratt Nov 1, 2026
95e103a
Rollup merge of #160370 - notriddle:notable-trait-color, r=GuillaumeG…
jhpratt Nov 1, 2026
e71da47
Rollup merge of #165077 - bjorn3:alloctests_panic_abort, r=thomcc
jhpratt Nov 1, 2026
1206de2
Rollup merge of #163623 - GuillaumeGomez:code-inline, r=notriddle
jhpratt Nov 1, 2026
4cf06e0
Rollup merge of #163833 - beetrees:fix-riscv-clobber-abi, r=Amanieu
jhpratt Nov 1, 2026
46af6c6
Rollup merge of #165067 - Zalathar:llmod, r=hanna-kruppe
jhpratt Nov 1, 2026
5a1e12b
Rollup merge of #165227 - Zalathar:explain-color, r=Kivooeo
jhpratt Nov 1, 2026
a47e556
Rollup merge of #165254 - GuillaumeGomez:cleanup-rustdoc-html-tests, …
jhpratt Nov 1, 2026
e3e42e0
Rollup merge of #165258 - RalfJung:alloc-range-eq, r=saethlin
jhpratt Nov 1, 2026
a83d800
Rollup merge of #165259 - tshepang:rdg-sync, r=tshepang
jhpratt Nov 1, 2026
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
37 changes: 37 additions & 0 deletions compiler/rustc_abi/src/extern_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,43 @@ impl ExternAbi {
| Self::Swift => true,
}
}

/// Returns whether safe functions with this ABI implement the `Fn` traits.
/// `false` only for uncallable or internal ABIs.
pub fn is_fn_trait_compatible(self) -> bool {
match self {
ExternAbi::C { .. }
| ExternAbi::System { .. }
| ExternAbi::Rust
| ExternAbi::RustCold
| ExternAbi::RustPreserveNone
| ExternAbi::RustTail
| ExternAbi::EfiApi
| ExternAbi::Swift
| ExternAbi::Aapcs { .. }
| ExternAbi::CmseNonSecureCall
| ExternAbi::CmseNonSecureEntry
| ExternAbi::Cdecl { .. }
| ExternAbi::Stdcall { .. }
| ExternAbi::Fastcall { .. }
| ExternAbi::Thiscall { .. }
| ExternAbi::Vectorcall { .. }
| ExternAbi::SysV64 { .. }
| ExternAbi::Win64 { .. } => true,
ExternAbi::RustCall
| ExternAbi::RustInvalid
| ExternAbi::LlvmIntrinsic
| ExternAbi::Custom
| ExternAbi::GpuKernel
| ExternAbi::PtxKernel
| ExternAbi::AvrInterrupt
| ExternAbi::AvrNonBlockingInterrupt
| ExternAbi::Msp430Interrupt
| ExternAbi::RiscvInterruptM
| ExternAbi::RiscvInterruptS
| ExternAbi::X86Interrupt => false,
}
}
}

pub fn all_names() -> Vec<&'static str> {
Expand Down
37 changes: 36 additions & 1 deletion compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ pub struct DocAttribute {
pub keyword: Option<(Symbol, Span)>,
pub attribute: Option<(Symbol, Span)>,
pub masked: Option<Span>,
pub notable_trait: Option<Span>,
pub notable_trait: Option<(Option<(NotableTraitColor, Span)>, Span)>,
pub search_unbox: Option<Span>,

// valid on crate
Expand All @@ -520,6 +520,41 @@ pub struct DocAttribute {
pub no_crate_inject: Option<Span>,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(StableHash, Encodable, Decodable, PrintAttribute)]
pub enum NotableTraitColor {
Grey,
Red,
Green,
Yellow,
Blue,
Magenta,
Cyan,
Transparent,
}

impl From<NotableTraitColor> for &'static str {
fn from(color: NotableTraitColor) -> &'static str {
use NotableTraitColor::*;
match color {
Grey => "grey",
Red => "red",
Green => "green",
Yellow => "yellow",
Blue => "blue",
Magenta => "magenta",
Cyan => "cyan",
Transparent => "transparent",
}
}
}

impl std::fmt::Display for NotableTraitColor {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str((*self).into())
}
}

impl<E: rustc_span::SpanEncoder> rustc_serialize::Encodable<E> for DocAttribute {
fn encode(&self, encoder: &mut E) {
let DocAttribute {
Expand Down
109 changes: 96 additions & 13 deletions compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc_ast::ast::{AttrStyle, LitKind, MetaItemLit};
use rustc_attr_ir::target::{AstTarget, ConstTypeAstTarget, Target};
use rustc_attr_ir::{
AttributeKind, CfgEntry, CfgHideShow, DocAttribute, DocCfgHideShow, DocCfgHideShowValue,
DocInline, HideOrShow,
DocInline, HideOrShow, NotableTraitColor,
};
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, IndexEntry};
use rustc_errors::{Applicability, MultiSpan, msg};
Expand All @@ -15,13 +15,14 @@ use super::{AcceptMapping, AttributeParser, template};
use crate::context::{AcceptContext, FinalizeContext};
use crate::diagnostics::{
DocAliasBadChar, DocAliasDuplicated, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd,
DocAttrNotCrateLevel, DocAttributeNotAttribute, DocAutoCfgExpectsHideOrShow,
DocAutoCfgHideShowExpectsList, DocAutoCfgHideShowNoIdentBeforeValues,
DocAutoCfgHideShowUnexpectedItem, DocAutoCfgHideShowUnexpectedItemAfterValues,
DocAutoCfgHideShowValuesMix, DocAutoCfgWrongLiteral, DocInlineConflict, DocInlineOnlyUse,
DocKeywordAttributeNotAnonConst, DocKeywordNotKeyword, DocTestLiteral, DocTestTakesList,
DocTestUnknown, DocUnknownAny, DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins,
DocUnknownSpotlight, ExpectedNameValue, ExpectedNoArgs, IllFormedAttributeInput, MalformedDoc,
DocAttrNotCrateLevel, DocAttrNotTraitLevel, DocAttributeNotAttribute,
DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList,
DocAutoCfgHideShowNoIdentBeforeValues, DocAutoCfgHideShowUnexpectedItem,
DocAutoCfgHideShowUnexpectedItemAfterValues, DocAutoCfgHideShowValuesMix,
DocAutoCfgWrongLiteral, DocInlineConflict, DocInlineOnlyUse, DocKeywordAttributeNotAnonConst,
DocKeywordNotKeyword, DocTestLiteral, DocTestTakesList, DocTestUnknown, DocUnknownAny,
DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins, DocUnknownSpotlight, ExpectedNameValue,
ExpectedNoArgs, IllFormedAttributeInput, InvalidNotableTraitAttr, MalformedDoc,
UnusedDuplicate,
};
use crate::parser::{
Expand Down Expand Up @@ -85,6 +86,82 @@ fn expected_string_literal(
cx.emit_lint(INVALID_DOC_ATTRIBUTES, MalformedDoc, span);
}

fn parse_notable_trait(
cx: &mut AcceptContext<'_, '_>,
path: &OwnedPathParser,
args: &ArgParser,
attr_value: &mut Option<(Option<(NotableTraitColor, Span)>, Span)>,
attr_name: Symbol,
) {
let span = path.span();

let notable_trait_color_attr = match args {
ArgParser::NoArgs => None,
ArgParser::List(meta_item_list_parser) => {
if meta_item_list_parser.is_empty() {
None
} else if let Some(meta_item) = meta_item_list_parser.as_single() {
Some(meta_item)
} else {
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
}
}
ArgParser::NameValue(_) => {
// FIXME(164728): every invalid notable trait attribute lint produces exactly
// the same warning and we should switch to more specific diagnostics
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
}
};

let notable_trait_color_and_span =
if let Some(notable_trait_color_attr) = notable_trait_color_attr {
let Some(notable_trait_color_attr) = notable_trait_color_attr.meta_item() else {
// FIXME(164728): every invalid notable trait attribute lint produces exactly
// the same warning and we should switch to more specific diagnostics
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
};
if !notable_trait_color_attr.path().word_is(sym::color) {
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
}
let Some(notable_trait_color) = notable_trait_color_attr.args().as_name_value() else {
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
};
let Some(notable_trait_color) = notable_trait_color.value_as_str() else {
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
};
let notable_trait_color = match notable_trait_color.as_str() {
"grey" | "gray" => NotableTraitColor::Grey,
"red" => NotableTraitColor::Red,
"green" => NotableTraitColor::Green,
"yellow" => NotableTraitColor::Yellow,
"blue" => NotableTraitColor::Blue,
"magenta" => NotableTraitColor::Magenta,
"cyan" => NotableTraitColor::Cyan,
"transparent" => NotableTraitColor::Transparent,
_ => {
cx.emit_lint(INVALID_DOC_ATTRIBUTES, InvalidNotableTraitAttr, span);
return;
}
};
Some((notable_trait_color, notable_trait_color_attr.span()))
} else {
None
};

if cx.shared.target != Target::Trait {
cx.emit_lint(INVALID_DOC_ATTRIBUTES, DocAttrNotTraitLevel { span, attr_name }, span);
return;
}

*attr_value = Some((notable_trait_color_and_span, span));
}

fn parse_keyword_and_attribute(
cx: &mut AcceptContext<'_, '_>,
path: &OwnedPathParser,
Expand Down Expand Up @@ -174,14 +251,14 @@ impl DocParser {
}
Some(sym::attr) => {
let Some(list) = args.as_list() else {
// FIXME: remove this method once merged and uncomment the line below instead.
// cx.expected_list(cx.attr_span, args);
// FIXME(164728): remove this method once merged and uncomment the line
// below instead. cx.expected_list(cx.attr_span, args);
let span = cx.attr_span;
cx.emit_lint(INVALID_DOC_ATTRIBUTES, MalformedDoc, span);
return;
};

// FIXME: convert list into a Vec of `AttributeKind` because current code is awful.
// FIXME(164728): remove this method once merged and uncomment the line
// below instead. cx.expected_list(cx.attr_span, args);
for attr in list.mixed() {
// Arguments of `attr` are checked via the span, so can be safely ignored
attr.ignore_args();
Expand Down Expand Up @@ -621,7 +698,13 @@ impl DocParser {
}
Some(sym::notable_trait) => {
gated!(doc_notable_trait);
no_args!(notable_trait)
parse_notable_trait(
cx,
path,
args,
&mut self.attribute.notable_trait,
sym::notable_trait,
)
}
Some(sym::keyword) => {
gated!(rustdoc_internals);
Expand Down
18 changes: 18 additions & 0 deletions compiler/rustc_attr_parsing/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,13 @@ pub(crate) struct ExpectedNoArgs;
)]
pub(crate) struct ExpectedNameValue;

#[derive(Diagnostic)]
#[diag("expected either `doc(notable_trait)` or `doc(notable_trait(color=\"...\"))`")]
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub(crate) struct InvalidNotableTraitAttr;

#[derive(Diagnostic)]
#[diag("malformed `{$attribute}` attribute")]
#[help("{$options}")]
Expand Down Expand Up @@ -1052,6 +1059,17 @@ pub(crate) struct DocAttributeNotAttribute {
pub attribute: Symbol,
}

#[derive(Diagnostic)]
#[diag("`#![doc({$attr_name})]` must be a trait attribute")]
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub(crate) struct DocAttrNotTraitLevel {
#[primary_span]
pub span: Span,
pub attr_name: Symbol,
}

#[derive(Diagnostic)]
#[diag(
"`#[target_feature]` cannot be applied to a {$kind ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ index 8402833..84592e0 100644
split_off_tests! {
slice: &mut [(); usize::MAX], method: split_off_mut,
(split_off_mut_in_bounds_max_range_to, (..usize::MAX), Some(empty_max_mut!()), &mut [(); 0]),
diff --git a/alloctests/tests/sort/tests.rs b/alloctests/tests/sort/tests.rs
index d321f8d..8b2040a 100644
--- a/alloctests/tests/sort/tests.rs
+++ b/alloctests/tests/sort/tests.rs
@@ -1,3 +1,5 @@
+#![cfg(any())]
+
use std::cell::Cell;
use std::cmp::Ordering;
use std::fmt::Debug;
diff --git a/alloctests/tests/str.rs b/alloctests/tests/str.rs
index 906fa2d..b82fa99 100644
--- a/alloctests/tests/str.rs
Expand Down
37 changes: 15 additions & 22 deletions compiler/rustc_codegen_llvm/src/back/llvm_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl CodegenBackend for LlvmCodegenBackend {

pub struct ModuleLlvm {
llcx_raw: ptr::NonNull<llvm::ContextRaw>,
llmod_raw: *const llvm::Module,
llmod_raw: ptr::NonNull<llvm::ModuleRaw>,

// This field is `ManuallyDrop` because it is important that the `TargetMachine`
// is disposed prior to the `Context` being disposed otherwise UAFs can occur.
Expand All @@ -461,22 +461,15 @@ pub struct ModuleLlvm {
// `ModuleLlvm` owns the context and only allows borrowing LLVM objects tied to the context.
unsafe impl Send for ModuleLlvm {}

/// Converts an unbranded pointer-to-context to a lifetime-branded [`llvm::Context`].
///
/// # Safety
/// - The pointer must be a valid LLVM context.
/// - If the context is passed to safe code, its caller-requested lifetime must be distinct
/// from that of any other context, and must not outlive the underlying context.
unsafe fn wrap_llcx<'ll>(llcx_raw: ptr::NonNull<llvm::ContextRaw>) -> llvm::Context<'ll> {
llvm::Context { llcx_raw, _invariant_ll: PhantomData }
}

/// Shared helper to call [`llvm::LLVMContextCreate`] and then configure
/// [`llvm::LLVMContextSetDiscardValueNames`].
fn create_context_and_set_fewer_names(fewer_names: bool) -> ptr::NonNull<llvm::ContextRaw> {
unsafe {
let llcx_raw = llvm::LLVMContextCreate();
llvm::LLVMContextSetDiscardValueNames(wrap_llcx(llcx_raw), fewer_names.to_llvm_bool());
llvm::LLVMContextSetDiscardValueNames(
llvm::wrap_llcx(llcx_raw),
fewer_names.to_llvm_bool(),
);
llcx_raw
}
}
Expand All @@ -485,7 +478,8 @@ impl ModuleLlvm {
pub(crate) fn new(tcx: TyCtxt<'_>, mod_name: &str) -> Self {
unsafe {
let llcx_raw = create_context_and_set_fewer_names(tcx.sess.fewer_names());
let llmod_raw = context::create_module(tcx, wrap_llcx(llcx_raw), mod_name);
let llmod_raw =
context::create_module(tcx, llvm::wrap_llcx(llcx_raw), mod_name).llmod_raw();
ModuleLlvm {
llmod_raw,
llcx_raw,
Expand All @@ -498,7 +492,8 @@ impl ModuleLlvm {
pub(crate) fn new_metadata(tcx: TyCtxt<'_>, mod_name: &str) -> Self {
unsafe {
let llcx_raw = create_context_and_set_fewer_names(tcx.sess.fewer_names());
let llmod_raw = context::create_module(tcx, wrap_llcx(llcx_raw), mod_name);
let llmod_raw =
context::create_module(tcx, llvm::wrap_llcx(llcx_raw), mod_name).llmod_raw();
ModuleLlvm {
llmod_raw,
llcx_raw,
Expand All @@ -517,7 +512,8 @@ impl ModuleLlvm {
) -> Self {
unsafe {
let llcx_raw = create_context_and_set_fewer_names(cgcx.fewer_names);
let llmod_raw = back::lto::parse_module(wrap_llcx(llcx_raw), name, buffer, dcx);
let llmod_raw =
back::lto::parse_module(llvm::wrap_llcx(llcx_raw), name, buffer, dcx).llmod_raw();
let tm = tm_factory(dcx, TargetMachineFactoryConfig::new(cgcx, name.to_str().unwrap()));

ModuleLlvm {
Expand All @@ -538,12 +534,9 @@ impl ModuleLlvm {
&self,
inner_fn: impl for<'ll> FnOnce(ModuleRefs<'ll>) -> R,
) -> R {
inner_fn(ModuleRefs {
llcx: unsafe { wrap_llcx(self.llcx_raw) },
llmod: unsafe { &*self.llmod_raw },
tm: self.tm.raw(),
_ph: PhantomData,
})
let llcx = unsafe { llvm::wrap_llcx(self.llcx_raw) };
let llmod = unsafe { llvm::wrap_llmod(llcx, self.llmod_raw) };
inner_fn(ModuleRefs { llcx, llmod, tm: self.tm.raw(), _ph: PhantomData })
}
}

Expand All @@ -560,7 +553,7 @@ impl Drop for ModuleLlvm {
#[derive(Clone, Copy)]
pub(crate) struct ModuleRefs<'ll> {
pub(crate) llcx: llvm::Context<'ll>,
pub(crate) llmod: &'ll llvm::Module,
pub(crate) llmod: llvm::Module<'ll>,
pub(crate) tm: &'ll llvm::TargetMachine,
/// Make sure `'ll` is invariant, even if no fields happen to require that.
///
Expand Down
Loading
Loading