Skip to content

Commit b6a8863

Browse files
committed
Show that it will pick up the entirely wrong function as a private candidate
1 parent 6cc4b22 commit b6a8863

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

tests/ui/issues/issue-53498.stderr renamed to tests/ui/issues/issue-53498.different_name.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0624]: associated function `foo` is private
2-
--> $DIR/issue-53498.rs:16:27
2+
--> $DIR/issue-53498.rs:21:27
33
|
44
LL | fn foo() {}
55
| -------- private associated function defined here

tests/ui/issues/issue-53498.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ revisions: same_name different_name
2+
13
pub mod test {
24
pub struct A;
35
pub struct B;
@@ -8,10 +10,15 @@ pub mod test {
810
}
911

1012
impl Foo<B> {
13+
#[cfg(same_name)]
1114
fn foo() {}
15+
#[cfg(different_name)]
16+
fn bar() {}
1217
}
1318
}
1419

1520
fn main() {
16-
test::Foo::<test::B>::foo(); //~ ERROR associated function `foo` is private
21+
test::Foo::<test::B>::foo();
22+
//[same_name]~^ ERROR associated function `foo` is private
23+
//[different_name]~^^ ERROR associated function `foo` is private
1724
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0624]: associated function `foo` is private
2+
--> $DIR/issue-53498.rs:21:27
3+
|
4+
LL | fn foo() {}
5+
| -------- private associated function defined here
6+
...
7+
LL | test::Foo::<test::B>::foo();
8+
| ^^^ private associated function
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0624`.

0 commit comments

Comments
 (0)