-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Confusing error message when same-named field and method both in scope #2327
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
Comments
Just as a side comment, this ambiguity would be addressed by using |
Do we want to allow a class that has a field and a method with the same name? Or should the typechecker reject such a thing? (I re-read the spec and there's nothing about it.) I would also be very cranky about using |
I naively figured that it would be illegal to have a field and a method with the same name. It seems like it would become a source of confusion. Niko mentioned on the mailing list that sometimes this is necessary to fulfill an iface, but I don't understand why that would be so. |
Imagine an iface defined in some library X:
and now a type defined in library Y:
and now I would like to define an impl so I can use |
A link to the thread with Niko's proposal: https://mail.mozilla.org/pipermail/rust-dev/2012-May/001819.html I'm still a bit wary of using the same accessor notation for two distinct and potentially-colliding concepts. Perhaps |
Possibly will get fixed by disambiguation between record field-selection and method-call. Niko will check back on this. |
Blocked on @nikomatsakis landing AST changes. |
Dup of #3446 |
call_function: make the unit-return-type case more convenient
Add benchcomp parser for kani perf tests This commit adds a parser that emits CBMC-generated metrics to benchcomp. It is intended to be run in a kani checkout after running `kani-perf.sh`. A minimal working example would be to run `benchcomp` in a directory containing the following benchcomp.yaml: variants: kani_0.17: config: directory: ~/src/kani command_line: git checkout .; git checkout kani-0.17.0 && rm -rf target && cargo build-dev && ./scripts/kani-perf.sh ; true kani_0.24: config: directory: ~/src/kani command_line: git checkout .; git checkout main; rm -rf target && cargo build-dev && ./scripts/kani-perf.sh ; true run: suites: kani_perf: parser: module: kani_perf variants: - kani_0.17 - kani_0.24 This commit also contains minor fixes to ensure that the test suite runs to completion even if it exited with a non-zero return code.
I had both a field and a method called
defer
. rustc should say that both are defined and show me where.The text was updated successfully, but these errors were encountered: