We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Into::into
From
impl
Attempted to compile a program with an Into<Field> that's called like let _: Field = T.into():
Into<Field>
let _: Field = T.into()
struct Foo { inner: Field, } impl Into<Field> for Foo { fn into(self) -> Field { self.inner } } fn main() { let foo = Foo { inner: 0, }; // This works: // let _: Field = Into::<Field>::into(foo); // This fails with 'No matching impl': // // error: No matching impl found for `Field: From<Foo>` // ┌─ main.nr:439:20 // │ // 439 │ let _: Field = foo.into(); // │ -------- No impl for `Field: From<Foo>` // │ let _: Field = foo.into(); }
Expected that, given impl Into<Field> for Foo and the following definition for Into:
impl Into<Field> for Foo
Into
pub trait Into<T> { fn into(self) -> T; }
For any foo: Foo, calling foo.into() when the return type is known to be Field would convert Foo -> Field.
foo: Foo
foo.into()
Field
Foo -> Field
foo.into() fails with the following error:
error: No matching impl found for `Field: From<Foo>` ┌─ main.nr:439:20 │ 439 │ let _: Field = foo.into(); │ -------- No impl for `Field: From<Foo>` │
It appears to be "getting stuck" on the following impl for Into:
impl<T, U> Into<T> for U where T: From<U>, { fn into(self) -> T { T::from(self) } }
However, it's unclear why this is happening since the turbofish version works: Into::<Field>::into(foo)
Into::<Field>::into(foo)
Yes
Use turbofish
No response
Nice-to-have
nargo version = 0.38.0 noirc version = 0.38.0+0fc0c53ec183890370c69aa4148952b3123cb055 (git version hash: 0fc0c53, is dirty: false)
None
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Aim
Attempted to compile a program with an
Into<Field>
that's called likelet _: Field = T.into()
:Expected Behavior
Expected that, given
impl Into<Field> for Foo
and the following definition forInto
:For any
foo: Foo
, callingfoo.into()
when the return type is known to beField
would convertFoo -> Field
.Bug
foo.into()
fails with the following error:It appears to be "getting stuck" on the following
impl
forInto
:However, it's unclear why this is happening since the turbofish version works:
Into::<Field>::into(foo)
To Reproduce
Workaround
Yes
Workaround Description
Use turbofish
Additional Context
No response
Project Impact
Nice-to-have
Blocker Context
No response
Nargo Version
nargo version = 0.38.0 noirc version = 0.38.0+0fc0c53ec183890370c69aa4148952b3123cb055 (git version hash: 0fc0c53, is dirty: false)
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: