Skip to content

Commit 000f038

Browse files
committed
Add ui test resolve/false-self-in-macro-issue-143134.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
1 parent 25ab022 commit 000f038

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
trait T {
2+
fn f(self);
3+
}
4+
impl T for () {
5+
fn f(self) {
6+
let self = (); //~ ERROR expected unit struct, unit variant or constant, found local variable `self`
7+
}
8+
}
9+
10+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0424]: expected unit struct, unit variant or constant, found local variable `self`
2+
--> $DIR/false-self-in-macro-issue-143134.rs:6:13
3+
|
4+
LL | / fn f(self) {
5+
LL | | let self = ();
6+
| | ^^^^ `self` value is a keyword and may not be bound to variables or shadowed
7+
LL | | }
8+
| |_____- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0424`.

0 commit comments

Comments
 (0)