File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,10 @@ impl Checker {
389389
390390 /// Load a file from disk, or from the cache if available.
391391 fn load_file ( & mut self , file : & Path , report : & mut Report ) -> ( String , & FileEntry ) {
392+ // https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
393+ #[ cfg( windows) ]
394+ const ERROR_INVALID_NAME : i32 = 123 ;
395+
392396 let pretty_path =
393397 file. strip_prefix ( & self . root ) . unwrap_or ( & file) . to_str ( ) . unwrap ( ) . to_string ( ) ;
394398
@@ -405,6 +409,14 @@ impl Checker {
405409 }
406410 Err ( e) if e. kind ( ) == ErrorKind :: NotFound => FileEntry :: Missing ,
407411 Err ( e) => {
412+ // If a broken intra-doc link contains `::`, on windows, it will cause `ERROR_INVALID_NAME` rather than `NotFound`.
413+ // Explicitly check for that so that the broken link can be allowed in `LINKCHECK_EXCEPTIONS`.
414+ #[ cfg( windows) ]
415+ if e. raw_os_error ( ) == Some ( ERROR_INVALID_NAME )
416+ && file. as_os_str ( ) . to_str ( ) . map_or ( false , |s| s. contains ( "::" ) )
417+ {
418+ return FileEntry :: Missing ;
419+ }
408420 panic ! ( "unexpected read error for {}: {}" , file. display( ) , e) ;
409421 }
410422 } ) ;
You can’t perform that action at this time.
0 commit comments