Description
If I have a script in a directory in my $PATH
, say /usr/local/bin/foo
, and it starts with #!/usr/bin/env rust-script
and it has the executable flag set, then I can invoke that script from anywhere in my system with $ foo
. And that usually works fine. When executing the script from a directory that has a rust-toolchain
file in it, then -- to my surprise -- rust-script
uses the rust toolchain version specified in the rust-toolchain
file to execute the script. This feels like a bug to me, since the contents of a directory shouldn't affect what interpreter or compiler is used to run an executable in my $PATH
.
An extreme example is this: If I put e.g. 1.10
into the rust-toolchain
file, the rust script cannot be executed at all, since rust-script
fails with error: Unknown flag: '--target-dir'
.
I think I would expect rust-script
to always use the default toolchain.
Is this an intended feature? Could this be changed?