| 1 | //! Diagnostics. Sprint 0 has the minimum surface the CLI and tests need: |
| 2 | //! a single `error(msg)` helper that writes a prefixed line to stderr. |
| 3 | //! Sprint 30 grows this into path + byte-offset + caret output mirroring |
| 4 | //! `afs-as/src/diag*.rs` style. |
| 5 | |
| 6 | use std::io::Write; |
| 7 | |
| 8 | pub fn error(msg: &str) { |
| 9 | let stderr = std::io::stderr(); |
| 10 | let mut h = stderr.lock(); |
| 11 | let _ = writeln!(h, "afs-ld: error: {msg}"); |
| 12 | } |
| 13 | |
| 14 | pub fn error_verbatim(msg: &str) { |
| 15 | let stderr = std::io::stderr(); |
| 16 | let mut h = stderr.lock(); |
| 17 | let _ = writeln!(h, "{msg}"); |
| 18 | } |
| 19 | |
| 20 | pub fn warning(msg: &str) { |
| 21 | let stderr = std::io::stderr(); |
| 22 | let mut h = stderr.lock(); |
| 23 | let _ = writeln!(h, "afs-ld: warning: {msg}"); |
| 24 | } |
| 25 | |
| 26 | pub fn warning_verbatim(msg: &str) { |
| 27 | let stderr = std::io::stderr(); |
| 28 | let mut h = stderr.lock(); |
| 29 | let _ = writeln!(h, "{msg}"); |
| 30 | } |
| 31 |