File tree 2 files changed +11
-13
lines changed
2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ fn main() {
46
46
// determine the version of the compiler, the real compiler needs to be
47
47
// used. Currently, these two states are differentiated based on whether
48
48
// --target and -vV is/isn't passed.
49
- let ( rustc, libdir) = if target. is_none ( ) && version. is_none ( ) {
49
+ let is_build_script = target. is_none ( ) && version. is_none ( ) ;
50
+ let ( rustc, libdir) = if is_build_script {
50
51
( "RUSTC_SNAPSHOT" , "RUSTC_SNAPSHOT_LIBDIR" )
51
52
} else {
52
53
( "RUSTC_REAL" , "RUSTC_LIBDIR" )
@@ -70,7 +71,15 @@ fn main() {
70
71
. unwrap_or_else ( || env:: var ( "CFG_COMPILER_HOST_TRIPLE" ) . unwrap ( ) ) ;
71
72
let is_clippy = args[ 0 ] . to_string_lossy ( ) . ends_with ( & exe ( "clippy-driver" , & target_name) ) ;
72
73
let rustc_driver = if is_clippy {
73
- args. remove ( 0 )
74
+ if is_build_script {
75
+ // Don't run clippy on build scripts (for one thing, we may not have libstd built with
76
+ // the appropriate version yet, e.g. for stage 1 std).
77
+ // Also remove the `clippy-driver` param in addition to the RUSTC param.
78
+ args. drain ( ..2 ) ;
79
+ rustc_real
80
+ } else {
81
+ args. remove ( 0 )
82
+ }
74
83
} else {
75
84
args. remove ( 0 ) ;
76
85
rustc_real
Original file line number Diff line number Diff line change @@ -1181,7 +1181,6 @@ impl<'a> Builder<'a> {
1181
1181
extra_features : vec ! [ ] ,
1182
1182
} ) ;
1183
1183
let mut dylib_path = dylib_path ( ) ;
1184
- let run_compiler = self . compiler ( build_compiler. stage + 1 , self . build . build ) ;
1185
1184
dylib_path. insert ( 0 , self . sysroot ( run_compiler) . join ( "lib" ) ) ;
1186
1185
1187
1186
let mut cmd = Command :: new ( cargo_clippy. unwrap ( ) ) ;
@@ -1634,16 +1633,6 @@ impl<'a> Builder<'a> {
1634
1633
self . clear_if_dirty ( & out_dir, & self . rustc ( compiler) ) ;
1635
1634
}
1636
1635
1637
- // HACK: clippy will pass `--sysroot` to `RunCompiler` if and only if SYSROOT is set and
1638
- // `--sysroot is not already passed. Cargo doesn't pass `--sysroot` through RUSTFLAGS for
1639
- // build scripts and proc-macros, which is exactly when we want to use the beta sysroot
1640
- // instead of the in-tree libstd. Set SYSROOT so we use beta for stage 0 build
1641
- if cmd == "clippy" {
1642
- let build_script_sysroot =
1643
- if stage == 0 { self . rustc_snapshot_sysroot ( ) } else { sysroot } ;
1644
- cargo. env ( "SYSROOT" , build_script_sysroot) ;
1645
- }
1646
-
1647
1636
// Customize the compiler we're running. Specify the compiler to cargo
1648
1637
// as our shim and then pass it some various options used to configure
1649
1638
// how the actual compiler itself is called.
You can’t perform that action at this time.
0 commit comments