forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop branching blocks with same span as expanded macro
Fixes: rust-lang#84561
- Loading branch information
Showing
4 changed files
with
276 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-84561.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
1| |// FIXME(#84561): function-like macros produce unintuitive coverage results. | ||
2| |// This test demonstrates some of the problems. | ||
3| | | ||
4| 18|#[derive(Debug, PartialEq, Eq)] | ||
^5 ^0 | ||
------------------ | ||
| <issue_84561::Foo as core::cmp::PartialEq>::eq: | ||
| 4| 18|#[derive(Debug, PartialEq, Eq)] | ||
------------------ | ||
| Unexecuted instantiation: <issue_84561::Foo as core::cmp::PartialEq>::ne | ||
------------------ | ||
5| |struct Foo(u32); | ||
6| | | ||
7| 1|fn main() { | ||
8| 1| let bar = Foo(1); | ||
9| 1| assert_eq!(bar, Foo(1)); | ||
10| 1| let baz = Foo(0); | ||
11| 1| assert_ne!(baz, Foo(1)); | ||
12| 1| println!("{:?}", Foo(1)); | ||
13| 1| println!("{:?}", bar); | ||
14| 1| println!("{:?}", baz); | ||
15| 1| | ||
16| 1| assert_eq!(Foo(1), Foo(1)); | ||
17| 1| assert_ne!(Foo(0), Foo(1)); | ||
18| 1| assert_eq!(Foo(2), Foo(2)); | ||
19| 1| let bar = Foo(1); | ||
20| 1| assert_ne!(Foo(0), Foo(3)); | ||
21| 1| assert_ne!(Foo(0), Foo(4)); | ||
22| 1| assert_eq!(Foo(3), Foo(3)); | ||
23| 1| assert_ne!(Foo(0), Foo(5)); | ||
24| 1| println!("{:?}", bar); | ||
25| 1| println!("{:?}", Foo(1)); | ||
26| 1| | ||
27| 1| let is_true = std::env::args().len() == 1; | ||
28| 1| | ||
29| 1| assert_eq!( | ||
30| 1| Foo(1), | ||
31| 1| Foo(1) | ||
32| 1| ); | ||
33| 1| assert_ne!( | ||
34| 1| Foo(0), | ||
35| 1| Foo(1) | ||
36| 1| ); | ||
37| 1| assert_eq!( | ||
38| 1| Foo(2), | ||
39| 1| Foo(2) | ||
40| 1| ); | ||
41| 1| let bar = Foo(1 | ||
42| 1| ); | ||
43| 1| assert_ne!( | ||
44| 1| Foo(0), | ||
45| 1| Foo(3) | ||
46| 1| ); | ||
47| 1| if is_true { | ||
48| 1| assert_ne!( | ||
49| 1| Foo(0), | ||
50| 1| Foo(4) | ||
51| 1| ); | ||
52| | } else { | ||
53| 0| assert_eq!( | ||
54| 0| Foo(3), | ||
55| 0| Foo(3) | ||
56| 0| ); | ||
57| | } | ||
58| | assert_ne!( | ||
59| 1| if is_true { | ||
60| 1| Foo(0) | ||
61| | } else { | ||
62| 0| Foo(1) | ||
63| | }, | ||
64| | Foo(5) | ||
65| | ); | ||
66| 1| assert_ne!( | ||
67| 1| Foo(5), | ||
68| 1| if is_true { | ||
69| 1| Foo(0) | ||
70| | } else { | ||
71| 0| Foo(1) | ||
72| | } | ||
73| | ); | ||
74| | assert_ne!( | ||
75| 1| if is_true { | ||
76| 1| assert_eq!( | ||
77| 1| Foo(3), | ||
78| 1| Foo(3) | ||
79| 1| ); | ||
80| 1| Foo(0) | ||
81| | } else { | ||
82| | assert_ne!( | ||
83| 0| if is_true { | ||
84| 0| Foo(0) | ||
85| | } else { | ||
86| 0| Foo(1) | ||
87| | }, | ||
88| | Foo(5) | ||
89| | ); | ||
90| 0| Foo(1) | ||
91| | }, | ||
92| | Foo(5) | ||
93| | ); | ||
94| 1|} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// FIXME(#84561): function-like macros produce unintuitive coverage results. | ||
// This test demonstrates some of the problems. | ||
|
||
#[derive(Debug, PartialEq, Eq)] | ||
struct Foo(u32); | ||
|
||
fn main() { | ||
let bar = Foo(1); | ||
assert_eq!(bar, Foo(1)); | ||
let baz = Foo(0); | ||
assert_ne!(baz, Foo(1)); | ||
println!("{:?}", Foo(1)); | ||
println!("{:?}", bar); | ||
println!("{:?}", baz); | ||
|
||
assert_eq!(Foo(1), Foo(1)); | ||
assert_ne!(Foo(0), Foo(1)); | ||
assert_eq!(Foo(2), Foo(2)); | ||
let bar = Foo(1); | ||
assert_ne!(Foo(0), Foo(3)); | ||
assert_ne!(Foo(0), Foo(4)); | ||
assert_eq!(Foo(3), Foo(3)); | ||
assert_ne!(Foo(0), Foo(5)); | ||
println!("{:?}", bar); | ||
println!("{:?}", Foo(1)); | ||
|
||
let is_true = std::env::args().len() == 1; | ||
|
||
assert_eq!( | ||
Foo(1), | ||
Foo(1) | ||
); | ||
assert_ne!( | ||
Foo(0), | ||
Foo(1) | ||
); | ||
assert_eq!( | ||
Foo(2), | ||
Foo(2) | ||
); | ||
let bar = Foo(1 | ||
); | ||
assert_ne!( | ||
Foo(0), | ||
Foo(3) | ||
); | ||
if is_true { | ||
assert_ne!( | ||
Foo(0), | ||
Foo(4) | ||
); | ||
} else { | ||
assert_eq!( | ||
Foo(3), | ||
Foo(3) | ||
); | ||
} | ||
assert_ne!( | ||
if is_true { | ||
Foo(0) | ||
} else { | ||
Foo(1) | ||
}, | ||
Foo(5) | ||
); | ||
assert_ne!( | ||
Foo(5), | ||
if is_true { | ||
Foo(0) | ||
} else { | ||
Foo(1) | ||
} | ||
); | ||
assert_ne!( | ||
if is_true { | ||
assert_eq!( | ||
Foo(3), | ||
Foo(3) | ||
); | ||
Foo(0) | ||
} else { | ||
assert_ne!( | ||
if is_true { | ||
Foo(0) | ||
} else { | ||
Foo(1) | ||
}, | ||
Foo(5) | ||
); | ||
Foo(1) | ||
}, | ||
Foo(5) | ||
); | ||
} |