]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #10824 : huonw/rust/str-doc, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 7 Dec 2013 09:36:17 +0000 (01:36 -0800)
committerbors <bors@rust-lang.org>
Sat, 7 Dec 2013 09:36:17 +0000 (01:36 -0800)
Fixes #10819.

24 files changed:
.gitignore
Makefile.in
mk/clean.mk
mk/host.mk
mk/install.mk
mk/llvm.mk
mk/rustllvm.mk
mk/stage0.mk
mk/target.mk
mk/tests.mk
src/etc/emacs/rust-mode.el
src/etc/mklldeps.py [new file with mode: 0644]
src/etc/snapshot.py
src/librustc/lib.rs
src/librustc/lib/llvm.rs
src/librustpkg/tests.rs
src/libstd/any.rs
src/libstd/result.rs
src/libstd/rt/local_ptr.rs
src/libstd/rt/task.rs
src/libsyntax/lib.rs
src/snapshots.txt
src/test/run-fail/result-get-fail.rs
src/test/run-pass/tempfile.rs

index 64299aa54116baf58cea3bef4ca1f331638826be..00dfeede99c8b9272a8e898f55212b361ba58c45 100644 (file)
@@ -90,3 +90,4 @@ src/etc/dl
 .settings/
 build/
 i686-pc-mingw32/
+src/librustc/lib/llvmdeps.rs
index 59e5301c99e5e17a92860532da745221cdd71bab..5348499a19fc8f105f5b1d62fb49506e8d2ec302 100644 (file)
@@ -134,10 +134,13 @@ endif
 # static copies of libstd and libextra. We also generate dynamic versions of all
 # libraries, so in the interest of space, prefer dynamic linking throughout the
 # compilation process.
+#
+# Note though that these flags are omitted for stage2+. This means that the
+# snapshot will be generated with a statically linked rustc so we only have to
+# worry about the distribution of one file (with its native dynamic
+# dependencies)
 RUSTFLAGS_STAGE0 += -Z prefer-dynamic
 RUSTFLAGS_STAGE1 += -Z prefer-dynamic
-RUSTFLAGS_STAGE2 += -Z prefer-dynamic
-RUSTFLAGS_STAGE3 += -Z prefer-dynamic
 
 # platform-specific auto-configuration
 include $(CFG_SRC_DIR)mk/platform.mk
@@ -224,7 +227,7 @@ GENERATED :=
 define DEF_LIBS
 
 CFG_RUNTIME_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustrt)
-CFG_RUSTLLVM_$(1) :=$(call CFG_LIB_NAME_$(1),rustllvm)
+CFG_RUSTLLVM_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustllvm)
 CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
 CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra)
 CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
@@ -251,6 +254,8 @@ LIBRUSTUV_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustuv)
 EXTRALIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,extra)
 STDLIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,std)
 LIBRUSTUV_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustuv)
+LIBSYNTAX_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,syntax)
+LIBRUSTC_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustc)
 
 endef
 
@@ -428,8 +433,6 @@ TLIBRUSTUV_DEFAULT$(1)_T_$(2)_H_$(3) = \
 # Preqrequisites for using the stageN compiler
 HSREQ$(1)_H_$(3) = \
        $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-       $$(HLIB$(1)_H_$(3))/$(CFG_RUNTIME_$(3)) \
-       $$(HLIB$(1)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
        $$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
        $$(HEXTRALIB_DEFAULT$(1)_H_$(3)) \
        $$(HLIBSYNTAX_DEFAULT$(1)_H_$(3)) \
index 1994fec0990caf129ea4ca41838edb383a73b040..251f2c751356892e7381bc25c605ab8203efb5b2 100644 (file)
@@ -132,7 +132,9 @@ clean$(1)_T_$(2)_H_$(3):
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTUV_GLOB_$(2))
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTUV_RGLOB_$(2))
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB_$(2))
+       $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_RGLOB_$(2))
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_GLOB_$(2))
+       $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_RGLOB_$(2))
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(2))
index 7e8a3e8a6eb1497497e182aced1a08986f92cf4b..3ddbd7d69c96cd9deff19742550883e0e5d073cc 100644 (file)
@@ -26,13 +26,13 @@ define CP_HOST_STAGE_N
 $$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
        $$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X_$(4)) \
        $$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
-       $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
        $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
        $$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
        $$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
        $$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
