Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fd3a74d
core/num: Implement feature `integer_cast_extras`
okaneco Apr 1, 2026
804f495
constify Index(Mut), Deref(Mut) for Vec
Lars-Schumann Apr 9, 2026
1a28bc4
Disable ABI checks for the `unadjusted` ABI
sayantn Apr 13, 2026
7e24cd8
Add autocast for `x86_amx`
sayantn Apr 13, 2026
0ce1696
Adjust some outdated docs for `//@ forbid-output`
Zalathar Apr 17, 2026
72abf37
Rename incremental `cfail`/`cpass` revisions to `bfail`/`bpass`
Zalathar Apr 17, 2026
8eb89a8
docs(num): fix stale link to `mem::Alignment`
sorairolake Apr 18, 2026
e4c852d
add suggestion for expect
Kivooeo Apr 19, 2026
ace320f
Remove `AttributeLintKind::AmbiguousDeriveHelpers` variant
GuillaumeGomez Apr 19, 2026
d7d9cf9
Remove `AttributeLintKind::DocAutoCfgHideShowUnexpectedItem` variant
GuillaumeGomez Apr 19, 2026
dacc42f
Remove `AttributeLintKind::DocAutoCfgHideShowExpectsList` variant
GuillaumeGomez Apr 20, 2026
4b2e2ac
Remove unused `AttributeLintKind::DocInvalid` variant
GuillaumeGomez Apr 20, 2026
6d23cf9
Remove `AttributeLintKind::DocUnknownInclude` variant
GuillaumeGomez Apr 20, 2026
5749fe8
Provide a const new for `GlobalCache`
ChayimFriedman2 Apr 20, 2026
fd65209
Tweak `is_ascii_punctuation()`/`graphic()` docs wording
Jules-Bertholet Apr 20, 2026
459be3e
compiletest: add a new diff for compare-out-by-lines tests.
Ozzy1423 Apr 13, 2026
ce91732
Rollup merge of #155054 - Lars-Schumann:const-vec-ops, r=dtolnay
JonathanBrouwer Apr 20, 2026
cccf996
Rollup merge of #155264 - sayantn:amx-autocast, r=dianqk
JonathanBrouwer Apr 20, 2026
8beed17
Rollup merge of #155507 - Kivooeo:no-expect, r=mejrs
JonathanBrouwer Apr 20, 2026
26f47ae
Rollup merge of #154664 - okaneco:integer_cast_extras, r=scottmcm
JonathanBrouwer Apr 20, 2026
1204fb1
Rollup merge of #155238 - Ozzy1423:diff-by-lines, r=jieyouxu
JonathanBrouwer Apr 20, 2026
fda59bf
Rollup merge of #155474 - Zalathar:bpass, r=jieyouxu
JonathanBrouwer Apr 20, 2026
ede69da
Rollup merge of #155493 - sorairolake:fix-alignment-doc-link, r=scottmcm
JonathanBrouwer Apr 20, 2026
055543f
Rollup merge of #155529 - GuillaumeGomez:rm-attributelintkind, r=Jona…
JonathanBrouwer Apr 20, 2026
2e5a9fc
Rollup merge of #155531 - Jules-Bertholet:is_ascii_punctuation_docs, …
JonathanBrouwer Apr 20, 2026
d00c047
Rollup merge of #155533 - ChayimFriedman2:const-cache-new, r=ShoyuVan…
JonathanBrouwer Apr 20, 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
44 changes: 29 additions & 15 deletions compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc_ast::ast::{AttrStyle, LitKind, MetaItemLit};
use rustc_errors::{Diagnostic, msg};
use rustc_errors::{Applicability, Diagnostic, msg};
use rustc_feature::template;
use rustc_hir::Target;
use rustc_hir::attrs::{
Expand All @@ -13,7 +13,10 @@ use thin_vec::ThinVec;
use super::prelude::{ALL_TARGETS, AllowedTargets};
use super::{AcceptMapping, AttributeParser};
use crate::context::{AcceptContext, FinalizeContext, Stage};
use crate::errors::{DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, IllFormedAttributeInput};
use crate::errors::{
DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList,
DocAutoCfgHideShowUnexpectedItem, DocUnknownInclude, IllFormedAttributeInput,
};
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
use crate::session_diagnostics::{
DocAliasBadChar, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd, DocAttrNotCrateLevel,
Expand Down Expand Up @@ -364,9 +367,11 @@ impl DocParser {
}
};
let ArgParser::List(list) = item.args() else {
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocAutoCfgHideShowExpectsList { attr_name },
move |dcx, level| {
DocAutoCfgHideShowExpectsList { attr_name }.into_diag(dcx, level)
},
item.span(),
);
continue;
Expand All @@ -376,9 +381,12 @@ impl DocParser {

for item in list.mixed() {
let MetaItemOrLitParser::MetaItemParser(sub_item) = item else {
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocAutoCfgHideShowUnexpectedItem { attr_name },
move |dcx, level| {
DocAutoCfgHideShowUnexpectedItem { attr_name }
.into_diag(dcx, level)
},
item.span(),
);
continue;
Expand Down Expand Up @@ -416,10 +424,11 @@ impl DocParser {
}
}
_ => {
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocAutoCfgHideShowUnexpectedItem {
attr_name,
move |dcx, level| {
DocAutoCfgHideShowUnexpectedItem { attr_name }
.into_diag(dcx, level)
},
sub_item.span(),
);
Expand Down Expand Up @@ -615,14 +624,19 @@ impl DocParser {
AttrStyle::Outer => "",
AttrStyle::Inner => "!",
};
cx.emit_lint(
let value = nv.value_as_lit().symbol;
let span = path.span();
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocUnknownInclude {
inner,
value: nv.value_as_lit().symbol,
span: path.span(),
move |dcx, level| {
DocUnknownInclude {
inner,
value,
sugg: (span, Applicability::MaybeIncorrect),
}
.into_diag(dcx, level)
},
path.span(),
span,
);
}
Some(name @ (sym::passes | sym::no_default_passes)) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_hir::lints::AttributeLintKind;
use rustc_errors::Diagnostic;
use rustc_session::lint::builtin::AMBIGUOUS_DERIVE_HELPERS;

use super::prelude::*;
Expand Down Expand Up @@ -125,9 +125,9 @@ fn parse_derive_like<S: Stage>(
return None;
}
if rustc_feature::is_builtin_attr_name(ident.name) {
cx.emit_lint(
cx.emit_dyn_lint(
AMBIGUOUS_DERIVE_HELPERS,
AttributeLintKind::AmbiguousDeriveHelpers,
|dcx, level| crate::errors::AmbiguousDeriveHelpers.into_diag(dcx, level),
ident.span,
);
}
Expand Down
30 changes: 29 additions & 1 deletion compiler/rustc_attr_parsing/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_errors::{DiagArgValue, MultiSpan};
use rustc_errors::{Applicability, DiagArgValue, MultiSpan};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{Span, Symbol};

Expand Down Expand Up @@ -177,3 +177,31 @@ pub(crate) struct DocAliasDuplicated {
#[derive(Diagnostic)]
#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
pub(crate) struct DocAutoCfgExpectsHideOrShow;

#[derive(Diagnostic)]
#[diag("there exists a built-in attribute with the same name")]
pub(crate) struct AmbiguousDeriveHelpers;

#[derive(Diagnostic)]
#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")]
pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
pub attr_name: Symbol,
}

#[derive(Diagnostic)]
#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
pub(crate) struct DocAutoCfgHideShowExpectsList {
pub attr_name: Symbol,
}

#[derive(Diagnostic)]
#[diag("unknown `doc` attribute `include`")]
pub(crate) struct DocUnknownInclude {
pub inner: &'static str,
pub value: Symbol,
#[suggestion(
"use `doc = include_str!` instead",
code = "#{inner}[doc = include_str!(\"{value}\")]"
)]
pub sugg: (Span, Applicability),
}
24 changes: 24 additions & 0 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,24 @@ fn can_autocast<'ll>(cx: &CodegenCx<'ll, '_>, rust_ty: &'ll Type, llvm_ty: &'ll
}
}
TypeKind::BFloat => rust_ty == cx.type_i16(),
TypeKind::X86_AMX if cx.type_kind(rust_ty) == TypeKind::Vector => {
let element_ty = cx.element_type(rust_ty);
let element_count = cx.vector_length(rust_ty) as u64;

let element_size_bits = match cx.type_kind(element_ty) {
TypeKind::Half => 16,
TypeKind::Float => 32,
TypeKind::Double => 64,
TypeKind::FP128 => 128,
TypeKind::Integer => cx.int_width(element_ty),
TypeKind::Pointer => cx.int_width(cx.isize_ty),
_ => bug!(
"Vector element type `{element_ty:?}` not one of integer, float or pointer"
),
};

element_size_bits * element_count == 8192
}
_ => false,
}
}
Expand Down Expand Up @@ -1102,6 +1120,12 @@ fn autocast<'ll>(
)
}
}
(TypeKind::Vector, TypeKind::X86_AMX) => {
bx.call_intrinsic("llvm.x86.cast.vector.to.tile", &[src_ty], &[val])
}
(TypeKind::X86_AMX, TypeKind::Vector) => {
bx.call_intrinsic("llvm.x86.cast.tile.to.vector", &[dest_ty], &[val])
}
_ => bx.bitcast(val, dest_ty), // for `bf16(xN)` <-> `u16(xN)`
}
}
Expand Down
27 changes: 27 additions & 0 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2346,6 +2346,17 @@ impl<'a, 'b, 'tcx> FnCallDiagCtxt<'a, 'b, 'tcx> {
provided_span,
format!("unexpected argument{idx}{provided_ty_name}"),
));
if self.provided_arg_tys.len() == 1
&& let Some(span) = self.maybe_suggest_expect_for_unwrap(provided_ty)
{
err.span_suggestion_verbose(
span,
"did you mean to use `expect`?",
"expect",
Applicability::MaybeIncorrect,
);
continue;
}
let mut span = provided_span;
if span.can_be_used_for_suggestions()
&& self.call_metadata.error_span.can_be_used_for_suggestions()
Expand Down Expand Up @@ -2776,6 +2787,22 @@ impl<'a, 'b, 'tcx> FnCallDiagCtxt<'a, 'b, 'tcx> {

(suggestion_span, suggestion)
}

