Skip to content

Commit fa4e6ae

Browse files
committed
---
yaml --- r: 147069 b: refs/heads/try2 c: 09a8794 h: refs/heads/master i: 147067: 00e07af v: v3
1 parent 12d65d7 commit fa4e6ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+509
-807
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 7c719ec1bc3939c2d30f7fbd3160db5c6497fc63
8+
refs/heads/try2: 09a879460cfa42ecfd4a769bdc21e1d55b795bd8
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,3 @@ src/etc/dl
9090
.settings/
9191
build/
9292
i686-pc-mingw32/
93-
src/librustc/lib/llvmdeps.rs

branches/try2/Makefile.in

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,10 @@ endif
134134
# static copies of libstd and libextra. We also generate dynamic versions of all
135135
# libraries, so in the interest of space, prefer dynamic linking throughout the
136136
# compilation process.
137-
#
138-
# Note though that these flags are omitted for stage2+. This means that the
139-
# snapshot will be generated with a statically linked rustc so we only have to
140-
# worry about the distribution of one file (with its native dynamic
141-
# dependencies)
142137
RUSTFLAGS_STAGE0 += -Z prefer-dynamic
143138
RUSTFLAGS_STAGE1 += -Z prefer-dynamic
139+
RUSTFLAGS_STAGE2 += -Z prefer-dynamic
140+
RUSTFLAGS_STAGE3 += -Z prefer-dynamic
144141

145142
# platform-specific auto-configuration
146143
include $(CFG_SRC_DIR)mk/platform.mk
@@ -227,7 +224,7 @@ GENERATED :=
227224
define DEF_LIBS
228225

229226
CFG_RUNTIME_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustrt)
230-
CFG_RUSTLLVM_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustllvm)
227+
CFG_RUSTLLVM_$(1) :=$(call CFG_LIB_NAME_$(1),rustllvm)
231228
CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
232229
CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra)
233230
CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
@@ -254,8 +251,6 @@ LIBRUSTUV_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustuv)
254251
EXTRALIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,extra)
255252
STDLIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,std)
256253
LIBRUSTUV_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustuv)
257-
LIBSYNTAX_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,syntax)
258-
LIBRUSTC_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustc)
259254

260255
endef
261256

@@ -433,6 +428,8 @@ TLIBRUSTUV_DEFAULT$(1)_T_$(2)_H_$(3) = \
433428
# Preqrequisites for using the stageN compiler
434429
HSREQ$(1)_H_$(3) = \
435430
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
431+
$$(HLIB$(1)_H_$(3))/$(CFG_RUNTIME_$(3)) \
432+
$$(HLIB$(1)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
436433
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
437434
$$(HEXTRALIB_DEFAULT$(1)_H_$(3)) \
438435
$$(HLIBSYNTAX_DEFAULT$(1)_H_$(3)) \

branches/try2/mk/clean.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ clean$(1)_T_$(2)_H_$(3):
132132
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTUV_GLOB_$(2))
133133
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTUV_RGLOB_$(2))
134134
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB_$(2))
135-
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_RGLOB_$(2))
136135
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_GLOB_$(2))
137-
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_RGLOB_$(2))
138136
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
139137
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
140138
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(2))

branches/try2/mk/host.mk

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,21 @@ define CP_HOST_STAGE_N
2626
$$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
2727
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X_$(4)) \
2828
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
29+
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
2930
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
3031
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
3132
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
3233
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
33-
$$(HLIBRUSTC_DEFAULT$(2)_H_$(4)) \
34-
$$(HLIBSYNTAX_DEFAULT$(2)_H_$(4)) \
3534
| $$(HBIN$(2)_H_$(4))/
35+
3636
@$$(call E, cp: $$@)
3737
$$(Q)cp $$< $$@
3838

3939
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
4040
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
4141
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)) \
4242
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
43+
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
4344
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
4445
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
4546
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
@@ -56,6 +57,7 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
5657
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
5758
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBSYNTAX_$(4)) \
5859
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
60+
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
5961
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
6062
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
6163
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
@@ -128,6 +130,12 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTUV_$(4)): \
128130
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(4)),$$(notdir $$@))
129131
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(4)),$$(notdir $$@))
130132

133+
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
134+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
135+
| $$(HLIB$(2)_H_$(4))/
136+
@$$(call E, cp: $$@)
137+
$$(Q)cp $$< $$@
138+
131139
$$(HBIN$(2)_H_$(4))/:
132140
mkdir -p $$@
133141

branches/try2/mk/install.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
103103
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
104104
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
105105
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
106+
$$(Q)$$(call INSTALL_LIB,$$(CFG_RUSTLLVM_$(1)))
106107
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1)))
107108
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_RGLOB_$(1)))
108109
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1)))
@@ -153,6 +154,7 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_))
153154
$(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD)))
154155
$(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD)))
155156
$(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD)))
157+
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD)))
156158
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustc.1)
157159
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustdoc.1)
158160
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustpkg.1)
@@ -167,6 +169,7 @@ uninstall:
167169
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD))
168170
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD))
169171
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD))
172+
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD))
170173
$(Q)for i in \
171174
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD))) \
172175
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_RGLOB_$(CFG_BUILD))) \

branches/try2/mk/llvm.mk

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,5 @@ $$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
4444

4545
endef
4646

47-
$(foreach host,$(CFG_HOST), \
48-
$(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
49-
50-
$(S)src/librustc/lib/llvmdeps.rs: \
51-
$(LLVM_CONFIGS) \
52-
$(S)src/etc/mklldeps.py
53-
$(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
54-
"$(LLVM_COMPONENTS)" $(LLVM_CONFIGS) \
55-
> $@
56-
5747
$(foreach host,$(CFG_HOST), \
5848
$(eval $(call DEF_LLVM_RULES,$(host))))

branches/try2/mk/rustllvm.mk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
3232
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
3333
ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
3434

35-
$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1))
35+
$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
36+
$$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
3637
@$$(call E, link: $$@)
37-
$$(Q)$$(AR_$(1)) rcs $$@ $$(RUSTLLVM_OBJS_OBJS_$(1))
38+
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
39+
$$(CFG_GCCISH_PRE_LIB_FLAGS_$(1)) $$(LLVM_LIBS_$(1)) \
40+
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) \
41+
$$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM_$(1)))
3842

3943
$(1)/rustllvm/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
4044
@$$(call E, compile: $$@)

branches/try2/mk/stage0.mk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ endif
2727

2828
# Host libs will be extracted by the above rule
2929

30-
# NOTE: remove all these after the next snapshot
30+
$(HLIB0_H_$(CFG_BUILD))/$(CFG_RUNTIME_$(CFG_BUILD)): \
31+
$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
32+
| $(HLIB0_H_$(CFG_BUILD))/
33+
$(Q)touch $@
34+
3135
$(HLIB0_H_$(CFG_BUILD))/$(CFG_STDLIB_$(CFG_BUILD)): \
3236
$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
3337
| $(HLIB0_H_$(CFG_BUILD))/
@@ -72,7 +76,12 @@ $$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
7276
@$$(call E, cp: $$@)
7377
$$(Q)cp $$< $$@
7478

75-
# NOTE: removing everything below after the next snapshot
79+
$$(HLIB0_H_$(1))/$(CFG_RUNTIME_$(1)): \
80+
$$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_RUNTIME_$(1)) \
81+
| $(HLIB0_H_$(1))/
82+
@$$(call E, cp: $$@)
83+
$$(Q)cp $$< $$@
84+
7685
$$(HLIB0_H_$(1))/$(CFG_STDLIB_$(1)): \
7786
$$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_STDLIB_$(1)) \
7887
| $(HLIB0_H_$(1))/

branches/try2/mk/target.mk

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
103103
| $$(TLIB$(1)_T_$(2)_H_$(3))/
104104
@$$(call E, compile_and_link: $$@)
105105
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
106-
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
107106
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
108107
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
109-
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
110108

111109
# Only build the compiler for host triples
112110
ifneq ($$(findstring $(2),$$(CFG_HOST)),)
@@ -121,19 +119,14 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
121119
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER = $(2)
122120
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
123121
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
124-
$(S)src/librustc/lib/llvmdeps.rs \
125122
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
126123
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
127124
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
128125
| $$(TLIB$(1)_T_$(2)_H_$(3))/
129126
@$$(call E, compile_and_link: $$@)
130127
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
131-
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
132-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
133-
-L "$$(LLVM_LIBDIR_$(3))" \
134-
--out-dir $$(@D) $$< && touch $$@
128+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
135129
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
136-
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
137130

138131
# NOTE: after the next snapshot remove these '-L' flags
139132
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \

branches/try2/mk/tests.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ $(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)): \
376376
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
377377
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
378378
@$$(call E, compile_and_link: $$@)
379-
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
380-
-L "$$(LLVM_LIBDIR_$(3))"
379+
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
381380

382381
$(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
383382
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \

branches/try2/src/etc/emacs/rust-mode.el

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
;; or one further indent from that if either current line
8585
;; begins with 'else', or previous line didn't end in
8686
;; semi, comma or brace (other than whitespace and line
87-
;; comments) , and wasn't an attribute. But if we have
87+
;; comments) , and wasn't an attribute. But if we have
8888
;; something after the open brace and ending with a comma,
8989
;; treat it as fields and align them. PHEW.
9090
((> level 0)
@@ -213,15 +213,15 @@
213213

214214
(defun rust-fill-prefix-for-comment-start (line-start)
215215
"Determine what to use for `fill-prefix' based on what is at the beginning of a line."
216-
(let ((result
216+
(let ((result
217217
;; Replace /* with same number of spaces
218218
(replace-regexp-in-string
219-
"\\(?:/\\*+\\)[!*]"
219+
"\\(?:/\\*+\\)[!*]"
220220
(lambda (s)
221221
;; We want the * to line up with the first * of the comment start
222222
(concat (make-string (- (length s) 2) ?\x20) "*"))
223223
line-start)))
224-
;; Make sure we've got at least one space at the end
224+
;; Make sure we've got at least one space at the end
225225
(if (not (= (aref result (- (length result) 1)) ?\x20))
226226
(setq result (concat result " ")))
227227
result))
@@ -247,14 +247,14 @@
247247
;; inferring it from the comment start.
248248
(let ((next-bol (line-beginning-position 2)))
249249
(while (save-excursion
250-
(end-of-line)
251-
(syntax-ppss-flush-cache 1)
252-
(and (nth 4 (syntax-ppss))
253-
(save-excursion
254-
(beginning-of-line)
255-
(looking-at paragraph-start))
256-
(looking-at "[[:space:]]*$")
257-
(nth 4 (syntax-ppss next-bol))))
250+
(end-of-line)
251+
(syntax-ppss-flush-cache 1)
252+
(and (nth 4 (syntax-ppss))
253+
(save-excursion
254+
(beginning-of-line)
255+
(looking-at paragraph-start))
256+
(looking-at "[[:space:]]*$")
257+
(nth 4 (syntax-ppss next-bol))))
258258
(goto-char next-bol)))
259259

260260
(syntax-ppss-flush-cache 1)
@@ -269,10 +269,10 @@
269269

270270
(defun rust-with-comment-fill-prefix (body)
271271
(let*
272-
((line-string (buffer-substring-no-properties
272+
((line-string (buffer-substring-no-properties
273273
(line-beginning-position) (line-end-position)))
274274
(line-comment-start
275-
(when (nth 4 (syntax-ppss))
275+
(when (nth 4 (syntax-ppss))
276276
(cond
277277
;; If we're inside the comment and see a * prefix, use it
278278
((string-match "^\\([[:space:]]*\\*+[[:space:]]*\\)"
@@ -281,9 +281,9 @@
281281
;; If we're at the start of a comment, figure out what prefix
282282
;; to use for the subsequent lines after it
283283
((string-match (concat "[[:space:]]*" comment-start-skip) line-string)
284-
(rust-fill-prefix-for-comment-start
284+
(rust-fill-prefix-for-comment-start
285285
(match-string 0 line-string))))))
286-
(fill-prefix
286+
(fill-prefix
287287
(or line-comment-start
288288
fill-prefix)))
289289
(funcall body)))
@@ -294,7 +294,7 @@
294294
(defun rust-fill-paragraph (&rest args)
295295
"Special wrapping for `fill-paragraph' to handle multi-line comments with a * prefix on each line."
296296
(rust-in-comment-paragraph
297-
(lambda ()
297+
(lambda ()
298298
(rust-with-comment-fill-prefix
299299
(lambda ()
300300
(let
@@ -321,20 +321,6 @@
321321
(rust-with-comment-fill-prefix
322322
(lambda () (comment-indent-new-line arg))))
323323

324-
;;; Imenu support
325-
(defvar rust-imenu-generic-expression
326-
(append (loop for item in
327-
'("enum" "struct" "type" "mod" "fn")
328-
collect `(nil ,(rust-re-item-def item) 1))
329-
`(("Impl" ,(rust-re-item-def "impl") 1)))
330-
"Value for `imenu-generic-expression' in Rust mode.
331-
332-
Create a flat index of the item definitions in a Rust file.
333-
334-
Imenu will show all the enums, structs, etc. at the same level.
335-
Implementations will be shown under the `Impl` subheading.
336-
Use idomenu (imenu with ido-mode) for best mileage.")
337-
338324
;; For compatibility with Emacs < 24, derive conditionally
339325
(defalias 'rust-parent-mode
340326
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
@@ -362,7 +348,7 @@ Use idomenu (imenu with ido-mode) for best mileage.")
362348
(set (make-local-variable 'indent-tabs-mode) nil)
363349

364350
;; Allow paragraph fills for comments
365-
(set (make-local-variable 'comment-start-skip)
351+
(set (make-local-variable 'comment-start-skip)
366352
"\\(?://[/!]*\\|/\\*[*!]?\\)[[:space:]]*")
367353
(set (make-local-variable 'paragraph-start)
368354
(concat "[[:space:]]*\\(?:" comment-start-skip "\\|\\*/?[[:space:]]*\\|\\)$"))
@@ -373,7 +359,6 @@ Use idomenu (imenu with ido-mode) for best mileage.")
373359
(set (make-local-variable 'adaptive-fill-function) 'rust-find-fill-prefix)
374360
(set (make-local-variable 'comment-multi-line) t)
375361
(set (make-local-variable 'comment-line-break-function) 'rust-comment-indent-new-line)
376-
(set (make-local-variable 'imenu-generic-expression) rust-imenu-generic-expression)
377362
)
378363

379364

0 commit comments

Comments
 (0)