1
Fork 0

Show that it will pick up the entirely wrong function as a private candidate

This commit is contained in:
Oli Scherer 2024-05-28 06:32:35 +00:00
parent 5e8df95dbb
commit 14f9c63759
4 changed files with 22 additions and 3 deletions

View file

@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
const ENTRY_LIMIT: u32 = 900;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: u32 = 1674;
const ISSUES_ENTRY_LIMIT: u32 = 1675;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files

View file

@ -1,5 +1,5 @@
error[E0624]: associated function `foo` is private
--> $DIR/issue-53498.rs:16:27
--> $DIR/issue-53498.rs:21:27
|
LL | fn foo() {}
| -------- private associated function defined here

View file

@ -1,3 +1,5 @@
//@ revisions: same_name different_name
pub mod test {
pub struct A;
pub struct B;
@ -8,10 +10,15 @@ pub mod test {
}
impl Foo<B> {
#[cfg(same_name)]
fn foo() {}
#[cfg(different_name)]
fn bar() {}
}
}
fn main() {
test::Foo::<test::B>::foo(); //~ ERROR associated function `foo` is private
test::Foo::<test::B>::foo();
//[same_name]~^ ERROR associated function `foo` is private
//[different_name]~^^ ERROR associated function `foo` is private
}

View file

@ -0,0 +1,12 @@
error[E0624]: associated function `foo` is private
--> $DIR/issue-53498.rs:21:27
|
LL | fn foo() {}
| -------- private associated function defined here
...
LL | test::Foo::<test::B>::foo();
| ^^^ private associated function
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0624`.