fn maybe_suggest_expect_for_unwrap(&self, provided_ty: Ty<'tcx>) -> Option<Span> {
let tcx = self.tcx();
if let Some(call_ident) = self.call_metadata.call_ident
&& call_ident.name == sym::unwrap
&& let Some(callee_ty) = self.callee_ty
&& let ty::Adt(adt, _) = callee_ty.peel_refs().kind()
&& (tcx.is_diagnostic_item(sym::Option, adt.did())
|| tcx.is_diagnostic_item(sym::Result, adt.did()))
&& self.may_coerce(provided_ty, Ty::new_static_str(tcx))
{
Some(call_ident.span)
} else {
None
}
}
}

struct ArgMatchingCtxt<'a, 'b, 'tcx> {
Expand Down
25 changes: 1 addition & 24 deletions compiler/rustc_lint/src/early/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::any::Any;

use rustc_data_structures::sync::DynSend;
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, Level};
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level};
use rustc_hir::lints::{AttributeLintKind, FormatWarning};
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
Expand Down Expand Up @@ -43,29 +43,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateAttrLint<'_, '_, '_> {
.into_diag(dcx, level)
}

&AttributeLintKind::AmbiguousDeriveHelpers => {
lints::AmbiguousDeriveHelpers.into_diag(dcx, level)
}

