Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Rust errors look messy #630

Closed
flip111 opened this issue Jul 19, 2018 · 4 comments
Closed

Rust errors look messy #630

flip111 opened this issue Jul 19, 2018 · 4 comments

Comments

@flip111
Copy link
Contributor

flip111 commented Jul 19, 2018

On this kata https://www.codewars.com/kata/square-n-sum/train/rust

with this code

fn square_sum(vec: Vec<i32>) -> i32 {
  let total = 0
  for n in vec {
    total += n.pow(2)
  }
}

i get this error

errorerror: expected one of `.`, `;`, `?`, or an operator, found `for`: expected one of `.`, `;`, `?`, or an operator, found `for`
 
-->  src/lib.rs:3:3
-->   src/lib.rs:3:3|

  2| 
|   let total = 02
   | |                  let total = 0-
 expected one of `.`, `;`, `?`, or an operator here  
| 3                -|    for n in vec {
expected one of `.`, `;`, `?`, or an operator here  
| 3  ^^^  | unexpected token  for n in vec {

  
|   ^^^ unexpected token

error: aborting due to previous error


warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error

error: Could not compile `qualified-rust`.


NOTE: Line numbers in error messages can be incorrect due to concatenation.

in the first part of this error message there is a lot of duplicate stuff .. this can't be right

@kazk
Copy link
Member

kazk commented Jul 19, 2018

Thanks for reporting.
Looks like cargo test is compiling it twice in parallel (rust-lang/cargo#851).
I'll look into how to prevent this.

@kazk
Copy link
Member

kazk commented Jul 19, 2018

I'll try adding doctest = false in Cargo.toml.

@kazk
Copy link
Member

kazk commented Jul 23, 2018

Fixed this by using cargo test --lib. I'll deploy the change maybe tomorrow.

@kazk
Copy link
Member

kazk commented Jul 24, 2018

The fix is deployed.

@kazk kazk closed this as completed Jul 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants