Repository: brendanzab/gl-rs (language: rust)

Issue:
Cargo always marks this as dirty
This is probably a `rustc` and not a `gl-rs` problem but I wanted to make an issue here to track the issue for whom it is going to be most effected. `gl-rs` is always marked as dirty by cargo because `rustc` does not mark the files it depends on correctly.

The root of the problem is shown here:

```
> rustc src/lib.rs --dep-info tmp  --no-analysis --no-trans -L target/deps/
> cat tmp 
libgl.rlib: src/lib.rs unknown
```

`src/lib.rs` is correct but `unknown` is not. This causes cargo to mark `gl-rs` as dirty since it can't check of a file that does not exist is up to date or not.



Discussion / hints:
There's a good chance that this `unknown` comes from here: https://github.com/bjz/gl-rs/blob/master/src/gl_generator/src/gl_generator.rs#L146

But I don't know how to fix this even if it is the case.


Fix patch:
diff --git a/src/gl_generator/src/gl_generator.rs b/src/gl_generator/src/gl_generator.rs
index 363fbe5b..2a7e4f27 100644
--- a/src/gl_generator/src/gl_generator.rs
+++ b/src/gl_generator/src/gl_generator.rs
@@ -93,9 +93,8 @@ fn macro_handler(ecx: &mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box
         }
     };
 
-    let path = Path::new(
-        format!("deps/khronos-api/{}.xml", nsLiteral)
-    );
+    let file_name = format!("deps/khronos-api/{}.xml", nsLiteral);
+    let path = Path::new(file_name.clone());
 
     let filter = Some(Filter {
         extensions: exts.unwrap_or("".to_string()).as_slice().split(',').map(|s| s.to_string()).collect(),
@@ -143,7 +142,7 @@ fn macro_handler(ecx: &mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box
             return DummyResult::any(span)
         }
     };
-    let mut parser = ::syntax::parse::new_parser_from_source_str(ecx.parse_sess(), ecx.cfg(), "unknown".to_string(), content);
+    let mut parser = ::syntax::parse::new_parser_from_source_str(ecx.parse_sess(), ecx.cfg(), file_name.to_string(), content);
 
     // getting all the items defined by the bindings
     let mut items = Vec::new();


Test patch: