Skip to content

Fix compile on latest nightly #117

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

Merged
merged 1 commit into from
Apr 25, 2022
Merged

Fix compile on latest nightly #117

merged 1 commit into from
Apr 25, 2022

Conversation

macmv
Copy link
Contributor

@macmv macmv commented Apr 24, 2022

On nightly, slice has two AsRef impls, one for [T], and one for Vec<T>. This change makes the program compile on nightly.

Here is the error before the change:

error[E0283]: type annotations needed
    --> src/render.rs:2021:54
     |
2021 | ...                   .constraints(constraints.as_ref())
     |                                    ------------^^^^^^--
     |                                    |           |
     |                                    |           cannot infer type for type parameter `T` declared on the trait `AsRef`
     |                                    this method call resolves to `&T`
     |
     = note: multiple `impl`s satisfying `Vec<Constraint>: AsRef<_>` found in the `alloc` crate:
             - impl<T, A> AsRef<Vec<T, A>> for Vec<T, A>
               where A: Allocator;
             - impl<T, A> AsRef<[T]> for Vec<T, A>
               where A: Allocator;
help: use the fully qualified path for the potential candidates
     |
2021 |                             .constraints(<Vec<T, A> as AsRef<Vec<T, A>>>::as_ref(constraints))
     |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021 |                             .constraints(<Vec<T, A> as AsRef<[T]>>::as_ref(constraints))
     |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0283`.
error: could not compile `zenith` due to previous error

@macmv macmv changed the title Compiles on latest nightly Fix compile on latest nightly Apr 24, 2022
@bvaisvil
Copy link
Owner

Thanks! Looks good to me!

@bvaisvil bvaisvil merged commit f5cc1cd into bvaisvil:master Apr 25, 2022
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

Successfully merging this pull request may close these issues.

2 participants