+       $$(HLIBRUSTC_DEFAULT$(2)_H_$(4)) \
+       $$(HLIBSYNTAX_DEFAULT$(2)_H_$(4)) \
        | $$(HBIN$(2)_H_$(4))/
-
        @$$(call E, cp: $$@)
        $$(Q)cp $$< $$@
 
@@ -40,7 +40,6 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
        $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
        $$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)) \
        $$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
-       $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
        $$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
        $$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
        $$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
@@ -57,7 +56,6 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
 $$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
        $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBSYNTAX_$(4)) \
        $$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
-       $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
        $$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
        $$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
        $$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
@@ -130,12 +128,6 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTUV_$(4)): \
        $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(4)),$$(notdir $$@))
        $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(4)),$$(notdir $$@))
 
-$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
-       $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
-       | $$(HLIB$(2)_H_$(4))/
-       @$$(call E, cp: $$@)
-       $$(Q)cp $$< $$@
-
 $$(HBIN$(2)_H_$(4))/:
        mkdir -p $$@
 
index 0cd6709e72c1cce4189d3b4a8bff26c3447df485..37eaa6f52167a0a55db727fa7c5ac957c45441a6 100644 (file)
@@ -103,7 +103,6 @@ install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
 install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
 install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
        $$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
-       $$(Q)$$(call INSTALL_LIB,$$(CFG_RUSTLLVM_$(1)))
        $$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1)))
        $$(Q)$$(call INSTALL_LIB,$$(STDLIB_RGLOB_$(1)))
        $$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1)))
@@ -154,7 +153,6 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_))
        $(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD)))
        $(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD)))
        $(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD)))
-       $(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD)))
        $(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustc.1)
        $(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustdoc.1)
        $(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustpkg.1)
@@ -169,7 +167,6 @@ uninstall:
        $(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD))
        $(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD))
        $(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD))
-       $(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD))
        $(Q)for i in \
           $(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD))) \
           $(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_RGLOB_$(CFG_BUILD))) \
index 42b1a551805aff93816a3e76b94d20e74f68f1b7..cf4e98c6dba562272ca3f8f961bd44868dc8e30d 100644 (file)
@@ -44,5 +44,15 @@ $$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
 
 endef
 
+$(foreach host,$(CFG_HOST), \
+    $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
+
+$(S)src/librustc/lib/llvmdeps.rs: \
+                   $(LLVM_CONFIGS) \
+                   $(S)src/etc/mklldeps.py
+       $(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
+           "$(LLVM_COMPONENTS)" $(LLVM_CONFIGS) \
+           > $@
+
 $(foreach host,$(CFG_HOST), \
  $(eval $(call DEF_LLVM_RULES,$(host))))
index c4a9c9c4f0b14b4c49457a309a620f23d73a1c78..89b31400d5c3da9c841f564aa985ca2c7114c99c 100644 (file)
@@ -32,13 +32,9 @@ RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
 RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
 ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
 
-$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
-                          $$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
+$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1))
        @$$(call E, link: $$@)
-       $$(Q)$$(call CFG_LINK_CXX_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
-         $$(CFG_GCCISH_PRE_LIB_FLAGS_$(1)) $$(LLVM_LIBS_$(1)) \
-          $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) \
-          $$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM_$(1)))
+       $$(Q)$$(AR_$(1)) rcs $$@ $$(RUSTLLVM_OBJS_OBJS_$(1))
 
 $(1)/rustllvm/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
        @$$(call E, compile: $$@)
index e671e65ea093dfd18ac1d401a30f169f79336178..bf55289a7fb012fdadb69d202801bb1fc28cf4e5 100644 (file)
@@ -27,11 +27,7 @@ endif
 
 # Host libs will be extracted by the above rule
 
-$(HLIB0_H_$(CFG_BUILD))/$(CFG_RUNTIME_$(CFG_BUILD)): \
-               $(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
-               | $(HLIB0_H_$(CFG_BUILD))/
-       $(Q)touch $@
-
+# NOTE: remove all these after the next snapshot
 $(HLIB0_H_$(CFG_BUILD))/$(CFG_STDLIB_$(CFG_BUILD)): \
                $(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
                | $(HLIB0_H_$(CFG_BUILD))/
@@ -76,12 +72,7 @@ $$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
        @$$(call E, cp: $$@)
        $$(Q)cp $$< $$@
 
-$$(HLIB0_H_$(1))/$(CFG_RUNTIME_$(1)): \
-               $$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_RUNTIME_$(1)) \
-               | $(HLIB0_H_$(1))/
-       @$$(call E, cp: $$@)
-       $$(Q)cp $$< $$@
-
+# NOTE: removing everything below after the next snapshot
 $$(HLIB0_H_$(1))/$(CFG_STDLIB_$(1)): \
                $$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_STDLIB_$(1)) \
                | $(HLIB0_H_$(1))/
index a8606cbdbcb658baa0368b9324ddd714aa17a1ff..3bf0a2f7843d82ab01ebc228120564b37b82f711 100644 (file)
@@ -103,8 +103,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
                | $$(TLIB$(1)_T_$(2)_H_$(3))/
        @$$(call E, compile_and_link: $$@)
        $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
+       $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
        $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
        $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
+       $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
 
 # Only build the compiler for host triples
 ifneq ($$(findstring $(2),$$(CFG_HOST)),)
@@ -119,14 +121,19 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
 $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER = $(2)
 $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)):               \
                $$(COMPILER_CRATE) $$(COMPILER_INPUTS)          \
+               $(S)src/librustc/lib/llvmdeps.rs                \
                $$(TSREQ$(1)_T_$(2)_H_$(3)) \
                 $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
                 $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
                | $$(TLIB$(1)_T_$(2)_H_$(3))/
        @$$(call E, compile_and_link: $$@)
        $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
-       $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
+       $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
+       $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
+           -L "$$(LLVM_LIBDIR_$(3))" \
+           --out-dir $$(@D) $$< && touch $$@
        $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
+       $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
 
 # NOTE: after the next snapshot remove these '-L' flags
 $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)):                    \
index e19e8638331ebffea13307a2cd614416e6e5f721..3f21b1b4819d5c27502d6ecea8fbe3b04714ae29 100644 (file)
@@ -376,7 +376,8 @@ $(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)):                                       \
                $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
        @$$(call E, compile_and_link: $$@)
-       $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
+       $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
+           -L "$$(LLVM_LIBDIR_$(3))"
 
 $(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)):                                        \
                $$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS)              \
