Repository: rust
Issue: bootstrap/dist.rs hard-coded pathways
Labels: T-compiler,T-bootstrap,C-bug

When installing with a --prefix, the bootstrap/dist.rs seems to set hardcoded paths that do not include the set --prefix:
```
        // Prepare the image directory
        builder.create_dir(&image.join("share/zsh/site-functions"));
        builder.create_dir(&image.join("etc/bash_completion.d"));
        let cargo = builder.ensure(tool::Cargo { compiler, target });
        builder.install(&cargo, &image.join("bin"), 0o755);
        for man in t!(etc.join("man").read_dir()) {
            let man = t!(man);
            builder.install(&man.path(), &image.join("share/man/man1"), 0o644);
        }
        builder.install(&etc.join("_cargo"), &image.join("share/zsh/site-functions"), 0o644);
        builder.copy(&etc.join("cargo.bashcomp.sh"), &image.join("etc/bash_completion.d/cargo"));
        let doc = image.join("share/doc/cargo");
```
https://github.com/rust-lang/rust/blob/master/src/bootstrap/dist.rs#L1210

This causes errors when /etc, /share, and the like are not available.  I am building rustc/cargo from the 1.45.2 source for use with OpenWrt.  I couldn't find a missed ```config.toml``` entry or ```configure``` flag for this.

I am not familar with the rust language, and would not feel comfortable submitting a PR on it.
Tail error from the build failure:

```
Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage2 tool cargo (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.19s
Dist cargo stage2 (x86_64-unknown-linux-gnu)
	finished in 9.372
Install cargo stage2 (Some("x86_64-unknown-linux-gnu"))
install: creating uninstall script at /home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/uninstall.sh
install: installing component 'cargo'
cp: cannot create regular file '/etc/bash_completion.d/cargo': Permission denied
chmod: cannot access '/etc/bash_completion.d/cargo': No such file or directory
install: error: file creation failed. see logs at '/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/install.log'


command did not execute successfully: "sh" "/home/grommish/openwrt/build_dir/hostpkg/rustc-1.45.2/build/tmp/dist/cargo-0.46.1-dev-x86_64-unknown-linux-gnu/install.sh" "--prefix=/home/grommish/openwrt/build_dir/hostpkg/.cargo" "--sysconfdir=/etc" "--datadir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/share" "--docdir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/share/doc/rust" "--bindir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/bin" "--libdir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib" "--mandir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/share/man" "--disable-ldconfig"
expected success, got: exit code: 1


failed to run: /home/grommish/openwrt/build_dir/hostpkg/rustc-1.45.2/build/bootstrap/debug/bootstrap install
Build completed unsuccessfully in 0:01:33
```

install.log:
```
$ umask 022 && mkdir -p "/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib"
$ echo "3" > "/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/rust-installer-version"
install: creating uninstall script at /home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/uninstall.sh
$ cp /home/grommish/openwrt/build_dir/hostpkg/rustc-1.45.2/build/tmp/dist/cargo-0.46.1-dev-x86_64-unknown-linux-gnu/install.sh /home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/uninstall.sh
install: installing component 'cargo'
$ echo "cargo" >> "/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/components"
$ umask 022 && mkdir -p "/etc/bash_completion.d"
install: copying file /etc/bash_completion.d/cargo
$ cp /home/grommish/openwrt/build_dir/hostpkg/rustc-1.45.2/build/tmp/dist/cargo-0.46.1-dev-x86_64-unknown-linux-gnu/cargo/etc/bash_completion.d/cargo /etc/bash_completion.d/cargo
$ chmod 644 /etc/bash_completion.d/cargo
install: error: file creation failed. see logs at '/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib/rustlib/install.log'
```