forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#103788 - chenyukang:yukang/fix-ice-103783, …
…r=compiler-errors Fix ICE in checking transmutability of NaughtyLenArray Fixes rust-lang#103783
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/test/ui/transmutability/arrays/issue-103783-array-length.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#![crate_type = "lib"] | ||
#![feature(transmutability)] | ||
#![allow(dead_code)] | ||
|
||
mod assert { | ||
use std::mem::{Assume, BikeshedIntrinsicFrom}; | ||
pub struct Context; | ||
|
||
pub fn is_maybe_transmutable<Src, Dst>() | ||
where | ||
Dst: BikeshedIntrinsicFrom< | ||
Src, | ||
Context, | ||
{ Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, | ||
>, | ||
{ | ||
} | ||
} | ||
|
||
fn test() { | ||
type NaughtyLenArray = [u32; 3.14159]; //~ ERROR mismatched types | ||
type JustUnit = (); | ||
assert::is_maybe_transmutable::<JustUnit, NaughtyLenArray>(); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/ui/transmutability/arrays/issue-103783-array-length.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-103783-array-length.rs:21:34 | ||
| | ||
LL | type NaughtyLenArray = [u32; 3.14159]; | ||
| ^^^^^^^ expected `usize`, found floating-point number | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |