Skip to content
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

Fix error output for module operations on types. #11623

Closed
wants to merge 1 commit into from
Closed

Fix error output for module operations on types. #11623

wants to merge 1 commit into from

Conversation

geoffhill-zz
Copy link
Contributor

Replace the error messages (shown when a non-module type is used as a
module) with internal debug messages. This is in line with the nearby
error behavior.

Closes #10551.

Replace the error messages (shown when a non-module type is used as a
module) with internal debug messages. This is in line with the nearby
error behavior.
@alexcrichton
Copy link
Member

I don't think that this closes #10551. That bug is about the odd error message (T in fact is in scope, it's just a struct)

I agree that error! shouldn't be used and rather it should be debug!, but without changing resolve itself I don't think we should be adding a test for broken behavior.

@alexcrichton
Copy link
Member

Technically we do want to allow this in the future, but resolve currently just doesn't do it.

@geoffhill-zz
Copy link
Contributor Author

So this test should actually compile? Or, is the intent to give a better error message with a suggestion?

@alexcrichton
Copy link
Member

The intent is to give a better error message, in the test the name T is actually in scope, the resolve pass is just complaining that it wasn't a module.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase!

@michaelsproul
Copy link
Contributor

I ran into this error and was similarly puzzled. I think the best error to report would be "fn whatever" is not part of trait A, but I'm not sure if this would require unreasonably difficult changes to the name resolution?

@geoffhill-zz geoffhill-zz deleted the issue10551 branch September 15, 2014 22:33
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 21, 2023
Fix ice in `redundant_locals`

Fixes rust-lang#11619

Rebinding over macro like the code below, idents will be different (`x#4` and `x#0` in that case).

```rust
fn reassign_in_macro() {
  let x = 10;
  macro_rules! mac {
    ($i:ident) => {
      let mut x = x;
    }
  }
  mac!(y);
}
```

It causes unwrapping `None`.

https://github.com/rust-lang/rust-clippy/blob/9554e477c29e6ddca9e5cdce71524341ef9d48e8/clippy_lints/src/redundant_locals.rs#L88-L98

changelog: ICE: [`redundant_locals`]: No longer lints rebinding over macro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing error with :: on struct
4 participants