Skip to content
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

Rollup of 8 pull requests #88992

Merged
merged 31 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3caf0bc
Accept `m!{ .. }.method()` and `m!{ .. }?` statements.
m-ou-se Sep 6, 2021
ebf1252
Add test for braced-macro followed by `.` or `?`.
m-ou-se Sep 6, 2021
ce35f8e
remap-cwd-prefix
danakj Jul 22, 2021
2a687de
Move documentation to the unstable book
danakj Sep 7, 2021
2691a39
Revert "Allow formatting `Anonymous{Struct, Union}` declarations"
pnkfelix Sep 8, 2021
2041fb1
Revert "Add test for pretty printing anonymous types"
pnkfelix Sep 8, 2021
5560f6d
Revert "Fix ast expanded printing for anonymous types"
pnkfelix Sep 8, 2021
f38ec9c
Revert "Add test for restriction of anonymous types on validation"
pnkfelix Sep 8, 2021
b6aa7e3
Manually crafted revert of d4ad050ce5778a09566f6f9ec172565815d54604 .
pnkfelix Sep 8, 2021
91feb76
Revert "Implement Anonymous{Struct, Union} in the AST"
pnkfelix Sep 8, 2021
f26f1ed
Re-add 71a7f8f1884b2c83eeb4a545eef16df1f2ea6476 post-revert.
pnkfelix Sep 8, 2021
35370a7
regression test for issue #88583.
pnkfelix Sep 9, 2021
5dab3c5
feat(rustc_typeck): suggest removing bad parens in `(recv.method)()`
notriddle Sep 11, 2021
e5c2412
Add the corrections stuff to the 88803 test case
notriddle Sep 11, 2021
d98892b
Make sure the call span parens check only fires on the callee, not args
notriddle Sep 11, 2021
8be729c
chore: convert to a multi-part suggestion
notriddle Sep 13, 2021
6ec7255
Highlight the const function if error happened because of a bound on …
WaffleLapkin Sep 13, 2021
7d8d7a0
Add negative test in macro-braces-dot-question.rs.
m-ou-se Sep 13, 2021
1053a5b
`Wrapping<T>` has the same layout and ABI as `T`
joshlf Sep 13, 2021
f9b8191
Remove implementation of `min_align_of` intrinsic
tmiasko Sep 14, 2021
a3115b3
Update books
ehuss Sep 15, 2021
4933be9
Verify bin crates are not deterministic on Windows
danakj Sep 15, 2021
c011828
Disable both reproducible-build tests for crate-type=bin
danakj Sep 15, 2021
84646e9
Rollup merge of #87320 - danakj:debug-compilation-dir, r=michaelwoeri…
Manishearth Sep 15, 2021
4b56840
Rollup merge of #88690 - m-ou-se:macro-braces-dot-question-expr-parse…
Manishearth Sep 15, 2021
fb2d7df
Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwco
Manishearth Sep 15, 2021
1bf94a1
Rollup merge of #88841 - notriddle:notriddle/method-parens, r=estebank
Manishearth Sep 15, 2021
e1acdf5
Rollup merge of #88907 - WaffleLapkin:targeted_const_fn_with_a_bound_…
Manishearth Sep 15, 2021
cad1efa
Rollup merge of #88915 - joshlf:patch-4, r=kennytm
Manishearth Sep 15, 2021
d11ee80
Rollup merge of #88933 - tmiasko:remove-min-align-of, r=oli-obk
Manishearth Sep 15, 2021
1da3c1d
Rollup merge of #88951 - ehuss:update-books, r=ehuss
Manishearth Sep 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remap-cwd-prefix
  • Loading branch information
