File tree 3 files changed +17
-3
lines changed
librustc/middle/typeck/infer
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -410,7 +410,7 @@ impl Coerce {
410
410
debug ! ( "coerce_from_bare_fn(a={}, b={})" ,
411
411
a. inf_str( self . get_ref( ) . infcx) , b. inf_str( self . get_ref( ) . infcx) ) ;
412
412
413
- if !fn_ty_a. abis . is_rust ( ) {
413
+ if !fn_ty_a. abis . is_rust ( ) || fn_ty_a . purity != ast :: ImpureFn {
414
414
return self . subtype ( a, b) ;
415
415
}
416
416
Original file line number Diff line number Diff line change @@ -392,13 +392,13 @@ impl GenericPath for Path {
392
392
#[ inline]
393
393
fn filestem_str < ' a > ( & ' a self ) -> Option < & ' a str > {
394
394
// 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 ) } )
396
396
}
397
397
398
398
#[ inline]
399
399
fn extension_str < ' a > ( & ' a self ) -> Option < & ' a str > {
400
400
// 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 ) } )
402
402
}
403
403
404
404
fn dir_path ( & self ) -> Path {
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments