Auto merge of #151971 - Zalathar:rollup-KwKpKLY, r=Zalathar
Rollup of 11 pull requests Successful merges: - rust-lang/rust#151756 (Avoid miri error in `slice::sort` under Stacked Borrows) - rust-lang/rust#147400 (TryFrom<integer> for bool) - rust-lang/rust#150993 (std: sys: uefi: os: Implement join_paths) - rust-lang/rust#151483 (Add regression test for issue rust-lang/rust#138225) - rust-lang/rust#151568 (Update hexagon target linker configurations) - rust-lang/rust#151725 (Fix outdated Debian Ports ISO reference) - rust-lang/rust#151895 (Move UI tests batch) - rust-lang/rust#151923 (Fix ICE when projection error reporting sees opaque alias terms) - rust-lang/rust#151947 (Include assoc const projections in CFI trait object) - rust-lang/rust#151948 (Handle unbalanced delimiters gracefully in make_attr_token_stream) - rust-lang/rust#151963 (Add regression test for negative literal in a range of unsigned type)
This commit is contained in:
commit
a60d12cbcc
33 changed files with 578 additions and 187 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
ty::TypingEnv::fully_monomorphized(),
|
||||
alias_ty.to_ty(tcx),
|
||||
let projection_term = ty::AliasTerm::new_from_args(
|
||||
tcx,
|
||||
assoc_item.def_id,
|
||||
super_trait_ref.args,
|
||||
);
|
||||
debug!("Resolved {:?} -> {resolved}", alias_ty.to_ty(tcx));
|
||||
let term = tcx.normalize_erasing_regions(
|
||||
ty::TypingEnv::fully_monomorphized(),
|
||||
projection_term.to_term(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 },
|
||||
),
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -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()
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -39,62 +39,51 @@ 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
|
||||
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 $(,)?) => {
|
||||
#[$attr]
|
||||
/// 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<$Small> for $Large {
|
||||
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
|
||||
// Rustdocs on functions do not.
|
||||
#[doc = $doc]
|
||||
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(small: $Small) -> Self {
|
||||
small as Self
|
||||
fn from(b: bool) -> Self {
|
||||
b 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);
|
||||
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 {
|
||||
($small:ty => $large:ty, #[$attr:meta]) => {
|
||||
#[$attr]
|
||||
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
|
||||
impl const From<$small> for $large {
|
||||
#[doc = concat!("Converts from [`", stringify!($small), "`] to [`", stringify!($large), "`] losslessly.")]
|
||||
#[inline(always)]
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unsigned integer -> unsigned integer
|
||||
impl_from!(u8 => u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
///
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,14 +36,19 @@ Also included in that toolchain is the C library that can be used when creating
|
|||
dynamically linked executables.
|
||||
|
||||
```text
|
||||
# /opt/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/qemu-hexagon -L /opt/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr/ ./hello
|
||||
# /opt/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/qemu-hexagon -L /opt/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr/ ./hello
|
||||
```
|
||||
|
||||
## Linking
|
||||
|
||||
This target selects `rust-lld` by default. Another option to use is
|
||||
[eld](https://github.com/qualcomm/eld), which is also provided with
|
||||
the opensource hexagon toolchain and the Hexagon SDK.
|
||||
This target uses `hexagon-unknown-linux-musl-clang` as the default linker.
|
||||
The linker is available from [the opensource hexagon toolchain](https://github.com/quic/toolchain_for_hexagon/releases)
|
||||
at paths like `/opt/clang+llvm-21.1.8-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/hexagon-unknown-linux-musl-clang`.
|
||||
|
||||
Alternative linkers include:
|
||||
- [eld](https://github.com/qualcomm/eld), which is provided with
|
||||
the opensource hexagon toolchain and the Hexagon SDK
|
||||
- `rust-lld` can be used by specifying `-C linker=rust-lld`
|
||||
|
||||
## Building the target
|
||||
Because it is Tier 3, rust does not yet ship pre-compiled artifacts for this
|
||||
|
|
@ -63,9 +68,9 @@ cxx = "hexagon-unknown-linux-musl-clang++"
|
|||
linker = "hexagon-unknown-linux-musl-clang"
|
||||
ar = "hexagon-unknown-linux-musl-ar"
|
||||
ranlib = "hexagon-unknown-linux-musl-ranlib"
|
||||
musl-root = "/opt/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
musl-root = "/opt/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
llvm-libunwind = 'in-tree'
|
||||
qemu-rootfs = "/opt/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
qemu-rootfs = "/opt/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -88,7 +93,7 @@ target = "hexagon-unknown-linux-musl"
|
|||
[target.hexagon-unknown-linux-musl]
|
||||
linker = "hexagon-unknown-linux-musl-clang"
|
||||
ar = "hexagon-unknown-linux-musl-ar"
|
||||
runner = "qemu-hexagon -L /opt/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
runner = "qemu-hexagon -L /opt/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
```
|
||||
|
||||
Edit the "runner" in `.cargo/config` to point to the path to your toolchain's
|
||||
|
|
@ -96,13 +101,13 @@ C library.
|
|||
|
||||
```text
|
||||
...
|
||||
runner = "qemu-hexagon -L /path/to/my/inst/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
runner = "qemu-hexagon -L /path/to/my/inst/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/target/hexagon-unknown-linux-musl/usr"
|
||||
...
|
||||
```
|
||||
|
||||
Build/run your rust program with `qemu-hexagon` in your `PATH`:
|
||||
|
||||
```text
|
||||
export PATH=/path/to/my/inst/clang+llvm-18.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/:$PATH
|
||||
export PATH=/path/to/my/inst/clang+llvm-VERSION-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/:$PATH
|
||||
cargo run -Zbuild-std -Zbuild-std-features=llvm-libunwind
|
||||
```
|
||||
|
|
|
|||
|
|
@ -33,10 +33,15 @@ required for building programs for this target.
|
|||
|
||||
## Linking
|
||||
|
||||
This target selects `rust-lld` by default. Another option to use is
|
||||
[eld](https://github.com/qualcomm/eld), which is also provided with
|
||||
[the opensource hexagon toolchain](https://github.com/quic/toolchain_for_hexagon)
|
||||
and the Hexagon SDK.
|
||||
This target uses `hexagon-clang` from the Hexagon SDK as the default linker.
|
||||
The linker is available at paths like
|
||||
`/opt/Hexagon_SDK/6.4.0.2/tools/HEXAGON_Tools/19.0.04/Tools/bin/hexagon-clang`.
|
||||
|
||||
Alternative linkers include:
|
||||
- [eld](https://github.com/qualcomm/eld), which is provided with both
|
||||
[the opensource hexagon toolchain](https://github.com/quic/toolchain_for_hexagon)
|
||||
and the Hexagon SDK
|
||||
- `rust-lld` can be used by specifying `-C linker=rust-lld`
|
||||
|
||||
## Building the target
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ Atari systems or emulated environments such as QEMU version 4.2 or newer or ARAn
|
|||
ISO images for installation are provided by the Debian Ports team and can be obtained
|
||||
from the Debian CD image server available at:
|
||||
|
||||
[https://cdimage.debian.org/cdimage/ports/current](https://cdimage.debian.org/cdimage/ports/current/)
|
||||
[https://cdimage.debian.org/cdimage/ports/12.0/m68k/](https://cdimage.debian.org/cdimage/ports/12.0/m68k/)
|
||||
|
||||
Documentation for Debian/m68k is available on the Debian Wiki at:
|
||||
|
||||
|
|
|
|||
22
tests/ui/closures/local-enums-in-closure-2074.rs
Normal file
22
tests/ui/closures/local-enums-in-closure-2074.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
//! Regression test for https://github.com/rust-lang/rust/issues/2074
|
||||
|
||||
//@ run-pass
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
pub fn main() {
|
||||
let one = || {
|
||||
enum r {
|
||||
a,
|
||||
}
|
||||
r::a as usize
|
||||
};
|
||||
let two = || {
|
||||
enum r {
|
||||
a,
|
||||
}
|
||||
r::a as usize
|
||||
};
|
||||
one();
|
||||
two();
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
pub fn main() {
|
||||
let one = || {
|
||||
enum r { a }
|
||||
r::a as usize
|
||||
};
|
||||
let two = || {
|
||||
enum r { a }
|
||||
r::a as usize
|
||||
};
|
||||
one(); two();
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
|
||||
struct c1<T> {
|
||||
x: T,
|
||||
}
|
||||
|
||||
impl<T> c1<T> {
|
||||
pub fn f1(&self, _x: isize) {
|
||||
}
|
||||
}
|
||||
|
||||
fn c1<T>(x: T) -> c1<T> {
|
||||
c1 {
|
||||
x: x
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> c1<T> {
|
||||
pub fn f2(&self, _x: isize) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn main() {
|
||||
c1::<isize>(3).f1(4);
|
||||
c1::<isize>(3).f2(4);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct Pair { f: isize, g: isize }
|
||||
|
||||
pub fn main() {
|
||||
|
||||
let x = Pair {
|
||||
f: 0,
|
||||
g: 0,
|
||||
};
|
||||
|
||||
let _y = Pair {
|
||||
f: 1,
|
||||
g: 1,
|
||||
.. x
|
||||
};
|
||||
|
||||
let _z = Pair {
|
||||
f: 1,
|
||||
.. x
|
||||
};
|
||||
|
||||
}
|
||||
22
tests/ui/macros/tokenstream-ice-issue-149954.rs
Normal file
22
tests/ui/macros/tokenstream-ice-issue-149954.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Regression test for ICE https://github.com/rust-lang/rust/issues/149954
|
||||
//@ edition: 2024
|
||||
|
||||
enum A {
|
||||
A
|
||||
const A: A = { //~ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found keyword `const`
|
||||
#[derive(Debug)]
|
||||
struct A
|
||||
where
|
||||
A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
//~^ ERROR malformed `cfg` attribute input
|
||||
//~| ERROR malformed `cfg` attribute input
|
||||
//~| ERROR expected trait, found struct `A`
|
||||
//~| ERROR expected trait, found type parameter `A`
|
||||
//~| ERROR expected trait, found struct `A`
|
||||
//~| ERROR expected trait, found type parameter `A`
|
||||
//~| ERROR expected one of `<`, `where`, or `{`, found `}`
|
||||
//~| ERROR expected one of `<`, `where`, or `{`, found `}`
|
||||
//~| ERROR expected one of `,`, `>`, or `}`, found `<eof>`
|
||||
}
|
||||
>;
|
||||
}; //~ ERROR `main` function not found in crate
|
||||
110
tests/ui/macros/tokenstream-ice-issue-149954.stderr
Normal file
110
tests/ui/macros/tokenstream-ice-issue-149954.stderr
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
error: expected one of `(`, `,`, `=`, `{`, or `}`, found keyword `const`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:6:5
|
||||
|
|
||||
LL | A
|
||||
| - expected one of `(`, `,`, `=`, `{`, or `}`
|
||||
LL | const A: A = {
|
||||
| ^^^^^ unexpected token
|
||||
|
|
||||
= help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
|
||||
|
||||
error: expected one of `<`, `where`, or `{`, found `}`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:60
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| - ^ expected one of `<`, `where`, or `{`
|
||||
| |
|
||||
| while parsing this enum
|
||||
|
||||
error: expected one of `<`, `where`, or `{`, found `}`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:60
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| - ^ expected one of `<`, `where`, or `{`
|
||||
| |
|
||||
| while parsing this enum
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: expected one of `,`, `>`, or `}`, found `<eof>`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:60
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| ^ expected one of `,`, `>`, or `}`
|
||||
|
|
||||
help: you might have meant to end the type parameters here
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }>
|
||||
| +
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:36
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| ^^^^^^
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:36
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| ^^^^^^
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0404]: expected trait, found struct `A`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:16
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| ________________^
|
||||
... |
|
||||
LL | | >;
|
||||
| |_________^ not a trait
|
||||
|
||||
error[E0404]: expected trait, found type parameter `A`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:32
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| - ^^^^^^^^^^^^^^^^ not a trait
|
||||
| |
|
||||
| found this type parameter
|
||||
|
||||
error[E0404]: expected trait, found struct `A`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:16
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| ________________^
|
||||
... |
|
||||
LL | | >;
|
||||
| |_________^ not a trait
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0404]: expected trait, found type parameter `A`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:10:32
|
||||
|
|
||||
LL | A: A<{ struct A<A: A<{ #[cfg] () }>> ; enum A }
|
||||
| - ^^^^^^^^^^^^^^^^ not a trait
|
||||
| |
|
||||
| found this type parameter
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0601]: `main` function not found in crate `tokenstream_ice_issue_149954`
|
||||
--> $DIR/tokenstream-ice-issue-149954.rs:22:3
|
||||
|
|
||||
LL | };
|
||||
| ^ consider adding a `main` function to `$DIR/tokenstream-ice-issue-149954.rs`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0404, E0539, E0601.
|
||||
For more information about an error, try `rustc --explain E0404`.
|
||||
16
tests/ui/mir/gvn-opt-138225.rs
Normal file
16
tests/ui/mir/gvn-opt-138225.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//! Regression test for <https://github.com/rust-lang/rust/issues/138225>
|
||||
|
||||
pub struct A {
|
||||
name: NestedOption<Option<String>>,
|
||||
//~^ ERROR cannot find type `NestedOption` in this scope
|
||||
}
|
||||
|
||||
impl A {
|
||||
pub async fn func1() -> &'static A {
|
||||
//~^ ERROR `async fn` is not permitted in Rust 2015
|
||||
static RES: A = A { name: None };
|
||||
&RES
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
19
tests/ui/mir/gvn-opt-138225.stderr
Normal file
19
tests/ui/mir/gvn-opt-138225.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||
--> $DIR/gvn-opt-138225.rs:9:9
|
||||
|
|
||||
LL | pub async fn func1() -> &'static A {
|
||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||
|
|
||||
= help: pass `--edition 2024` to `rustc`
|
||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||
|
||||
error[E0425]: cannot find type `NestedOption` in this scope
|
||||
--> $DIR/gvn-opt-138225.rs:4:11
|
||||
|
|
||||
LL | name: NestedOption<Option<String>>,
|
||||
| ^^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0425, E0670.
|
||||
For more information about an error, try `rustc --explain E0425`.
|
||||
21
tests/ui/range/range-negative-literal-unsigned-type.rs
Normal file
21
tests/ui/range/range-negative-literal-unsigned-type.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Regression tests for: https://github.com/rust-lang/rust/issues/136514
|
||||
|
||||
#![allow(unreachable_patterns)]
|
||||
fn main() {
|
||||
match 0u8 {
|
||||
-1..=2 => {}
|
||||
//~^ ERROR the trait bound `u8: Neg` is not satisfied
|
||||
-0..=0 => {}
|
||||
//~^ ERROR the trait bound `u8: Neg` is not satisfied
|
||||
-256..=2 => {}
|
||||
//~^ ERROR the trait bound `u8: Neg` is not satisfied
|
||||
-255..=2 => {}
|
||||
//~^ ERROR the trait bound `u8: Neg` is not satisfied
|
||||
0..=-1 => {}
|
||||
//~^ ERROR the trait bound `u8: Neg` is not satisfied
|
||||
-2..=-1 => {}
|
||||
//~^ ERROR the trait bound `u8: Neg` is not satisfied
|
||||
//~| ERROR the trait bound `u8: Neg` is not satisfied
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
122
tests/ui/range/range-negative-literal-unsigned-type.stderr
Normal file
122
tests/ui/range/range-negative-literal-unsigned-type.stderr
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:6:9
|
||||
|
|
||||
LL | -1..=2 => {}
|
||||
| ^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:8:9
|
||||
|
|
||||
LL | -0..=0 => {}
|
||||
| ^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:10:9
|
||||
|
|
||||
LL | -256..=2 => {}
|
||||
| ^^^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:12:9
|
||||
|
|
||||
LL | -255..=2 => {}
|
||||
| ^^^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:14:13
|
||||
|
|
||||
LL | 0..=-1 => {}
|
||||
| ^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:16:9
|
||||
|
|
||||
LL | -2..=-1 => {}
|
||||
| ^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error[E0277]: the trait bound `u8: Neg` is not satisfied
|
||||
--> $DIR/range-negative-literal-unsigned-type.rs:16:14
|
||||
|
|
||||
LL | -2..=-1 => {}
|
||||
| ^^ the trait `Neg` is not implemented for `u8`
|
||||
|
|
||||
= help: the following other types implement trait `Neg`:
|
||||
&f128
|
||||
&f16
|
||||
&f32
|
||||
&f64
|
||||
&i128
|
||||
&i16
|
||||
&i32
|
||||
&i64
|
||||
and 12 others
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
//! Regression test for https://github.com/rust-lang/rust/issues/2445
|
||||
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
|
||||
struct c1<T> {
|
||||
x: T,
|
||||
}
|
||||
|
|
@ -12,16 +13,13 @@ impl<T> c1<T> {
|
|||
}
|
||||
|
||||
fn c1<T>(x: T) -> c1<T> {
|
||||
c1 {
|
||||
x: x
|
||||
}
|
||||
c1 { x }
|
||||
}
|
||||
|
||||
impl<T> c1<T> {
|
||||
pub fn f2(&self, _x: T) {}
|
||||
}
|
||||
|
||||
|
||||
pub fn main() {
|
||||
c1::<isize>(3).f1(4);
|
||||
c1::<isize>(3).f2(4);
|
||||
|
|
@ -2,10 +2,8 @@
|
|||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
|
||||
struct socket {
|
||||
sock: isize,
|
||||
|
||||
}
|
||||
|
||||
impl Drop for socket {
|
||||
|
|
@ -13,19 +11,22 @@ impl Drop for socket {
|
|||
}
|
||||
|
||||
impl socket {
|
||||
pub fn set_identity(&self) {
|
||||
pub fn set_identity(&self) {
|
||||
closure(|| setsockopt_bytes(self.sock.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
fn socket() -> socket {
|
||||
socket {
|
||||
sock: 1
|
||||
}
|
||||
socket { sock: 1 }
|
||||
}
|
||||
|
||||
fn closure<F>(f: F) where F: FnOnce() { f() }
|
||||
fn closure<F>(f: F)
|
||||
where
|
||||
F: FnOnce(),
|
||||
{
|
||||
f()
|
||||
}
|
||||
|
||||
fn setsockopt_bytes(_sock: isize) { }
|
||||
fn setsockopt_bytes(_sock: isize) {}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
//! Regression test for https://github.com/rust-lang/rust/issues/2502
|
||||
|
||||
//@ check-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
|
||||
|
||||
struct font<'a> {
|
||||
fontbuf: &'a Vec<u8> ,
|
||||
fontbuf: &'a Vec<u8>,
|
||||
}
|
||||
|
||||
impl<'a> font<'a> {
|
||||
|
|
@ -14,10 +14,8 @@ impl<'a> font<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn font(fontbuf: &Vec<u8> ) -> font<'_> {
|
||||
font {
|
||||
fontbuf: fontbuf
|
||||
}
|
||||
fn font(fontbuf: &Vec<u8>) -> font<'_> {
|
||||
font { fontbuf }
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
pub fn main() {}
|
||||
|
|
@ -1,20 +1,18 @@
|
|||
//! Regression test for https://github.com/rust-lang/rust/issues/2550
|
||||
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
|
||||
struct C {
|
||||
x: usize,
|
||||
}
|
||||
|
||||
fn C(x: usize) -> C {
|
||||
C {
|
||||
x: x
|
||||
}
|
||||
C { x }
|
||||
}
|
||||
|
||||
fn f<T>(_x: T) {
|
||||
}
|
||||
fn f<T>(_x: T) {}
|
||||
|
||||
pub fn main() {
|
||||
f(C(1));
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
//@ compile-flags: -Zsanitizer=cfi -Cunsafe-allow-abi-mismatch=sanitizer -Ccodegen-units=1 -Clto
|
||||
//@ needs-rustc-debug-assertions
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ build-pass
|
||||
//@ no-prefer-dynamic
|
||||
|
||||
#![feature(min_generic_const_args)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
trait Trait {
|
||||
#[type_const]
|
||||
const N: usize = 0;
|
||||
fn process(&self, _: [u8; Self::N]) {}
|
||||
}
|
||||
|
||||
impl Trait for () {}
|
||||
|
||||
fn main() {
|
||||
let _x: &dyn Trait<N = 0> = &();
|
||||
}
|
||||
17
tests/ui/structs/struct-update-syntax-2463.rs
Normal file
17
tests/ui/structs/struct-update-syntax-2463.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//! Regression test for https://github.com/rust-lang/rust/issues/2463
|
||||
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct Pair {
|
||||
f: isize,
|
||||
g: isize,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x = Pair { f: 0, g: 0 };
|
||||
|
||||
let _y = Pair { f: 1, g: 1, ..x };
|
||||
|
||||
let _z = Pair { f: 1, ..x };
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ help: the following other types implement trait `From<T>`
|
|||
::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
||||
|
|
||||
= note: in this macro invocation
|
||||
= note: this error originates in the macro `impl_from` which comes from the expansion of the macro `into_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `impl_from_bool` which comes from the expansion of the macro `into_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`
|
||||
--> $DIR/bad-interconversion.rs:9:12
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
//@ compile-flags: -Znext-solver=globally
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo = Vec<impl Send>;
|
||||
|
||||
#[define_opaque(Foo)]
|
||||
fn make_foo() -> Foo {}
|
||||
//~^ ERROR type mismatch resolving
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error[E0271]: type mismatch resolving `Foo == ()`
|
||||
--> $DIR/opaque-alias-relate-issue-151331.rs:7:18
|
||||
|
|
||||
LL | fn make_foo() -> Foo {}
|
||||
| ^^^ types differ
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue