-
Notifications
You must be signed in to change notification settings - Fork 62
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
Can't set simultaneous expectations of different types on generic method whose generic parameters only appear in output #236
Comments
To get a more useful error message, you must not only use the nightly toolchain, but also build mockall with the "nightly" crate feature. |
Adding |
Oh, I see. That "ONLY ON NIGHTLY" message is coming from the downcast crate, which also has a nightly feature. You've found a bug. I'll try to fix it as time allows. |
Ok, thank you! 👍 |
The return type was not being used to index into the Expectations object. Probably I didn't do that to allow generic methods returning references, because older versions of Mockall didn't already determine the owned form of the return type. Fixes #236
I'm trying to mock a struct with the generic method. And for the case when we use generic parameter only as return type, expectation set panics if we use different types. But it will be ok if we set expectations for the same type, or if we add the generic parameter as a method argument.
I've created a minimal example in this repo: https://github.com/Kormick/mockall-test. Please take a look.
I'm using
rustc 1.50.0-nightly (eb4fc71dc 2020-12-17) (from rustc 1.50.0-nightly (6645da366 2020-12-01))
toolchainPanic message:
panicked at 'called `Result::unwrap()` on an `Err` value: TypeMismatch { expected: "[ONLY ON NIGHTLY]", found: "[ONLY ON NIGHTLY]" }'
For some reason, I always have the
[ONLY ON NIGHTLY]
message, even though I'm using the nightly toolchain.Backtrace:
The text was updated successfully, but these errors were encountered: