Skip to content

Commit f46fa9e

Browse files
committed
---
yaml --- r: 94154 b: refs/heads/try c: 9522a08 h: refs/heads/master v: v3
1 parent 3978698 commit f46fa9e

File tree

10 files changed

+89
-305
lines changed

10 files changed

+89
-305
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: ad292ac8fd1fe79b4db389a32dde986b9549d6c3
5+
refs/heads/try: 9522a08cf06a76302eed114b0281b8743ae36dcc
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/etc/emacs/rust-mode-tests.el

Lines changed: 24 additions & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,24 @@ Also, the result should be the same regardless of whether the code is at the beg
5252
(loop
5353
for pad-at-beginning from 0 to 1
5454
do (loop for pad-at-end from 0 to 1
55-
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
56-
with padding-end = (if (= 0 pad-at-end) "" padding)
57-
with padding-adjust = (* padding-len pad-at-beginning)
58-
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
59-
with padding-end = (if (= 0 pad-at-end) "" padding)
60-
;; If we're adding space to the beginning, and our start position
61-
;; is at the very beginning, we want to test within the added space.
62-
;; Otherwise adjust the start and end for the beginning padding.
63-
with start-pos = (if (= 1 start-pos) 1 (+ padding-adjust start-pos))
64-
with end-pos = (+ end-pos padding-adjust)
65-
do (loop for pos from start-pos to end-pos
66-
do (rust-test-manip-code
67-
(concat padding-beginning unfilled padding-end)
68-
pos
69-
(lambda ()
70-
(let ((fill-column rust-test-fill-column))
71-
(fill-paragraph)))
72-
(concat padding-beginning expected padding-end)))))))
55+
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
56+
with padding-end = (if (= 0 pad-at-end) "" padding)
57+
with padding-adjust = (* padding-len pad-at-beginning)
58+
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
59+
with padding-end = (if (= 0 pad-at-end) "" padding)
60+
;; If we're adding space to the beginning, and our start position
61+
;; is at the very beginning, we want to test within the added space.
62+
;; Otherwise adjust the start and end for the beginning padding.
63+
with start-pos = (if (= 1 start-pos) 1 (+ padding-adjust start-pos))
64+
with end-pos = (+ end-pos padding-adjust)
65+
do (loop for pos from start-pos to end-pos
66+
do (rust-test-manip-code
67+
(concat padding-beginning unfilled padding-end)
68+
pos
69+
(lambda ()
70+
(let ((fill-column rust-test-fill-column))
71+
(fill-paragraph)))
72+
(concat padding-beginning expected padding-end)))))))
7373

7474
(ert-deftest fill-paragraph-top-level-multi-line-style-doc-comment-second-line ()
7575
(test-fill-paragraph
@@ -262,14 +262,14 @@ fn bar() { }" 14 67))
262262
/// "
263263
103
264264
"This is the second really really really really really really long paragraph"
265-
"/// This is the first really
265+
"/// This is the first really
266266
/// really really really really
267267
/// really really long paragraph
268268
///
269269
/// This is the second really
270270
/// really really really really
271271
/// really long paragraph"
272-
))
272+
))
273273

274274
(ert-deftest auto-fill-multi-line-prefixless ()
275275
(test-auto-fill
@@ -295,7 +295,7 @@ very very very long string
295295

296296
(ert-deftest indent-struct-fields-aligned ()
297297
(test-indent
298-
"
298+
"
299299
struct Foo { bar: int,
300300
baz: int }
301301
@@ -305,7 +305,7 @@ struct Blah {x:int,
305305

306306
(ert-deftest indent-doc-comments ()
307307
(test-indent
308-
"
308+
"
309309
/**
310310
* This is a doc comment
311311
*
@@ -411,7 +411,7 @@ fn nexted_fns(a: fn(b:int,
411411
0
412412
}
413413
"
414-
))
414+
))
415415

416416
(ert-deftest indent-multi-line-expr ()
417417
(test-indent
@@ -423,206 +423,4 @@ fn foo()
423423
b();
424424
}
425425
"
426-
))
427-
428-
(setq rust-test-motion-string
429-
"
430-
fn fn1(arg: int) -> bool {
431-
let x = 5;
432-
let y = b();
433-
true
434-
}
435-
436-
fn fn2(arg: int) -> bool {
437-
let x = 5;
438-
let y = b();
439-
true
440-
}
441-
442-
pub fn fn3(arg: int) -> bool {
443-
let x = 5;
444-
let y = b();
445-
true
446-
}
447-
448-
struct Foo {
449-
x: int
450-
}
451-
"
452-
rust-test-region-string rust-test-motion-string
453-
;; Symbol -> (line column)
454-
rust-test-positions-alist '((start-of-fn1 (2 0))
455-
(start-of-fn1-middle-of-line (2 15))
456-
(middle-of-fn1 (3 7))
457-
(end-of-fn1 (6 0))
458-
(between-fn1-fn2 (7 0))
459-
(start-of-fn2 (8 0))
460-
(middle-of-fn2 (10 4))
461-
(before-start-of-fn1 (1 0))
462-
(after-end-of-fn2 (13 0))
463-
(beginning-of-fn3 (14 0))
464-
(middle-of-fn3 (16 4))
465-
(middle-of-struct (21 10))
466-
(before-start-of-struct (19 0))
467-
(after-end-of-struct (23 0))))
468-
469-
(defun rust-get-buffer-pos (pos-symbol)
470-
"Get buffer position from POS-SYMBOL.
471-
472-
POS-SYMBOL is a symbol found in `rust-test-positions-alist'.
473-
Convert the line-column information from that list into a buffer position value."
474-
(interactive "P")
475-
(pcase-let ((`(,line ,column) (cadr (assoc pos-symbol rust-test-positions-alist))))
476-
(save-excursion
477-
(goto-line line)
478-
(move-to-column column)
479-
(point))))
480-
481-
;;; TODO: Maybe add an ERT explainer function (something that shows the
482-
;;; surrounding code of the final point, not just the position).
483-
(defun rust-test-motion (source-code init-pos final-pos manip-func &optional &rest args)
484-
"Test that MANIP-FUNC moves point from INIT-POS to FINAL-POS.
485-
486-
If ARGS are provided, send them to MANIP-FUNC.
487-
488-
INIT-POS, FINAL-POS are position symbols found in `rust-test-positions-alist'."
489-
(with-temp-buffer
490-
(rust-mode)
491-
(insert source-code)
492-
(goto-char (rust-get-buffer-pos init-pos))
493-
(apply manip-func args)
494-
(should (equal (point) (rust-get-buffer-pos final-pos)))))
495-
496-
(defun rust-test-region (source-code init-pos reg-beg reg-end manip-func &optional &rest args)
497-
"Test that MANIP-FUNC marks region from REG-BEG to REG-END.
498-
499-
INIT-POS is the initial position of point.
500-
If ARGS are provided, send them to MANIP-FUNC.
501-
All positions are position symbols found in `rust-test-positions-alist'."
502-
(with-temp-buffer
503-
(rust-mode)
504-
(insert source-code)
505-
(goto-char (rust-get-buffer-pos init-pos))
506-
(apply manip-func args)
507-
(should (equal (list (region-beginning) (region-end))
508-
(list (rust-get-buffer-pos reg-beg)
509-
(rust-get-buffer-pos reg-end))))))
510-
511-
(ert-deftest rust-beginning-of-defun-from-middle-of-fn ()
512-
(rust-test-motion
513-
rust-test-motion-string
514-
'middle-of-fn1
515-
'start-of-fn1
516-
#'beginning-of-defun))
517-
518-
(ert-deftest rust-beginning-of-defun-from-end ()
519-
(rust-test-motion
520-
rust-test-motion-string
521-
'end-of-fn1
522-
'start-of-fn1
523-
#'beginning-of-defun))
524-
525-
(ert-deftest rust-beginning-of-defun-before-open-brace ()
526-
(rust-test-motion
527-
rust-test-motion-string
528-
'start-of-fn1-middle-of-line
529-
'start-of-fn1
530-
#'beginning-of-defun))
531-
532-
(ert-deftest rust-beginning-of-defun-between-fns ()
533-
(rust-test-motion
534-
rust-test-motion-string
535-
'between-fn1-fn2
536-
'start-of-fn1
537-
#'beginning-of-defun))
538-
539-
(ert-deftest rust-beginning-of-defun-with-arg ()
540-
(rust-test-motion
541-
rust-test-motion-string
542-
'middle-of-fn2
543-
'start-of-fn1
544-
#'beginning-of-defun 2))
545-
546-
(ert-deftest rust-beginning-of-defun-with-negative-arg ()
547-
(rust-test-motion
548-
rust-test-motion-string
549-
'middle-of-fn1
550-
'beginning-of-fn3
551-
#'beginning-of-defun -2))
552-
553-
(ert-deftest rust-beginning-of-defun-pub-fn ()
554-
(rust-test-motion
555-
rust-test-motion-string
556-
'middle-of-fn3
557-
'beginning-of-fn3
558-
#'beginning-of-defun))
559-
560-
(ert-deftest rust-end-of-defun-from-middle-of-fn ()
561-
(rust-test-motion
562-
rust-test-motion-string
563-
'middle-of-fn1
564-
'between-fn1-fn2
565-
#'end-of-defun))
566-
567-
(ert-deftest rust-end-of-defun-from-beg ()
568-
(rust-test-motion
569-
rust-test-motion-string
570-
'start-of-fn1
571-
'between-fn1-fn2
572-
#'end-of-defun))
573-
574-
(ert-deftest rust-end-of-defun-before-open-brace ()
575-
(rust-test-motion
576-
rust-test-motion-string
577-
'start-of-fn1-middle-of-line
578-
'between-fn1-fn2
579-
#'end-of-defun))
580-
581-
(ert-deftest rust-end-of-defun-between-fns ()
582-
(rust-test-motion
583-
rust-test-motion-string
584-
'between-fn1-fn2
585-
'after-end-of-fn2
586-
#'end-of-defun))
587-
588-
(ert-deftest rust-end-of-defun-with-arg ()
589-
(rust-test-motion
590-
rust-test-motion-string
591-
'middle-of-fn1
592-
'after-end-of-fn2
593-
#'end-of-defun 2))
594-
595-
(ert-deftest rust-end-of-defun-with-negative-arg ()
596-
(rust-test-motion
597-
rust-test-motion-string
598-
'middle-of-fn3
599-
'between-fn1-fn2
600-
#'end-of-defun -2))
601-
602-
(ert-deftest rust-mark-defun-from-middle-of-fn ()
603-
(rust-test-region
604-
rust-test-region-string
605-
'middle-of-fn2
606-
'between-fn1-fn2 'after-end-of-fn2
607-
#'mark-defun))
608-
609-
(ert-deftest rust-mark-defun-from-end ()
610-
(rust-test-region
611-
rust-test-region-string
612-
'end-of-fn1
613-
'before-start-of-fn1 'between-fn1-fn2
614-
#'mark-defun))
615-
616-
(ert-deftest rust-mark-defun-start-of-defun ()
617-
(rust-test-region
618-
rust-test-region-string
619-
'start-of-fn2
620-
'between-fn1-fn2 'after-end-of-fn2
621-
#'mark-defun))
622-
623-
(ert-deftest rust-mark-defun-from-middle-of-struct ()
624-
(rust-test-region
625-
rust-test-region-string
626-
'middle-of-struct
627-
'before-start-of-struct 'after-end-of-struct
628-
#'mark-defun))
426+
))

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

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
;;; Imenu support
325325
(defvar rust-imenu-generic-expression
326326
(append (loop for item in
327-
'("enum" "struct" "type" "mod" "fn" "trait")
327+
'("enum" "struct" "type" "mod" "fn")
328328
collect `(nil ,(rust-re-item-def item) 1))
329329
`(("Impl" ,(rust-re-item-def "impl") 1)))
330330
"Value for `imenu-generic-expression' in Rust mode.
@@ -335,46 +335,6 @@ Imenu will show all the enums, structs, etc. at the same level.
335335
Implementations will be shown under the `Impl` subheading.
336336
Use idomenu (imenu with ido-mode) for best mileage.")
337337

338-
;;; Defun Motions
339-
340-
;;; Start of a Rust item
341-
(setq rust-top-item-beg-re
342-
(concat "^\\s-*\\(?:priv\\|pub\\)?\\s-*"
343-
(regexp-opt
344-
'("enum" "struct" "type" "mod" "use" "fn" "static" "impl"
345-
"extern" "impl" "static" "trait"
346-
))))
347-
348-
(defun rust-beginning-of-defun (&optional arg)
349-
"Move backward to the beginning of the current defun.
350-
351-
With ARG, move backward multiple defuns. Negative ARG means
352-
move forward.
353-
354-
This is written mainly to be used as `beginning-of-defun-function' for Rust.
355-
Don't move to the beginning of the line. `beginning-of-defun',
356-
which calls this, does that afterwards."
357-
(interactive "p")
358-
(re-search-backward (concat "^\\(" rust-top-item-beg-re "\\)\\b")
359-
nil 'move (or arg 1)))
360-
361-
(defun rust-end-of-defun ()
362-
"Move forward to the next end of defun.
363-
364-
With argument, do it that many times.
365-
Negative argument -N means move back to Nth preceding end of defun.
366-
367-
Assume that this is called after beginning-of-defun. So point is
368-
at the beginning of the defun body.
369-
370-
This is written mainly to be used as `end-of-defun-function' for Rust."
371-
(interactive "p")
372-
;; Find the opening brace
373-
(re-search-forward "[{]" nil t)
374-
(goto-char (match-beginning 0))
375-
;; Go to the closing brace
376-
(forward-sexp))
377-
378338
;; For compatibility with Emacs < 24, derive conditionally
379339
(defalias 'rust-parent-mode
380340
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
@@ -414,8 +374,6 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
414374
(set (make-local-variable 'comment-multi-line) t)
415375
(set (make-local-variable 'comment-line-break-function) 'rust-comment-indent-new-line)
416376
(set (make-local-variable 'imenu-generic-expression) rust-imenu-generic-expression)
417-
(set (make-local-variable 'beginning-of-defun-function) 'rust-beginning-of-defun)
418-
(set (make-local-variable 'end-of-defun-function) 'rust-end-of-defun)
419377
)
420378

421379

branches/try/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ impl<'self> Visitor<()> for CheckLoanCtxt<'self> {
5858
b:ast::P<ast::Block>, s:Span, n:ast::NodeId, _:()) {
5959
check_loans_in_fn(self, fk, fd, b, s, n);
6060
}
61+
62+
// FIXME(#10894) should continue recursing
63+
fn visit_ty(&mut self, _t: &ast::Ty, _: ()) {}
6164
}
6265

6366
pub fn check_loans(bccx: &BorrowckCtxt,

branches/try/src/librustc/middle/lint.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,9 @@ impl<'self> Visitor<()> for Context<'self> {
13641364
visit::walk_variant(cx, v, g, ());
13651365
})
13661366
}
1367+
1368+
// FIXME(#10894) should continue recursing
1369+
fn visit_ty(&mut self, _t: &ast::Ty, _: ()) {}
13671370
}
13681371

13691372
impl<'self> IdVisitingOperation for Context<'self> {

branches/try/src/librustc/middle/moves.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ impl visit::Visitor<()> for VisitContext {
202202
fn visit_local(&mut self, l:@Local, _:()) {
203203
compute_modes_for_local(self, l);
204204
}
205+
// FIXME(#10894) should continue recursing
206+
fn visit_ty(&mut self, _t: &Ty, _: ()) {}
205207
}
206208

207209
pub fn compute_moves(tcx: ty::ctxt,

0 commit comments

Comments
 (0)