11use serde_derive:: Deserialize ;
22use snafu:: prelude:: * ;
3- use std:: { collections:: BTreeMap , fmt , io, string, time:: Duration } ;
3+ use std:: { collections:: BTreeMap , io, string, time:: Duration } ;
44use tempfile:: TempDir ;
55use tokio:: { process:: Command , time} ;
66
@@ -290,47 +290,6 @@ async fn run_command_with_timeout(mut command: Command) -> Result<std::process::
290290 Ok ( output)
291291}
292292
293- #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
294- pub enum AssemblyFlavor {
295- Att ,
296- Intel ,
297- }
298-
299- #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
300- pub enum DemangleAssembly {
301- Demangle ,
302- Mangle ,
303- }
304-
305- #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
306- pub enum ProcessAssembly {
307- Filter ,
308- Raw ,
309- }
310-
311- #[ derive( Debug , Copy , Clone , PartialEq , Eq , strum:: IntoStaticStr ) ]
312- pub enum CompileTarget {
313- Assembly ( AssemblyFlavor , DemangleAssembly , ProcessAssembly ) ,
314- LlvmIr ,
315- Mir ,
316- Hir ,
317- Wasm ,
318- }
319-
320- impl fmt:: Display for CompileTarget {
321- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
322- use self :: CompileTarget :: * ;
323-
324- match * self {
325- Assembly ( _, _, _) => "assembly" . fmt ( f) ,
326- LlvmIr => "LLVM IR" . fmt ( f) ,
327- Mir => "Rust MIR" . fmt ( f) ,
328- Hir => "Rust HIR" . fmt ( f) ,
329- Wasm => "WebAssembly" . fmt ( f) ,
330- }
331- }
332- }
333-
334293#[ derive( Debug , Copy , Clone , PartialEq , Eq , strum:: IntoStaticStr ) ]
335294pub enum Channel {
336295 Stable ,
@@ -349,127 +308,3 @@ impl Channel {
349308 }
350309 }
351310}
352-
353- #[ derive( Debug , Copy , Clone , PartialEq , Eq , strum:: IntoStaticStr ) ]
354- pub enum Mode {
355- Debug ,
356- Release ,
357- }
358-
359- #[ derive( Debug , Copy , Clone , PartialEq , Eq , strum:: IntoStaticStr ) ]
360- pub enum Edition {
361- Rust2015 ,
362- Rust2018 ,
363- Rust2021 , // TODO - add parallel tests for 2021
364- Rust2024 ,
365- }
366-
367- impl Edition {
368- fn cargo_ident ( & self ) -> & ' static str {
369- use self :: Edition :: * ;
370-
371- match * self {
372- Rust2015 => "2015" ,
373- Rust2018 => "2018" ,
374- Rust2021 => "2021" ,
375- Rust2024 => "2024" ,
376- }
377- }
378- }
379-
380- #[ derive( Debug , Copy , Clone , PartialEq , Eq , strum:: IntoStaticStr ) ]
381- pub enum CrateType {
382- Binary ,
383- Library ( LibraryType ) ,
384- }
385-
386- #[ derive( Debug , Copy , Clone , PartialEq , Eq , strum:: IntoStaticStr ) ]
387- pub enum LibraryType {
388- Lib ,
389- Dylib ,
390- Rlib ,
391- Staticlib ,
392- Cdylib ,
393- ProcMacro ,
394- }
395-
396- impl LibraryType {
397- fn cargo_ident ( & self ) -> & ' static str {
398- use self :: LibraryType :: * ;
399-
400- match * self {
401- Lib => "lib" ,
402- Dylib => "dylib" ,
403- Rlib => "rlib" ,
404- Staticlib => "staticlib" ,
405- Cdylib => "cdylib" ,
406- ProcMacro => "proc-macro" ,
407- }
408- }
409- }
410-
411- trait DockerCommandExt {
412- fn apply_crate_type ( & mut self , req : impl CrateTypeRequest ) ;
413- fn apply_edition ( & mut self , req : impl EditionRequest ) ;
414- fn apply_backtrace ( & mut self , req : impl BacktraceRequest ) ;
415- }
416-
417- impl DockerCommandExt for Command {
418- fn apply_crate_type ( & mut self , req : impl CrateTypeRequest ) {
419- if let CrateType :: Library ( lib) = req. crate_type ( ) {
420- self . args ( & [
421- "--env" ,
422- & format ! ( "PLAYGROUND_CRATE_TYPE={}" , lib. cargo_ident( ) ) ,
423- ] ) ;
424- }
425- }
426-
427- fn apply_edition ( & mut self , req : impl EditionRequest ) {
428- if let Some ( edition) = req. edition ( ) {
429- if edition == Edition :: Rust2024 {
430- self . args ( & [ "--env" , & format ! ( "PLAYGROUND_FEATURE_EDITION2024=true" ) ] ) ;
431- }
432-
433- self . args ( & [
434- "--env" ,
435- & format ! ( "PLAYGROUND_EDITION={}" , edition. cargo_ident( ) ) ,
436- ] ) ;
437- }
438- }
439-
440- fn apply_backtrace ( & mut self , req : impl BacktraceRequest ) {
441- if req. backtrace ( ) {
442- self . args ( & [ "--env" , "RUST_BACKTRACE=1" ] ) ;
443- }
444- }
445- }
446-
447- trait CrateTypeRequest {
448- fn crate_type ( & self ) -> CrateType ;
449- }
450-
451- impl < R : CrateTypeRequest > CrateTypeRequest for & ' _ R {
452- fn crate_type ( & self ) -> CrateType {
453- ( * self ) . crate_type ( )
454- }
455- }
456-
457- trait EditionRequest {
458- fn edition ( & self ) -> Option < Edition > ;
459- }
460-
461- impl < R : EditionRequest > EditionRequest for & ' _ R {
462- fn edition ( & self ) -> Option < Edition > {
463- ( * self ) . edition ( )
464- }
465- }
466-
467- trait BacktraceRequest {
468- fn backtrace ( & self ) -> bool ;
469- }
470-
471- impl < R : BacktraceRequest > BacktraceRequest for & ' _ R {
472- fn backtrace ( & self ) -> bool {
473- ( * self ) . backtrace ( )
474- }
475- }
0 commit comments