Skip to content

Commit 67f8876

Browse files
committed
---
yaml --- r: 82570 b: refs/heads/auto c: a170183 h: refs/heads/master v: v3
1 parent 8d461b0 commit 67f8876

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
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 68ea9aed96b6b8147b6c37b844c85cb7ae2867f4
16+
refs/heads/auto: a170183ba39c32b9f85c50a379dc4f9b8bd6e0fa
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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/auto/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)