Skip to content

Paths printed relative to the Cargo.toml file interfere with M-x compile #209

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
huonw opened this issue Jul 17, 2014 · 4 comments · Fixed by #1164
Closed

Paths printed relative to the Cargo.toml file interfere with M-x compile #209

huonw opened this issue Jul 17, 2014 · 4 comments · Fixed by #1164
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. E-easy Experience: Easy

Comments

@huonw
Copy link
Member

huonw commented Jul 17, 2014

If you're in a subdirectory of Cargo repository (e.g. src) and run cargo build, rustc is run from the directory with Cargo.toml, meaning all printed paths are relevative to that directory, not the one where cargo build was run.

Emac's M-x compile mode will "hyperlink" paths in error messages to allow jumping straight to the error (I'm sure other editors provide this functionality too), but it is taken relative to the folder of the buffer on which M-x compile was run (i.e. if you are editing .../src/lib.rs and run M-x compile cargo build then emacs assumes the diagnostics are relative to .../src). Hence, the automatic running of rustc in a different directory makes it harder to use that mode.

This would theoretically be fixed by running the rustc subprocess from the directory in which cargo is invoked.

@huonw huonw changed the title Paths printed relevative to the Cargo.toml interfere with M-x compile Paths printed relative to the Cargo.toml file interfere with M-x compile Jul 17, 2014
@photex
Copy link

photex commented Jul 29, 2014

+10

I use projectile instead of M-x compile but the problem is the same since build errors lose helpful path information ("which mod.rs is this again?").

@vhbit
Copy link
Contributor

vhbit commented Oct 10, 2014

Looks like not at issue anymore as compilation warnings/errors now contain full paths.

@alexcrichton
Copy link
Member

Possibly solution: #694 (comment)

@flodiebold
Copy link
Member

Note that the paths are still relative when compiling a crate at a non-standard location using a [[bin]] entry (and I assume the same goes for [[lib]]).

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jan 14, 2015
All paths printed will now be absolute paths unless the path is a descendant of
the current directory. This should keep error messages and warnings of a
reasonable length when working with the local project while still allowing
errors in registry/git dependencies to be tracked down.

Special care is taken in these situations to ensure that the error message from
the compiler prints a reasonable path.

Closes rust-lang#209
Closes rust-lang#694
@alexcrichton alexcrichton added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Jan 14, 2015
bors added a commit that referenced this issue Jan 14, 2015
All paths printed will now be absolute paths unless the path is a descendant of
the current directory. This should keep error messages and warnings of a
reasonable length when working with the local project while still allowing
errors in registry/git dependencies to be tracked down.

Special care is taken in these situations to ensure that the error message from
the compiler prints a reasonable path.

Closes #209
Closes #694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants