From a1ea1c128d4e7c53965ae88d8b6ad0305d8c3d65 Mon Sep 17 00:00:00 2001 From: Steven Tang Date: Sun, 20 Nov 2022 10:44:16 +1100 Subject: [PATCH] Check that library is file --- compiler/rustc_metadata/src/locator.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index bf346c86b58..046125a985a 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -707,6 +707,12 @@ impl<'a> CrateLocator<'a> { loc.original().clone(), )); } + if !loc.original().is_file() { + return Err(CrateError::ExternLocationNotFile( + self.crate_name, + loc.original().clone(), + )); + } let Some(file) = loc.original().file_name().and_then(|s| s.to_str()) else { return Err(CrateError::ExternLocationNotFile( self.crate_name,