parent
ad8a3eb039
commit
d7bb98f7a1
6 changed files with 74 additions and 21 deletions
22
src/test/ui/issues/issue-58734.rs
Normal file
22
src/test/ui/issues/issue-58734.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
trait Trait {
|
||||
fn exists(self) -> ();
|
||||
|
||||
fn not_object_safe() -> Self;
|
||||
}
|
||||
|
||||
impl Trait for () {
|
||||
fn exists(self) -> () {
|
||||
}
|
||||
|
||||
fn not_object_safe() -> Self {
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// object-safe or not, this call is OK
|
||||
Trait::exists(());
|
||||
// no object safety error
|
||||
Trait::nonexistent(());
|
||||
//~^ ERROR no function or associated item named `nonexistent` found for type `dyn Trait`
|
||||
}
|
||||
11
src/test/ui/issues/issue-58734.stderr
Normal file
11
src/test/ui/issues/issue-58734.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0599]: no function or associated item named `nonexistent` found for type `dyn Trait` in the current scope
|
||||
--> $DIR/issue-58734.rs:20:12
|
||||
|
|
||||
LL | Trait::nonexistent(());
|
||||
| -------^^^^^^^^^^^
|
||||
| |
|
||||
| function or associated item not found in `dyn Trait`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue