Skip to content
Closed
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
27be5c2
docs(core): update `find()` and `rfind()` examples
smirzaei Dec 22, 2025
8ca47cd
Clarify `MoveData::init_loc_map`.
nnethercote Jan 1, 2026
2b76903
Use all thread::current static variables from realstd in tests.
Dec 18, 2025
abbbd77
Use re-exports from test_internals.
Dec 18, 2025
ea7ada9
Update browser-ui-test version to `0.23.1`
GuillaumeGomez Jan 7, 2026
b0e65da
rustc_parse_format: improve error for missing `:` before `?` in forma…
Unique-Usman Jan 7, 2026
8e3d604
Finish transition from `semitransparent` to `semiopaque` for `rustc_m…
Enselic Jan 1, 2026
9e00663
rust-analyzer: Also use `semiopaque` instead of `semitransparent`
Enselic Jan 1, 2026
a9749be
mgca: Type-check fields of ADT constructor expr const args
camelid Jan 5, 2026
1c2cb16
mgca: Type-check fields of tuple expr const args
camelid Jan 8, 2026
c502d7f
Fix trait method anchor disappearing before user can click on it
GuillaumeGomez Jan 8, 2026
bfb117a
Clean up `tests/rustdoc-gui/anchors.goml` test code
GuillaumeGomez Jan 8, 2026
16fbf6a
Add check for trait impl method anchor
GuillaumeGomez Jan 8, 2026
945e7c7
Use functions more in rustdoc GUI tests
GuillaumeGomez Jan 7, 2026
45e0fbf
Implement partial_sort_unstable for slice
tisonkun Jan 9, 2026
484ea76
adding minicore to test file to avoid duplicating lang error
paradoxicalguy Dec 31, 2025
b8a5c38
Rollup merge of #149318 - slice_partial_sort_unstable, r=tgross35
matthiaskrgr Jan 9, 2026
2be03b8
Rollup merge of #150131 - realstd_thread_variables, r=Mark-Simulacrum
matthiaskrgr Jan 9, 2026
c8f8370
Rollup merge of #150272 - doc/improve-iter-find-docs, r=scottmcm
matthiaskrgr Jan 9, 2026
389a58c
Rollup merge of #150368 - minicore-ordering, r=workingjubilee
matthiaskrgr Jan 9, 2026
1a2af6c
Rollup merge of #150561 - semiopaque, r=BoxyUwU
matthiaskrgr Jan 9, 2026
b710d6b
Rollup merge of #150574 - MoveData-init_loc_map, r=cjgillot
matthiaskrgr Jan 9, 2026
88beaf7
Rollup merge of #150713 - mgca-typeck-struct-fields, r=BoxyUwU
matthiaskrgr Jan 9, 2026
395681a
Rollup merge of #150762 - cleanup-gui, r=lolbinarycat
matthiaskrgr Jan 9, 2026
4d283b0
Rollup merge of #150765 - ua/missing-colon, r=estebank
matthiaskrgr Jan 9, 2026
2fa1ccd
Rollup merge of #150816 - method-anchor, r=camelid
matthiaskrgr Jan 9, 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: 1 addition & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ impl DroplessArena {
/// - Types that are `!Copy` and `Drop`: these must be specified in the
/// arguments. The `TypedArena` will be used for them.
///
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
#[derive(Default)]
pub struct Arena<'tcx> {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/transparency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
});
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::MacroDef)]);
const TEMPLATE: AttributeTemplate =
template!(NameValueStr: ["transparent", "semitransparent", "opaque"]);
template!(NameValueStr: ["transparent", "semiopaque", "opaque"]);

fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(nv) = args.name_value() else {
Expand All @@ -24,12 +24,12 @@ impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
};
match nv.value_as_str() {
Some(sym::transparent) => Some(Transparency::Transparent),
Some(sym::semiopaque | sym::semitransparent) => Some(Transparency::SemiOpaque),
Some(sym::semiopaque) => Some(Transparency::SemiOpaque),
Some(sym::opaque) => Some(Transparency::Opaque),
Some(_) => {
cx.expected_specific_argument_strings(
nv.value_span,
&[sym::transparent, sym::semitransparent, sym::opaque],
&[sym::transparent, sym::semiopaque, sym::opaque],
);
None
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_builtin_macros/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ builtin_macros_expected_other = expected operand, {$is_inline_asm ->

builtin_macros_export_macro_rules = cannot export macro_rules! macros from a `proc-macro` crate type currently

builtin_macros_format_add_missing_colon = add a colon before the format specifier

builtin_macros_format_duplicate_arg = duplicate argument named `{$ident}`
.label1 = previously here
.label2 = duplicate argument
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_builtin_macros/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,15 @@ pub(crate) enum InvalidFormatStringSuggestion {
span: Span,
replacement: String,
},
#[suggestion(
builtin_macros_format_add_missing_colon,
code = ":?",
applicability = "machine-applicable"
)]
AddMissingColon {
#[primary_span]
span: Span,
},
}

#[derive(Diagnostic)]
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ fn make_format_args(
replacement,
});
}
parse::Suggestion::AddMissingColon(span) => {
let span = fmt_span.from_inner(InnerSpan::new(span.start, span.end));
e.sugg_ = Some(errors::InvalidFormatStringSuggestion::AddMissingColon { span });
}
}
let guar = ecx.dcx().emit_err(e);
return ExpandResult::Ready(Err(guar));
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_codegen_cranelift/example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,43 +744,43 @@ unsafe extern "C" {
pub struct VaList<'a>(&'a mut VaListImpl);

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro stringify($($t:tt)*) {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro file() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro line() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro cfg() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro asm() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro global_asm() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro naked_asm() {
/* compiler built-in */
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/global_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub(crate) fn compile_global_asm(
#![allow(internal_features)]
#![no_core]
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro global_asm() { /* compiler built-in */ }
global_asm!(r###"
"####,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_gcc/example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,25 +748,25 @@ extern "C" {
pub struct VaList<'a>(&'a mut VaListImpl);

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro stringify($($t:tt)*) {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro file() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro line() {
/* compiler built-in */
}

#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro cfg() {
/* compiler built-in */
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/src/ty/consts/valtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ impl<'tcx> Value<'tcx> {
}
}

/// Destructures array, ADT or tuple constants into the constants
/// of their fields.
/// Destructures ADT constants into the constants of their fields.
pub fn destructure_adt_const(&self) -> ty::DestructuredAdtConst<'tcx> {
let fields = self.to_branch();

Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_mir_dataflow/src/move_paths/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ pub struct MoveData<'tcx> {
pub rev_lookup: MovePathLookup<'tcx>,
pub inits: IndexVec<InitIndex, Init>,
/// Each Location `l` is mapped to the Inits that are effects
/// of executing the code at `l`.
pub init_loc_map: LocationMap<SmallVec<[InitIndex; 4]>>,
/// of executing the code at `l`. Only very rarely (e.g. inline asm)
/// is there more than one Init at any `l`.
pub init_loc_map: LocationMap<SmallVec<[InitIndex; 1]>>,
pub init_path_map: IndexVec<MovePathIndex, SmallVec<[InitIndex; 4]>>,
}

Expand Down
29 changes: 25 additions & 4 deletions compiler/rustc_parse_format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ pub enum Suggestion {
/// `format!("{foo:?x}")` -> `format!("{foo:x?}")`
/// `format!("{foo:?X}")` -> `format!("{foo:X?}")`
ReorderFormatParameter(Range<usize>, String),
/// Add missing colon:
/// `format!("{foo?}")` -> `format!("{foo:?}")`
AddMissingColon(Range<usize>),
}

/// The parser structure for interpreting the input format string. This is
Expand Down Expand Up @@ -453,10 +456,11 @@ impl<'input> Parser<'input> {
suggestion: Suggestion::None,
});

if let Some((_, _, c)) = self.peek() {
match c {
'?' => self.suggest_format_debug(),
'<' | '^' | '>' => self.suggest_format_align(c),
if let (Some((_, _, c)), Some((_, _, nc))) = (self.peek(), self.peek_ahead()) {
match (c, nc) {
('?', '}') => self.missing_colon_before_debug_formatter(),
('?', _) => self.suggest_format_debug(),
('<' | '^' | '>', _) => self.suggest_format_align(c),
_ => self.suggest_positional_arg_instead_of_captured_arg(arg),
}
}
Expand Down Expand Up @@ -849,6 +853,23 @@ impl<'input> Parser<'input> {
}
}

fn missing_colon_before_debug_formatter(&mut self) {
if let Some((range, _)) = self.consume_pos('?') {
let span = range.clone();
self.errors.insert(
0,
ParseError {
description: "expected `}`, found `?`".to_owned(),
note: Some(format!("to print `{{`, you can escape it using `{{{{`",)),
label: "expected `:` before `?` to format with `Debug`".to_owned(),
span: range,
secondary_label: None,
suggestion: Suggestion::AddMissingColon(span),
},
);
}
}

fn suggest_format_align(&mut self, alignment: char) {
if let Some((range, _)) = self.consume_pos(alignment) {
self.errors.insert(
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,6 @@ symbols! {
self_in_typedefs,
self_struct_ctor,
semiopaque,
semitransparent,
sha2,
sha3,
sha512_sm_x86,
Expand Down
48 changes: 47 additions & 1 deletion compiler/rustc_trait_selection/src/traits/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,53 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
| ty::ConstKind::Placeholder(..) => {
// These variants are trivially WF, so nothing to do here.
}
ty::ConstKind::Value(..) => {
ty::ConstKind::Value(val) => {
// FIXME(mgca): no need to feature-gate once valtree lifetimes are not erased
if tcx.features().min_generic_const_args() {
match val.ty.kind() {
ty::Adt(adt_def, args) => {
let adt_val = val.destructure_adt_const();
let variant_def = adt_def.variant(adt_val.variant);
let cause = self.cause(ObligationCauseCode::WellFormed(None));
self.out.extend(variant_def.fields.iter().zip(adt_val.fields).map(
|(field_def, &field_val)| {
let field_ty =
tcx.type_of(field_def.did).instantiate(tcx, args);
let predicate = ty::PredicateKind::Clause(
ty::ClauseKind::ConstArgHasType(field_val, field_ty),
);
traits::Obligation::with_depth(
tcx,
cause.clone(),
self.recursion_depth,
self.param_env,
predicate,
)
},
));
}
ty::Tuple(field_tys) => {
let field_vals = val.to_branch();
let cause = self.cause(ObligationCauseCode::WellFormed(None));
self.out.extend(field_tys.iter().zip(field_vals).map(
|(field_ty, &field_val)| {
let predicate = ty::PredicateKind::Clause(
ty::ClauseKind::ConstArgHasType(field_val, field_ty),
);
traits::Obligation::with_depth(
tcx,
cause.clone(),
self.recursion_depth,
self.param_env,
predicate,
)
},
));
}
_ => {}
}
}

// FIXME: Enforce that values are structurally-matchable.
}
}
Expand Down
2 changes: 2 additions & 0 deletions library/alloctests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#![feature(binary_heap_into_iter_sorted)]
#![feature(binary_heap_drain_sorted)]
#![feature(slice_ptr_get)]
#![feature(slice_range)]
#![feature(slice_partial_sort_unstable)]
#![feature(inplace_iteration)]
#![feature(iter_advance_by)]
#![feature(iter_next_chunk)]
Expand Down
1 change: 1 addition & 0 deletions library/alloctests/tests/sort/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub trait Sort {

mod ffi_types;
mod known_good_stable_sort;
mod partial;
mod patterns;
mod tests;
mod zipf;
84 changes: 84 additions & 0 deletions library/alloctests/tests/sort/partial.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
use std::fmt::Debug;
use std::ops::{Range, RangeBounds};
use std::slice;

use super::patterns;

fn check_is_partial_sorted<T: Ord + Clone + Debug, R: RangeBounds<usize>>(v: &mut [T], range: R) {
let Range { start, end } = slice::range(range, ..v.len());
v.partial_sort_unstable(start..end);

let max_before = v[..start].iter().max().into_iter();
let sorted_range = v[start..end].into_iter();
let min_after = v[end..].iter().min().into_iter();
let seq = max_before.chain(sorted_range).chain(min_after);
assert!(seq.is_sorted());
}

fn check_is_partial_sorted_ranges<T: Ord + Clone + Debug>(v: &[T]) {
let len = v.len();

check_is_partial_sorted::<T, _>(&mut v.to_vec(), ..);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), 0..0);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), len..len);

if len > 0 {
check_is_partial_sorted::<T, _>(&mut v.to_vec(), len - 1..len - 1);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), 0..1);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), len - 1..len);

for mid in 1..len {
check_is_partial_sorted::<T, _>(&mut v.to_vec(), 0..mid);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), mid..len);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), mid..mid);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), mid - 1..mid + 1);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), mid - 1..mid);
check_is_partial_sorted::<T, _>(&mut v.to_vec(), mid..mid + 1);
}

let quarters = [0, len / 4, len / 2, (3 * len) / 4, len];
for &start in &quarters {
for &end in &quarters {
if start < end {
check_is_partial_sorted::<T, _>(&mut v.to_vec(), start..end);
}
}
}
}
}

#[test]
fn basic_impl() {
check_is_partial_sorted::<i32, _>(&mut [], ..);
check_is_partial_sorted::<(), _>(&mut [], ..);
check_is_partial_sorted::<(), _>(&mut [()], ..);
check_is_partial_sorted::<(), _>(&mut [(), ()], ..);
check_is_partial_sorted::<(), _>(&mut [(), (), ()], ..);
check_is_partial_sorted::<i32, _>(&mut [], ..);

check_is_partial_sorted::<i32, _>(&mut [77], ..);
check_is_partial_sorted::<i32, _>(&mut [2, 3], ..);
check_is_partial_sorted::<i32, _>(&mut [2, 3, 6], ..);
check_is_partial_sorted::<i32, _>(&mut [2, 3, 99, 6], ..);
check_is_partial_sorted::<i32, _>(&mut [2, 7709, 400, 90932], ..);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], ..);

check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 0..0);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 0..1);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 0..5);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 0..7);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 7..7);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 6..7);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 5..7);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 5..5);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 4..5);
check_is_partial_sorted::<i32, _>(&mut [15, -1, 3, -1, -3, -1, 7], 4..6);
}

#[test]
fn random_patterns() {
check_is_partial_sorted_ranges(&patterns::random(10));
check_is_partial_sorted_ranges(&patterns::random(50));
check_is_partial_sorted_ranges(&patterns::random(100));
check_is_partial_sorted_ranges(&patterns::random(1000));
}
Loading
Loading