Should file paths reflect what the user passes to `rustc`?

Today rustc often canonicalizes paths even when given by the user (or at least tries to). This means resolving symlinks which in turn can mean the resulting path bares little resemblance to the path the user wrote.

I would think however that it's more user-friendly if the paths given in output and diagnostics were logically based on the paths given by the user. If they say /home/user/symlink/project then assume that's what they want to see in output. I'd argue this is true for weirder paths like ../../../../project.

There can be technical reasons why canonicalization is preferred but that should be an internal thing where possible and only shown to the user when an error necessitates it (e.g. some kind of filesystem error).

1 Like

One question that brings up: handling prefix-stripping for anonymization, which we should really be doing by default.

1 Like

That's a good point! Making the path absolute would possible be enough for that purpose. Though I wonder if there are other ways we could normalize the root paths. E.g. have a kind of fake filesystem that's laid out in a deterministic way, no matter what the real paths are.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.