Skip to content

Commit a9950c0

Browse files
committed
---
yaml --- r: 224277 b: refs/heads/beta c: 922aef0 h: refs/heads/master i: 224275: 9567bf4 v: v3
1 parent 7098df7 commit a9950c0

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 11c22180a790b5010140bb9712d47dd7bca7d903
26+
refs/heads/beta: 922aef03597e9168d68cfed10f063ebaf0743a26
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_typeck/check/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
24902490
// The special-cased logic below has three functions:
24912491
// 1. Provide as good of an expected type as possible.
24922492
let expected = expected_arg_tys.get(i).map(|&ty| {
2493-
Expectation::rvalue_hint(ty)
2493+
Expectation::rvalue_hint(fcx.tcx(), ty)
24942494
});
24952495

24962496
check_expr_with_unifier(fcx, &**arg,
@@ -3268,7 +3268,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
32683268
match unop {
32693269
ast::UnUniq => match ty.sty {
32703270
ty::TyBox(ty) => {
3271-
Expectation::rvalue_hint(ty)
3271+
Expectation::rvalue_hint(tcx, ty)
32723272
}
32733273
_ => {
32743274
NoExpectation
@@ -3345,7 +3345,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
33453345
// the last field of a struct can be unsized.
33463346
ExpectHasType(mt.ty)
33473347
} else {
3348-
Expectation::rvalue_hint(mt.ty)
3348+
Expectation::rvalue_hint(tcx, mt.ty)
33493349
}
33503350
}
33513351
_ => NoExpectation
@@ -3982,8 +3982,8 @@ impl<'tcx> Expectation<'tcx> {
39823982
/// which still is useful, because it informs integer literals and the like.
39833983
/// See the test case `test/run-pass/coerce-expect-unsized.rs` and #20169
39843984
/// for examples of where this comes up,.
3985-
fn rvalue_hint(ty: Ty<'tcx>) -> Expectation<'tcx> {
3986-
match ty.sty {
3985+
fn rvalue_hint(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Expectation<'tcx> {
3986+
match tcx.struct_tail(ty).sty {
39873987
ty::TySlice(_) | ty::TyTrait(..) => {
39883988
ExpectRvalueLikeUnsized(ty)
39893989
}

branches/beta/src/libstd/rand/os.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ mod imp {
185185
use io;
186186
use mem;
187187
use rand::Rng;
188-
use libc::{c_int, size_t};
188+
use libc::{c_int, c_void, size_t};
189189

190190
/// A random number generator that retrieves randomness straight from
191191
/// the operating system. Platform sources:
@@ -203,8 +203,9 @@ mod imp {
203203
_dummy: (),
204204
}
205205

206-
#[repr(C)]
207-
struct SecRandom;
206+
// Fake definition; this is actually a struct, but we don't use the
207+
// contents here.
208+
type SecRandom = c_void;
208209

209210
#[allow(non_upper_case_globals)]
210211
const kSecRandomDefault: *const SecRandom = 0 as *const SecRandom;

branches/beta/src/test/run-pass/coerce-expect-unsized.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#![allow(unknown_features)]
1414
#![feature(box_syntax)]
1515

16+
use std::cell::RefCell;
1617
use std::fmt::Debug;
18+
use std::rc::Rc;
1719

1820
// Check that coercions apply at the pointer level and don't cause
1921
// rvalue expressions to be unsized. See #20169 for more information.
@@ -45,6 +47,9 @@ pub fn main() {
4547
let _: Box<[isize]> = Box::new([1, 2, 3]);
4648
let _: Box<Fn(isize) -> _> = Box::new(|x| (x as u8));
4749

50+
let _: Rc<RefCell<[isize]>> = Rc::new(RefCell::new([1, 2, 3]));
51+
let _: Rc<RefCell<FnMut(isize) -> _>> = Rc::new(RefCell::new(|x| (x as u8)));
52+
4853
let _: Vec<Box<Fn(isize) -> _>> = vec![
4954
Box::new(|x| (x as u8)),
5055
Box::new(|x| (x as i16 as u8)),

0 commit comments

Comments
 (0)