rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Usage example for `remap-path-prefix`

Open pikajude opened this issue 2 years ago • 1 comments

As far as I can tell from searching through the source code, rules_rust does support passing this option to rustc, but I can't tell how or where to configure it.

pikajude avatar Aug 17 '22 17:08 pikajude

rustc_flags doesn’t work to pass the flags? I’m assuming there’s more nuance to the issue so just want to clarify things

UebelAndre avatar Aug 20 '22 21:08 UebelAndre

I also would like to see where I can set this. It's not clear for me at all

cristifalcas avatar Nov 07 '22 18:11 cristifalcas

The remap path prefix is not user-configurable I believe. We have it as a param to the internal function that computes the compiler flags, but that's only ever called with the default of "" or None from the rustdoc definitions. The thing that makes it a bit special is that it requires ${{pwd}} substitution: https://github.com/bazelbuild/rules_rust/blob/c8ab970c4b89dca6cd8cd4ad5c602180acb1e5a9/rust/private/rustc.bzl#L882

Using rustc_flags to set this may just work out of the box, but I'm not sure if the pwd substitution is performed for rustc_flags and what does rustc do in the presence of multiple --remap-path-prefix= arguments.

krasimirgg avatar Nov 10 '22 08:11 krasimirgg