Remove crashes, add comment

This commit is contained in:
Michael Goulet 2024-10-03 15:19:23 -04:00
parent 5b1a2b8712
commit bc5f9520c1
4 changed files with 2 additions and 54 deletions

View File

@ -2224,6 +2224,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
) -> GetSafeTransmuteErrorAndReason { ) -> GetSafeTransmuteErrorAndReason {
use rustc_transmute::Answer; use rustc_transmute::Answer;
// We don't assemble a transmutability candidate for types that are generic
// and we should have ambiguity for types that still have non-region infer.
if obligation.predicate.has_non_region_param() || obligation.has_non_region_infer() { if obligation.predicate.has_non_region_param() || obligation.has_non_region_infer() {
return GetSafeTransmuteErrorAndReason::Default; return GetSafeTransmuteErrorAndReason::Default;
} }

View File

@ -1,8 +0,0 @@
//@ known-bug: rust-lang/rust#125881
#![crate_type = "lib"]
#![feature(transmutability)]
#![feature(unboxed_closures,effects)]
const fn test() -> impl std::mem::TransmuteFrom() {
|| {}
}

View File

@ -1,29 +0,0 @@
//@ known-bug: rust-lang/rust#126377
#![feature(effects)]
#![feature(generic_const_exprs)]
mod assert {
use std::mem::{Assume, TransmuteFrom};
pub fn is_transmutable<
Src,
Dst,
const ASSUME_ALIGNMENT: bool,
const ASSUME_LIFETIMES: bool,
const ASSUME_SAFETY: bool,
const ASSUME_VALIDITY: bool,
>()
where
Dst: TransmuteFrom<
Src,
{ }
>,
{}
}
const fn from_options() -> Assume {
#[repr(C)] struct Src;
#[repr(C)] struct Dst;
assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
}

View File

@ -1,17 +0,0 @@
//@ known-bug: #130413
#![feature(transmutability)]
trait Aaa {
type Y;
}
trait Bbb {
type B: std::mem::TransmuteFrom<()>;
}
impl<T> Bbb for T
where
T: Aaa,
{
type B = T::Y;
}