File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ extern mod syntax;
72
72
73
73
use std:: { libc, io, os, task} ;
74
74
use std:: cell:: Cell ;
75
+ use extra:: rl:: CompletionCb ;
75
76
use extra:: rl;
76
77
77
78
use rustc:: driver:: { driver, session} ;
@@ -520,6 +521,19 @@ pub fn main() {
520
521
main_args ( args) ;
521
522
}
522
523
524
+ struct Completer ;
525
+
526
+ impl CompletionCb for Completer {
527
+ fn complete ( & self , line : ~str , suggest : & fn ( ~str ) ) {
528
+ if line. starts_with ( ":" ) {
529
+ suggest ( ~": clear") ;
530
+ suggest ( ~": exit") ;
531
+ suggest ( ~": help") ;
532
+ suggest ( ~": load") ;
533
+ }
534
+ }
535
+ }
536
+
523
537
pub fn main_args ( args : & [ ~str ] ) {
524
538
#[ fixed_stack_segment] ; #[ inline( never) ] ;
525
539
@@ -543,13 +557,8 @@ pub fn main_args(args: &[~str]) {
543
557
println( "unstable. If you encounter problems, please use the" ) ;
544
558
println ( "compiler instead. Type :help for help." ) ;
545
559
546
- do rl:: complete |line, suggest| {
547
- if line. starts_with ( ":" ) {
548
- suggest ( ~": clear") ;
549
- suggest ( ~": exit") ;
550
- suggest ( ~": help") ;
551
- suggest ( ~": load") ;
552
- }
560
+ unsafe {
561
+ rl:: complete ( @Completer as @CompletionCb )
553
562
}
554
563
}
555
564
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ use syntax::print::pprust;
15
15
use syntax:: parse:: token;
16
16
use syntax:: visit;
17
17
18
- struct EachBindingVisitor {
19
- f : @ fn ( & ast:: Path , ast:: NodeId )
18
+ struct EachBindingVisitor < ' self > {
19
+ f : & ' self fn ( & ast:: Path , ast:: NodeId )
20
20
}
21
21
22
- impl visit:: Visitor < ( ) > for EachBindingVisitor {
22
+ impl < ' self > visit:: Visitor < ( ) > for EachBindingVisitor < ' self > {
23
23
fn visit_pat ( & mut self , pat : @ast:: Pat , _: ( ) ) {
24
24
match pat. node {
25
25
ast:: PatIdent ( _, ref path, _) => {
@@ -32,7 +32,7 @@ impl visit::Visitor<()> for EachBindingVisitor {
32
32
}
33
33
}
34
34
35
- pub fn each_binding ( l : @ast:: Local , f : @ fn ( & ast:: Path , ast:: NodeId ) ) {
35
+ pub fn each_binding ( l : @ast:: Local , f : & fn ( & ast:: Path , ast:: NodeId ) ) {
36
36
use syntax:: visit:: Visitor ;
37
37
38
38
let mut vt = EachBindingVisitor { f : f } ;
You can’t perform that action at this time.
0 commit comments