summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile235
-rw-r--r--Notes/ISSUE-MovesInMatchGuards.txt30
-rw-r--r--Notes/ISSUE-TraitMethodsVsInherentMethods.txt12
-rw-r--r--minicargo.mk6
-rw-r--r--script-overrides/nightly-2017-07-08/build_rustc_asan.txt0
-rw-r--r--script-overrides/nightly-2017-07-08/build_rustc_lsan.txt0
-rw-r--r--script-overrides/nightly-2017-07-08/build_rustc_msan.txt0
-rw-r--r--script-overrides/nightly-2017-07-08/build_rustc_tsan.txt0
-rw-r--r--src/hir/from_ast.cpp1
-rw-r--r--src/hir_conv/expand_type.cpp1
-rw-r--r--src/hir_typeck/expr_cs.cpp16
-rw-r--r--src/hir_typeck/helpers.cpp5
12 files changed, 85 insertions, 221 deletions
diff --git a/Makefile b/Makefile
index 82a6d952..482d7d8f 100644
--- a/Makefile
+++ b/Makefile
@@ -131,58 +131,23 @@ clean:
PIPECMD ?= 2>&1 | tee $@_dbg.txt | tail -n $(TAIL_COUNT) ; test $${PIPESTATUS[0]} -eq 0
-output/%.ast: samples/%.rs $(BIN)
- @mkdir -p output/
- $(DBG) $(BIN) $< -o $@ $(PIPECMD)
-
RUSTCSRC := rustc-nightly/
RUSTC_SRC_DL := $(RUSTCSRC)/dl-version
-fn_build_lib =\
- $Vecho "--- [MRUSTC] $@" ; \
- mkdir -p $(dir $@); rm -f $@ ; \
- $(DBG) $(ENV_$@) $(BIN) $1 --crate-type rlib --crate-name $2 -o $@ $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD) ; \
- test -e $@
-output/lib%.hir: $(RUSTCSRC)src/lib%/lib.rs $(RUSTCSRC) $(BIN)
- @echo "--- [MRUSTC] $@"
- @mkdir -p output/
- @rm -f $@
- $(DBG) $(ENV_$@) $(BIN) $< -o $@ $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD)
-# # HACK: Work around gdb returning success even if the program crashed
- @test -e $@
-output/lib%.hir: $(RUSTCSRC)src/lib%/src/lib.rs $(RUSTCSRC) $(BIN)
- @echo "--- [MRUSTC] $@"
- @mkdir -p output/
- @rm -f $@
- $(DBG) $(ENV_$@) $(BIN) $< -o $@ $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD)
-# # HACK: Work around gdb returning success even if the program crashed
- @test -e $@
-output/lib%.hir: $(RUSTCSRC)src/vendor/%/src/lib.rs $(RUSTCSRC) $(BIN)
- @echo "--- [MRUSTC] $@"
- @mkdir -p output/
- @rm -f $@
- $(DBG) $(ENV_$@) $(BIN) $< --crate-type rlib --crate-name $* -o $@ $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD)
-# # HACK: Work around gdb returning success even if the program crashed
- @test -e $@
+output/libstd.hir output/libtest.hir output/rustc output/cargo output/libpanic_unwind.hir: $(BIN) $(RUSTCSRC)
+ $(MAKE) -f minicargo.mk $@
-output/librustc_demangle.hir: $(RUSTCSRC)src/vendor/rustc-demangle/src/lib.rs $(RUSTCSRC) $(BIN)
- $(call fn_build_lib, $<, rustc_demangle)
-output/librls_data.hir: $(RUSTCSRC)src/vendor/rls-data/src/lib.rs $(RUSTCSRC) $(BIN)
- $(call fn_build_lib, $<, rls_data)
-output/librls_span.hir: $(RUSTCSRC)src/vendor/rls-span/src/lib.rs $(RUSTCSRC) $(BIN)
- $(call fn_build_lib, $<, rls_span)
-output/librustc_serialize.hir: $(RUSTCSRC)src/vendor/rustc-serialize/src/lib.rs $(RUSTCSRC) $(BIN)
- $(call fn_build_lib, $< rustc_serialize)
+TEST_DEPS := output/libstd.hir output/libtest.hir output/libpanic_unwind.hir
-output/lib%-test: $(RUSTCSRC)src/lib%/lib.rs $(RUSTCSRC) $(BIN) output/libtest.hir
+output/lib%-test: $(RUSTCSRC)src/lib%/lib.rs $(RUSTCSRC) $(TEST_DEPS)
@echo "--- [MRUSTC] --test -o $@"
@mkdir -p output/
@rm -f $@
$(DBG) $(ENV_$@) $(BIN) --test $< -o $@ -L output/libs $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD)
# # HACK: Work around gdb returning success even if the program crashed
@test -e $@
-output/lib%-test: $(RUSTCSRC)src/lib%/src/lib.rs $(RUSTCSRC) $(BIN) output/libtest.hir
+output/lib%-test: $(RUSTCSRC)src/lib%/src/lib.rs $(RUSTCSRC) $(TEST_DEPS)
@echo "--- [MRUSTC] $@"
@mkdir -p output/
@rm -f $@
@@ -197,151 +162,6 @@ fn_getdeps = \
| tr '\n' ' ')
-# --- rustc: librustc_llvm ---
-RUSTC_TARGET := x86_64-unknown-linux-gnu
-RUSTC_HOST := $(shell $(CC) --verbose 2>&1 | grep 'Target' | awk '{print $$2}')
-ifeq ($(RUSTC_HOST),x86_64-linux-gnu)
- RUSTC_HOST := x86_64-unknown-linux-gnu
-endif
-LLVM_LINKAGE_FILE := $(abspath rustc-nightly/$(RUSTC_TARGET)/rt/llvmdeps.rs)
-LLVM_CONFIG := $(RUSTCSRC)build/bin/llvm-config
-
-output/librustc_llvm.hir: $(LLVM_LINKAGE_FILE)
-
-#
-# librustc_llvm build script
-#
-RUSTC_LLVM_LINKAGE: $(LLVM_LINKAGE_FILE)
-output/librustc_llvm_build: rustc-nightly/src/librustc_llvm/build.rs $(call fcn_extcrate, std gcc build_helper alloc_system panic_abort)
- @echo "--- [MRUSTC] $@"
- $(BIN) $< -o $@ -L output/libs $(RUST_FLAGS) $(PIPECMD)
-output/libgcc.hir: crates.io/gcc-0.3.28/src/lib.rs $(BIN) output/libstd.hir
- @echo "--- [MRUSTC] $@"
- $(BIN) $< -o $@ --crate-type rlib --crate-name gcc $(RUST_FLAGS) $(PIPECMD)
-output/libbuild_helper.hir: rustc-nightly/src/build_helper/lib.rs $(BIN) output/libstd.hir output/libfiletime.hir
- @echo "--- [MRUSTC] $@"
- $(BIN) $< -o $@ --crate-type rlib --crate-name build_helper $(RUST_FLAGS) $(PIPECMD)
-
-output/libgetopts.hir: rustc-nightly/src/vendor/getopts/src/lib.rs $(BIN) output/libstd.hir
- @echo "--- [MRUSTC] $@"
- $(BIN) $< -o $@ --crate-type rlib --crate-name getopts $(RUST_FLAGS) $(PIPECMD)
-
-crates.io/%/src/lib.rs: crates.io/%.tar.gz
- tar -xf $< -C crates.io/
- @test -e $@ && touch $@
-crates.io/gcc-0.3.28.tar.gz:
- @mkdir -p $(dir $@)
- curl -LsS https://crates.io/api/v1/crates/gcc/0.3.28/download -o $@
-
-output/rustc_link_opts.txt: $(LLVM_LINKAGE_FILE)
- @
-$(LLVM_LINKAGE_FILE): output/librustc_llvm_build $(LLVM_CONFIG)
- @mkdir -p $(dir $@)
- @mkdir -p rustc-nightly/$(RUSTC_TARGET)/cargo_out
- @echo "--- [rustc-nightly/src/librustc_llvm]"
- $Vcd rustc-nightly/src/librustc_llvm && (export OUT_DIR=$(abspath rustc-nightly/$(RUSTC_TARGET)/cargo_out) OPT_LEVEL=1 PROFILE=release TARGET=$(RUSTC_TARGET) HOST=$(RUSTC_HOST) LLVM_CONFIG=$(abspath $(LLVM_CONFIG)); $(DBG) ../../../output/librustc_llvm_build > ../../../output/librustc_llvm_build-output.txt)
- $Vcat output/librustc_llvm_build-output.txt | grep '^cargo:' > output/librustc_llvm_build-output_cargo.txt
- $Vcat output/librustc_llvm_build-output_cargo.txt | grep 'cargo:rustc-link-lib=.*=' | grep -v =rustllvm | awk -F = '{ print "-l" $$3 }' > output/rustc_link_opts.txt
- $Vcat output/librustc_llvm_build-output_cargo.txt | grep 'cargo:rustc-link-search=native=' | awk -F = '{ print "-L " $$3 }' >> output/rustc_link_opts.txt
- @touch $@
-
-output/cargo_libflate/libminiz.a: output/libflate_build
- @echo "--- $<"
- $Vmkdir -p $(abspath output/cargo_libflate)
- $Vcd rustc-nightly/src/libflate && (export OUT_DIR=$(abspath output/cargo_libflate) OPT_LEVEL=1 PROFILE=release TARGET=$(RUSTC_TARGET) HOST=$(RUSTC_HOST); $(DBG) ../../../$< > ../../../$<-output.txt)
- $Vcat $<-output.txt | grep '^cargo:' > $<-output_cargo.txt
- $Vcat $<-output_cargo.txt | grep 'cargo:rustc-link-search=native=' | awk -F = '{ print "-L " $$3 }' > output/rustc_link_opts-libflate.txt
-
-output/libflate_build: rustc-nightly/src/libflate/build.rs $(call fcn_extcrate, std gcc alloc_system panic_abort)
- @echo "--- [MRUSTC] $@"
- $(BIN) $< -o $@ -L output/libs $(RUST_FLAGS) $(PIPECMD)
-
-ARGS_output/libstd.hir := --cfg feature=backtrace
-ARGS_output/librustc_llvm.hir := --cfg llvm_component=x86 --cfg cargobuild
-ARGS_output/liblog.hir := --cfg feature=use_std
-ARGS_output/libstable_deref_trait.hir := --cfg feature=stdR
-ARGS_output/librustc_allocator.hir := --crate-type rlib --crate-name rustc_allocator
-ENV_output/librustc_llvm.hir := CFG_LLVM_LINKAGE_FILE=$(LLVM_LINKAGE_FILE)
-
-ENV_output/librustc.hir := CFG_COMPILER_HOST_TRIPLE=$(RUSTC_HOST)
-
-# Optional: linux only
-output/libstd.hir: output/libs/libbacktrace.a
-
-output/libarena.hir: output/libstd.hir
-output/liballoc.hir: output/libcore.hir output/libstd_unicode.hir
-output/liballoc_system.hir: output/liballoc.hir
-output/libstd_unicode.hir: $(call fcn_extcrate, core)
-output/libcollections.hir: $(call fcn_extcrate, core alloc)
-output/librand.hir: output/libcore.hir
-output/liblibc.hir: output/libcore.hir
-output/libcompiler_builtins.hir: output/libcore.hir
-output/libstd.hir: $(call fcn_extcrate, core collections rand libc unwind compiler_builtins alloc_system)
-output/libunwind.hir: $(call fcn_extcrate, core libc)
-
-output/libterm.hir: $(call fcn_extcrate, std)
-output/libpanic_unwind.hir: $(call fcn_extcrate, core alloc libc unwind)
-output/libpanic_abort.hir: $(call fcn_extcrate, core $(call fn_getdeps, $(RUSTCSRC)src/libpanic_abort/lib.rs))
-output/libtest.hir: $(call fcn_extcrate, std getopts term panic_unwind)
-output/libgetopts.hir: output/libstd.hir
-output/libflate2.hir: $(call fcn_extcrate, std libc miniz_sys)
-output/liblog.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/vendor/log/src/lib.rs))
-output/libenv_logger.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/vendor/env_logger/src/lib.rs))
-output/libminiz_sys.hir: $(RUSTCSRC)src/vendor/miniz-sys/lib.rs $(call fcn_extcrate, std)
- $(DBG) $(ENV_$@) $(BIN) $< --crate-type rlib --crate-name miniz_sys -o $@ $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD)
-
-output/liballoc_system.hir: $(call fcn_extcrate, core libc)
-output/liballoc_jemalloc.hir: $(call fcn_extcrate, core libc)
-
-output/libserialize.hir: $(call fcn_extcrate, std log rustc_i128)
-output/librustc_llvm.hir: $(call fcn_extcrate, std rustc_bitflags)
-output/librustc_errors.hir: $(call fcn_extcrate, std syntax_pos term)
-output/libsyntax.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/libsyntax/lib.rs))
-# TODO libsyntax wants bitflags-0.8
-output/libbitflags.hir: $(RUSTCSRC)src/vendor/bitflags-0.8.2/src/lib.rs $(call fcn_extcrate, std)
- $(DBG) $(ENV_$@) $(BIN) $< --crate-type rlib --crate-name bitflags -o $@ $(RUST_FLAGS) $(ARGS_$@) $(PIPECMD)
-
-output/librustc_back.hir: $(call fcn_extcrate, std syntax)
-output/librustc_data_structures.hir: $(call fcn_extcrate, std log serialize libc)
-output/librustc_const_math.hir: $(call fcn_extcrate, std log syntax serialize)
-output/libfmt_macros.hir: $(call fcn_extcrate, std)
-output/libproc_macro.hir: $(call fcn_extcrate, std syntax)
-output/libsyntax_ext.hir: $(call fcn_extcrate, std fmt_macros log syntax syntax_pos rustc_errors proc_macro)
-output/librustc_metadata.hir: $(call fcn_extcrate, std log flate2 serialize rustc rustc_back rustc_const_math rustc_data_structures rustc_errors syntax syntax_pos syntax_ext)
-output/librustc_borrowck.hir: $(call fcn_extcrate, std log syntax syntax_pos rustc_errors graphviz rustc rustc_data_structures rustc_mir core)
-output/librustc_mir.hir: $(call fcn_extcrate, std log graphviz rustc rustc_data_structures rustc_back rustc_bitflags syntax syntax_pos rustc_const_math rustc_const_eval)
-output/librustc_const_eval.hir: $(call fcn_extcrate, std arena syntax log rustc rustc_back rustc_const_math rustc_data_structures rustc_errors graphviz syntax_pos serialize)
-output/libgraphviz.hir: $(call fcn_extcrate, std)
-output/libstable_deref_trait.hir: $(call fcn_extcrate, std)
-output/libowning_ref.hir: $(call fcn_extcrate, std stable_deref_trait $(call fn_getdeps, $(RUSTCSRC)src/vendor/owning_ref/src/lib.rs))
-output/libjobserver.hir: $(call fcn_extcrate, std)
-
-output/libsyntax_pos.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/libsyntax_pos/lib.rs))
-
-output/librustc_i128.hir: output/libcore.hir
-output/librustc_plugin.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_plugin/lib.rs))
-output/librustc_save_analysis.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_save_analysis/lib.rs))
-output/librustc_resolve.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_resolve/lib.rs))
-output/librustc_plugin.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_plugin/lib.rs))
-output/librustc.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc/lib.rs))
-output/librustc_trans.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_trans/lib.rs))
-output/librustc_lint.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_lint/lib.rs))
-output/librustc_passes.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_passes/lib.rs))
-output/librustc_incremental.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_incremental/lib.rs))
-output/librustc_typeck.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_trans/lib.rs))
-output/librustc_driver.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_driver/lib.rs))
-output/librustc_bitflags.hir: $(call fcn_extcrate, core $(call fn_getdeps, $(RUSTCSRC)src/librustc_bitflags/lib.rs))
-output/librustc_privacy.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_privacy/lib.rs))
-output/librustc_platform_intrinsics.hir: $(call fcn_extcrate, std $(call fn_getdeps, $(RUSTCSRC)src/librustc_platform_intrinsics/lib.rs))
-
-output/rustc: $(RUSTCSRC)src/rustc/rustc.rs output/librustc_driver.hir output/rustc_link_opts.txt
- @echo "--- [MRUSTC] $@"
- @mkdir -p output/
- @rm -f $@
- $V$(DBG) $(BIN) $< -o $@ -L output/libs $$(cat output/rustc_link_opts.txt output/rustc_link_opts-libflate.txt) -l stdc++ $(RUST_FLAGS) $(PIPECMD)
-# # HACK: Work around gdb returning success even if the program crashed
- @test -e $@
-
.PHONY: RUSTCSRC
RUSTCSRC: $(RUSTCSRC)
@@ -353,34 +173,12 @@ $(RUSTCSRC): rust-nightly-date rust_src.patch
rm -f rustc-nightly-src.tar.gz; \
rm -rf rustc-nightly; \
curl -sS https://static.rust-lang.org/dist/$${DL_RUST_DATE}/rustc-nightly-src.tar.gz -o rustc-nightly-src.tar.gz; \
- tar -xf rustc-nightly-src.tar.gz --transform 's~^rustc-nightly-src~rustc-nightly~'; \
+ tar -xf rustc-nightly-src.tar.gz; \
+ mv rustc-nightly-src rustc-nightly; \
patch -p0 < rust_src.patch; \
echo "$$DL_RUST_DATE" > $(RUSTC_SRC_DL); \
fi
-# - libbacktrace, needed for libstd on linux
-output/libs/libbacktrace.a: $(RUSTCSRC)src/libbacktrace/Makefile
- @mkdir -p $(dir $@)
- @cd $(RUSTCSRC)src/libbacktrace && $(MAKE) INCDIR=.
- @cp $(RUSTCSRC)src/libbacktrace/.libs/libbacktrace.a $@
-$(RUSTCSRC)src/libbacktrace/Makefile:
- @echo "[configure] $(RUSTCSRC)src/libbacktrace"
- @cd $(RUSTCSRC)src/libbacktrace && ./configure --target=$(RUSTC_HOST) --host=$(RUSTC_HOST) --build=$(RUSTC_HOST)
-
-
-LLVM_CMAKE_OPTS := LLVM_TARGET_ARCH=$(firstword $(subst -, ,$(RUSTC_TARGET))) LLVM_DEFAULT_TARGET_TRIPLE=$(RUSTC_TARGET)
-LLVM_CMAKE_OPTS += LLVM_TARGETS_TO_BUILD=X86#;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX
-LLVM_CMAKE_OPTS += LLVM_ENABLE_ASSERTIONS=OFF
-LLVM_CMAKE_OPTS += LLVM_INCLUDE_EXAMPLES=OFF LLVM_INCLUDE_TESTS=OFF LLVM_INCLUDE_DOCS=OFF
-LLVM_CMAKE_OPTS += LLVM_ENABLE_ZLIB=OFF LLVM_ENABLE_TERMINFO=OFF LLVM_ENABLE_LIBEDIT=OFF WITH_POLLY=OFF
-LLVM_CMAKE_OPTS += CMAKE_CXX_COMPILER="g++" CMAKE_C_COMPILER="gcc"
-
-$(LLVM_CONFIG): $(RUSTCSRC)build/Makefile
- $Vcd $(RUSTCSRC)build && $(MAKE)
-$(RUSTCSRC)build/Makefile: $(RUSTCSRC)src/llvm/CMakeLists.txt
- @mkdir -p $(RUSTCSRC)build
- $Vcd $(RUSTCSRC)build && cmake $(addprefix -D , $(LLVM_CMAKE_OPTS)) ../src/llvm
-
# MRUSTC-specific tests
.PHONY: local_tests
@@ -388,7 +186,7 @@ local_tests: $(patsubst samples/test/%.rs,output/local_test/%_out.txt,$(wildcard
output/local_test/%_out.txt: output/local_test/%
./$< > $@
-output/local_test/%: samples/test/%.rs $(BIN) output/libtest.hir output/libpanic_abort.hir output/liballoc_system.hir
+output/local_test/%: samples/test/%.rs $(TEST_DEPS)
mkdir -p $(dir $@)
$(BIN) -L output/libs -g $< -o $@ $(RUST_FLAGS) --test $(PIPECMD)
@@ -426,8 +224,7 @@ DISABLED_TESTS += run-pass/cast # Disallows cast from char to i32
DISABLED_TESTS += run-pass/empty-struct-braces # HIR Gen - Empty struct support
DISABLED_TESTS += run-pass/explicit-self-generic # Method Selection: Picks ExactSizeIterator::len instead of Self::len
DISABLED_TESTS += run-pass/extern-compare-with-return-type # TODO Specialisation with function pointers
-DISABLED_TESTS += run-pass/issue-14399 # Inferrence ran though a coercion point.
-DISABLED_TESTS += run-pass/issue-26709 # ^ (integer literal)
+DISABLED_TESTS += run-pass/issue-26709 # Inferrence ran though a coercion point (integer literal)
DISABLED_TESTS += run-pass/issue-20797 # Failed to find impl with associated type, possible incorrect coerce?
DISABLED_TESTS += run-pass/issue-21245 # IntoIterator on core::slice::Iterator ?
DISABLED_TESTS += run-pass/issue-21486 # Type mismatch
@@ -579,6 +376,7 @@ DISABLED_TESTS += run-pass/issue-25757 # UFCS function pointer
DISABLED_TESTS += run-pass/mir_refs_correct
DISABLED_TESTS += run-pass/vec-fixed-length # Overflow in costeval
DISABLED_TESTS += run-pass/union/union-const-trans # Union literal
+DISABLED_TESTS += run-pass/union/union-packed # ConstEval UnionLiteral
# - Type defaults not supported
DISABLED_TESTS += run-pass/default-associated-types
DISABLED_TESTS += run-pass/default_ty_param_default_dependent_associated_type
@@ -640,11 +438,10 @@ DISABLED_TESTS += run-pass/smallest-hello-world # missing lang item
DISABLED_TESTS += run-pass/trait-item-inside-macro # macro invocations in traits
DISABLED_TESTS += run-pass/try-operator-custom # `?` carrier
DISABLED_TESTS += run-pass/wrapping-int-api # cfg on match arms
-DISABLED_TESTS += run-pass/union/union-c-interop # union derive
+#DISABLED_TESTS += run-pass/union/union-c-interop # union derive
DISABLED_TESTS += run-pass/union/union-derive # ^
-DISABLED_TESTS += run-pass/union/union-overwrite # ? MetaItem::as_String()
-DISABLED_TESTS += run-pass/union/union-packed # ^
-DISABLED_TESTS += run-pass/union/union-pat-refutability # ^
+#DISABLED_TESTS += run-pass/union/union-overwrite # ? MetaItem::as_String()
+DISABLED_TESTS += run-pass/union/union-pat-refutability # Union matching
# - Parse
DISABLED_TESTS += run-pass/issue-37733 # for<'a,>
DISABLED_TESTS += run-pass/loop-break-value # `break value`
@@ -842,7 +639,7 @@ rust_tests-libs: $(patsubst %,output/lib%-test_out.txt, $(LIB_TESTS))
#rust_tests-compile-fail: $(call DEF_RUST_TESTS,compile-fail)
-output/rust/test_run-pass_hello: $(RUST_TESTS_DIR)run-pass/hello.rs output/libstd.hir $(BIN) output/liballoc_system.hir output/libpanic_abort.hir
+output/rust/test_run-pass_hello: $(RUST_TESTS_DIR)run-pass/hello.rs $(TEST_DEPS)
@mkdir -p $(dir $@)
@echo "--- [MRUSTC] -o $@"
$(DBG) $(BIN) $< -L output/libs -o $@ $(RUST_FLAGS) $(PIPECMD)
@@ -859,7 +656,7 @@ TEST_ARGS_run-pass/macro-meta-items := --cfg foo
TEST_ARGS_run-pass/issue-21361 := -g
TEST_ARGS_run-pass/syntax-extension-cfg := --cfg foo --cfg 'qux=foo'
-output/rust/%: $(RUST_TESTS_DIR)%.rs $(RUSTCSRC) $(BIN) output/libstd.hir output/libtest.hir output/test_deps/librust_test_helpers.a
+output/rust/%: $(RUST_TESTS_DIR)%.rs $(TEST_DEPS)
@mkdir -p $(dir $@)
@echo "=== TEST $(patsubst output/rust/%,%,$@)"
@echo "--- [MRUSTC] -o $@"
@@ -900,7 +697,7 @@ test_deps_run-pass.mk: Makefile $(wildcard $(RUST_TESTS_DIR)run_pass/*.rs)
#
# TEST: Rust standard library and the "hello, world" run-pass test
#
-test: $(RUSTCSRC) output/libcore.hir output/liballoc.hir output/libcollections.hir output/libstd.hir output/rust/test_run-pass_hello_out.txt $(BIN)
+test: $(RUSTCSRC) output/libstd.hir output/rust/test_run-pass_hello_out.txt $(BIN)
#
# TEST: Attempt to compile rust_os (Tifflin) from ../rust_os
diff --git a/Notes/ISSUE-MovesInMatchGuards.txt b/Notes/ISSUE-MovesInMatchGuards.txt
new file mode 100644
index 00000000..51f9453c
--- /dev/null
+++ b/Notes/ISSUE-MovesInMatchGuards.txt
@@ -0,0 +1,30 @@
+Encountered while processing https://github.com/rust-lang/rust/blob/8c93a79e387f5197e8b8fe73b3d87d2b101b7c4a/src/test/run-pass/move-guard-const.rs
+- Value is moved in a match guard, which fails and falls to an arm where the value is still belived to be valid.
+
+Ideal 1: Model match common codegen as a else-if chain.
+ > For each arm: Make a split scope, expand patterns, codegen guard, then switch to the other scope and immediately complete it.
+- Problem: A move can be bypassed.
+- Solution: Treat a bypass path as a second arm to the `if`
+- Problem 2: Arms can be mutually exclusive, and hence can move in both with no lower-time error.
+- Post-validation can solve that.
+
+
+Idea 2: Refactor state tracking to instead store a COW state stack what can have the state removed for later use.
+- Push/pop state around each pattern
+- Unify apply after patterns in an arm
+- Pop state after processing the condition
+- Unify before processing each arm
+- Problem: Doens't concretely determine if something is moved? (Will use drop
+ flags when not needed)
+
+
+Idea 3: When processing a match guard, enter a mode where all moves of above values are conditional.
+ > Flag on the Scope::Split used for the match pattern
+ > Flag is set/cleared around processing the arm guard
+ > Mutating the state within this scope creates a drop flag
+- Problem: Structurally, allocating the drop flag is a challeng
+ > Solution: Use a new scope type (with no split, just applies backwards)
+
+
+Overall problem: Use-after-free still possible (but has to be invalid code with the above fixes)
+- Solution: Dump the entire concept and just add a "NoMutate" scope type that errors if state changes across it
diff --git a/Notes/ISSUE-TraitMethodsVsInherentMethods.txt b/Notes/ISSUE-TraitMethodsVsInherentMethods.txt
new file mode 100644
index 00000000..1e70f767
--- /dev/null
+++ b/Notes/ISSUE-TraitMethodsVsInherentMethods.txt
@@ -0,0 +1,12 @@
+ISSUE: Trait method .powi not being considered because <f32>::powi is found
+
+Needs to search for trait methods first.
+- But that falls into problems when the trait method isn't the correct method!
+ - E.g. `impl Iterator for Parser` ... `impl Parser { fn position(&mut self) }`
+
+
+References:
+- `rustc-nightly/src/libfmt_macros/lib.rs` line 272
+ - Requires that `<Parser>::position` be called not `Iterator::position`
+- `rustc-nightly/src/vendor/num-traits/src/lib.rs` line 308
+ - Requires that `Float::powi` be chosen for inferrence to succeed
diff --git a/minicargo.mk b/minicargo.mk
index cae8979a..0ba087be 100644
--- a/minicargo.mk
+++ b/minicargo.mk
@@ -6,10 +6,12 @@ RUSTCSRC := rustc-nightly/
LLVM_CONFIG := rustc-nightly/build/bin/llvm-config
RUSTC_TARGET := x86_64-unknown-linux-gnu
-.PHONY: bin/mrustc tools/bin/minicargo output/libsrc.hir output/libtest.hir output/libpanic_unwind.hir output/rustc
+.PHONY: bin/mrustc tools/bin/minicargo output/libsrc.hir output/libtest.hir output/libpanic_unwind.hir output/rustc output/cargo
all: output/rustc
+mini: output/libpanic_unwind.hir output/libtest.hit
+
$(MRUSTC):
$(MAKE) -f Makefile all
test -e $@
@@ -38,6 +40,8 @@ RUSTC_ENV_VARS += CFG_LIBDIR_RELATIVE=lib
output/rustc: $(MRUSTC) $(MINICARGO) output/libstd.hir output/libtest.hir $(LLVM_CONFIG)
$(RUSTC_ENV_VARS) $(MINICARGO) rustc-nightly/src/rustc --vendor-dir rustc-nightly/src/vendor
+output/cargo: $(MRUSTC) output/libstd.hir
+ $(MINICARGO) rustc-nightly/src/tools/cargo --vendor-dir rustc-nightly/src/vendor
# Reference rustc-nightly/src/bootstrap/native.rs for these values
LLVM_CMAKE_OPTS := LLVM_TARGET_ARCH=$(firstword $(subst -, ,$(RUSTC_TARGET))) LLVM_DEFAULT_TARGET_TRIPLE=$(RUSTC_TARGET)
diff --git a/script-overrides/nightly-2017-07-08/build_rustc_asan.txt b/script-overrides/nightly-2017-07-08/build_rustc_asan.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/script-overrides/nightly-2017-07-08/build_rustc_asan.txt
diff --git a/script-overrides/nightly-2017-07-08/build_rustc_lsan.txt b/script-overrides/nightly-2017-07-08/build_rustc_lsan.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/script-overrides/nightly-2017-07-08/build_rustc_lsan.txt
diff --git a/script-overrides/nightly-2017-07-08/build_rustc_msan.txt b/script-overrides/nightly-2017-07-08/build_rustc_msan.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/script-overrides/nightly-2017-07-08/build_rustc_msan.txt
diff --git a/script-overrides/nightly-2017-07-08/build_rustc_tsan.txt b/script-overrides/nightly-2017-07-08/build_rustc_tsan.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/script-overrides/nightly-2017-07-08/build_rustc_tsan.txt
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index 48aa7af4..b005f79b 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -1181,6 +1181,7 @@ void _add_mod_val_item(::HIR::Module& mod, ::std::string name, bool is_pub, ::H
{
const auto& sp = item.data.span;
auto item_path = ::HIR::ItemPath(path, item.name.c_str());
+ DEBUG(item_path << " " << item.data.tag_str());
TU_MATCH(::AST::Item, (item.data), (e),
(None,
),
diff --git a/src/hir_conv/expand_type.cpp b/src/hir_conv/expand_type.cpp
index 44102f18..6802cf22 100644
--- a/src/hir_conv/expand_type.cpp
+++ b/src/hir_conv/expand_type.cpp
@@ -231,6 +231,7 @@ public:
void visit(::HIR::ExprNode_CallPath& node) override
{
+ //TRACE_FUNCTION_F(node.m_path);
upper_visitor.visit_path(node.m_path, ::HIR::Visitor::PathContext::VALUE);
::HIR::ExprVisitorDef::visit(node);
}
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 61f2b568..226be96c 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -2606,7 +2606,12 @@ namespace {
// Using autoderef, locate this method on the type
::HIR::Path fcn_path { ::HIR::SimplePath() };
TraitResolution::AutoderefBorrow ad_borrow;
+ // TODO: Obtain a list of avaliable methods at that level?
+ // - If running in a mode after stablise (before defaults), fall
+ // back to trait if the inherent is still ambigious.
unsigned int deref_count = this->context.m_resolve.autoderef_find_method(node.span(), node.m_traits, node.m_trait_param_ivars, ty, node.m_method, fcn_path, ad_borrow);
+ //::std::vector<::std::pair<TraitResolution::AutoderefBorrow, ::HIR::Path>> possible_methods;
+ //unsigned int deref_count = this->context.m_resolve.autoderef_find_method(node.span(), node.m_traits, node.m_trait_param_ivars, ty, node.m_method, possible_methods);
if( deref_count != ~0u )
{
DEBUG("- deref_count = " << deref_count << ", fcn_path = " << fcn_path);
@@ -2629,6 +2634,17 @@ namespace {
)
if( !visit_call_populate_cache(this->context, node.span(), node.m_method_path, node.m_cache) ) {
DEBUG("- AMBIGUOUS - Trying again later");
+ // Move the params back
+ TU_MATCH(::HIR::Path::Data, (node.m_method_path.m_data), (e),
+ (Generic, ),
+ (UfcsUnknown, ),
+ (UfcsKnown,
+ node.m_params = mv$(e.params);
+ ),
+ (UfcsInherent,
+ node.m_params = mv$(e.params);
+ )
+ )
return ;
}
DEBUG("> m_method_path = " << node.m_method_path);
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index eb8fef0a..94f7304d 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -3465,6 +3465,8 @@ const ::HIR::TypeRef* TraitResolution::autoderef(const Span& sp, const ::HIR::Ty
}
}
}
+
+//unsigned int TraitResolution::autoderef_find_method(const Span& sp, const HIR::t_trait_list& traits, const ::std::vector<unsigned>& ivars, const ::HIR::TypeRef& top_ty, const ::std::string& method_name, /* Out -> */::std::vector<AutoderefBorrow,::HIR::Path>& possibilities) const
unsigned int TraitResolution::autoderef_find_method(const Span& sp, const HIR::t_trait_list& traits, const ::std::vector<unsigned>& ivars, const ::HIR::TypeRef& top_ty, const ::std::string& method_name, /* Out -> */::HIR::Path& fcn_path, AutoderefBorrow& borrow) const
{
TRACE_FUNCTION_F("{" << top_ty << "}." << method_name);
@@ -3501,7 +3503,7 @@ unsigned int TraitResolution::autoderef_find_method(const Span& sp, const HIR::t
if( ty.m_data.is_Borrow() && should_pause( this->m_ivars.get_type(*ty.m_data.as_Borrow().inner) ) ) {
return ~0u;
}
- // TODO: Pause on Box<_>
+ // TODO: Pause on Box<_>?
DEBUG(deref_count << ": " << ty);
// Non-referenced
@@ -3898,6 +3900,7 @@ bool TraitResolution::find_method(
}
// 4. Search for inherent methods
+ // - Inherent methods are searched first.
DEBUG("> Inherent methods");
{
const ::HIR::TypeRef* cur_check_ty = &ty;