Index: staticassert.c
===================================================================
--- staticassert.c	(revision 755)
+++ staticassert.c	(working copy)
@@ -61,19 +61,26 @@
     e = e->optimize(WANTvalue | WANTinterpret);
     if (e->isBool(FALSE))
     {
-        if (msg)
+		OutBuffer buf;
+
+		if (msg)
         {   HdrGenState hgs;
-            OutBuffer buf;
 
             msg = msg->semantic(sc);
             msg = msg->optimize(WANTvalue | WANTinterpret);
             hgs.console = 1;
             msg->toCBuffer(&buf, &hgs);
+			buf.writestring("\n");
+			ModuleImportBacktrace(sc, &buf);
             error("%s", buf.toChars());
         }
         else
-            error("(%s) is false", exp->toChars());
-        if (sc->tinst)
+		{
+			ModuleImportBacktrace(sc, &buf);
+			error("(%s) is false\n%s", exp->toChars(), buf.toChars());
+		}
+
+		if (sc->tinst)
             sc->tinst->printInstantiationTrace();
         if (!global.gag)
               fatal();
Index: module.c
===================================================================
--- module.c	(revision 755)
+++ module.c	(working copy)
@@ -100,7 +100,8 @@
     sfilename = NULL;
     root = 0;
     importedFrom = NULL;
-    srcfile = NULL;
+	actualImporter = NULL;
+	srcfile = NULL;
     docfile = NULL;
 
     debuglevel = 0;
Index: module.h
===================================================================
--- module.h	(revision 755)
+++ module.h	(working copy)
@@ -21,7 +21,7 @@
 struct ModuleInfoDeclaration;
 struct ClassDeclaration;
 struct ModuleDeclaration;
-struct Macro;
+class Macro;
 struct Escape;
 struct VarDeclaration;
 struct Library;
@@ -87,9 +87,11 @@
                                 // i.e. a module that will be taken all the
                                 // way to an object file
     Module *importedFrom;       // module from command line we're imported from,
-                                // i.e. a module that will be taken all the
-                                // way to an object file
+                                // i.e. a module that will be taken all the way to an object file
 
+	Import *actualImporter;		// the import statement that pulled in this module, if 0 then module came from command line
+								// NOTE: acutalImporter->mod == this, use actualImporter->getModule() to get parent module
+
     Array *decldefs;            // top level declarations for this Module
 
     Array aimports;             // all imported modules
Index: scope.c
===================================================================
--- scope.c	(revision 755)
+++ scope.c	(working copy)
@@ -14,8 +14,9 @@
 #include "speller.h"
 
 #include "mars.h"
+#include "identifier.h"
 #include "init.h"
-#include "identifier.h"
+#include "import.h"
 #include "scope.h"
 #include "attrib.h"
 #include "dsymbol.h"
@@ -397,3 +398,19 @@
 
     return (Dsymbol *)speller(ident->toChars(), &scope_search_fp, this, idchars);
 }
+
+void ModuleImportBacktrace(Scope* current, OutBuffer* dst)
+{
+	assert(current && dst);
+
+	Module*	currModule = current->module->actualImporter->getModule();
+
+	while(currModule)
+	{
+		dst->printf("imported from Module: %s @ %s\n", currModule->toChars(), currModule->locToChars());
+		
+		if(0 == currModule->actualImporter)
+			return;
+		currModule = currModule->actualImporter->getModule();
+	}
+}
Index: import.c
===================================================================
--- import.c	(revision 755)
+++ import.c	(working copy)
@@ -103,6 +103,7 @@
     {
         // Load module
         mod = Module::load(loc, packages, id);
+		mod->actualImporter = this;
         dst->insert(id, mod);           // id may be different from mod->ident,
                                         // if so then insert alias
         if (!mod->importedFrom)
Index: scope.h
===================================================================
--- scope.h	(revision 755)
+++ scope.h	(working copy)
@@ -118,4 +118,8 @@
     void setNoFree();
 };
 
+/**\brief brack trace the list of module imports from the specified
+	Scope and format nicely into dst for better compilation error messages */
+void ModuleImportBacktrace(Scope* current, OutBuffer* dst);
+
 #endif /* DMD_SCOPE_H */
