Skip to content

Imprecise error message when Trait in qualified path is not in scope #109809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
krtab opened this issue Mar 31, 2023 · 5 comments
Closed

Imprecise error message when Trait in qualified path is not in scope #109809

krtab opened this issue Mar 31, 2023 · 5 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@krtab
Copy link
Contributor

krtab commented Mar 31, 2023

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

@krtab krtab added the C-bug Category: This is a bug. label Mar 31, 2023
@krtab
Copy link
Contributor Author

krtab commented Mar 31, 2023

Remark: not fixed by #109788

@clubby789
Copy link
Contributor

@rustbot label -C-bug +A-diagnostics

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints and removed C-bug Category: This is a bug. labels Mar 31, 2023
@akorchyn
Copy link

akorchyn commented Apr 2, 2023

@rustbot claim

@rustbot rustbot assigned akorchyn and unassigned krtab Apr 2, 2023
@akorchyn
Copy link

akorchyn commented Apr 2, 2023

@rustbot release-assignment

@Noratrieb Noratrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Apr 5, 2023
@krtab
Copy link
Contributor Author

krtab commented Oct 20, 2023

Remark: not fixed by #109788

This was actually fixed by this MR... Closing.

@krtab krtab closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants