vvv_engine/protocol/notice.rs
1use vvv_core::RelPath;
2
3use serde::{Deserialize, Serialize};
4
5use vvv_core::{Address, Position, ReachKind};
6
7/// Something a plan could not do and a human should look at. Never fatal:
8/// the rest of the plan is still valid. Data only; the display layer words it.
9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
10pub struct Notice {
11 pub path: RelPath,
12 pub start: Position,
13 #[serde(flatten)]
14 pub kind: NoticeKind,
15}
16
17#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
18#[serde(tag = "kind", rename_all = "snake_case")]
19pub enum NoticeKind {
20 /// An import the layout understood but the surgery could not rewrite in place;
21 /// `replacement` is what it should become.
22 UnrewritableImport { import: String, replacement: String },
23 /// After the move, `from` references `item` but may not see it, and the
24 /// widening it would take is not one vvv makes on its own (making a
25 /// declaration public across packages is the author's call).
26 Unreachable {
27 item: String,
28 from: Address,
29 needs: ReachKind,
30 },
31 /// An import that now names a declaration in its own file, inside a
32 /// grouped statement vvv does not split for this; remove the entry.
33 RedundantImport { import: String },
34}