index a3b758157184de5daeddf32db0b29d801adf4800..2a5f2d90735c2addfe9881685f169ebfff11a923 100644 (file)
@@ -84,7 +84,7 @@
               ;;    or one further indent from that if either current line
               ;;    begins with 'else', or previous line didn't end in
               ;;    semi, comma or brace (other than whitespace and line
-              ;;    comments) , and wasn't an attribute.  But if we have 
+              ;;    comments) , and wasn't an attribute.  But if we have
               ;;    something after the open brace and ending with a comma,
               ;;    treat it as fields and align them.  PHEW.
               ((> level 0)
 
 (defun rust-fill-prefix-for-comment-start (line-start)
   "Determine what to use for `fill-prefix' based on what is at the beginning of a line."
-  (let ((result 
+  (let ((result
          ;; Replace /* with same number of spaces
          (replace-regexp-in-string
-          "\\(?:/\\*+\\)[!*]" 
+          "\\(?:/\\*+\\)[!*]"
           (lambda (s)
             ;; We want the * to line up with the first * of the comment start
             (concat (make-string (- (length s) 2) ?\x20) "*"))
           line-start)))
-       ;; Make sure we've got at least one space at the end
+    ;; Make sure we've got at least one space at the end
     (if (not (= (aref result (- (length result) 1)) ?\x20))
         (setq result (concat result " ")))
     result))
     ;; inferring it from the comment start.
     (let ((next-bol (line-beginning-position 2)))
       (while (save-excursion
-              (end-of-line)
-              (syntax-ppss-flush-cache 1)
-              (and (nth 4 (syntax-ppss))
-                   (save-excursion 
-                     (beginning-of-line)
-                     (looking-at paragraph-start))
-                   (looking-at "[[:space:]]*$")
-                   (nth 4 (syntax-ppss next-bol))))
+               (end-of-line)
+               (syntax-ppss-flush-cache 1)
+               (and (nth 4 (syntax-ppss))
+                    (save-excursion
+                      (beginning-of-line)
+                      (looking-at paragraph-start))
+                    (looking-at "[[:space:]]*$")
+                    (nth 4 (syntax-ppss next-bol))))
         (goto-char next-bol)))
 
     (syntax-ppss-flush-cache 1)
 
 (defun rust-with-comment-fill-prefix (body)
   (let*
-      ((line-string (buffer-substring-no-properties 
+      ((line-string (buffer-substring-no-properties
                      (line-beginning-position) (line-end-position)))
        (line-comment-start
-        (when (nth 4 (syntax-ppss)) 
+        (when (nth 4 (syntax-ppss))
           (cond
            ;; If we're inside the comment and see a * prefix, use it
            ((string-match "^\\([[:space:]]*\\*+[[:space:]]*\\)"
            ;; If we're at the start of a comment, figure out what prefix
            ;; to use for the subsequent lines after it
            ((string-match (concat "[[:space:]]*" comment-start-skip) line-string)
-            (rust-fill-prefix-for-comment-start 
+            (rust-fill-prefix-for-comment-start
              (match-string 0 line-string))))))
-       (fill-prefix 
+       (fill-prefix
         (or line-comment-start
             fill-prefix)))
     (funcall body)))
 (defun rust-fill-paragraph (&rest args)
   "Special wrapping for `fill-paragraph' to handle multi-line comments with a * prefix on each line."
   (rust-in-comment-paragraph
-   (lambda () 
+   (lambda ()
      (rust-with-comment-fill-prefix
       (lambda ()
         (let
   (rust-with-comment-fill-prefix
    (lambda () (comment-indent-new-line arg))))
 
+;;; Imenu support
+(defvar rust-imenu-generic-expression
+  (append (loop for item in
+                '("enum" "struct" "type" "mod" "fn")
+                collect `(nil ,(rust-re-item-def item) 1))
+          `(("Impl" ,(rust-re-item-def "impl") 1)))
+  "Value for `imenu-generic-expression' in Rust mode.
+
+Create a flat index of the item definitions in a Rust file.
+
+Imenu will show all the enums, structs, etc. at the same level.
+Implementations will be shown under the `Impl` subheading.
+Use idomenu (imenu with ido-mode) for best mileage.")
+
 ;; For compatibility with Emacs < 24, derive conditionally
 (defalias 'rust-parent-mode
   (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
   (set (make-local-variable 'indent-tabs-mode) nil)
 
   ;; Allow paragraph fills for comments
-  (set (make-local-variable 'comment-start-skip) 
+  (set (make-local-variable 'comment-start-skip)
        "\\(?://[/!]*\\|/\\*[*!]?\\)[[:space:]]*")
   (set (make-local-variable 'paragraph-start)
        (concat "[[:space:]]*\\(?:" comment-start-skip "\\|\\*/?[[:space:]]*\\|\\)$"))
   (set (make-local-variable 'adaptive-fill-function) 'rust-find-fill-prefix)
   (set (make-local-variable 'comment-multi-line) t)
   (set (make-local-variable 'comment-line-break-function) 'rust-comment-indent-new-line)
+  (set (make-local-variable 'imenu-generic-expression) rust-imenu-generic-expression)
   )
 
 
diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py
new file mode 100644 (file)
index 0000000..90e48de
--- /dev/null
@@ -0,0 +1,58 @@
+# xfail-license
+
+import os
+import sys
+import subprocess
+
+components = sys.argv[1].split(' ')
+
+print """// Copyright 2013 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.
+
+// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
+//          take a look at src/etc/mklldeps.py if you're interested
+"""
+
+for llconfig in sys.argv[2:]:
+    print
+
+    proc = subprocess.Popen([llconfig, '--host-target'], stdout = subprocess.PIPE)
+    out, err = proc.communicate()
+    arch, os = out.split('-', 1)
+    arch = 'x86' if arch == 'i686' or arch == 'i386' else arch
+    if 'darwin' in os:
+        os = 'macos'
+    elif 'linux' in os:
+        os = 'linux'
+    elif 'freebsd' in os:
+        os = 'freebsd'
+    elif 'android' in os:
+        os = 'android'
+    elif 'win' in os or 'mingw' in os:
+        os = 'win32'
+    cfg = [
+        "target_arch = \"" + arch + "\"",
+        "target_os = \"" + os + "\"",
+    ]
+
+    print "#[cfg(" + ', '.join(cfg) + ")]"
+
+    args = [llconfig, '--libs']
+    args.extend(components)
+    proc = subprocess.Popen(args, stdout = subprocess.PIPE)
+    out, err = proc.communicate()
+
+    for lib in out.strip().split(' '):
+        lib = lib[2:] # chop of the leading '-l'
+        print "#[link(name = \"" + lib + "\", kind = \"static\")]"
+    if os == 'win32':
+        print "#[link(name = \"pthread\")]"
+        print "#[link(name = \"imagehlp\")]"
+    print "extern {}"
index 03ada0eef18331057b69642110b2eb9623f6d2ed..e6508ec526e201febdffee6376c1337fa79243c5 100644 (file)
@@ -25,34 +25,10 @@ download_dir_base = "dl"
 download_unpack_base = os.path.join(download_dir_base, "unpack")
 
 snapshot_files = {
-    "linux": ["bin/rustc",
-              "lib/libstd-*.so",
-              "lib/libextra-*.so",
-              "lib/librustc-*.so",
-              "lib/libsyntax-*.so",
-              "lib/librustuv-*.so",
-              "lib/librustllvm.so"],
-    "macos": ["bin/rustc",
-              "lib/libstd-*.dylib",
-              "lib/libextra-*.dylib",
-              "lib/librustc-*.dylib",
-              "lib/libsyntax-*.dylib",
-              "lib/librustuv-*.dylib",
-              "lib/librustllvm.dylib"],
-    "winnt": ["bin/rustc.exe",
-              "bin/std-*.dll",
-              "bin/extra-*.dll",
-              "bin/rustc-*.dll",
-              "bin/syntax-*.dll",
-              "bin/rustuv-*.dll",
-              "bin/rustllvm.dll"],
-    "freebsd": ["bin/rustc",
-                "lib/libstd-*.so",
-                "lib/libextra-*.so",
-                "lib/librustc-*.so",
-                "lib/libsyntax-*.so",
-                "lib/librustuv-*.so",
-                "lib/librustllvm.so"]
+    "linux": ["bin/rustc"],
+    "macos": ["bin/rustc"],
+    "winnt": ["bin/rustc.exe"],
+    "freebsd": ["bin/rustc"],
     }
 
 winnt_runtime_deps = ["libgcc_s_dw2-1.dll",
index 166e1414f6ea24b69f07b6102f9594e4bcff3a3b..7484550b3f3fd4e4882b1bd93d183c133a10712c 100644 (file)
@@ -17,6 +17,7 @@
 #[comment = "The Rust compiler"];
 #[license = "MIT/ASL2"];
 #[crate_type = "dylib"];
+#[crate_type = "rlib"];
 
 #[feature(macro_rules, globs, struct_variant, managed_boxes)];
 
@@ -110,6 +111,7 @@ pub mod util {
 
 pub mod lib {
     pub mod llvm;
+    pub mod llvmdeps;
 }
 
 // A curious inner module that allows ::std::foo to be available in here for
index 1e1444babf232007e70edca6cf6b3dd950ba1960..3b0925164c9821510b07beb7065ef99f0018478e 100644 (file)
@@ -306,7 +306,18 @@ pub mod llvm {
     use std::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong,
                     size_t};
 
-    #[link(name = "rustllvm")]
+    // Link to our native llvm bindings (things that we need to use the C++ api
+    // for) and because llvm is written in C++ we need to link against libstdc++
+    //
+    // You'll probably notice that there is an omission of all LLVM libraries
+    // from this location. This is because the set of LLVM libraries that we
+    // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
+    // figure out the exact set of libraries. To do this, the build system
+    // generates an llvmdeps.rs file next to this one which will be
+    // automatically updated whenever LLVM is updated to include an up-to-date
+    // set of the libraries we need to link to LLVM for.
+    #[link(name = "rustllvm", kind = "static")]
+    #[link(name = "stdc++")]
     extern {
         /* Create and destroy contexts. */
         pub fn LLVMContextCreate() -> ContextRef;
index 6136be2e8d30bc3adc28de74890dab5cbca03c1e..135ba9e9702c951ddd8cbc6c72bdaf1dd5a44400 100644 (file)
@@ -1101,6 +1101,7 @@ fn no_rebuilding() {
 }
 
 #[test]
+#[ignore]
 fn no_recopying() {
     let p_id = PkgId::new("foo");
     let workspace = create_local_package(&p_id);
@@ -1822,7 +1823,7 @@ fn test_linker_build() {
     let workspace = workspace.path();
     let matches = getopts([], optgroups());
     let options = build_session_options(@"rustpkg",
-                                        matches.get_ref(),
+                                        matches.as_ref().unwrap(),
                                         @diagnostic::DefaultEmitter as
                                             @diagnostic::Emitter);
     let sess = build_session(options,
index 965b9ffb95c1ff4170ab749585f578eea9f42a6f..6a3e6933001fa1139710b395f65ea61af1f7716a 100644 (file)
@@ -151,7 +151,6 @@ mod tests {
     use super::*;
     use super::AnyRefExt;
     use option::{Some, None};
-    use hash::Hash;
 
     #[deriving(Eq)]
     struct Test;
index afcf092b4f6cb251f9726a5eff1907fb79cdb08c..690b4e06d49995b6aa7bbfe4a0781e51c4284abb 100644 (file)
 
 //! A type representing either success or failure
 
-use any::Any;
 use clone::Clone;
 use cmp::Eq;
 use fmt;
 use iter::Iterator;
-use kinds::Send;
-use option::{None, Option, Some, OptionIterator};
+use option::{None, Option, Some};
 use option::{ToOption, IntoOption, AsOption};
 use str::OwnedStr;
 use to_str::ToStr;
 use vec;
 
 /// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
-///
-/// In order to provide informative error messages, `E` is required to implement `ToStr`.
-/// It is further recommended for `E` to be a descriptive error type, eg a `enum` for
-/// all possible errors cases.
 #[deriving(Clone, DeepClone, Eq, Ord, TotalEq, TotalOrd, ToStr)]
 pub enum Result<T, E> {
-    /// Contains the successful result value
+    /// Contains the success value
     Ok(T),
+
     /// Contains the error value
     Err(E)
 }
@@ -40,7 +35,7 @@ pub enum Result<T, E> {
 // Type implementation
 /////////////////////////////////////////////////////////////////////////////
 
-impl<T, E: ToStr> Result<T, E> {
+impl<T, E> Result<T, E> {
     /////////////////////////////////////////////////////////////////////////
     // Querying the contained values
     /////////////////////////////////////////////////////////////////////////
@@ -60,71 +55,48 @@ pub fn is_err(&self) -> bool {
         !self.is_ok()
     }
 
-    /////////////////////////////////////////////////////////////////////////
-    // Adapter for working with references
-    /////////////////////////////////////////////////////////////////////////
-
-    /// Convert from `Result<T, E>` to `Result<&T, &E>`
-    #[inline]
-    pub fn as_ref<'r>(&'r self) -> Result<&'r T, &'r E> {
-        match *self {
-            Ok(ref x) => Ok(x),
-            Err(ref x) => Err(x),
-        }
-    }
-
-    /// Convert from `Result<T, E>` to `Result<&mut T, &mut E>`
-    #[inline]
-    pub fn as_mut<'r>(&'r mut self) -> Result<&'r mut T, &'r mut E> {
-        match *self {
-            Ok(ref mut x) => Ok(x),
-            Err(ref mut x) => Err(x),
-        }
-    }
 
     /////////////////////////////////////////////////////////////////////////
-    // Getting to contained values
+    // Adapter for each variant
     /////////////////////////////////////////////////////////////////////////
 
-    /// Unwraps a result, yielding the content of an `Ok`.
-    /// Fails if the value is a `Err` with a custom failure message provided by `msg`.
+    /// Convert from `Result<T, E>` to `Option<T>`
     #[inline]
-    pub fn expect<M: Any + Send>(self, msg: M) -> T {
+    pub fn ok(self) -> Option<T> {
         match self {
-            Ok(t) => t,
-            Err(_) => fail!(msg),
+            Ok(x)  => Some(x),
+            Err(_) => None,
         }
     }
 
-    /// Unwraps a result, yielding the content of an `Err`.
-    /// Fails if the value is a `Ok` with a custom failure message provided by `msg`.
+    /// Convert from `Result<T, E>` to `Option<E>`
     #[inline]
-    pub fn expect_err<M: Any + Send>(self, msg: M) -> E {
+    pub fn err(self) -> Option<E> {
         match self {
-            Err(e) => e,
-            Ok(_) => fail!(msg),
+            Ok(_)  => None,
+            Err(x) => Some(x),
         }
     }
 
-    /// Unwraps a result, yielding the content of an `Ok`.
-    /// Fails if the value is a `Err` with an error message derived
-    /// from `E`'s `ToStr` implementation.
+    /////////////////////////////////////////////////////////////////////////
+    // Adapter for working with references
+    /////////////////////////////////////////////////////////////////////////
+
+    /// Convert from `Result<T, E>` to `Result<&T, &E>`
     #[inline]
-    pub fn unwrap(self) -> T {
-        match self {
-            Ok(t) => t,
-            Err(e) => fail!("called `Result::unwrap()` on `Err` value '{}'",
-                             e.to_str()),
+    pub fn as_ref<'r>(&'r self) -> Result<&'r T, &'r E> {
+        match *self {
+            Ok(ref x) => Ok(x),
+            Err(ref x) => Err(x),
         }
     }
 
-    /// Unwraps a result, yielding the content of an `Err`.
-    /// Fails if the value is a `Ok`.
+    /// Convert from `Result<T, E>` to `Result<&mut T, &mut E>`
     #[inline]
-    pub fn unwrap_err(self) -> E {
-        match self {
-            Ok(_) => fail!("called `Result::unwrap_err()` on an `Ok` value"),
-            Err(e) => e
+    pub fn as_mut<'r>(&'r mut self) -> Result<&'r mut T, &'r mut E> {
+        match *self {
+            Ok(ref mut x) => Ok(x),
+            Err(ref mut x) => Err(x),
         }
     }
 
@@ -163,34 +135,6 @@ pub fn map_err<F>(self, op: |E| -> F) -> Result<T,F> {
         }
     }
 
-    /////////////////////////////////////////////////////////////////////////
-    // Iterator constructors
-    /////////////////////////////////////////////////////////////////////////
-
-    /// Returns an `Iterator` over one or zero references to the value of an `Ok`
-    ///
-    /// Example:
-    ///
-    ///     for buf in read_file(file) {
-    ///         print_buf(buf)
-    ///     }
-    #[inline]
-    pub fn iter<'r>(&'r self) -> OptionIterator<&'r T> {
-        match *self {
-            Ok(ref t) => Some(t),
-            Err(..) => None,
-        }.move_iter()
-    }
-
-    /// Returns an `Iterator` over one or zero references to the value of an `Err`
-    #[inline]
-    pub fn iter_err<'r>(&'r self) -> OptionIterator<&'r E> {
-        match *self {
-            Ok(..) => None,
-            Err(ref t) => Some(t),
-        }.move_iter()
-    }
-
     ////////////////////////////////////////////////////////////////////////
     // Boolean operations on the values, eager and lazy
     /////////////////////////////////////////////////////////////////////////
@@ -239,17 +183,23 @@ pub fn or_else<F>(self, op: |E| -> Result<T, F>) -> Result<T, F> {
     // Common special cases
     /////////////////////////////////////////////////////////////////////////
 
-    /// Get a reference to the value out of a successful result
-    ///
-    /// # Failure
-    ///
-    /// If the result is an error
+    /// Unwraps a result, yielding the content of an `Ok`.
+    /// Fails if the value is an `Err`.
     #[inline]
-    pub fn get_ref<'a>(&'a self) -> &'a T {
-        match *self {
-            Ok(ref t) => t,
-            Err(ref e) => fail!("called `Result::get_ref()` on `Err` value '{}'",
-                                 e.to_str()),
+    pub fn unwrap(self) -> T {
+        match self {
+            Ok(t) => t,
+            Err(_) => fail!("called `Result::unwrap()` on an `Err` value")
+        }
+    }
+
+    /// Unwraps a result, yielding the content of an `Err`.
+    /// Fails if the value is an `Ok`.
+    #[inline]
+    pub fn unwrap_err(self) -> E {
+        match self {
+            Ok(_) => fail!("called `Result::unwrap_err()` on an `Ok` value"),
+            Err(e) => e
         }
     }
 }
@@ -458,31 +408,6 @@ pub fn test_or_else() {
         assert_eq!(op2().or_else(|e| Err::<int, ~str>(e + "!")).unwrap_err(), ~"sadface!");
     }
 
-    #[test]
-    pub fn test_impl_iter() {
-        let mut valid = false;
-        let okval = Ok::<~str, ~str>(~"a");
-        okval.iter().next().map(|_| { valid = true; });
-        assert!(valid);
-
-        let errval = Err::<~str, ~str>(~"b");
-        errval.iter().next().map(|_| { valid = false; });
-        assert!(valid);
-    }
-
-    #[test]
-    pub fn test_impl_iter_err() {
-        let mut valid = true;
-        let okval = Ok::<~str, ~str>(~"a");
-        okval.iter_err().next().map(|_| { valid = false });
-        assert!(valid);
-
-        valid = false;
-        let errval = Err::<~str, ~str>(~"b");
-        errval.iter_err().next().map(|_| { valid = true });
-        assert!(valid);
-    }
-
     #[test]
     pub fn test_impl_map() {
         assert_eq!(Ok::<~str, ~str>(~"a").map(|x| x + "b"), Ok(~"ab"));
@@ -495,12 +420,6 @@ pub fn test_impl_map_err() {
         assert_eq!(Err::<~str, ~str>(~"a").map_err(|x| x + "b"), Err(~"ab"));
     }
 
-    #[test]
-    pub fn test_get_ref_method() {
-        let foo: Result<int, ()> = Ok(100);
-        assert_eq!(*foo.get_ref(), 100);
-    }
-
     #[test]
     fn test_collect() {
         assert_eq!(collect(range(0, 0)
index 803938589afcf3a26f7ca07a48218589248b80eb..bff9390ee3b1e657a84179beee70160746d69675 100644 (file)
@@ -48,6 +48,7 @@ pub unsafe fn borrow<T>(f: |&mut T|) {
 /// it wherever possible.
 #[cfg(not(windows), not(target_os = "android"))]
 pub mod compiled {
+    #[cfg(not(test))]
     use libc::c_void;
     use cast;
     use option::{Option, Some, None};
index fd7fee9e2b405cba2cfb3858154a59a263106fe7..63cc397e8d795df248ee86ee2a920dab38eea228 100644 (file)
@@ -543,6 +543,7 @@ pub fn begin_unwind(&mut self, cause: ~Any) -> ! {
 #[no_split_stack] // - it would be sad for this function to trigger __morestack
 #[doc(hidden)]    // - Function must be `pub` to get exported, but it's
                   //   irrelevant for documentation purposes.
+#[cfg(not(test))] // in testing, use the original libstd's version
 pub extern "C" fn rust_stack_exhausted() {
     use rt::in_green_task_context;
     use rt::task::Task;
index eafcf7c09a0e2ca7e5cd94634e08b1bc647b0f15..c9b3ba9d4600f3b6e8cccd852826fc918444b0f8 100644 (file)
@@ -20,6 +20,7 @@
 
 #[license = "MIT/ASL2"];
 #[crate_type = "dylib"];
+#[crate_type = "rlib"];
 
 #[feature(macro_rules, globs, managed_boxes)];
 
index e71b218394da9ae6d7d847710c4021b946745508..b9be50701d9f9c6d0960cac6da58a83effe3e1cc 100644 (file)
@@ -1,3 +1,11 @@
+S 2013-12-04 9169579
+  freebsd-x86_64 0dc6dcd9435e23c891b9e9e37d483e92cfe51449
+  linux-i386 9802f6ba319bec4dd02299af08e421270ede5f5f
+  linux-x86_64 195d69ac1846cd646faaa50d05639d41b03e33ae
+  macos-i386 b0729f5ce3f5581fbb02f963a0f5261e6f011e01
+  macos-x86_64 5091706c1111bbbd21a22e11b18f68717be17c29
+  winnt-i386 1f975067f08f7702ab7f1d88b13221a0c2becd2f
+
 S 2013-11-30 4252a24
   freebsd-x86_64 2e0bfc6eb0dd75b8a1ad5c9958d90f3b626650dd
   linux-i386 2ea4b43fbc22c295e60874ef494dfbea1cc08a63
index 027faadecadfd4975fb4015c931014442c343f78..a41ab53964bec49e690e1196040aa3a883460ee4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:called `Result::unwrap()` on `Err` value 'kitty'
+// error-pattern:called `Result::unwrap()` on an `Err` value
 
 use std::result;
 
index 3ab0fe1c058d878e38ae018e31264ab7d74748a0..dd5aa4bc8c670ceb4c0eaeeb71810bffbedb1a9e 100644 (file)
@@ -64,7 +64,7 @@ fn test_rm_tempdir() {
         let f: proc() -> TempDir = proc() {
             TempDir::new("test_rm_tempdir").unwrap()
         };
-        let tmp = task::try(f).expect("test_rm_tmdir");
+        let tmp = task::try(f).ok().expect("test_rm_tmdir");
         path = tmp.path().clone();
         assert!(path.exists());
     }