File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ crate_name = "foo" ]
2
+ #![ crate_type = "lib" ]
3
+ // bbb
4
+ pub struct Foo ;
5
+
6
+ impl Foo {
7
+ pub fn bar ( self : Foo ) { }
8
+ }
Original file line number Diff line number Diff line change
1
+ #![ crate_name = "foo" ]
2
+ #![ crate_type = "lib" ]
3
+ // aaa
4
+ pub struct Foo ;
5
+
6
+ impl Foo {
7
+ pub fn bar ( self : Foo ) { }
8
+ }
Original file line number Diff line number Diff line change
1
+ // tests that changing the content of a comment will cause a change in the rmeta of a file
2
+ use run_make_support:: { rfs, rustc} ;
3
+ use std:: hash:: { Hash , Hasher } ;
4
+ use std:: path:: Path ;
5
+
6
+ fn main ( ) {
7
+ let before = check_and_hash ( "before.rs" ) ;
8
+ let after = check_and_hash ( "after.rs" ) ;
9
+ dbg ! ( before, after) ;
10
+ assert_neq ! ( before, after) ;
11
+ }
12
+
13
+ fn check_and_hash < P > ( filename : P ) -> u64
14
+ where
15
+ P : AsRef < Path > ,
16
+ {
17
+ rfs:: rename ( filename, "foo.rs" ) ;
18
+ rustc ( ) . input ( "foo.rs" ) . emit ( "metadata" ) . run ( ) ;
19
+ // hash the output
20
+ let bytes = rfs:: read ( "libfoo.rmeta" ) ;
21
+ let mut hasher = std:: hash:: DefaultHasher :: new ( ) ;
22
+ bytes. hash ( & mut hasher) ;
23
+ hasher. finish ( )
24
+ }
You can’t perform that action at this time.
0 commit comments