Skip to content

Commit 88dd987

Browse files
committed
auto merge of #11605 : alexcrichton/rust/issue-9582, r=brson
Closes #9582
2 parents 1da2962 + afa392a commit 88dd987

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/librustc/middle/typeck/infer/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl Coerce {
410410
debug!("coerce_from_bare_fn(a={}, b={})",
411411
a.inf_str(self.get_ref().infcx), b.inf_str(self.get_ref().infcx));
412412

413-
if !fn_ty_a.abis.is_rust() {
413+
if !fn_ty_a.abis.is_rust() || fn_ty_a.purity != ast::ImpureFn {
414414
return self.subtype(a, b);
415415
}
416416

src/libstd/path/windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ impl GenericPath for Path {
392392
#[inline]
393393
fn filestem_str<'a>(&'a self) -> Option<&'a str> {
394394
// filestem() returns a byte vector that's guaranteed valid UTF-8
395-
self.filestem().map(cast::transmute)
395+
self.filestem().map(|t| unsafe { cast::transmute(t) })
396396
}
397397

398398
#[inline]
399399
fn extension_str<'a>(&'a self) -> Option<&'a str> {
400400
// extension() returns a byte vector that's guaranteed valid UTF-8
401-
self.extension().map(cast::transmute)
401+
self.extension().map(|t| unsafe { cast::transmute(t) })
402402
}
403403

404404
fn dir_path(&self) -> Path {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let x: Option<&[u8]> = Some("foo").map(std::cast::transmute);
13+
//~^ ERROR: mismatched types
14+
}

0 commit comments

Comments
 (0)