mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
70269cd8ef
The path we pass to rustc will be visible in panic messages and backtraces: they will be user visible! Avoid junk in these paths by passing relative paths to rustc. For most advanced users, `libcore` or `libstd` in the path will be a clue to the location -- inside our code, not theirs. Store both the relative path to the source as well as the absolute. Use the relative path where it matters, compiling the main crates, instead of changing all of the build process to cope with relative paths. Example output after this patch: ``` $ ./testunwrap thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362 $ RUST_BACKTRACE=1 ./testunwrap thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362 stack backtrace: 1: 0x7ff59c1e9956 - sys::backtrace::write::h67a542fd2b201576des at ../src/libstd/sys/unix/backtrace.rs:158 2: 0x7ff59c1ed5b6 - panicking::on_panic::h3d21c41cdd5c12d41Xw at ../src/libstd/panicking.rs:58 3: 0x7ff59c1e7b6e - rt::unwind::begin_unwind_inner::h9f3a5440cebb8baeLDw at ../src/libstd/rt/unwind/mod.rs:273 4: 0x7ff59c1e7f84 - rt::unwind::begin_unwind_fmt::h4fe8a903e0c296b0RCw at ../src/libstd/rt/unwind/mod.rs:212 5: 0x7ff59c1eced7 - rust_begin_unwind 6: 0x7ff59c22c11a - panicking::panic_fmt::h00b0cd49c98a9220i5B at ../src/libcore/panicking.rs:64 7: 0x7ff59c22b9e0 - panicking::panic::hf549420c0ee03339P3B at ../src/libcore/panicking.rs:45 8: 0x7ff59c1e621d - option::Option<T>::unwrap::h501963526474862829 9: 0x7ff59c1e61b1 - main::hb5c91ce92347d1e6eaa 10: 0x7ff59c1f1c18 - rust_try_inner 11: 0x7ff59c1f1c05 - rust_try 12: 0x7ff59c1ef374 - rt::lang_start::h7e51e19c6677cffe5Sw at ../src/libstd/rt/unwind/mod.rs:147 at ../src/libstd/rt/unwind/mod.rs:130 at ../src/libstd/rt/mod.rs:128 13: 0x7ff59c1e628e - main 14: 0x7ff59b3f6b44 - __libc_start_main 15: 0x7ff59c1e6078 - <unknown> 16: 0x0 - <unknown> ```
38 lines
1.4 KiB
Makefile
38 lines
1.4 KiB
Makefile
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
# file at the top-level directory of this distribution and at
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
# option. This file may not be copied, modified, or distributed
|
|
# except according to those terms.
|
|
|
|
# Recursive wildcard function
|
|
# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
|
|
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
|
|
$(filter $(subst *,%,$2),$d))
|
|
|
|
ifndef CFG_DISABLE_MANAGE_SUBMODULES
|
|
# This is a pretty expensive operation but I don't see any way to avoid it
|
|
# NB: This only looks for '+' status (wrong commit checked out), not '-' status
|
|
# (nothing checked out at all). `./configure --{llvm,jemalloc}-root`
|
|
# will explicitly deinitialize the corresponding submodules, and we don't
|
|
# want to force constant rebuilds in that case.
|
|
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
|
|
else
|
|
NEED_GIT_RECONFIG=0
|
|
endif
|
|
|
|
ifeq ($(NEED_GIT_RECONFIG),0)
|
|
else
|
|
# If the submodules have changed then always execute config.mk
|
|
.PHONY: config.stamp
|
|
endif
|
|
|
|
Makefile config.mk: config.stamp
|
|
|
|
config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
|
|
@$(call E, cfg: reconfiguring)
|
|
$(SREL)configure $(CFG_CONFIGURE_ARGS)
|