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

Fails to build on Nightly #1963

Closed
antonok-edm opened this issue Nov 30, 2021 · 2 comments
Closed

Fails to build on Nightly #1963

antonok-edm opened this issue Nov 30, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@antonok-edm
Copy link

antonok-edm commented Nov 30, 2021

Hopefully no action required here, but I wanted to give a heads up that bat currently doesn't build on 1.59 (Nightly). I've filed a report of the (minimized) regression here (now being tracked within rust-lang/rust#90904).

The error is as follows:

error[E0277]: cannot add `&()` to `usize`
  --> src/line_range.rs:56:37
   |
56 |                     new_range.lower + more_lines
   |                                     ^ no implementation for `usize + &()`
   |
   = help: the trait `Add<&()>` is not implemented for `usize`

error[E0277]: the trait bound `(): FromStr` is not satisfied
    --> src/line_range.rs:54:26
     |
54   |                         .parse()
     |                          ^^^^^ the trait `FromStr` is not implemented for `()`
     |
note: required by a bound in `core::str::<impl str>::parse`
    --> /home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:2247:21
     |
2247 |     pub fn parse<F: FromStr>(&self) -> Result<F, F::Err> {
     |                     ^^^^^^^ required by this bound in `core::str::<impl str>::parse`

And in case anyone urgently needs to build on Nightly, this tiny patch should do the trick:

diff --git a/src/line_range.rs b/src/line_range.rs
index ccd998f..5e4e74c 100644
--- a/src/line_range.rs
+++ b/src/line_range.rs
@@ -50,7 +50,7 @@ impl LineRange {
                 let first_byte = line_numbers[1].bytes().next();
 
                 new_range.upper = if first_byte == Some(b'+') {
-                    let more_lines = &line_numbers[1][1..]
+                    let more_lines: &usize = &line_numbers[1][1..]
                         .parse()
                         .map_err(|_| "Invalid character after +")?;
                     new_range.lower + more_lines
@Enselic
Copy link
Collaborator

Enselic commented Jan 2, 2022

While interesting, I'm not sure what we can do about it in bat.

In any case, bat seems to build with rustc 1.59.0-nightly (c14569225 2022-01-01), so I'll close this issue.

@Enselic Enselic closed this as completed Jan 2, 2022
@antonok-edm
Copy link
Author

@Enselic my bad, I should have followed up earlier! The problematic change in Nightly/Beta was reverted as of rust-lang/rust#90904 (comment), so this is indeed safe to close.

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

2 participants