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

error : cannot resolve `std::borrow::Cow<'_, str>: std::borrow::Borrow<_> #643

Closed
vamshi9666 opened this issue May 19, 2018 · 10 comments
Closed

Comments

@vamshi9666
Copy link

rocket version : 0.3.10
rustc version : 1.28.0-nightly
i am getting started into rocket .
i have installation as in docs and downloaded examples from git .
when i entered cargo run .
i see

 type annotations required: cannot resolve `std::borrow::Cow<'_, str>: std::borrow::Borrow<_>`
   --> lib/src/http/header.rs:544:47
    |
544 |                 Header::new(key.as_str(), val.borrow())
    |                                               ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
error: Could not compile `rocket`.
i tied to switch to other versions and i faced more error in previous versions.
if this issue is already in progress . please provide link or reference 

@bjorn3
Copy link

bjorn3 commented May 19, 2018

I get this at rustc 1.28.0-nightly (952f344cd 2018-05-18)

@mammadov-ali
Copy link

Hi Sergio,

The same problem :-(

stable-x86_64-apple-darwin unchanged - rustc 1.26.0 (a77568041 2018-05-07)
nightly-x86_64-apple-darwin unchanged - rustc 1.28.0-nightly (952f344cd 2018-05-18)

rustup override set nightly
rustup update && cargo update

But no results:

screen shot 2018-05-19 at 14 31 19

@CallistoM
Copy link

Having the same problem, tried to downgrade to version 0.3.6, cargo does not like this.

Running the following nightly version:

  • cargo 1.28.0-nightly (f352115d5 2018-05-15)
  • rustc 1.28.0-nightly (952f344cd 2018-05-18)

capture

@alex1702
Copy link

my temporary solution is to downgrade:

rustup toolchain install nightly-2018-05-17
rustup default nightly-2018-05-17

@jebrosen
Copy link
Collaborator

jebrosen commented May 19, 2018

Looks like something has changed with type inference, but I can't tell what. Changing https://github.com/SergioBenitez/Rocket/blob/v0.3/lib/src/http/header.rs#L544 from val.borrow() to &**val (which is what Cow::borrow() does anyway) appears to compile successfully.

EDIT: hypothetical reason for the error -- Header::new wants any Into<Cow<'_, str>>, and there might be multiple valid things to borrow() out of a Cow<'_, str> especially given that it impls Deref. Borrow::<str>::borrow(val) is another way to resolve the ambiguity.

jebrosen added a commit to jebrosen/Rocket that referenced this issue May 19, 2018
@jebrosen jebrosen mentioned this issue May 19, 2018
@vamshi9666
Copy link
Author

is this resolved ?

@bjorn3
Copy link

bjorn3 commented May 19, 2018

Not yet #644 isn't merged yet

@vamshi9666
Copy link
Author

did downgrading worked for anyone ?

@mammadov-ali
Copy link

mammadov-ali commented May 19, 2018

Downgrading fixed the problem

Try this: rustup override set nightly-2018-05-17

SergioBenitez pushed a commit that referenced this issue May 19, 2018
@SergioBenitez
Copy link
Member

SergioBenitez commented May 19, 2018

Fixed in ff5db84. Will push a new release with this fix soon.

Edit: Released in v0.3.11.

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

No branches or pull requests

7 participants