use std::rc::Rc; use super::{ErrorPosition, ProjectError}; use crate::representations::location::Location; use crate::utils::BoxedIter; /// An import refers to a symbol which exists but is not exported. #[derive(Debug)] pub struct NotExported { pub file: Vec, pub subpath: Vec, pub referrer_file: Vec, pub referrer_subpath: Vec, } impl ProjectError for NotExported { fn description(&self) -> &str { "An import refers to a symbol that exists but isn't exported" } fn positions(&self) -> BoxedIter { Box::new( [ ErrorPosition { location: Location::File(Rc::new(self.file.clone())), message: Some(format!("{} isn't exported", self.subpath.join("::"))), }, ErrorPosition { location: Location::File(Rc::new(self.referrer_file.clone())), message: Some(format!( "{} cannot see this symbol", self.referrer_subpath.join("::") )), }, ] .into_iter(), ) } }