Closed
Description
I tried this code:
struct S {}
impl S {
fn new() -> Self {
S {}
}
}
fn main() {
<S as NonExistingTrait>::method_of_non_existing_trait();
}
I would expect the error message to be something like "cannot find trait NonExistingTrait
in this scope" like I would have for
fn f<T : NonExistingTrait>(){}
Instead the error message is
error[E0433]: failed to resolve: use of undeclared type `NonExistingTrait`
--> example.rs:12:11
|
12 | <S as NonExistingTrait>::method_of_non_existing_trait();
| ^^^^^^^^^^^^^^^^ use of undeclared type `NonExistingTrait`
Meta
rustc --version --verbose
:
rustc 1.70.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.70.0-dev
LLVM version: 16.0.0
@rustbot claim