1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Compile-fail coverage for the public spawn API's evolution boundaries.
//!
//! Downstream callers configure [`super::SpawnOptions`] from its default instead
//! of an exhaustive struct literal, so future optional inputs remain additive.
//!
//! ```compile_fail,E0639
//! use muse_code_sdk::spawn::SpawnOptions;
//!
//! let _ = SpawnOptions {
//! ..SpawnOptions::default()
//! };
//! ```
//!
//! ```no_run
//! use std::path::PathBuf;
//!
//! use muse_code_sdk::spawn::SpawnOptions;
//!
//! let mut options = SpawnOptions::default();
//! options.muse_bin = Some(PathBuf::from("/path/to/muse"));
//! ```
//!
//! Downstream code cannot build [`super::ExitClassification`] with a struct
//! literal and must match it with `..`, so later evidence fields stay additive.
//!
//! ```compile_fail,E0639
//! use muse_code_sdk::spawn::ExitClassification;
//!
//! fn rebuild(classification: ExitClassification) {
//! let _ = ExitClassification {
//! ..classification
//! };
//! }
//! ```
//!
//! ```no_run
//! use muse_code_sdk::spawn::ExitClassification;
//!
//! fn inspect(classification: ExitClassification) {
//! let ExitClassification { kind, .. } = classification;
//! println!("{kind:?}");
//! }
//! ```
//!
//! Downstream matches on [`super::SpawnError::Launch`] include `..`, so later
//! launch evidence can be added without breaking exhaustive destructuring.
//!
//! ```compile_fail,E0638
//! use muse_code_sdk::spawn::SpawnError;
//!
//! fn inspect(error: SpawnError) {
//! match error {
//! SpawnError::Discovery(_) => {}
//! SpawnError::Launch {
//! binary: _,
//! source: _,
//! } => {}
//! }
//! }
//! ```
//!
//! Callers inspect only the launch-failure fields they need, and match
//! `SpawnError` itself with a catch-all arm, since it is `#[non_exhaustive]`.
//!
//! ```
//! use std::path::Path;
//!
//! use muse_code_sdk::spawn::SpawnError;
//!
//! fn binary(error: &SpawnError) -> Option<&Path> {
//! match error {
//! SpawnError::Discovery(_) => None,
//! SpawnError::Launch { binary, .. } => Some(binary.as_path()),
//! _ => None,
//! }
//! }
//! ```
//!
//! Launch failures are created only by SDK-owned spawn paths, so downstream
//! callers cannot freeze an external constructor signature.
//!
//! ```compile_fail,E0599
//! use std::io;
//!
//! use muse_code_sdk::spawn::SpawnError;
//!
//! let _ = SpawnError::launch("muse", io::Error::other("not executable"));
//! ```