&AttributeLintKind::DocAutoCfgHideShowUnexpectedItem { attr_name } => {
lints::DocAutoCfgHideShowUnexpectedItem { attr_name }.into_diag(dcx, level)
}

&AttributeLintKind::DocAutoCfgHideShowExpectsList { attr_name } => {
lints::DocAutoCfgHideShowExpectsList { attr_name }.into_diag(dcx, level)
}

&AttributeLintKind::DocInvalid => lints::DocInvalid.into_diag(dcx, level),

&AttributeLintKind::DocUnknownInclude { span, inner, value } => {
lints::DocUnknownInclude {
inner,
value,
sugg: (span, Applicability::MaybeIncorrect),
}
.into_diag(dcx, level)
}

&AttributeLintKind::DocUnknownSpotlight { span } => {
lints::DocUnknownSpotlight { sugg_span: span }.into_diag(dcx, level)
}
Expand Down
32 changes: 0 additions & 32 deletions compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3303,38 +3303,6 @@ pub(crate) struct ExpectedNoArgs;
)]
pub(crate) struct ExpectedNameValue;

#[derive(Diagnostic)]
#[diag("there exists a built-in attribute with the same name")]
pub(crate) struct AmbiguousDeriveHelpers;

#[derive(Diagnostic)]
#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")]
pub(crate) struct DocAutoCfgHideShowUnexpectedItem {
pub attr_name: Symbol,
}

