Skip to content

Wrong path in error messages when compiling a local dependency with a path attribute #954

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

Closed
ebfe opened this issue Nov 22, 2014 · 1 comment

Comments

@ebfe
Copy link
Contributor

ebfe commented Nov 22, 2014

Consider:

$ cargo new foo
$ cd foo
foo $ cargo new bar
foo $ cat << EOF >> Cargo.toml
> [dependencies.bar]
> path = "bar"
> EOF
foo $ echo "this is a syntax error" >> bar/src/lib.rs
foo $ cargo build
   Compiling bar v0.0.1 (file:///tmp/foo)
/tmp/foo/bar/src/lib.rs:4:1: 4:5 error: expected item, found `this`
/tmp/foo/bar/src/lib.rs:4 this is a syntax error
                          ^~~~
[...]

This works as expected. Adding a [lib] section with a path attribute to
bar/Cargo.toml results in errors printed with a path relative to bar, which
confuses editors trying to match errors to source lines.

foo $ cat << EOF >> bar/Cargo.toml
> [lib]
> name = "bar"
> path = "src/lib.rs"
> EOF
foo $ cargo build
   Compiling bar v0.0.1 (file:///tmp/foo)
src/lib.rs:4:1: 4:5 error: expected item, found `this`
src/lib.rs:4 this is a syntax error
             ^~~~
[...]
@alexcrichton
Copy link
Member

This is a dupe of #694 essentially

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

2 participants