File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,12 @@ impl<'a> LintExtractor<'a> {
3939 fn collect_groups ( & self ) -> Result < LintGroups , Box < dyn Error > > {
4040 let mut result = BTreeMap :: new ( ) ;
4141 let mut cmd = Command :: new ( self . rustc_path ) ;
42+ cmd. env_remove ( "LD_LIBRARY_PATH" ) ;
4243 cmd. arg ( "-Whelp" ) ;
4344 let output = cmd. output ( ) . map_err ( |e| format ! ( "failed to run command {:?}\n {}" , cmd, e) ) ?;
4445 if !output. status . success ( ) {
4546 return Err ( format ! (
46- "failed to collect lint info: {:?}\n --- stderr\n {}--- stdout\n {}\n " ,
47+ "failed to collect lint info: failed to run {cmd:?}: {:?}\n --- stderr\n {}--- stdout\n {}\n " ,
4748 output. status,
4849 std:: str :: from_utf8( & output. stderr) . unwrap( ) ,
4950 std:: str :: from_utf8( & output. stdout) . unwrap( ) ,
Original file line number Diff line number Diff line change @@ -403,6 +403,12 @@ impl<'a> LintExtractor<'a> {
403403 fs:: write ( & tempfile, source)
404404 . map_err ( |e| format ! ( "failed to write {}: {}" , tempfile. display( ) , e) ) ?;
405405 let mut cmd = Command :: new ( self . rustc_path ) ;
406+ // NOTE: bootstrap sets `LD_LIBRARY_PATH` for building lint-docs itself.
407+ // Unfortunately, lint-docs is a bootstrap tool while rustc is built from source,
408+ // and sometimes the paths conflict. In particular, when using `download-rustc`,
409+ // the LLVM versions can differ between `ci-llvm` and `ci-rustc-sysroot`.
410+ // Unset LD_LIBRARY_PATH here so it doesn't interfere with running the compiler.
411+ cmd. env_remove ( "LD_LIBRARY_PATH" ) ;
406412 if options. contains ( & "edition2015" ) {
407413 cmd. arg ( "--edition=2015" ) ;
408414 } else {
@@ -415,6 +421,9 @@ impl<'a> LintExtractor<'a> {
415421 }
416422 cmd. arg ( "lint_example.rs" ) ;
417423 cmd. current_dir ( tempdir. path ( ) ) ;
424+ if self . verbose {
425+ eprintln ! ( "running: {cmd:?}" ) ;
426+ }
418427 let output = cmd. output ( ) . map_err ( |e| format ! ( "failed to run command {:?}\n {}" , cmd, e) ) ?;
419428 let stderr = std:: str:: from_utf8 ( & output. stderr ) . unwrap ( ) ;
420429 let msgs = stderr
You can’t perform that action at this time.
0 commit comments