Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
67e8a19
[bootstrap] Don't reverse the order of dylib search path entries
jnkel Aug 19, 2026
37aaf5c
forward global target features to module-level assembly
folkertdev Aug 5, 2026
8ceed4d
Document PartialOrd behavior for Option<T> where T: PartialOrd
zepredos Aug 26, 2026
3fec803
Formatting changes for HTML tag errors
zepredos Aug 26, 2026
bb75ebf
loongarch: support passing `u128`/`i128` to inline assembly
heiher Aug 27, 2026
97fe424
Change the doc comments to link to the relevant doc section
zepredos Aug 27, 2026
a1fb7b3
add test
qaijuang Aug 27, 2026
0f08915
do not load macro metadata for local definitions in rustdoc
qaijuang Aug 27, 2026
42629e3
better deal with internal features being injected into doctests
RalfJung Aug 27, 2026
a0ec511
fix rustc_lint_defs doctest issues
RalfJung Aug 27, 2026
cdd3fc0
std: uefi: fix File::seek returning the EOF sentinel
devnexen Aug 27, 2026
7047ae8
Add regression test for empty contract attributes with lifetime lints
chenyukang Aug 28, 2026
12f970e
Reject contract attributes without arguments
chenyukang Aug 28, 2026
9c6ebca
Add regression test for the Polonius help default
chenyukang Aug 28, 2026
d471202
fix ICE in generic_const_parameter_types with inherents
khyperia Aug 28, 2026
f31b77f
Report the configured Polonius default in -Z help
chenyukang Aug 28, 2026
66bbc14
Add rustdoc-html regression test for generated macro
GuillaumeGomez Aug 28, 2026
448757d
Retroactively add relnotes for `bool::{ok_or,ok_or_else}`
jieyouxu Aug 28, 2026
d3b2959
Clarify None and Some comparisons in docs
zepredos Aug 28, 2026
9b2b381
Use `drop_guard` in some places in {core,alloc,std}
GrigorenkoPV Aug 24, 2026
d20d512
std: optimize IO error formatting
joboet Aug 28, 2026
aee52d7
implement [u8]::split_ascii_whitespace
malezjaa Aug 28, 2026
c5e02b4
Rollup merge of #161945 - joboet:format_error, r=hanna-kruppe
JonathanBrouwer Aug 28, 2026
b1989e6
Rollup merge of #160594 - folkertdev:asm-forward-target-features, r=n…
JonathanBrouwer Aug 28, 2026
6a87718
Rollup merge of #161577 - malezjaa:u8_split_ascii_whitespace, r=nia-e
JonathanBrouwer Aug 28, 2026
9185582
Rollup merge of #161858 - khyperia:ice-generic_const_parameter_types,…
JonathanBrouwer Aug 28, 2026
1d5088a
Rollup merge of #161377 - jnkel:fix-dylib-search-order, r=jieyouxu
JonathanBrouwer Aug 28, 2026
967cbf6
Rollup merge of #161702 - GrigorenkoPV:drop-guard, r=clarfonthey
JonathanBrouwer Aug 28, 2026
6ebb6b3
Rollup merge of #161804 - zepredos:doc-option-partialord-fix, r=nia-e
JonathanBrouwer Aug 28, 2026
755d313
Rollup merge of #161865 - heiher:inline-asm-i128, r=folkertdev
JonathanBrouwer Aug 28, 2026
079c738
Rollup merge of #161877 - qaijuang:156009-follow-up, r=GuillaumeGomez
JonathanBrouwer Aug 28, 2026
34ee2f1
Rollup merge of #161880 - RalfJung:rustc_lint_defs-doctests, r=Jonath…
JonathanBrouwer Aug 28, 2026
f628f6e
Rollup merge of #161883 - RalfJung:doctest-internal-features, r=bjorn3
JonathanBrouwer Aug 28, 2026
271c7a6
Rollup merge of #161887 - devnexen:uefi_seekfrom_fix, r=ChrisDenton
JonathanBrouwer Aug 28, 2026
ec836e8
Rollup merge of #161897 - chenyukang:yukang/fix-contracts-ice-146834,…
JonathanBrouwer Aug 28, 2026
9a87346
Rollup merge of #161909 - chenyukang:yukang-fix-161543-polonius-help-…
JonathanBrouwer Aug 28, 2026
ac693d3
Rollup merge of #161910 - GuillaumeGomez:generated-macro, r=Urgau
JonathanBrouwer Aug 28, 2026
190b25c
Rollup merge of #161914 - jieyouxu:relnotes-1.98.0-bool, r=BoxyUwU
JonathanBrouwer Aug 28, 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
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Stabilized APIs
- [`Atomic<T>::get_mut_slice`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.Atomic.html#method.get_mut_slice)
- [`Atomic<T>::from_mut_slice`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.Atomic.html#method.from_mut_slice)
- [`std::range::legacy`](https://doc.rust-lang.org/stable/std/range/legacy/index.html)
- [`bool::ok_or`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or)
- [`bool::ok_or_else`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or_else)


<a id="1.98.0-Compatibility-Notes"></a>
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))]
#![doc(test(no_crate_inject, attr(deny(warnings))))]
#![feature(decl_macro)]
#![feature(dropck_eyepatch)]
#![feature(rustc_attrs)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! This API is completely unstable and subject to change.

// tidy-alphabetical-start
#![doc(test(attr(deny(warnings), allow(internal_features))))]
#![doc(test(attr(deny(warnings))))]
#![feature(associated_type_defaults)]
#![feature(deref_patterns)]
#![feature(iter_order_by)]
Expand Down
15 changes: 15 additions & 0 deletions compiler/rustc_builtin_macros/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ fn expand_contract_clause_tts(
annotated: TokenStream,
clause_keyword: rustc_span::Symbol,
) -> Result<TokenStream, ErrorGuaranteed> {
if annotation.is_empty() {
let (name, example) = if clause_keyword == kw::ContractRequires {
("requires", "condition")
} else {
("ensures", "|result: &T| condition")
};
ecx.sess.dcx().span_err(
attr_span,
format!("`{name}` attribute requires an argument, e.g., `#[{name}({example})]`"),
);
// Returning `Err` would replace it with a dummy fragment and cause cascading name-resolution errors.
// Instead, we return the original token stream so that there is no later noises.
return Ok(annotated);
}

let feature_span = ecx.with_def_site_ctxt(attr_span);
expand_contract_clause(ecx, attr_span, annotated, |new_tts| {
new_tts.push(TokenTree::Token(
Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ use rustc_target::spec::HasTargetSpec;
use smallvec::SmallVec;
use tracing::debug;

use crate::attributes;
use crate::builder::Builder;
use crate::common::Funclet;
use crate::context::CodegenCx;
use crate::llvm::{self, ToLlvmBool, Type, Value};
use crate::type_of::LayoutLlvmExt;
use crate::{attributes, llvm_util};

impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
fn codegen_inline_asm(
Expand Down Expand Up @@ -499,7 +499,15 @@ impl<'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
template_str.push_str("\n.att_syntax\n");
}

llvm::append_module_inline_asm(self.llmod, template_str.as_bytes());
let target_features = self.tcx.global_backend_features(()).join(",");
let target_cpu = llvm_util::target_cpu(self.tcx.sess);

llvm::append_module_inline_asm(
self.llmod,
template_str.as_bytes(),
&target_features,
target_cpu,
);
}

fn mangled_name(&self, instance: Instance<'tcx>) -> String {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,9 +1303,9 @@ fn embed_bitcode(
// We need custom section flags, so emit module-level inline assembly.
let section_flags = if cgcx.is_pe_coff { "n" } else { "e" };
let asm = create_section_with_flags_asm(".llvmbc", section_flags, bitcode);
llvm::append_module_inline_asm(llmod, &asm);
llvm::append_module_inline_asm(llmod, &asm, "", "");
let asm = create_section_with_flags_asm(".llvmcmd", section_flags, &[]);
llvm::append_module_inline_asm(llmod, &asm);
llvm::append_module_inline_asm(llmod, &asm, "", "");
}
}

Expand Down
18 changes: 11 additions & 7 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,13 +907,6 @@ unsafe extern "C" {
pub(crate) fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
pub(crate) fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);

/// Append inline assembly to a module. See `Module::appendModuleInlineAsm`.
pub(crate) fn LLVMAppendModuleInlineAsm(
M: &Module,
Asm: *const c_uchar, // See "PTR_LEN_STR".
Len: size_t,
);

/// Create the specified uniqued inline asm string. See `InlineAsm::get()`.
pub(crate) fn LLVMGetInlineAsm<'ll>(
Ty: &'ll Type,
Expand Down Expand Up @@ -2119,6 +2112,17 @@ unsafe extern "C" {
ConstraintsLen: size_t,
) -> bool;

/// Append inline assembly to a module. See `Module::appendModuleInlineAsm`.
pub(crate) fn LLVMRustAppendModuleInlineAsm(
M: &Module,
Asm: *const c_uchar, // See "PTR_LEN_STR".
AsmLen: size_t,
TargetFeatures: *const c_uchar, // See "PTR_LEN_STR".
TargetFeaturesLen: size_t,
TargetCpu: *const c_uchar, // See "PTR_LEN_STR".
TargetCpuLen: size_t,
);

/// A list of pointer-length strings is passed as two pointer-length slices,
/// one slice containing pointers and one slice containing their corresponding
/// lengths. The implementation will check that both slices have the same length.
Expand Down
19 changes: 16 additions & 3 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,24 @@ pub(crate) fn set_dso_local<'ll>(v: &'ll Value) {
}
}

/// Safe wrapper for `LLVMAppendModuleInlineAsm`, which delegates to
/// Safe wrapper for `LLVMRustAppendModuleInlineAsm`, which delegates to
/// `Module::appendModuleInlineAsm`.
pub(crate) fn append_module_inline_asm<'ll>(llmod: &'ll Module, asm: &[u8]) {
pub(crate) fn append_module_inline_asm<'ll>(
llmod: &'ll Module,
asm: &[u8],
target_features: &str,
target_cpu: &str,
) {
unsafe {
LLVMAppendModuleInlineAsm(llmod, asm.as_ptr(), asm.len());
LLVMRustAppendModuleInlineAsm(
llmod,
asm.as_ptr(),
asm.len(),
target_features.as_ptr(),
target_features.len(),
target_cpu.as_ptr(),
target_cpu.len(),
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_graphviz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
//! * [DOT language](https://www.graphviz.org/doc/info/lang.html)

// tidy-alphabetical-start
#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
// tidy-alphabetical-end

use std::borrow::Cow;
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust
/// ```rust,compile_fail
/// #![deny(dead_code_pub_in_binary)]
///
/// pub fn unused_pub_fn() {}
Expand Down Expand Up @@ -1132,9 +1132,9 @@ declare_lint! {
///
/// ### Example
///
/// ```rust
/// ```rust,compile_fail
/// #![deny(warnings)]
/// fn foo() {}
/// struct non_standard_name;
/// ```
///
/// {{produces}}
Expand Down
14 changes: 14 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,20 @@ extern "C" bool LLVMRustInlineAsmVerify(LLVMTypeRef Ty, char *Constraints,
unwrap<FunctionType>(Ty), StringRef(Constraints, ConstraintsLen)));
}

extern "C" void LLVMRustAppendModuleInlineAsm(
LLVMModuleRef M, const char *Asm, size_t AsmLen, const char *TargetFeatures,
size_t TargetFeaturesLen, const char *TargetCPU, size_t TargetCPULen) {
#if LLVM_VERSION_GE(23, 0)
Module::GlobalAsmProperties Props;
Props.TargetFeatures = std::string(TargetFeatures, TargetFeaturesLen);
Props.TargetCPU = std::string(TargetCPU, TargetCPULen);
unwrap(M)->appendModuleInlineAsm(
Module::GlobalAsmFragment(std::string(Asm, AsmLen), Props));
#else
unwrap(M)->appendModuleInlineAsm(StringRef(Asm, AsmLen));
#endif
}

template <typename DIT> DIT *unwrapDIPtr(LLVMMetadataRef Ref) {
return (DIT *)(Ref ? unwrap<Metadata>(Ref) : nullptr);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse_format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// We want to be able to build this crate with a stable compiler,
// so no `#![feature]` attributes should be added.
#![deny(unstable_features)]
#![doc(test(attr(deny(warnings), allow(internal_features))))]
#![doc(test(attr(deny(warnings))))]
// tidy-alphabetical-end

use std::ops::Range;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
//! For more information, see <https://github.com/rust-lang/rustc_public>.

#![allow(rustc::usage_of_ty_tykind)]
#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![feature(sized_hierarchy)]

use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public_bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// tidy-alphabetical-start
#![allow(rustc::usage_of_ty_tykind)]
#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![feature(trait_alias)]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_serialize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![allow(internal_features)]
#![allow(rustc::internal)]
#![cfg_attr(bootstrap, feature(never_type))]
#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![feature(core_intrinsics)]
#![feature(min_specialization)]
#![feature(nonzero_internals)]
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3647,11 +3647,14 @@ pub enum Polonius {

impl Default for Polonius {
fn default() -> Self {
if option_env!("CFG_DEFAULT_POLONIUS_NEXT").is_some() { Self::Next } else { Self::Off }
Self::DEFAULT
}
}

impl Polonius {
pub(crate) const DEFAULT: Self =
if option_env!("CFG_DEFAULT_POLONIUS_NEXT").is_some() { Self::Next } else { Self::Off };

/// Returns whether the legacy version of polonius is enabled
pub fn is_legacy_enabled(&self) -> bool {
matches!(self, Polonius::Legacy)
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ macro_rules! options {
$( { TARGET_MODIFIER: $tmod_variant:ident } )?
$( { MITIGATION: $mitigation_variant:ident } )?
,
$desc:literal
$desc:expr
$(, removed: $removed:ident )?
),
)*
Expand Down Expand Up @@ -2350,6 +2350,12 @@ options! {
// - src/doc/rustc/src/codegen-options/index.md
}

const POLONIUS_HELP: &str = match Polonius::DEFAULT {
Polonius::Off => "enable polonius-based borrow-checker (default: no)",
Polonius::Next => "enable polonius-based borrow-checker (default: next)",
Polonius::Legacy => panic!("Polonius::Legacy is not a valid default value"),
};

options! {
UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable",

Expand Down Expand Up @@ -2750,7 +2756,7 @@ options! {
`vt-ptr-type-discrimination - incorporate type discrimination in authenticated vtable pointers
Example: `-Zpointer-authentication=+calls,-init-fini`."),
polonius: Polonius = (Polonius::default(), parse_polonius, [TRACKED],
"enable polonius-based borrow-checker (default: no)"),
POLONIUS_HELP),
pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED],
"a single extra argument to prepend the linker invocation (can be used several times)"),
pre_link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_target/src/asm/loongarch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl LoongArchInlineAsmRegClass {
(Self::vreg, _) => {
if allow_experimental_reg {
types! {
lsx: F16, F32, F64,
lsx: I128, F16, F32, F64,
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF32(4), VecF64(2);
}
} else {
Expand All @@ -63,7 +63,7 @@ impl LoongArchInlineAsmRegClass {
(Self::xreg, _) => {
if allow_experimental_reg {
types! {
lasx: F16, F32, F64,
lasx: I128, F16, F32, F64,
VecI8(16), VecI16(8), VecI32(4), VecI64(2), VecF32(4), VecF64(2),
VecI8(32), VecI16(16), VecI32(8), VecI64(4), VecF32(8), VecF64(4);
}
Expand Down
12 changes: 0 additions & 12 deletions compiler/rustc_traits/src/normalize_projection_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ fn normalize_canonicalized_projection<'tcx>(
0,
&mut obligations,
);
obligations.extend(const_arg_has_type_obligation(
tcx,
param_env,
normalized_term,
goal,
));
ocx.register_obligations(obligations);
// #112047: With projections and opaques, we are able to create opaques that
// are recursive (given some generic parameters of the opaque's type variables).
Expand Down Expand Up @@ -147,12 +141,6 @@ fn normalize_canonicalized_inherent_projection<'tcx>(
0,
&mut obligations,
);
obligations.extend(const_arg_has_type_obligation(
tcx,
param_env,
normalized_term,
goal,
));
ocx.register_obligations(obligations);

Ok(NormalizationResult { normalized_term })
Expand Down
41 changes: 13 additions & 28 deletions library/alloc/src/boxed/thin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use core::marker::PhantomData;
use core::marker::Unsize;
#[cfg(not(no_global_oom_handling))]
use core::mem;
use core::mem::SizedTypeProperties;
use core::mem::{DropGuard, SizedTypeProperties};
use core::ops::{Deref, DerefMut};
use core::ptr::{self, NonNull, Pointee};

Expand Down Expand Up @@ -360,38 +360,23 @@ impl<H> WithHeader<H> {
// - Assumes that either `value` can be dereferenced, or is the
// `NonNull::dangling()` we use when both `T` and `H` are ZSTs.
unsafe fn drop<T: ?Sized>(&self, value: *mut T) {
struct DropGuard<H> {
ptr: NonNull<u8>,
value_layout: Layout,
_marker: PhantomData<H>,
}

impl<H> Drop for DropGuard<H> {
fn drop(&mut self) {
// All ZST are allocated statically.
if self.value_layout.size() == 0 {
return;
}
unsafe {
// `_guard` will deallocate the memory when dropped, even if `drop_in_place` unwinds.
let _guard =
DropGuard::new((self.0, Layout::for_value_raw(value)), |(ptr, value_layout)| {
// All ZST are allocated statically.
if value_layout.size() == 0 {
return;
}

unsafe {
// SAFETY: Layout must have been computable if we're in drop
let (layout, value_offset) =
WithHeader::<H>::alloc_layout(self.value_layout).unwrap_unchecked();
WithHeader::<H>::alloc_layout(value_layout).unwrap_unchecked();

// Since we only allocate for non-ZSTs, the layout size cannot be zero.
debug_assert!(layout.size() != 0);
alloc::dealloc(self.ptr.as_ptr().sub(value_offset), layout);
}
}
}

unsafe {
// `_guard` will deallocate the memory when dropped, even if `drop_in_place` unwinds.
let _guard = DropGuard {
ptr: self.0,
value_layout: Layout::for_value_raw(value),
_marker: PhantomData::<H>,
};
debug_assert_ne!(layout.size(), 0);
alloc::dealloc(ptr.as_ptr().sub(value_offset), layout);
});

// We only drop the value because the Pointee trait requires that the metadata is copy
// aka trivially droppable.
Expand Down
Loading
Loading