This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree 5 files changed +15
-17
lines changed
5 files changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ impl<O: Output> PostBuildHandler<O> {
49
49
) ) ;
50
50
51
51
match result {
52
- BuildResult :: Success ( messages, new_analysis)
53
- | BuildResult :: Failure ( messages, new_analysis) => {
52
+ BuildResult :: Success ( messages, new_analysis) => {
54
53
thread:: spawn ( move || {
55
54
trace ! ( "build - Success" ) ;
56
55
Original file line number Diff line number Diff line change @@ -476,8 +476,7 @@ impl Executor for RlsExecutor {
476
476
self . config . clone ( ) ,
477
477
env_lock,
478
478
) {
479
- BuildResult :: Success ( mut messages, mut analysis)
480
- | BuildResult :: Failure ( mut messages, mut analysis) => {
479
+ BuildResult :: Success ( mut messages, mut analysis) => {
481
480
self . compiler_messages . lock ( ) . unwrap ( ) . append ( & mut messages) ;
482
481
self . analysis . lock ( ) . unwrap ( ) . append ( & mut analysis) ;
483
482
}
Original file line number Diff line number Diff line change @@ -92,10 +92,9 @@ struct Internals {
92
92
/// The result of a build request.
93
93
#[ derive( Debug ) ]
94
94
pub enum BuildResult {
95
- /// Build was successful, argument is warnings.
95
+ /// Build was performed without any internal errors. The payload
96
+ /// contains emitted raw diagnostics and Analysis data.
96
97
Success ( Vec < String > , Vec < Analysis > ) ,
97
- /// Build finished with errors, argument is errors and warnings.
98
- Failure ( Vec < String > , Vec < Analysis > ) ,
99
98
/// Build was coalesced with another build.
100
99
Squashed ,
101
100
/// There was an error attempting to build.
@@ -421,7 +420,7 @@ impl Internals {
421
420
// now. It's possible that a build was scheduled with given files, but
422
421
// user later changed them. These should still be left as dirty (not built).
423
422
match * & result {
424
- BuildResult :: Success ( _, _) | BuildResult :: Failure ( _ , _ ) => {
423
+ BuildResult :: Success ( _, _) => {
425
424
let mut dirty_files = self . dirty_files . lock ( ) . unwrap ( ) ;
426
425
dirty_files. retain ( |file, dirty_version| {
427
426
built_files
Original file line number Diff line number Diff line change @@ -361,17 +361,16 @@ impl JobQueue {
361
361
internals. config . clone ( ) ,
362
362
internals. env_lock . as_facade ( ) ,
363
363
) {
364
- BuildResult :: Success ( mut messages, mut analysis)
365
- | BuildResult :: Failure ( mut messages, mut analysis) => {
364
+ BuildResult :: Success ( mut messages, mut analysis) => {
366
365
compiler_messages. append ( & mut messages) ;
367
366
analyses. append ( & mut analysis) ;
368
367
}
369
368
BuildResult :: Err => return BuildResult :: Err ,
370
369
_ => { }
371
370
}
372
371
}
373
- // TODO: Should we combine with ::Failure? What's the difference between those two?
374
- return BuildResult :: Success ( compiler_messages, analyses) ;
372
+
373
+ BuildResult :: Success ( compiler_messages, analyses)
375
374
}
376
375
}
377
376
Original file line number Diff line number Diff line change @@ -74,7 +74,11 @@ pub fn rustc(
74
74
75
75
let mut controller = RlsRustcCalls :: new ( analysis. clone ( ) ) ;
76
76
77
- let exit_code = :: std:: panic:: catch_unwind ( || {
77
+ // rustc explicitly panics in run_compiler() on compile failure, regardless
78
+ // if it encounters an ICE (internal compiler error) or not.
79
+ // TODO: Change librustc_driver behaviour to distinguish between ICEs and
80
+ // regular compilation failure with errors?
81
+ let _ = :: std:: panic:: catch_unwind ( || {
78
82
run ( move || {
79
83
// Replace stderr so we catch most errors.
80
84
run_compiler (
@@ -94,10 +98,8 @@ pub fn rustc(
94
98
95
99
let analysis = analysis. lock ( ) . unwrap ( ) . clone ( ) ;
96
100
let analysis = analysis. map ( |analysis| vec ! [ analysis] ) . unwrap_or ( vec ! [ ] ) ;
97
- match exit_code {
98
- Ok ( 0 ) => BuildResult :: Success ( stderr_json_msgs, analysis) ,
99
- _ => BuildResult :: Failure ( stderr_json_msgs, analysis) ,
100
- }
101
+
102
+ BuildResult :: Success ( stderr_json_msgs, analysis)
101
103
}
102
104
103
105
// Our compiler controller. We mostly delegate to the default rustc
You can’t perform that action at this time.
0 commit comments