Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9f7dc2e
Extract version check from ensure_version_or_cargo_install
Shunpoco Dec 21, 2025
b305a98
implpement if_installed for spellcheck
Shunpoco Dec 21, 2025
70d8c61
implement shellcheck
Shunpoco Dec 25, 2025
258708f
implement js check
Shunpoco Dec 25, 2025
5642a2d
implement py and cpp
Shunpoco Dec 26, 2025
6da3605
Prepare for merging from rust-lang/rust
invalid-email-address Dec 28, 2025
a5ed928
Merge ref '23d01cd24125' from rust-lang/rust
invalid-email-address Dec 28, 2025
380e4d2
compiler-builtins: Revert "cpuid is safe since the stdarch sync, so r…
tgross35 Dec 28, 2025
1276564
Ignore unused_unsafe lint in libm/src/math/arch/x86/detect.rs
taiki-e Dec 27, 2025
b49e56d
fix typo (this commit will be squashed after review)
Shunpoco Dec 29, 2025
215768a
fix missing_panics_doc in `std::os::fd::owned`
xtqqczze Dec 31, 2025
68ea14a
address review
Shunpoco Jan 1, 2026
0d366e0
Fix a typo in `libm::Libm::roundeven`
the-ssd Jan 2, 2026
65639fe
ci: Move the dependency installs and wall time benchmarks to scripts
tgross35 Jan 4, 2026
08e0400
add unit test for ExtraCheckArg::from_str
Shunpoco Jan 4, 2026
dfe7d8a
move ensure_version/ensure_version_or_cargo_install to extra_checks
Shunpoco Jan 4, 2026
3f773fa
std: sys: fs: uefi: Implement remove_dir_all
Ayush1325 Dec 31, 2025
0dfff23
address reviews
Shunpoco Jan 6, 2026
69bedd1
compiler-builtins: Enable AArch64 `__chkstk` for MinGW
mati865 Jan 7, 2026
64c78f6
make `MarkdownItemInfo` a field struct
folkertdev Jan 5, 2026
3be74a7
render intra-doc links in the `#[deprectated]` note
folkertdev Jan 6, 2026
aec8b69
Minor cleanups to fn_abi_new_uncached
bjorn3 Jan 7, 2026
27b1083
Update `literal-escaper` version to `0.0.7`
GuillaumeGomez Jan 8, 2026
6b88c6b
store defids instead of symbol names in the aliases list
jdonszelmann Jan 8, 2026
9f3956f
MGCA: literals support
Human9000-bit Jan 5, 2026
1eb605f
Query associated_item_def_ids when needed
cvengler Jan 8, 2026
5c31b5f
Rollup merge of #149961 - add-optional-spellcheck-in-pre-hook, r=lolb…
matthiaskrgr Jan 8, 2026
05420fc
Rollup merge of #150533 - uefi-fs-rmdirall, r=ChrisDenton
matthiaskrgr Jan 8, 2026
158f1c6
Rollup merge of #150549 - patch-1, r=ChrisDenton
matthiaskrgr Jan 8, 2026
1a5ba32
Rollup merge of #150699 - literals-as-direct-const-args, r=BoxyUwU
matthiaskrgr Jan 8, 2026
653ead8
Rollup merge of #150721 - deprecated-doc-intra-link, r=GuillaumeGomez
matthiaskrgr Jan 8, 2026
e94acea
Rollup merge of #150802 - fn_abi_cleanup, r=lqd
matthiaskrgr Jan 8, 2026
0083f09
Rollup merge of #150803 - update-builtins, r=tgross35
matthiaskrgr Jan 8, 2026
4c640fb
Rollup merge of #150809 - update-literal-escaper, r=Urgau
matthiaskrgr Jan 8, 2026
86c5509
Rollup merge of #150811 - defid-aliases, r=bjorn3
matthiaskrgr Jan 8, 2026
39471cc
Rollup merge of #150825 - move-items, r=JonathanBrouwer
matthiaskrgr Jan 8, 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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3412,9 +3412,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"

[[package]]
name = "rustc-literal-escaper"
version = "0.0.5"
version = "0.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ee29da77c5a54f42697493cd4c9b9f31b74df666a6c04dfc4fde77abe0438b"
checksum = "8be87abb9e40db7466e0681dc8ecd9dcfd40360cb10b4c8fe24a7c4c3669b198"

[[package]]
name = "rustc-main"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
# tidy-alphabetical-start
bitflags = "2.4.1"
memchr = "2.7.6"
rustc-literal-escaper = "0.0.5"
rustc-literal-escaper = "0.0.7"
rustc_ast_ir = { path = "../rustc_ast_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_index = { path = "../rustc_index" }
Expand Down
34 changes: 34 additions & 0 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,34 @@ impl AttributeExt for Attribute {
}
}

fn deprecation_note(&self) -> Option<Symbol> {
match &self.kind {
AttrKind::Normal(normal) if normal.item.path == sym::deprecated => {
let meta = &normal.item;

// #[deprecated = "..."]
if let Some(s) = meta.value_str() {
return Some(s);
}

// #[deprecated(note = "...")]
if let Some(list) = meta.meta_item_list() {
for nested in list {
if let Some(mi) = nested.meta_item()
&& mi.path == sym::note
&& let Some(s) = mi.value_str()
{
return Some(s);
}
}
}

None
}
_ => None,
}
}

fn doc_resolution_scope(&self) -> Option<AttrStyle> {
match &self.kind {
AttrKind::DocComment(..) => Some(self.style),
Expand Down Expand Up @@ -277,6 +305,7 @@ impl Attribute {

pub fn may_have_doc_links(&self) -> bool {
self.doc_str().is_some_and(|s| comments::may_have_doc_links(s.as_str()))
|| self.deprecation_note().is_some_and(|s| comments::may_have_doc_links(s.as_str()))
}

/// Extracts the MetaItem from inside this Attribute.
Expand Down Expand Up @@ -873,6 +902,11 @@ pub trait AttributeExt: Debug {
/// * `#[doc(...)]` returns `None`.
fn doc_str(&self) -> Option<Symbol>;

/// Returns the deprecation note if this is deprecation attribute.
/// * `#[deprecated = "note"]` returns `Some("note")`.
/// * `#[deprecated(note = "note", ...)]` returns `Some("note")`.
fn deprecation_note(&self) -> Option<Symbol>;

fn is_proc_macro_attr(&self) -> bool {
[sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
.iter()
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2536,6 +2536,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

overly_complex_const(self)
}
ExprKind::Lit(literal) => {
let span = expr.span;
let literal = self.lower_lit(literal, span);

ConstArg {
hir_id: self.lower_node_id(expr.id),
kind: hir::ConstArgKind::Literal(literal.node),
span,
}
}
_ => overly_complex_const(self),
}
}
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rustc_middle::mir::mono::Visibility;
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv, LayoutOf};
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
use rustc_session::config::CrateType;
use rustc_span::Symbol;
use rustc_target::spec::{Arch, RelocModel};
use tracing::debug;

Expand Down Expand Up @@ -92,17 +91,19 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
}

impl CodegenCx<'_, '_> {
fn add_aliases(&self, aliasee: &llvm::Value, aliases: &[(Symbol, Linkage, Visibility)]) {
fn add_aliases(&self, aliasee: &llvm::Value, aliases: &[(DefId, Linkage, Visibility)]) {
let ty = self.get_type_of_global(aliasee);

for (alias, linkage, visibility) in aliases {
let symbol_name = self.tcx.symbol_name(Instance::mono(self.tcx, *alias));

tracing::debug!("ALIAS: {alias:?} {linkage:?} {visibility:?}");
let lldecl = llvm::add_alias(
self.llmod,
ty,
AddressSpace::ZERO,
aliasee,
&CString::new(alias.as_str()).unwrap(),
&CString::new(symbol_name.name).unwrap(),
);

llvm::set_visibility(lldecl, base::visibility_to_llvm(*visibility));
Expand Down
8 changes: 3 additions & 5 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use rustc_middle::middle::codegen_fn_attrs::{
use rustc_middle::mir::mono::Visibility;
use rustc_middle::query::Providers;
use rustc_middle::span_bug;
use rustc_middle::ty::{self as ty, Instance, TyCtxt};
use rustc_middle::ty::{self as ty, TyCtxt};
use rustc_session::lint;
use rustc_session::parse::feature_err;
use rustc_span::{Span, Symbol, sym};
use rustc_span::{Span, sym};
use rustc_target::spec::Os;

use crate::errors;
Expand Down Expand Up @@ -291,8 +291,6 @@ fn process_builtin_attrs(
)
.expect("eii should have declaration macro with extern target attribute");

let symbol_name = tcx.symbol_name(Instance::mono(tcx, extern_item));

// this is to prevent a bug where a single crate defines both the default and explicit implementation
// for an EII. In that case, both of them may be part of the same final object file. I'm not 100% sure
// what happens, either rustc deduplicates the symbol or llvm, or it's random/order-dependent.
Expand All @@ -310,7 +308,7 @@ fn process_builtin_attrs(
}

codegen_fn_attrs.foreign_item_symbol_aliases.push((
Symbol::intern(symbol_name.name),
extern_item,
if i.is_default { Linkage::LinkOnceAny } else { Linkage::External },
Visibility::Default,
));
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ pub enum ConstArgKind<'hir, Unambig = ()> {
/// This variant is not always used to represent inference consts, sometimes
/// [`GenericArg::Infer`] is used instead.
Infer(Unambig),
Literal(LitKind),
}

#[derive(Clone, Copy, Debug, HashStable_Generic)]
Expand Down Expand Up @@ -1400,6 +1401,14 @@ impl AttributeExt for Attribute {
}
}

#[inline]
fn deprecation_note(&self) -> Option<Symbol> {
match &self {
Attribute::Parsed(AttributeKind::Deprecation { deprecation, .. }) => deprecation.note,
_ => None,
}
}

fn is_automatically_derived_attr(&self) -> bool {
matches!(self, Attribute::Parsed(AttributeKind::AutomaticallyDerived(..)))
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ pub fn walk_const_arg<'v, V: Visitor<'v>>(
ConstArgKind::Path(qpath) => visitor.visit_qpath(qpath, *hir_id, qpath.span()),
ConstArgKind::Anon(anon) => visitor.visit_anon_const(*anon),
ConstArgKind::Error(_) => V::Result::output(), // errors and spans are not important
ConstArgKind::Literal(..) => V::Result::output(), // FIXME(mcga)
}
}

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ impl<'tcx> InherentCollect<'tcx> {
}

if self.tcx.features().rustc_attrs() {
let items = self.tcx.associated_item_def_ids(impl_def_id);

if !self.tcx.has_attr(ty_def_id, sym::rustc_has_incoherent_inherent_impls) {
let impl_span = self.tcx.def_span(impl_def_id);
return Err(self.tcx.dcx().emit_err(errors::InherentTyOutside { span: impl_span }));
}

let items = self.tcx.associated_item_def_ids(impl_def_id);
for &impl_item in items {
if !find_attr!(
self.tcx.get_all_attrs(impl_item),
Expand Down
15 changes: 15 additions & 0 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub mod generics;
use std::assert_matches::assert_matches;
use std::slice;

use rustc_ast::LitKind;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_errors::codes::*;
use rustc_errors::{
Expand Down Expand Up @@ -2391,6 +2392,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
hir::ConstArgKind::Anon(anon) => self.lower_const_arg_anon(anon),
hir::ConstArgKind::Infer(()) => self.ct_infer(None, const_arg.span),
hir::ConstArgKind::Error(e) => ty::Const::new_error(tcx, e),
hir::ConstArgKind::Literal(kind) if let FeedConstTy::WithTy(anon_const_type) = feed => {
self.lower_const_arg_literal(&kind, anon_const_type, const_arg.span)
}
hir::ConstArgKind::Literal(..) => {
let e = self.dcx().span_err(const_arg.span, "literal of unknown type");
ty::Const::new_error(tcx, e)
}
}
}

Expand Down Expand Up @@ -2773,6 +2781,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
}
}

#[instrument(skip(self), level = "debug")]
fn lower_const_arg_literal(&self, kind: &LitKind, ty: Ty<'tcx>, span: Span) -> Const<'tcx> {
let tcx = self.tcx();
let input = LitToConstInput { lit: *kind, ty, neg: false };
tcx.at(span).lit_to_const(input)
}

#[instrument(skip(self), level = "debug")]
fn try_lower_anon_const_lit(
&self,
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_hir::{
GenericParam, GenericParamKind, HirId, ImplicitSelfKind, LifetimeParamKind, Node, PatKind,
PreciseCapturingArg, RangeEnd, Term, TyPatKind,
};
use rustc_span::source_map::SourceMap;
use rustc_span::source_map::{SourceMap, Spanned};
use rustc_span::{DUMMY_SP, FileName, Ident, Span, Symbol, kw, sym};
use {rustc_ast as ast, rustc_hir as hir};

Expand Down Expand Up @@ -1157,6 +1157,10 @@ impl<'a> State<'a> {
ConstArgKind::Anon(anon) => self.print_anon_const(anon),
ConstArgKind::Error(_) => self.word("/*ERROR*/"),
ConstArgKind::Infer(..) => self.word("_"),
ConstArgKind::Literal(node) => {
let span = const_arg.span;
self.print_literal(&Spanned { span, node: *node })
}
}
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
| hir::ConstArgKind::TupleCall(..)
| hir::ConstArgKind::Tup(..)
| hir::ConstArgKind::Path(..)
| hir::ConstArgKind::Literal(..)
| hir::ConstArgKind::Infer(..) => true,
hir::ConstArgKind::Anon(..) => false,
},
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::borrow::Cow;

use rustc_abi::Align;
use rustc_hir::attrs::{InlineAttr, InstructionSetAttr, Linkage, OptimizeAttr, RtsanSetting};
use rustc_hir::def_id::DefId;
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
use rustc_span::Symbol;
use rustc_target::spec::SanitizerSet;
Expand Down Expand Up @@ -72,7 +73,7 @@ pub struct CodegenFnAttrs {
/// generate this function under its real name,
/// but *also* under the same name as this foreign function so that the foreign function has an implementation.
// FIXME: make "SymbolName<'tcx>"
pub foreign_item_symbol_aliases: Vec<(Symbol, Linkage, Visibility)>,
pub foreign_item_symbol_aliases: Vec<(DefId, Linkage, Visibility)>,
/// The `#[link_ordinal = "..."]` attribute, indicating an ordinal an
/// imported function has in the dynamic library. Note that this must not
/// be set when `link_name` is set. This is for foreign items with the
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
bitflags = "2.4.1"
rustc-literal-escaper = "0.0.5"
rustc-literal-escaper = "0.0.7"
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse_format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"

[dependencies]
# tidy-alphabetical-start
rustc-literal-escaper = "0.0.5"
rustc-literal-escaper = "0.0.7"
rustc_lexer = { path = "../rustc_lexer" }
# tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_proc_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ doctest = false

[dependencies]
# tidy-alphabetical-start
rustc-literal-escaper = "0.0.5"
rustc-literal-escaper = "0.0.7"
# tidy-alphabetical-end

[features]
Expand Down
13 changes: 11 additions & 2 deletions compiler/rustc_resolve/src/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,17 @@ pub fn may_be_doc_link(link_type: LinkType) -> bool {
/// Simplified version of `preprocessed_markdown_links` from rustdoc.
/// Must return at least the same links as it, but may add some more links on top of that.
pub(crate) fn attrs_to_preprocessed_links<A: AttributeExt + Clone>(attrs: &[A]) -> Vec<Box<str>> {
let (doc_fragments, _) = attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), true);
let doc = prepare_to_doc_link_resolution(&doc_fragments).into_values().next().unwrap();
let (doc_fragments, other_attrs) =
attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), false);
let mut doc =
prepare_to_doc_link_resolution(&doc_fragments).into_values().next().unwrap_or_default();

for attr in other_attrs {
if let Some(note) = attr.deprecation_note() {
doc += note.as_str();
doc += "\n";
}
}

parse_links(&doc)
}
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_target/src/callconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,14 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
pub fn new(
cx: &impl HasDataLayout,
layout: TyAndLayout<'a, Ty>,
scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, Scalar, Size) -> ArgAttributes,
scalar_attrs: impl Fn(Scalar, Size) -> ArgAttributes,
) -> Self {
let mode = match layout.backend_repr {
BackendRepr::Scalar(scalar) => {
PassMode::Direct(scalar_attrs(&layout, scalar, Size::ZERO))
}
_ if layout.is_zst() => PassMode::Ignore,
BackendRepr::Scalar(scalar) => PassMode::Direct(scalar_attrs(scalar, Size::ZERO)),
BackendRepr::ScalarPair(a, b) => PassMode::Pair(
scalar_attrs(&layout, a, Size::ZERO),
scalar_attrs(&layout, b, a.size(cx).align_to(b.align(cx).abi)),
scalar_attrs(a, Size::ZERO),
scalar_attrs(b, a.size(cx).align_to(b.align(cx).abi)),
),
BackendRepr::SimdVector { .. } => PassMode::Direct(ArgAttributes::new()),
BackendRepr::Memory { .. } => Self::indirect_pass_mode(&layout),
Expand Down
12 changes: 3 additions & 9 deletions compiler/rustc_ty_utils/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,9 @@ fn fn_abi_new_uncached<'tcx>(
layout
};

let mut arg = ArgAbi::new(cx, layout, |layout, scalar, offset| {
arg_attrs_for_rust_scalar(*cx, scalar, *layout, offset, is_return, drop_target_pointee)
});

if arg.layout.is_zst() {
arg.mode = PassMode::Ignore;
}

Ok(arg)
Ok(ArgAbi::new(cx, layout, |scalar, offset| {
arg_attrs_for_rust_scalar(*cx, scalar, layout, offset, is_return, drop_target_pointee)
}))
};

let mut fn_abi = FnAbi {
Expand Down
5 changes: 2 additions & 3 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,11 @@ dependencies = [

[[package]]
name = "rustc-literal-escaper"
version = "0.0.5"
version = "0.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ee29da77c5a54f42697493cd4c9b9f31b74df666a6c04dfc4fde77abe0438b"
checksum = "8be87abb9e40db7466e0681dc8ecd9dcfd40360cb10b4c8fe24a7c4c3669b198"
dependencies = [
"rustc-std-workspace-core",
"rustc-std-workspace-std",
]

[[package]]
Expand Down
Loading
Loading