Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f5cdd5d
Update hexagon target linker configurations
androm3da Jan 23, 2026
163a4b4
From: cleanup
hkBst Oct 6, 2025
f12288e
TryFrom<integer> for bool
hkBst Oct 6, 2025
bcb76f4
docs: fix outdated Debian Ports ISO reference
zzaekkii Jan 27, 2026
3d6f46c
docs: point m68k install link to final Debian 12.0 release
zzaekkii Jan 27, 2026
90f0f4b
std: sys: uefi: os: Implement join_paths
Ayush1325 Jan 12, 2026
ce03e7b
Avoid miri error in `slice::sort` under Stacked Borrows
Voultapher Jan 27, 2026
85ae47f
moved 7 tests to organized locations
Delta17920 Jan 31, 2026
565b772
Add regression test for ICE with undefined type in async fn
ThanhNguyxn Jan 22, 2026
c8ce140
check if ProjectionTy or ProjectionConst
TaKO8Ki Jan 31, 2026
a7dea55
rename various regression tests
Delta17920 Jan 31, 2026
2bab7a0
Handle unbalanced delimiters gracefully in make_attr_token_stream
chenyukang Jan 31, 2026
990c558
Include assoc const projections in CFI trait object
mu001999 Feb 1, 2026
f490f64
Add regression test for issue-136514: Negative literal in unsigned range
mcraeynest Feb 1, 2026
a57663e
Rollup merge of #151756 - Voultapher:fix-box-retag-in-sort, r=Mark-Si…
Zalathar Feb 1, 2026
e6e2d39
Rollup merge of #147400 - hkBst:convert-1, r=Mark-Simulacrum
Zalathar Feb 1, 2026
512afea
Rollup merge of #150993 - Ayush1325:uefi-join-path, r=Mark-Simulacrum
Zalathar Feb 1, 2026
2cc38ff
Rollup merge of #151483 - ThanhNguyxn:fix/add-test-issue-138225, r=Ki…
Zalathar Feb 1, 2026
39e5256
Rollup merge of #151568 - androm3da:bcain/hexagon_linker_cfg, r=Norat…
Zalathar Feb 1, 2026
f59d2eb
Rollup merge of #151725 - zzaekkii:debian-cdimage-ports, r=Noratrieb
Zalathar Feb 1, 2026
393ce4b
Rollup merge of #151895 - Delta17920:move-ui-tests-batch, r=Kivooeo
Zalathar Feb 1, 2026
be3bf82
Rollup merge of #151923 - TaKO8Ki:issue-151331-opaque-alias-relate, r…
Zalathar Feb 1, 2026
d748af9
Rollup merge of #151947 - mu001999-contrib:fix/151878, r=fmease
Zalathar Feb 1, 2026
7fe7cee
Rollup merge of #151948 - chenyukang:yukang-fix-149954-tokenstream-ic…
Zalathar Feb 1, 2026
cfdd14d
Rollup merge of #151963 - mcraeynest:main, r=Kivooeo
Zalathar Feb 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
8 changes: 7 additions & 1 deletion compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ fn make_attr_token_stream(
FrameData { open_delim_sp: Some((delim, span, spacing)), inner: vec![] },
));
} else if let Some(delim) = kind.close_delim() {
let frame_data = mem::replace(&mut stack_top, stack_rest.pop().unwrap());
// If there's no matching opening delimiter, the token stream is malformed,
// likely due to a improper delimiter positions in the source code.
// It's not delimiter mismatch, and lexer can not detect it, so we just ignore it here.
let Some(frame) = stack_rest.pop() else {
return AttrTokenStream::new(stack_top.inner);
};
let frame_data = mem::replace(&mut stack_top, frame);
let (open_delim, open_sp, open_spacing) = frame_data.open_delim_sp.unwrap();
assert!(
open_delim.eq_ignoring_invisible_origin(&delim),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,24 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
.flat_map(|super_poly_trait_ref| {
tcx.associated_items(super_poly_trait_ref.def_id())
.in_definition_order()
.filter(|item| item.is_type())
.filter(|item| item.is_type() || item.is_const())
.filter(|item| !tcx.generics_require_sized_self(item.def_id))
.map(move |assoc_ty| {
.map(move |assoc_item| {
super_poly_trait_ref.map_bound(|super_trait_ref| {
let alias_ty =
ty::AliasTy::new_from_args(tcx, assoc_ty.def_id, super_trait_ref.args);
let resolved = tcx.normalize_erasing_regions(
let projection_term = ty::AliasTerm::new_from_args(
tcx,
assoc_item.def_id,
super_trait_ref.args,
);
let term = tcx.normalize_erasing_regions(
ty::TypingEnv::fully_monomorphized(),
alias_ty.to_ty(tcx),
projection_term.to_term(tcx),
);
debug!("Resolved {:?} -> {resolved}", alias_ty.to_ty(tcx));
debug!("Projection {:?} -> {term}", projection_term.to_term(tcx),);
ty::ExistentialPredicate::Projection(
ty::ExistentialProjection::erase_self_ty(
tcx,
ty::ProjectionPredicate {
projection_term: alias_ty.into(),
term: resolved.into(),
},
ty::ProjectionPredicate { projection_term, term },
),
)
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{Arch, Cc, LinkerFlavor, Target, TargetMetadata, base};
use crate::spec::{Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, base};

pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
Expand All @@ -8,8 +8,8 @@ pub(crate) fn target() -> Target {
base.features = "-small-data,+hvx-length128b".into();

base.has_rpath = true;
base.linker = Some("rust-lld".into());
base.linker_flavor = LinkerFlavor::Unix(Cc::Yes);
base.linker = Some("hexagon-unknown-linux-musl-clang".into());
base.linker_flavor = LinkerFlavor::Gnu(Cc::Yes, Lld::No);

base.c_enum_min_bits = Some(8);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::spec::{Arch, PanicStrategy, Target, TargetMetadata, TargetOptions};
use crate::spec::{
Arch, Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata, TargetOptions,
};

pub(crate) fn target() -> Target {
Target {
Expand Down Expand Up @@ -28,6 +30,7 @@ pub(crate) fn target() -> Target {
emit_debug_gdb_scripts: false,
c_enum_min_bits: Some(8),
linker: Some("rust-lld".into()),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
..Default::default()
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pub(crate) fn target() -> Target {
os: Os::Qurt,
vendor: "unknown".into(),
cpu: "hexagonv69".into(),
linker: Some("rust-lld".into()),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("hexagon-clang".into()),
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
exe_suffix: ".elf".into(),
dynamic_linking: true,
executables: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
};

if let Some(lhs) = lhs.to_alias_term()
&& let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = lhs.kind(self.tcx)
&& let Some((better_type_err, expected_term)) =
derive_better_type_error(lhs, rhs)
{
Expand All @@ -1615,6 +1616,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
better_type_err,
)
} else if let Some(rhs) = rhs.to_alias_term()
&& let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = rhs.kind(self.tcx)
&& let Some((better_type_err, expected_term)) =
derive_better_type_error(rhs, lhs)
{
Expand Down
8 changes: 8 additions & 0 deletions library/alloctests/tests/sort/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ fn sort_vs_sort_by_impl<S: Sort>() {
assert_eq!(input_sort_by, expected);
}

pub fn box_value_impl<S: Sort>() {
for len in [3, 9, 35, 56, 132] {
test_is_sorted::<Box<i32>, S>(len, Box::new, patterns::random);
test_is_sorted::<Box<i32>, S>(len, Box::new, |len| patterns::random_sorted(len, 80.0));
}
}

gen_sort_test_fns_with_default_patterns!(
correct_i32,
|len, pattern_fn| test_is_sorted::<i32, S>(len, |val| val, pattern_fn),
Expand Down Expand Up @@ -967,6 +974,7 @@ define_instantiate_sort_tests!(
[miri_yes, fixed_seed_rand_vec_prefix],
[miri_yes, int_edge],
[miri_yes, sort_vs_sort_by],
[miri_yes, box_value],
[miri_yes, correct_i32_random],
[miri_yes, correct_i32_random_z1],
[miri_yes, correct_i32_random_d2],
Expand Down
121 changes: 73 additions & 48 deletions library/core/src/convert/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,63 +39,52 @@ impl_float_to_int!(f32 => u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i12
impl_float_to_int!(f64 => u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize);
impl_float_to_int!(f128 => u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize);

// Conversion traits for primitive integer and float types
// Conversions T -> T are covered by a blanket impl and therefore excluded
// Some conversions from and to usize/isize are not implemented due to portability concerns
/// Implement `From<bool>` for integers
macro_rules! impl_from_bool {
($($int:ty)*) => {$(
#[stable(feature = "from_bool", since = "1.28.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl const From<bool> for $int {
/// Converts from [`bool`] to
#[doc = concat!("[`", stringify!($int), "`]")]
/// , by turning `false` into `0` and `true` into `1`.
///
/// # Examples
///
/// ```
#[doc = concat!("assert_eq!(", stringify!($int), "::from(false), 0);")]
///
#[doc = concat!("assert_eq!(", stringify!($int), "::from(true), 1);")]
/// ```
#[inline(always)]
fn from(b: bool) -> Self {
b as Self
}
}
)*}
}

// boolean -> integer
impl_from_bool!(u8 u16 u32 u64 u128 usize);
impl_from_bool!(i8 i16 i32 i64 i128 isize);

/// Implement `From<$small>` for `$large`
macro_rules! impl_from {
(bool => $Int:ty $(,)?) => {
impl_from!(
bool => $Int,
#[stable(feature = "from_bool", since = "1.28.0")],
concat!(
"Converts a [`bool`] to [`", stringify!($Int), "`] losslessly.\n",
"The resulting value is `0` for `false` and `1` for `true` values.\n",
"\n",
"# Examples\n",
"\n",
"```\n",
"assert_eq!(", stringify!($Int), "::from(true), 1);\n",
"assert_eq!(", stringify!($Int), "::from(false), 0);\n",
"```\n",
),
);
};
($Small:ty => $Large:ty, #[$attr:meta] $(,)?) => {
impl_from!(
$Small => $Large,
#[$attr],
concat!("Converts [`", stringify!($Small), "`] to [`", stringify!($Large), "`] losslessly."),
);
};
($Small:ty => $Large:ty, #[$attr:meta], $doc:expr $(,)?) => {
($small:ty => $large:ty, #[$attr:meta]) => {
#[$attr]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl const From<$Small> for $Large {
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
impl const From<$small> for $large {
#[doc = concat!("Converts from [`", stringify!($small), "`] to [`", stringify!($large), "`] losslessly.")]
#[inline(always)]
fn from(small: $Small) -> Self {
fn from(small: $small) -> Self {
debug_assert!(<$large>::MIN as i128 <= <$small>::MIN as i128);
debug_assert!(<$small>::MAX as u128 <= <$large>::MAX as u128);
small as Self
}
}
};
}
}

// boolean -> integer
impl_from!(bool => u8);
impl_from!(bool => u16);
impl_from!(bool => u32);
impl_from!(bool => u64);
impl_from!(bool => u128);
impl_from!(bool => usize);
impl_from!(bool => i8);
impl_from!(bool => i16);
impl_from!(bool => i32);
impl_from!(bool => i64);
impl_from!(bool => i128);
impl_from!(bool => isize);

// unsigned integer -> unsigned integer
impl_from!(u8 => u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
impl_from!(u8 => u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
Expand Down Expand Up @@ -338,12 +327,48 @@ macro_rules! impl_try_from_both_bounded {
)*}
}

/// Implement `TryFrom<integer>` for `bool`
macro_rules! impl_try_from_integer_for_bool {
($($int:ty)+) => {$(
#[stable(feature = "try_from", since = "1.34.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl const TryFrom<$int> for bool {
type Error = TryFromIntError;

/// Tries to create a bool from an integer type.
/// Returns an error if the integer is not 0 or 1.
///
/// # Examples
///
/// ```
#[doc = concat!("assert_eq!(0_", stringify!($int), ".try_into(), Ok(false));")]
///
#[doc = concat!("assert_eq!(1_", stringify!($int), ".try_into(), Ok(true));")]
///
#[doc = concat!("assert!(<", stringify!($int), " as TryInto<bool>>::try_into(2).is_err());")]
/// ```
#[inline]
fn try_from(i: $int) -> Result<Self, Self::Error> {
match i {
0 => Ok(false),
1 => Ok(true),
_ => Err(TryFromIntError(())),
}
}
}
)*}
}

macro_rules! rev {
($mac:ident, $source:ty => $($target:ty),+) => {$(
$mac!($target => $source);
)*}
}

// integer -> bool
impl_try_from_integer_for_bool!(u128 u64 u32 u16 u8);
impl_try_from_integer_for_bool!(i128 i64 i32 i16 i8);

// unsigned integer -> unsigned integer
impl_try_from_upper_bounded!(u16 => u8);
impl_try_from_upper_bounded!(u32 => u8, u16);
Expand Down
9 changes: 6 additions & 3 deletions library/core/src/slice/sort/stable/quicksort.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module contains a stable quicksort and partition implementation.

use crate::mem::{ManuallyDrop, MaybeUninit};
use crate::mem::MaybeUninit;
use crate::slice::sort::shared::FreezeMarker;
use crate::slice::sort::shared::pivot::choose_pivot;
use crate::slice::sort::shared::smallsort::StableSmallSortTypeImpl;
Expand Down Expand Up @@ -41,8 +41,11 @@ pub fn quicksort<T, F: FnMut(&T, &T) -> bool>(
// SAFETY: We only access the temporary copy for Freeze types, otherwise
// self-modifications via `is_less` would not be observed and this would
// be unsound. Our temporary copy does not escape this scope.
let pivot_copy = unsafe { ManuallyDrop::new(ptr::read(&v[pivot_pos])) };
let pivot_ref = (!has_direct_interior_mutability::<T>()).then_some(&*pivot_copy);
// We use `MaybeUninit` to avoid re-tag issues. FIXME: use `MaybeDangling`.
let pivot_copy = unsafe { ptr::read((&raw const v[pivot_pos]).cast::<MaybeUninit<T>>()) };
let pivot_ref =
// SAFETY: We created the value in an init state.
(!has_direct_interior_mutability::<T>()).then_some(unsafe { &*pivot_copy.as_ptr() });

// We choose a pivot, and check if this pivot is equal to our left
// ancestor. If true, we do a partition putting equal elements on the
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ pub struct JoinPathsError {
///
/// Returns an [`Err`] (containing an error message) if one of the input
/// [`Path`]s contains an invalid character for constructing the `PATH`
/// variable (a double quote on Windows or a colon on Unix), or if the system
/// does not have a `PATH`-like variable (e.g. UEFI or WASI).
/// variable (a double quote on Windows or a colon on Unix or semicolon on
/// UEFI), or if the system does not have a `PATH`-like variable (e.g. WASI).
///
/// # Examples
///
Expand Down
26 changes: 23 additions & 3 deletions library/std/src/sys/pal/uefi/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ use super::{helpers, unsupported_err};
use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::os::uefi;
use crate::os::uefi::ffi::{OsStrExt, OsStringExt};
use crate::path::{self, PathBuf};
use crate::ptr::NonNull;
use crate::{fmt, io};

const PATHS_SEP: u16 = b';' as u16;

pub fn getcwd() -> io::Result<PathBuf> {
match helpers::open_shell() {
Some(shell) => {
Expand Down Expand Up @@ -54,17 +57,34 @@ impl<'a> Iterator for SplitPaths<'a> {
#[derive(Debug)]
pub struct JoinPathsError;

pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
// UEFI Shell Path variable is defined in Section 3.6.1
// [UEFI Shell Specification](https://uefi.org/sites/default/files/resources/UEFI_Shell_2_2.pdf).
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
where
I: Iterator<Item = T>,
T: AsRef<OsStr>,
{
Err(JoinPathsError)
let mut joined = Vec::new();

for (i, path) in paths.enumerate() {
if i > 0 {
joined.push(PATHS_SEP)
}

let v = path.as_ref().encode_wide().collect::<Vec<u16>>();
if v.contains(&PATHS_SEP) {
return Err(JoinPathsError);
}

joined.extend_from_slice(&v);
}

Ok(OsString::from_wide(&joined))
}

impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"not supported on this platform yet".fmt(f)
"path segment contains `;`".fmt(f)
}
}

Expand Down
Loading
Loading