refix_codegen/namespace/error.rs
1use std::fmt;
2
3use crate::Owner;
4
5/// A name that two parts of the generated code would both use.
6#[derive(Debug, Eq, PartialEq)]
7pub struct NameClash {
8 pub name: String,
9 pub first: Owner,
10 pub second: Owner,
11}
12
13impl fmt::Display for NameClash {
14 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 write!(
16 f,
17 "`{}` is taken by both {} and {}",
18 self.name, self.first, self.second
19 )
20 }
21}
22
23impl std::error::Error for NameClash {}