mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix: better error message for using the script as a dep
Signed-off-by: Rustin170506 <techregister@pm.me>
This commit is contained in:
parent
1514c7e630
commit
91da8dba0d
@ -393,6 +393,9 @@ impl SourceId {
|
|||||||
.url
|
.url
|
||||||
.to_file_path()
|
.to_file_path()
|
||||||
.expect("path sources cannot be remote");
|
.expect("path sources cannot be remote");
|
||||||
|
if crate::util::toml::is_embedded(&path) {
|
||||||
|
anyhow::bail!("Single file packages cannot be used as dependencies")
|
||||||
|
}
|
||||||
Ok(Box::new(PathSource::new(&path, self, gctx)))
|
Ok(Box::new(PathSource::new(&path, self, gctx)))
|
||||||
}
|
}
|
||||||
SourceKind::Registry | SourceKind::SparseRegistry => Ok(Box::new(
|
SourceKind::Registry | SourceKind::SparseRegistry => Ok(Box::new(
|
||||||
|
@ -1402,10 +1402,7 @@ Caused by:
|
|||||||
Unable to update [ROOT]/foo/script.rs
|
Unable to update [ROOT]/foo/script.rs
|
||||||
|
|
||||||
Caused by:
|
Caused by:
|
||||||
failed to read `[ROOT]/foo/script.rs/Cargo.toml`
|
Single file packages cannot be used as dependencies
|
||||||
|
|
||||||
Caused by:
|
|
||||||
Not a directory (os error 20)
|
|
||||||
|
|
||||||
"#]])
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user