Skip to content

Fix building with current rust #16

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
Aug 26, 2014
Merged

Fix building with current rust #16

merged 1 commit into from
Aug 26, 2014

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Aug 26, 2014

&[T, ..n] isn't coerced to &[T] anymore, so we have to manually do that
in a few places.

&[T, ..n] isn't coerced to &[T] anymore, so we have to manually do that
in a few places.
None => if isindex { (&[], piece) } else { (piece, &[]) }
None => {
let tmp: (&[u8], &[u8]) = if isindex { (&[], piece) } else { (piece, &[]) };
tmp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I’d prefer [].as_slice(). Does that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the special rules for let foo = &rvalue expand the lifetime of the vector here. Those rules don't apply for [].as_slice() so you get a lifetime error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate, but oh well.

SimonSapin added a commit that referenced this pull request Aug 26, 2014
Fix building with current rust
@SimonSapin SimonSapin merged commit 23fb9ec into servo:master Aug 26, 2014
@SimonSapin
Copy link
Member

Merged, thanks!

@dotdash
Copy link
Contributor Author

dotdash commented Aug 26, 2014

D'oh, actually I'm an idiot. I'm at a different box now and didn't upgrade rustc yet. [].as_slice() works with the new rustc (not sure why). I'll send a follow-up PR to fix that and also fix the tests sigh

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