Skip to content

Fix compile on latest nightly#117

Merged
bvaisvil merged 1 commit intobvaisvil:masterfrom
macmv:master
Apr 25, 2022
Merged

Fix compile on latest nightly#117
bvaisvil merged 1 commit intobvaisvil:masterfrom
macmv:master

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