Skip to content

Commit 9b45874

Browse files
committed
plumbing to automatically run MIR for crates where it works;
this serves as a poor man's unit test infrastructure until MIR is more built up
1 parent faa9ec8 commit 9b45874

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mk/main.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
172172
# by not emitting them.
173173
RUSTFLAGS_STAGE0 += -Z no-landing-pads
174174

175+
# Enable MIR to "always build" for crates where this works. This is
176+
# just temporary while MIR is being actively built up -- it's just a
177+
# poor man's unit testing infrastructure. Anyway we only want this for
178+
# stage1/stage2.
179+
define ADD_MIR_FLAG
180+
RUSTFLAGS1_$(1) += -Z always-build-mir
181+
RUSTFLAGS2_$(1) += -Z always-build-mir
182+
endef
183+
$(foreach crate,$(TARGET_CRATES),$(eval $(call ADD_MIR_FLAG,$(crate))))
184+
$(foreach crate,$(RUSTC_CRATES),$(eval $(call ADD_MIR_FLAG,$(crate))))
185+
$(foreach crate,syntax,$(eval $(call ADD_MIR_FLAG,$(crate))))
186+
175187
# platform-specific auto-configuration
176188
include $(CFG_SRC_DIR)mk/platform.mk
177189

mk/target.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
9393
$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
9494
$$(LLVM_STDCPP_RUSTFLAGS_$(2)) \
9595
$$(RUSTFLAGS_$(4)) \
96+
$$(RUSTFLAGS$(1)_$(4)) \
9697
$$(RUSTFLAGS$(1)_$(4)_T_$(2)) \
9798
--out-dir $$(@D) \
9899
-C extra-filename=-$$(CFG_FILENAME_EXTRA) \

0 commit comments

Comments
 (0)