Commit b6facc1
committed
reject duplicate
after #140 landed the entry, exception and interrupt attributes started
accepting code like this:
``` rust
#[entry]
fn main() -> ! {
static mut FOO: u32 = 0;
static mut FOO: i32 = 0;
}
```
because that code expands into:
``` rust
fn main() -> ! {
let FOO: &'static mut u32 = unsafe {
static mut FOO: u32 = 0;
&mut FOO
};
// shadows previous variable
let FOO: &'static mut u32 = unsafe {
static mut FOO: i32 = 0;
&mut FOO
};
}
```
this commit adds a check that rejects `static mut`s with duplicated names to
these three attributes.static mut variables1 parent 2f890d8 commit b6facc1
2 files changed
Lines changed: 55 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
122 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
| |||
434 | 438 | | |
435 | 439 | | |
436 | 440 | | |
437 | | - | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
438 | 445 | | |
439 | 446 | | |
440 | 447 | | |
| |||
588 | 595 | | |
589 | 596 | | |
590 | 597 | | |
591 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
592 | 602 | | |
593 | 603 | | |
594 | 604 | | |
| |||
732 | 742 | | |
733 | 743 | | |
734 | 744 | | |
735 | | - | |
| 745 | + | |
736 | 746 | | |
737 | 747 | | |
| 748 | + | |
738 | 749 | | |
739 | 750 | | |
740 | 751 | | |
741 | 752 | | |
742 | 753 | | |
743 | 754 | | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
744 | 763 | | |
745 | 764 | | |
746 | 765 | | |
| |||
755 | 774 | | |
756 | 775 | | |
757 | 776 | | |
758 | | - | |
| 777 | + | |
759 | 778 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments