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

bug: impl Trait only allowed in function and inherent method return types, not in trait method return types #285

Closed
dedupely opened this issue Mar 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@dedupely
Copy link

dedupely commented Mar 26, 2024

Describe the bug

I don't have ts-rs in my code yet, it has just been added to Cargo.toml and cargo run fails straight out.

I'm super new to rust but this doesn't make sense to me. Looks like no one else has this issue. I tried it with 8.1.0 and also 8.0.0 as below:

cargo build
   Compiling ts-rs v8.0.0
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
  --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/typelist.rs:61:48
   |
61 |     fn push<T: TS + 'static + ?Sized>(self) -> impl TypeList {
   |                                                ^^^^^^^^^^^^^
   |
   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
  --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/typelist.rs:64:42
   |
64 |     fn extend(self, l: impl TypeList) -> impl TypeList {
   |                                          ^^^^^^^^^^^^^
   |
   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:413:30
    |
413 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:421:22
    |
421 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:702:30
    |
702 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:709:22
    |
709 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:740:30
    |
740 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:747:22
    |
747 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:782:30
    |
782 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:789:22
    |
789 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:835:30
    |
835 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:842:22
    |
842 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:877:30
    |
877 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:884:22
    |
884 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:910:30
    |
910 |     fn dependency_types() -> impl TypeList
    |                              ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:917:22
    |
917 |     fn generics() -> impl TypeList
    |                      ^^^^^^^^^^^^^
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:673:38
    |
673 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
941 | impl_shadow!(as Range<I>: impl<I: TS> TS for RangeInclusive<I>);
    | --------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:679:30
    |
679 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
941 | impl_shadow!(as Range<I>: impl<I: TS> TS for RangeInclusive<I>);
    | --------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:673:38
    |
673 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
942 | impl_shadow!(as Vec<T>: impl<T: TS, H> TS for HashSet<T, H>);
    | ------------------------------------------------------------ in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:679:30
    |
679 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
942 | impl_shadow!(as Vec<T>: impl<T: TS, H> TS for HashSet<T, H>);
    | ------------------------------------------------------------ in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:673:38
    |
673 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
943 | impl_shadow!(as Vec<T>: impl<T: TS> TS for BTreeSet<T>);
    | ------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:679:30
    |
679 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
943 | impl_shadow!(as Vec<T>: impl<T: TS> TS for BTreeSet<T>);
    | ------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:673:38
    |
673 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
944 | impl_shadow!(as HashMap<K, V>: impl<K: TS, V: TS> TS for BTreeMap<K, V>);
    | ------------------------------------------------------------------------ in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:679:30
    |
679 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
944 | impl_shadow!(as HashMap<K, V>: impl<K: TS, V: TS> TS for BTreeMap<K, V>);
    | ------------------------------------------------------------------------ in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:673:38
    |
673 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
945 | impl_shadow!(as Vec<T>: impl<T: TS> TS for [T]);
    | ----------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:679:30
    |
679 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
945 | impl_shadow!(as Vec<T>: impl<T: TS> TS for [T]);
    | ----------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_shadow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
947 | impl_wrapper!(impl<T: TS + ?Sized> TS for &T);
    | --------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
947 | impl_wrapper!(impl<T: TS + ?Sized> TS for &T);
    | --------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
948 | impl_wrapper!(impl<T: TS + ?Sized> TS for Box<T>);
    | ------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
948 | impl_wrapper!(impl<T: TS + ?Sized> TS for Box<T>);
    | ------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
949 | impl_wrapper!(impl<T: TS + ?Sized> TS for std::sync::Arc<T>);
    | ------------------------------------------------------------ in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
949 | impl_wrapper!(impl<T: TS + ?Sized> TS for std::sync::Arc<T>);
    | ------------------------------------------------------------ in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
950 | impl_wrapper!(impl<T: TS + ?Sized> TS for std::rc::Rc<T>);
    | --------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
950 | impl_wrapper!(impl<T: TS + ?Sized> TS for std::rc::Rc<T>);
    | --------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
951 | impl_wrapper!(impl<'a, T: TS + ToOwned + ?Sized> TS for std::borrow::Cow<'a, T>);
    | -------------------------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
951 | impl_wrapper!(impl<'a, T: TS + ToOwned + ?Sized> TS for std::borrow::Cow<'a, T>);
    | -------------------------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
952 | impl_wrapper!(impl<T: TS> TS for std::cell::Cell<T>);
    | ---------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
952 | impl_wrapper!(impl<T: TS> TS for std::cell::Cell<T>);
    | ---------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
953 | impl_wrapper!(impl<T: TS> TS for std::cell::RefCell<T>);
    | ------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
953 | impl_wrapper!(impl<T: TS> TS for std::cell::RefCell<T>);
    | ------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
954 | impl_wrapper!(impl<T: TS> TS for std::sync::Mutex<T>);
    | ----------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
954 | impl_wrapper!(impl<T: TS> TS for std::sync::Mutex<T>);
    | ----------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
955 | impl_wrapper!(impl<T: TS + ?Sized> TS for std::sync::Weak<T>);
    | ------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
955 | impl_wrapper!(impl<T: TS + ?Sized> TS for std::sync::Weak<T>);
    | ------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:646:38
    |
646 |             fn dependency_types() -> impl $crate::typelist::TypeList
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
956 | impl_wrapper!(impl<T: TS> TS for std::marker::PhantomData<T>);
    | ------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:652:30
    |
652 |             fn generics() -> impl $crate::typelist::TypeList
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
956 | impl_wrapper!(impl<T: TS> TS for std::marker::PhantomData<T>);
    | ------------------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/ts-rs-8.0.0/src/lib.rs:620:38
    |
620 |             fn dependency_types() -> impl TypeList
    |                                      ^^^^^^^^^^^^^
...
958 | impl_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10);
    | ----------------------------------------------------- in this macro invocation
    |
    = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
    = note: this error originates in the macro `impl_tuples` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0562`.
error: could not compile `ts-rs` (lib) due to 56 previous errors

To Reproduce
Steps to reproduce the behavior:

  • Add ts-rs to Cargo and run build.

Expected behavior
Should compile without errors.

Version
8.0.0 and 8.1.0

Additional context
Debian (on codespaces) using rustc 1.74.0

My Cargo file looks like:

[package]
name = "app"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rocket = { version = "0.5.0", features = ["secrets"] }
diesel = { version = "2.1.5", features = ["postgres", "64-column-tables"] }
dotenvy = "0.15"
r2d2 = "0.8"
lazy_static = "1.4.0"
ts-rs = "8.0.0"
@dedupely dedupely added the bug Something isn't working label Mar 26, 2024
@dedupely dedupely changed the title bug: bug: impl Trait only allowed in function and inherent method return types, not in trait method return types Mar 26, 2024
@NyxCode
Copy link
Collaborator

NyxCode commented Mar 26, 2024

Hey!
ts-rs requires at least rust 1.75.0, which got released end of last year.

@dedupely
Copy link
Author

Ohhh, damn. Ok thanks. I'll close this then. Sorry.

@NyxCode
Copy link
Collaborator

NyxCode commented Mar 26, 2024

No worries!
This is probably something we should have noted in the README.md. I guess we're just used to being on the latest release, but that shouldn't be the expectation.

@escritorio-gustavo
Copy link
Contributor

I added the MSRV readme and the Cargo.toml, which should (hopefully) prevent the crate from being installed with an unsupported Rust version starting with the next release #300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants