Skip to content

Commit f547214

Browse files
committed
---
yaml --- r: 145390 b: refs/heads/try2 c: a170183 h: refs/heads/master v: v3
1 parent 51f3872 commit f547214

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
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: 68ea9aed96b6b8147b6c37b844c85cb7ae2867f4
8+
refs/heads/try2: a170183ba39c32b9f85c50a379dc4f9b8bd6e0fa
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librusti/rusti.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ extern mod syntax;
7272

7373
use std::{libc, io, os, task};
7474
use std::cell::Cell;
75+
use extra::rl::CompletionCb;
7576
use extra::rl;
7677

7778
use rustc::driver::{driver, session};
@@ -520,6 +521,19 @@ pub fn main() {
520521
main_args(args);
521522
}
522523

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+
523537
pub fn main_args(args: &[~str]) {
524538
#[fixed_stack_segment]; #[inline(never)];
525539

@@ -543,13 +557,8 @@ pub fn main_args(args: &[~str]) {
543557
println("unstable. If you encounter problems, please use the");
544558
println("compiler instead. Type :help for help.");
545559

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)
553562
}
554563
}
555564

branches/try2/src/librusti/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ use syntax::print::pprust;
1515
use syntax::parse::token;
1616
use syntax::visit;
1717

18-
struct EachBindingVisitor {
19-
f: @fn(&ast::Path, ast::NodeId)
18+
struct EachBindingVisitor<'self> {
19+
f: &'self fn(&ast::Path, ast::NodeId)
2020
}
2121

22-
impl visit::Visitor<()> for EachBindingVisitor {
22+
impl<'self> visit::Visitor<()> for EachBindingVisitor<'self> {
2323
fn visit_pat(&mut self, pat:@ast::Pat, _:()) {
2424
match pat.node {
2525
ast::PatIdent(_, ref path, _) => {
@@ -32,7 +32,7 @@ impl visit::Visitor<()> for EachBindingVisitor {
3232
}
3333
}
3434

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)) {
3636
use syntax::visit::Visitor;
3737

3838
let mut vt = EachBindingVisitor{ f: f };

0 commit comments

Comments
 (0)