File tree 3 files changed +36
-3
lines changed
3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ use creader::Library;
217
217
use schema:: { METADATA_HEADER , rustc_version} ;
218
218
219
219
use rustc:: hir:: svh:: Svh ;
220
- use rustc:: session:: Session ;
220
+ use rustc:: session:: { config , Session } ;
221
221
use rustc:: session:: filesearch:: { FileSearch , FileMatches , FileDoesntMatch } ;
222
222
use rustc:: session:: search_paths:: PathKind ;
223
223
use rustc:: util:: common;
@@ -355,6 +355,11 @@ impl<'a> Context<'a> {
355
355
"can't find crate for `{}`{}" ,
356
356
self . ident,
357
357
add) ;
358
+
359
+ if ( self . ident == "std" || self . ident == "core" )
360
+ && self . triple != config:: host_triple ( ) {
361
+ err. note ( & format ! ( "the `{}` target may not be installed" , self . triple) ) ;
362
+ }
358
363
err. span_label ( self . span , & format ! ( "can't find crate" ) ) ;
359
364
err
360
365
} ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2012-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
+ // Tests that compiling for a target which is not installed will result in a helpful
12
+ // error message.
13
+
14
+ // compile-flags: --target=s390x-unknown-linux-gnu
15
+ // ignore s390x
16
+
17
+ // error-pattern:target may not be installed
18
+ fn main ( ) { }
Original file line number Diff line number Diff line change @@ -1334,8 +1334,18 @@ actual:\n\
1334
1334
// FIXME (#9639): This needs to handle non-utf8 paths
1335
1335
let mut args = vec ! [ input_file. to_str( ) . unwrap( ) . to_owned( ) ,
1336
1336
"-L" . to_owned( ) ,
1337
- self . config. build_base. to_str( ) . unwrap( ) . to_owned( ) ,
1338
- format!( "--target={}" , target) ] ;
1337
+ self . config. build_base. to_str( ) . unwrap( ) . to_owned( ) ] ;
1338
+
1339
+ // Optionally prevent default --target if specified in test compile-flags.
1340
+ let custom_target = self . props . compile_flags
1341
+ . iter ( )
1342
+ . fold ( false , |acc, ref x| acc || x. starts_with ( "--target" ) ) ;
1343
+
1344
+ if !custom_target {
1345
+ args. extend ( vec ! [
1346
+ format!( "--target={}" , target) ,
1347
+ ] ) ;
1348
+ }
1339
1349
1340
1350
if let Some ( revision) = self . revision {
1341
1351
args. extend ( vec ! [
You can’t perform that action at this time.
0 commit comments