#[derive(Diagnostic)]
#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")]
pub(crate) struct DocAutoCfgHideShowExpectsList {
pub attr_name: Symbol,
}

#[derive(Diagnostic)]
#[diag("invalid `doc` attribute")]
pub(crate) struct DocInvalid;

#[derive(Diagnostic)]
#[diag("unknown `doc` attribute `include`")]
pub(crate) struct DocUnknownInclude {
pub inner: &'static str,
pub value: Symbol,
#[suggestion(
"use `doc = include_str!` instead",
code = "#{inner}[doc = include_str!(\"{value}\")]"
)]
pub sugg: (Span, Applicability),
}

#[derive(Diagnostic)]
#[diag("unknown `doc` attribute `spotlight`")]
#[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")]
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,6 @@ pub enum DeprecatedSinceKind {
pub enum AttributeLintKind {
UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>),
UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>),
DocAutoCfgHideShowUnexpectedItem { attr_name: Symbol },
DocAutoCfgHideShowExpectsList { attr_name: Symbol },
DocInvalid,
AmbiguousDeriveHelpers,
DocUnknownInclude { span: Span, inner: &'static str, value: Symbol },
DocUnknownSpotlight { span: Span },
DocUnknownPasses { name: Symbol, span: Span },
DocUnknownPlugins { span: Span },
Expand Down
13 changes: 11 additions & 2 deletions compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module ensures that if a function's ABI requires a particular target feature,
//! that target feature is enabled both on the callee and all callers.
use rustc_abi::{BackendRepr, CanonAbi, RegKind, X86Call};
use rustc_abi::{BackendRepr, CanonAbi, ExternAbi, RegKind, X86Call};
use rustc_hir::{CRATE_HIR_ID, HirId};
use rustc_middle::mir::{self, Location, traversal};
use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TyCtxt};
Expand Down Expand Up @@ -160,6 +160,12 @@ fn do_check_unsized_params<'tcx>(
/// - the signature requires target features that are not enabled
fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
let typing_env = ty::TypingEnv::fully_monomorphized();
let ty = instance.ty(tcx, typing_env);
if ty.is_fn() && ty.fn_sig(tcx).abi() == ExternAbi::Unadjusted {
// We disable all checks for the unadjusted ABI to allow linking to arbitrary LLVM
// intrinsics
return;
}
let Ok(abi) = tcx.fn_abi_of_instance(typing_env.as_query_input((instance, ty::List::empty())))
else {
// An error will be reported during codegen if we cannot determine the ABI of this
Expand Down Expand Up @@ -194,9 +200,12 @@ fn check_call_site_abi<'tcx>(
caller: InstanceKind<'tcx>,
loc: impl Fn() -> (Span, HirId) + Copy,
) {
if callee.fn_sig(tcx).abi().is_rustic_abi() {
let extern_abi = callee.fn_sig(tcx).abi();
if extern_abi.is_rustic_abi() || extern_abi == ExternAbi::Unadjusted {
// We directly handle the soundness of Rust ABIs -- so let's skip the majority of
// call sites to avoid a perf regression.
// We disable all checks for the unadjusted ABI to allow linking to arbitrary LLVM
// intrinsics
return;
}
let typing_env = ty::TypingEnv::fully_monomorphized();
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_type_ir/src/search_graph/global_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ pub struct GlobalCache<X: Cx> {
}

impl<X: Cx> GlobalCache<X> {
#[inline]
pub const fn new() -> Self {
GlobalCache { map: HashMap::with_hasher(rustc_hash::FxBuildHasher) }
}

/// Insert a final result into the global cache.
pub(super) fn insert(
&mut self,
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
#![feature(const_destruct)]
#![feature(const_eval_select)]
#![feature(const_heap)]
#![feature(const_index)]
#![feature(const_option_ops)]
#![feature(const_try)]
#![feature(copied_into_inner)]
Expand Down
Loading
Loading