Skip to content

Commit a50d87f

Browse files
committed
Auto merge of #1280 - RalfJung:rustup, r=RalfJung
rustup; fix for TyLayout rename
2 parents 2d50873 + 846ce3c commit a50d87f

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
150322f86d441752874a8bed603d71119f190b8b
1+
0afdf43dc1d9be4c8b422840166b51dd99e56a16

src/helpers.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::mem;
44
use rustc::mir;
55
use rustc::ty::{
66
self,
7-
layout::{self, LayoutOf, Size, TyLayout},
7+
layout::{self, LayoutOf, Size, TyAndLayout},
88
List, TyCtxt,
99
};
1010
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX};
@@ -84,8 +84,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
8484
self.eval_libc(name)?.to_i32()
8585
}
8686

87-
/// Helper function to get the `TyLayout` of a `libc` type
88-
fn libc_ty_layout(&mut self, name: &str) -> InterpResult<'tcx, TyLayout<'tcx>> {
87+
/// Helper function to get the `TyAndLayout` of a `libc` type
88+
fn libc_ty_layout(&mut self, name: &str) -> InterpResult<'tcx, TyAndLayout<'tcx>> {
8989
let this = self.eval_context_mut();
9090
let ty = this.resolve_path(&["libc", name]).monomorphic_ty(*this.tcx);
9191
this.layout_of(ty)
@@ -469,7 +469,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
469469

470470
pub fn immty_from_int_checked<'tcx>(
471471
int: impl Into<i128>,
472-
layout: TyLayout<'tcx>,
472+
layout: TyAndLayout<'tcx>,
473473
) -> InterpResult<'tcx, ImmTy<'tcx, Tag>> {
474474
let int = int.into();
475475
Ok(ImmTy::try_from_int(int, layout).ok_or_else(|| {
@@ -479,7 +479,7 @@ pub fn immty_from_int_checked<'tcx>(
479479

480480
pub fn immty_from_uint_checked<'tcx>(
481481
int: impl Into<u128>,
482-
layout: TyLayout<'tcx>,
482+
layout: TyAndLayout<'tcx>,
483483
) -> InterpResult<'tcx, ImmTy<'tcx, Tag>> {
484484
let int = int.into();
485485
Ok(ImmTy::try_from_uint(int, layout).ok_or_else(|| {

tests/run-pass/arrays.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ fn slice_index() -> u8 {
3535
arr[5]
3636
}
3737

38-
fn try_from() {
38+
fn from() {
3939
const N: usize = 16;
4040
type Array = [u8; N];
4141
let array: Array = [0; N];
4242
let slice: &[u8] = &array[..];
4343

4444
let result = <&Array>::try_from(slice);
4545
assert_eq!(&array, result.unwrap());
46+
47+
let vec = Vec::from(array);
48+
assert_eq!(vec.len(), N);
4649
}
4750

4851
fn eq() {
@@ -69,7 +72,7 @@ fn main() {
6972
assert_eq!(array_array(), [[5, 4], [3, 2], [1, 0]]);
7073
assert_eq!(array_repeat(), [42; 8]);
7174
assert_eq!(mini_array(), [42]);
72-
try_from();
75+
from();
7376
eq();
7477
debug();
7578
}

0 commit comments

Comments
 (0)