Skip to content

Poor error while expanding macro_rules with bad match #5911

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
ScatteredRay opened this issue Apr 16, 2013 · 1 comment
Closed

Poor error while expanding macro_rules with bad match #5911

ScatteredRay opened this issue Apr 16, 2013 · 1 comment

Comments

@ScatteredRay
Copy link

With this block of code:

macro_rules! object {
  ($foo:ident) => (
    match $bar {
    }
  )
}

object!(baz)

I get the error

rust: task failed at 'No entry found for key: &{repr: 41}', /Users/indy/dev/guava/dep/rust-0.6/src/libcore/hashmap.rs:521
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/indy/dev/guava/dep/rust-0.6/src/librustc/rustc.rc:357
rust: domain main @0x7fbe4100c210 root task failed`

This error should be improved.

@Aatch
Copy link
Contributor

Aatch commented Jun 7, 2013

This has been fixed, now produces: unknown macro variable 'bar'

@Aatch Aatch closed this as completed Jun 7, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 5, 2020
Add lint for 'field_reassign_with_default` rust-lang#568

changelog: Add lint for field_reassign_with_default that checks if mutable object + field modification is used to edit a binding initialized with Default::default() instead of struct constructor.

Fixes rust-lang#568

Notes:
- Checks for reassignment of one or more fields of a binding initialized with Default::default().
- Implemented using EarlyLintPass, might be future proofed better with LateLintPass.
- Does not trigger if Default::default() is used via another type implementing Default.
- This is a re-open of [PR#4761](rust-lang/rust-clippy#4761), but I couldn't figure out how to re-open that one so here's a new one with the requested changes :S
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

No branches or pull requests

2 participants