@@ -219,7 +219,7 @@ fn is_ident_or_underscore(t: &token::Token) -> bool {
219
219
pub struct ModulePath {
220
220
pub name : String ,
221
221
pub path_exists : bool ,
222
- pub result : Result < ModulePathSuccess , Errors > ,
222
+ pub result : Result < ModulePathSuccess , Error > ,
223
223
}
224
224
225
225
pub struct ModulePathSuccess {
@@ -233,7 +233,7 @@ pub struct ModulePathError {
233
233
pub help_msg : String ,
234
234
}
235
235
236
- pub enum Errors {
236
+ pub enum Error {
237
237
FileNotFoundForModule {
238
238
mod_name : String ,
239
239
default_path : String ,
@@ -249,13 +249,13 @@ pub enum Errors {
249
249
InclusiveRangeWithNoEnd ,
250
250
}
251
251
252
- impl Errors {
252
+ impl Error {
253
253
pub fn span_err < ' a > ( self , sp : Span , handler : & ' a errors:: Handler ) -> DiagnosticBuilder < ' a > {
254
254
match self {
255
- Errors :: FileNotFoundForModule { ref mod_name,
256
- ref default_path,
257
- ref secondary_path,
258
- ref dir_path } => {
255
+ Error :: FileNotFoundForModule { ref mod_name,
256
+ ref default_path,
257
+ ref secondary_path,
258
+ ref dir_path } => {
259
259
let mut err = struct_span_err ! ( handler, sp, E0583 ,
260
260
"file not found for module `{}`" , mod_name) ;
261
261
err. help ( & format ! ( "name the file either {} or {} inside the directory {:?}" ,
@@ -264,7 +264,7 @@ impl Errors {
264
264
dir_path) ) ;
265
265
err
266
266
}
267
- Errors :: DuplicatePaths { ref mod_name, ref default_path, ref secondary_path } => {
267
+ Error :: DuplicatePaths { ref mod_name, ref default_path, ref secondary_path } => {
268
268
let mut err = struct_span_err ! ( handler, sp, E0584 ,
269
269
"file for module `{}` found at both {} and {}" ,
270
270
mod_name,
@@ -273,14 +273,14 @@ impl Errors {
273
273
err. help ( "delete or rename one of them to remove the ambiguity" ) ;
274
274
err
275
275
}
276
- Errors :: UselessDocComment => {
276
+ Error :: UselessDocComment => {
277
277
let mut err = struct_span_err ! ( handler, sp, E0585 ,
278
278
"found a documentation comment that doesn't document anything" ) ;
279
279
err. help ( "doc comments must come before what they document, maybe a comment was \
280
280
intended with `//`?") ;
281
281
err
282
282
}
283
- Errors :: InclusiveRangeWithNoEnd => {
283
+ Error :: InclusiveRangeWithNoEnd => {
284
284
let mut err = struct_span_err ! ( handler, sp, E0586 ,
285
285
"inclusive range with no end" ) ;
286
286
err. help ( "inclusive ranges must be bounded at the end (`...b` or `a...b`)" ) ;
@@ -518,7 +518,7 @@ impl<'a> Parser<'a> {
518
518
}
519
519
_ => {
520
520
Err ( if self . prev_token_kind == PrevTokenKind :: DocComment {
521
- self . span_fatal_err ( self . prev_span , Errors :: UselessDocComment )
521
+ self . span_fatal_err ( self . prev_span , Error :: UselessDocComment )
522
522
} else {
523
523
let mut err = self . fatal ( & format ! ( "expected identifier, found `{}`" ,
524
524
self . this_token_to_string( ) ) ) ;
@@ -1009,7 +1009,7 @@ impl<'a> Parser<'a> {
1009
1009
pub fn span_fatal ( & self , sp : Span , m : & str ) -> DiagnosticBuilder < ' a > {
1010
1010
self . sess . span_diagnostic . struct_span_fatal ( sp, m)
1011
1011
}
1012
- pub fn span_fatal_err ( & self , sp : Span , err : Errors ) -> DiagnosticBuilder < ' a > {
1012
+ pub fn span_fatal_err ( & self , sp : Span , err : Error ) -> DiagnosticBuilder < ' a > {
1013
1013
err. span_err ( sp, self . diagnostic ( ) )
1014
1014
}
1015
1015
pub fn span_fatal_help ( & self , sp : Span , m : & str , help : & str ) -> DiagnosticBuilder < ' a > {
@@ -2001,7 +2001,7 @@ impl<'a> Parser<'a> {
2001
2001
limits : RangeLimits )
2002
2002
-> PResult < ' a , ast:: ExprKind > {
2003
2003
if end. is_none ( ) && limits == RangeLimits :: Closed {
2004
- Err ( self . span_fatal_err ( self . span , Errors :: InclusiveRangeWithNoEnd ) )
2004
+ Err ( self . span_fatal_err ( self . span , Error :: InclusiveRangeWithNoEnd ) )
2005
2005
} else {
2006
2006
Ok ( ExprKind :: Range ( start, end, limits) )
2007
2007
}
@@ -3916,7 +3916,7 @@ impl<'a> Parser<'a> {
3916
3916
let unused_attrs = |attrs : & [ _ ] , s : & mut Self | {
3917
3917
if attrs. len ( ) > 0 {
3918
3918
if s. prev_token_kind == PrevTokenKind :: DocComment {
3919
- self . span_fatal_err ( s. prev_span , Errors :: UselessDocComment ) . emit ( ) ;
3919
+ s . span_fatal_err ( s. prev_span , Error :: UselessDocComment ) . emit ( ) ;
3920
3920
} else {
3921
3921
s. span_err ( s. span , "expected statement after outer attribute" ) ;
3922
3922
}
@@ -5050,7 +5050,7 @@ impl<'a> Parser<'a> {
5050
5050
}
5051
5051
token:: CloseDelim ( token:: Brace ) => { }
5052
5052
token:: DocComment ( _) => return Err ( self . span_fatal_err ( self . span ,
5053
- Errors :: UselessDocComment ) ) ,
5053
+ Error :: UselessDocComment ) ) ,
5054
5054
_ => return Err ( self . span_fatal_help ( self . span ,
5055
5055
& format ! ( "expected `,`, or `}}`, found `{}`" , self . this_token_to_string( ) ) ,
5056
5056
"struct fields should be separated by commas" ) ) ,
@@ -5231,13 +5231,13 @@ impl<'a> Parser<'a> {
5231
5231
directory_ownership : DirectoryOwnership :: Owned ,
5232
5232
warn : false ,
5233
5233
} ) ,
5234
- ( false , false ) => Err ( Errors :: FileNotFoundForModule {
5234
+ ( false , false ) => Err ( Error :: FileNotFoundForModule {
5235
5235
mod_name : mod_name. clone ( ) ,
5236
5236
default_path : default_path_str,
5237
5237
secondary_path : secondary_path_str,
5238
5238
dir_path : format ! ( "{}" , dir_path. display( ) ) ,
5239
5239
} ) ,
5240
- ( true , true ) => Err ( Errors :: DuplicatePaths {
5240
+ ( true , true ) => Err ( Error :: DuplicatePaths {
5241
5241
mod_name : mod_name. clone ( ) ,
5242
5242
default_path : default_path_str,
5243
5243
secondary_path : secondary_path_str,
0 commit comments