Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 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
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
1689fcd
feat(windows): add Unix domain socket support
kouhe3 Jan 29, 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
77ddb32
Rollup merge of #150428 - kouhe3:win-af-unix-2, r=Mark-Simulacrum
JonathanBrouwer Feb 1, 2026
77e4e35
Rollup merge of #147400 - hkBst:convert-1, r=Mark-Simulacrum
JonathanBrouwer Feb 1, 2026
f32f54c
Rollup merge of #150993 - Ayush1325:uefi-join-path, r=Mark-Simulacrum
JonathanBrouwer Feb 1, 2026
713fb81
Rollup merge of #151483 - ThanhNguyxn:fix/add-test-issue-138225, r=Ki…
JonathanBrouwer Feb 1, 2026
4eb736c
Rollup merge of #151568 - androm3da:bcain/hexagon_linker_cfg, r=Norat…
JonathanBrouwer Feb 1, 2026
267055f
Rollup merge of #151725 - zzaekkii:debian-cdimage-ports, r=Noratrieb
JonathanBrouwer Feb 1, 2026
6f015dd
Rollup merge of #151895 - Delta17920:move-ui-tests-batch, r=Kivooeo
JonathanBrouwer Feb 1, 2026
0e29291
Rollup merge of #151923 - TaKO8Ki:issue-151331-opaque-alias-relate, r…
JonathanBrouwer Feb 1, 2026
03c5398
Rollup merge of #151947 - mu001999-contrib:fix/151878, r=fmease
JonathanBrouwer Feb 1, 2026
7073bcd
Rollup merge of #151948 - chenyukang:yukang-fix-149954-tokenstream-ic…
JonathanBrouwer 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
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
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
2 changes: 2 additions & 0 deletions library/std/src/os/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
pub mod ffi;
pub mod fs;
pub mod io;
#[unstable(feature = "windows_unix_domain_sockets", issue = "150487")]
pub mod net;
pub mod process;
pub mod raw;
pub mod thread;
Expand Down
Loading
Loading