danakj committed Sep 7, 2021
commit ce35f8ec56ec7e89d351cd95001f4d819c97e07d
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(profiler_runtime, "abc".to_string());
tracked!(relax_elf_relocations, Some(true));
tracked!(relro_level, Some(RelroLevel::Full));
tracked!(remap_cwd_prefix, Some(PathBuf::from("abc")));
tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc")));
tracked!(report_delayed_bugs, true);
tracked!(sanitizer, SanitizerSet::ADDRESS);
Expand Down
15 changes: 12 additions & 3 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1920,9 +1920,10 @@ fn parse_extern_dep_specs(

fn parse_remap_path_prefix(
matches: &getopts::Matches,
debugging_opts: &DebuggingOptions,
error_format: ErrorOutputType,
) -> Vec<(PathBuf, PathBuf)> {
matches
let mut mapping: Vec<(PathBuf, PathBuf)> = matches
.opt_strs("remap-path-prefix")
.into_iter()
.map(|remap| match remap.rsplit_once('=') {
Expand All @@ -1932,7 +1933,15 @@ fn parse_remap_path_prefix(
),
Some((from, to)) => (PathBuf::from(from), PathBuf::from(to)),
})
.collect()
.collect();
match &debugging_opts.remap_cwd_prefix {
Some(to) => match std::env::current_dir() {
Ok(cwd) => mapping.push((cwd, to.clone())),
Err(_) => (),
},
None => (),
};
mapping
}

pub fn build_session_options(matches: &getopts::Matches) -> Options {
Expand Down Expand Up @@ -2077,7 +2086,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {

let crate_name = matches.opt_str("crate-name");

let remap_path_prefix = parse_remap_path_prefix(matches, error_format);
let remap_path_prefix = parse_remap_path_prefix(matches, &debugging_opts, error_format);

let pretty = parse_pretty(&debugging_opts, error_format);

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,8 @@ options! {
"whether ELF relocations can be relaxed"),
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
"choose which RELRO level to use"),
remap_cwd_prefix: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
"remap paths under the current working directory to this path prefix"),
simulate_remapped_rust_src_base: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
"simulate the effect of remap-debuginfo = true at bootstrapping by remapping path \
to rust's source base directory. only meant for testing purposes"),
Expand Down
13 changes: 13 additions & 0 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ replacement is purely textual, with no consideration of the current system's
pathname syntax. For example `--remap-path-prefix foo=bar` will match
`foo/lib.rs` but not `./foo/lib.rs`.

<a id="option-remap-cwd-prefix"></a>
## `--remap-cwd-prefix`: remap paths under the cwd in output

Remap all absolute paths that are rooted under the current working directory to
be under the given value instead. The given value may be absolute or relative,
or empty. This switch takes precidence over `--remap-path-prefix` in case they
would both match a given path.

This flag allows the command line to be universally reproducible, such that the
same execution will work on all machines, regardless of build environment.

This is an unstable option. Use `-Z remap-cwd-prefix=val` to specify a value.

<a id="option-json"></a>
## `--json`: configure json messages printed by the compiler

Expand Down
42 changes: 42 additions & 0 deletions src/test/run-make-fulldeps/reproducible-build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ all: \
link_paths \
remap_paths \
different_source_dirs \
remap_cwd_bin \
remap_cwd_rlib \
remap_cwd_to_empty \
extern_flags

smoke:
Expand Down Expand Up @@ -64,6 +67,45 @@ different_source_dirs:
--crate-type rlib)
cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1

remap_cwd_bin:
rm -rf $(TMPDIR) && mkdir $(TMPDIR)
$(RUSTC) reproducible-build-aux.rs
mkdir $(TMPDIR)/test
cp reproducible-build.rs $(TMPDIR)/test
$(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \
-Z remap-cwd-prefix=.
cp $(TMPDIR)/reproducible-build $(TMPDIR)/first
(cd $(TMPDIR)/test && \
$(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \
-Z remap-cwd-prefix=.)
cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1

remap_cwd_rlib:
rm -rf $(TMPDIR) && mkdir $(TMPDIR)
$(RUSTC) reproducible-build-aux.rs
mkdir $(TMPDIR)/test
cp reproducible-build.rs $(TMPDIR)/test
$(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
-Z remap-cwd-prefix=.
cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib
(cd $(TMPDIR)/test && \
$(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
-Z remap-cwd-prefix=.)
cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1

remap_cwd_to_empty:
rm -rf $(TMPDIR) && mkdir $(TMPDIR)
$(RUSTC) reproducible-build-aux.rs
mkdir $(TMPDIR)/test
cp reproducible-build.rs $(TMPDIR)/test
$(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
-Z remap-cwd-prefix=
cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib
(cd $(TMPDIR)/test && \
$(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
-Z remap-cwd-prefix=)
cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1

extern_flags:
rm -rf $(TMPDIR) && mkdir $(TMPDIR)
$(RUSTC) reproducible-build-aux.rs
Expand Down