summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-01-14 08:59:42 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-01-14 08:59:42 +0800
commit8a2d3afc5a9eb6092420dd7164f3e8a0a3e3950b (patch)
treeb64bd9f39cb9ad1323af4dcdc7ea92972cb15a90 /src
parenta7d4daf2e2d802d78ced6ed48248506963fd1066 (diff)
downloadmrust-8a2d3afc5a9eb6092420dd7164f3e8a0a3e3950b.tar.gz
LoadCrates - Better error reporting
Diffstat (limited to 'src')
-rw-r--r--src/ast/crate.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ast/crate.cpp b/src/ast/crate.cpp
index f9e99369..823f7d00 100644
--- a/src/ast/crate.cpp
+++ b/src/ast/crate.cpp
@@ -112,6 +112,9 @@ void Crate::load_externs()
if(basename == "" && it != g_crate_overrides.end())
{
path = it->second;
+ if( !::std::ifstream(path).good() ) {
+ ERROR(sp, E0000, "Unable to open crate '" << name << "' at path " << path);
+ }
}
else
{
@@ -131,14 +134,13 @@ void Crate::load_externs()
if( ::std::ifstream(path).good() ) {
break ;
}
- // TODO: Search for `p+"/lib"+name+"-*.hir" (which would match e.g. libnum-0.11.hir)
}
- }
- if( !::std::ifstream(path).good() ) {
- if( basename.empty() )
- ERROR(sp, E0000, "Unable to locate crate '" << name << "'");
- else
- ERROR(sp, E0000, "Unable to locate crate '" << name << "' with filename " << basename);
+ if( !::std::ifstream(path).good() ) {
+ if( basename.empty() )
+ ERROR(sp, E0000, "Unable to locate crate '" << name << "' in search directories");
+ else
+ ERROR(sp, E0000, "Unable to locate crate '" << name << "' with filename " << basename << " in search directories");
+ }
}
// NOTE: Creating `ExternCrate` loads the crate from the specified path