@@ -18,6 +18,7 @@ use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP};
18
18
19
19
use log:: { debug, trace} ;
20
20
use std:: mem;
21
+ use std:: path:: PathBuf ;
21
22
22
23
const TURBOFISH : & str = "use `::<...>` instead of `<...>` to specify type arguments" ;
23
24
@@ -40,29 +41,15 @@ pub(super) fn dummy_arg(ident: Ident) -> Param {
40
41
}
41
42
42
43
pub enum Error {
43
- FileNotFoundForModule {
44
- mod_name : String ,
45
- default_path : String ,
46
- secondary_path : String ,
47
- dir_path : String ,
48
- } ,
49
- DuplicatePaths {
50
- mod_name : String ,
51
- default_path : String ,
52
- secondary_path : String ,
53
- } ,
44
+ FileNotFoundForModule { mod_name : String , default_path : PathBuf } ,
45
+ DuplicatePaths { mod_name : String , default_path : String , secondary_path : String } ,
54
46
UselessDocComment ,
55
47
}
56
48
57
49
impl Error {
58
50
fn span_err ( self , sp : impl Into < MultiSpan > , handler : & Handler ) -> DiagnosticBuilder < ' _ > {
59
51
match self {
60
- Error :: FileNotFoundForModule {
61
- ref mod_name,
62
- ref default_path,
63
- ref secondary_path,
64
- ref dir_path,
65
- } => {
52
+ Error :: FileNotFoundForModule { ref mod_name, ref default_path } => {
66
53
let mut err = struct_span_err ! (
67
54
handler,
68
55
sp,
@@ -71,8 +58,9 @@ impl Error {
71
58
mod_name,
72
59
) ;
73
60
err. help ( & format ! (
74
- "name the file either {} or {} inside the directory \" {}\" " ,
75
- default_path, secondary_path, dir_path,
61
+ "to create the module `{}`, create file \" {}\" " ,
62
+ mod_name,
63
+ default_path. display( ) ,
76
64
) ) ;
77
65
err
78
66
}
0 commit comments