Giter VIP home page Giter VIP logo

rusti's Introduction

Rusti

A REPL for the Rust programming language.

The rusti project is deprecated. It is not recommended for regular use.

Dependencies

On Unix systems, Rusti requires libncursesw (libncurses on Mac OS).

Building

Rusti builds with Rust nightly, using the Cargo build system.
Currently, it must be built using a nightly release of the Rust compiler released no later than 2016-08-01.

The recommended method of installation is to use the following command to rustup:

rustup install nightly-2016-08-01

Installation using Cargo

Rusti can be installed directly using Cargo. The following command will download, compile, and install Rusti, placing it in ~/.cargo/bin/ or your operating system equivalent, assuming you haved installed nightly-2016-08-01 using rustup:

rustup run nightly-2016-08-01 cargo install --git https://github.com/murarth/rusti

Then you can run it like this:

rustup run nightly-2016-08-01 ~/.cargo/bin/rusti

Building from a Git clone

If using rustup, the following command will create an override to use the correct nightly build within the rusti source tree:

rustup override add nightly-2016-08-01

Build with Cargo:

cargo build

Run tests:

cargo test

Run rusti:

cargo run

Install:

cargo install

Usage

Running rusti gives a prompt that accepts (most) any valid Rust code. If the final statement is an expression, the result will be displayed using the std::fmt::Debug trait. This is equivalent to println!("{:?}", expr);.

rusti=> println!("Hello, world!");
Hello, world!
rusti=> 2 + 2
4
rusti=> (0..5).collect::<Vec<_>>()
[0, 1, 2, 3, 4]

If any delimiters are left open, rusti will continue reading input until they are closed. Only then will the code be executed.

rusti=> fn factorial(n: u32) -> u32 {
rusti.>     match n {
rusti.>         0 => 0,
rusti.>         1 => 1,
rusti.>         n => n * factorial(n - 1),
rusti.>     }
rusti.> }
rusti=> factorial(3)
6
rusti=> factorial(4)
24
rusti=> factorial(5)
120

rusti can also run a file given on the command line.
Note that a rusti input file is not quite the same as a typical Rust program. A typical Rust program contains a function named main. While a rusti program can define functions, no functions will be called automatically. Instead, all statements not within a function body will be executed sequentially, just like interactive mode.

Loading Crates

Loading crates which are part of the standard Rust distribution is as easy as declaring the crate, thusly:

extern crate foo;

However, loading a crate that you have compiled yourself requires some extra steps:

  • First, rusti must be able to find the location of compiled crate.
    You can add a path to its search list using the command line option -L path.
    rusti accepts any number of -L arguments.

  • Secondly, rusti requires both an rlib and a dylib version of the compiled crate. If you're building your crate with Cargo, the following command will build the required files for your project's library:

    cargo rustc --lib -- --crate-type=rlib,dylib
    

    If you're building with rustc directly, simply add --crate-type=rlib,dylib to the build command to produce the required files.

Code completion

rusti provides optional support for code completion using Racer.

To enable code completion, install Racer as outlined in the Installation Instructions and place the racer executable into your PATH.

Commands

These are special inputs interpreted by rusti that are not directly evaluated as Rust code, though they may operate on Rust code.

Commands are invoked by entering a line beginning with . or :, followed by the name of the command and, perhaps, some text used by the command.

Command names may be arbitrarily abbreviated.
For example, .type may be abbreviated as .typ, .ty, or .t.

.block

The .block command will run multiple lines of Rust code as one program.

To end the command and run all code, input . on its own line.

rusti=> .block
rusti+> let a = 1;
rusti+> let b = a * 2;
rusti+> let c = b * 3;
rusti+> c
rusti+> .
6

Entering .q instead will end the command without running code.

.exit

The .exit command exits the REPL loop.

.help

The .help command shows usage text for any available commands.

.load

The .load command evaluates the contents of a named file.

.print

The .print command will display the value of an expression, using the std::fmt::Display trait. This is equivalent to println!("{}", expr);.

.type

The .type command will display the type of an expression without running it.

rusti=> .type 42
42 = i32
rusti=> .t 'x'
'x' = char
rusti=> .t "Hello!"
"Hello!" = &'static str
rusti=> .t (1i32, 2u32)
(1i32, 2u32) = (i32, u32)
rusti=> fn foo() -> i32 { 1 }
rusti=> .t foo
foo = fn() -> i32 {foo}
rusti=> .t foo()
foo() = i32

Limitations

Currently, Rusti has the following limitations. I hope to fix each of them, but some may prove to be large problems to tackle.

  • Functions and types are redefined in each round of input.
    This is inefficient.
  • static items are also redefined in each round of input.
    This means that the address of a static item will change in every round of input and that the values of mut items or those with interior mutability will be reset to their initial definition on each round of input.
    This is bad.
  • Use of thread_local! causes a crash.
    This is bad.
  • let declarations are local to the input in which they are defined.
    They cannot be referenced later and are destroyed after that round of input completes its execution.
    This is inconvenient.
  • And more!

License

Rusti is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

rusti's People

Contributors

achanda avatar badboy avatar bitemyapp avatar bltavares avatar cbcoutinho avatar coder543 avatar jonas-schievink avatar kindlychung avatar mseri avatar murarth avatar quininer avatar wuranbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rusti's Issues

Use of thread-local storage causes a crash

rusti=> thread_local!(static FOO: int = 1);

crashes with:

Relocation type not implemented yet!
UNREACHABLE executed at /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:266!
Aborted (core dumped)

Implement a readline alternative on Windows

The recommended method of using GNU Readline on Windows is to install Cygwin, which is an unappealing option for some users.
A Windows version of the rusti::readline module could be implemented using Windows' console API.

Mac OS X lazy symbol binding failed

Trying to run Rusti gives the following error message:

 Running `target/debug/rusti`
dyld: lazy symbol binding failed: Symbol not found: __ZN6driver19phase_1_parse_input20hfdf988a0e9a4ff55NqaE
  Referenced from: /Users/.../rusti/target/debug/rusti
  Expected in: /usr/local/lib/librustc_driver-4e7c5e5c.dylib

dyld: Symbol not found: __ZN6driver19phase_1_parse_input20hfdf988a0e9a4ff55NqaE
  Referenced from: /Users/.../rusti/target/debug/rusti
  Expected in: /usr/local/lib/librustc_driver-4e7c5e5c.dylib

An unknown error occurred

I get the following error when building on the nightly channel

cargo build
       Fresh winapi v0.2.2
       Fresh getopts v0.2.14
       Fresh winapi-build v0.1.1
       Fresh libc v0.1.10
       Fresh regex-syntax v0.2.1
       Fresh log v0.3.2
       Fresh memchr v0.1.6
       Fresh aho-corasick v0.3.2
       Fresh advapi32-sys v0.1.2
       Fresh kernel32-sys v0.1.4
       Fresh regex v0.1.41
       Fresh rand v0.3.11
       Fresh env_logger v0.3.1
       Fresh tempfile v1.1.1
   Compiling rusti v0.0.1 (file:///Users/dave/code/rusti)
     Running `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g --out-dir /Users/dave/code/rusti/target/debug --emit=dep-info,link -L dependency=/Users/dave/code/rusti/target/debug -L dependency=/Users/dave/code/rusti/target/debug/deps --extern getopts=/Users/dave/code/rusti/target/debug/deps/libgetopts-1be2f24cd9708e15.rlib --extern log=/Users/dave/code/rusti/target/debug/deps/liblog-f18a3e885170bd3f.rlib --extern env_logger=/Users/dave/code/rusti/target/debug/deps/libenv_logger-9877a407b506c549.rlib --extern libc=/Users/dave/code/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --extern tempfile=/Users/dave/code/rusti/target/debug/deps/libtempfile-91489cdece569e6b.rlib`
src/rusti/exec.rs:326:38: 326:40 error: mismatched types:
 expected `&str`,
    found `collections::string::String`
(expected &-ptr,
    found struct `collections::string::String`) [E0308]
src/rusti/exec.rs:326             &sess, ast_map, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
                                                           ^~
src/rusti/exec.rs:326:38: 326:40 help: run `rustc --explain E0308` to see a detailed explanation
src/rusti/exec.rs:390:38: 390:40 error: mismatched types:
 expected `&str`,
    found `collections::string::String`
(expected &-ptr,
    found struct `collections::string::String`) [E0308]
src/rusti/exec.rs:390             &sess, ast_map, &arenas, id, MakeGlobMap::No,
                                                           ^~
src/rusti/exec.rs:390:38: 390:40 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 2 previous errors
Could not compile `rusti`.

Caused by:
  Process didn't exit successfully: `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g --out-dir /Users/dave/code/rusti/target/debug --emit=dep-info,link -L dependency=/Users/dave/code/rusti/target/debug -L dependency=/Users/dave/code/rusti/target/debug/deps --extern getopts=/Users/dave/code/rusti/target/debug/deps/libgetopts-1be2f24cd9708e15.rlib --extern log=/Users/dave/code/rusti/target/debug/deps/liblog-f18a3e885170bd3f.rlib --extern env_logger=/Users/dave/code/rusti/target/debug/deps/libenv_logger-9877a407b506c549.rlib --extern libc=/Users/dave/code/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --extern tempfile=/Users/dave/code/rusti/target/debug/deps/libtempfile-91489cdece569e6b.rlib` (exit code: 101)

`info` command, similar to GHCi

The command would resolve a name and print its type (for a named value) or definition (for a named type) and the place it was defined.

I don't think this is possible without a change to rustc. Resolution is performed by a rustc_resolve::Resolver instance, but the type is private and the name resolution data is dropped after it serves its purpose. CrateAnalysis uses NodeId as keys rather than names.

cargo build broken ?

Here is what I am using:

lowks@lowkster ~/src/rustlang/rusti $ /usr/local/bin/cargo --version
cargo 0.0.1-pre-nightly (5af754d 2014-12-18 01:50:48 +0000)
lowks@lowkster ~/src/rustlang/rusti $ /usr/local/bin/rustc --version
rustc 0.13.0-nightly (99d6956c3 2014-12-18 20:32:07 +0000)

Here is the result I got from cargo build

src/rusti/input.rs:16:5: 16:25 error: unresolved import `std::thread::Builder`. Could not find `thread` in `std`
src/rusti/input.rs:16 use std::thread::Builder;
                          ^~~~~~~~~~~~~~~~~~~~
src/rusti/exec.rs:20:5: 20:25 error: unresolved import `std::thread::Builder`. Could not find `thread` in `std`
src/rusti/exec.rs:20 use std::thread::Builder;
                         ^~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `rusti`.

Broken against nightly

~/src/rusti (master=)$ cargo run
   Compiling libc v0.1.6
   Compiling regex v0.1.30
   Compiling log v0.3.1
   Compiling getopts v0.2.10
   Compiling env_logger v0.3.0
   Compiling rusti v0.0.1 (file:///Users/Abhishek/src/rusti)
     Running `target/debug/rusti`
rusti=> println!("Hello world!")
LLVM ERROR: Program used external function '___morestack_addr' which could not be resolved!
An unknown error occurred

To learn more, run the command again with --verbose.

Compiler info:

~/src/rusti (master=)$ rustc --version
rustc 1.1.0-nightly (ce1150b9f 2015-05-04) (built 2015-05-03)

`.type` incorrectly classifies unboxed closures as a boxed closure

// OK
rusti=> .t || 0i
|| 0i = || -> int
// Err
rusti=> .t |:| 0i
|:| 0i = 'static |()|:'static -> int
// Err
rusti=> .t |&:| 0i
|&:| 0i = 'static |()|:'static -> int

Unboxed closures have anonymous types, so maybe you could report them by their Fn* trait, like:

|:| 0i = F where F: FnOnce() -> int
// or
|:| 0i = FnOnce() -> int implementor

(Or you could do what rustc does and just report them as closure :P)

OSX Lion - get an error on PResult import

$ cargo build
 > Downloading log v0.3.1
 > Downloading libc v0.1.5
 > Downloading getopts v0.2.9
 > Downloading regex v0.1.26
 > Downloading env_logger v0.3.0
     Compiling regex v0.1.26
     Compiling libc v0.1.5
     Compiling log v0.3.1
     Compiling getopts v0.2.9
     Compiling env_logger v0.3.0
     Compiling rusti v0.0.1 (file:///Users/agilestyle/Dev/rust/rusti)
src/rusti/input.rs:31:38: 31:45 error: unresolved import `syntax::parse::PResult`. There is no `PResult` in `syntax::parse`
src/rusti/input.rs:31 use syntax::parse::{classify, token, PResult};
                                                           ^~~~~~~
error: aborting due to previous error
Could not compile `rusti`.

To learn more, run the command again with --verbose.

Build fails with error: use of unstable library feature 'path_ext_deprecated'

# cargo build
 Downloading tempfile v1.1.1
 Downloading getopts v0.2.14
 Downloading log v0.3.2
 Downloading kernel32-sys v0.1.4
 Downloading aho-corasick v0.3.2
 Downloading regex-syntax v0.2.1
 Downloading libc v0.1.10
 Downloading winapi v0.2.2
 Downloading env_logger v0.3.1
   Compiling libc v0.1.10
   Compiling winapi v0.2.2
   Compiling regex-syntax v0.2.1
   Compiling getopts v0.2.14
   Compiling winapi-build v0.1.1
   Compiling log v0.3.2
   Compiling memchr v0.1.6
   Compiling kernel32-sys v0.1.4
   Compiling advapi32-sys v0.1.2
   Compiling aho-corasick v0.3.2
   Compiling rand v0.3.11
   Compiling regex v0.1.41
   Compiling tempfile v1.1.1
   Compiling env_logger v0.3.1
   Compiling rusti v0.0.1 (file:///home/at/rusti)
src/rusti/lib.rs:29:5: 29:21 error: use of unstable library feature 'path_ext_deprecated': The precise set of methods exposed on this trait may change and some methods may be removed.  For stable code, see the std::fs::metadata function. (see issue #27725)
src/rusti/lib.rs:29 use std::fs::PathExt;
                        ^~~~~~~~~~~~~~~~
src/rusti/lib.rs:29:5: 29:21 help: add #![feature(path_ext_deprecated)] to the crate attributes to enable
src/rusti/lib.rs:12:12: 12:20 warning: this feature is stable. attribute no longer needed, #[warn(stable_features)] on by default
src/rusti/lib.rs:12 #![feature(path_ext, rustc_private, set_stdio)]
                               ^~~~~~~~
src/rusti/lib.rs:29:5: 29:21 warning: use of deprecated item: replaced with inherent methods, #[warn(deprecated)] on by default
src/rusti/lib.rs:29 use std::fs::PathExt;
                        ^~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `rusti`.

To learn more, run the command again with --verbose.
# rustc --version
rustc 1.6.0-nightly (2e07996a9 2015-10-29)

rusti cannot compile with latest rust release on macos

Mac version: 10.10.2

Rust version:

➜  rusti git:(master) ✗ rustc -V -v
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-apple-darwin
release: 1.0.0-beta

Error produced when trying to run cargo run:

   Compiling rusti v0.0.1 (file:///Users/lowks/Projects/src/rustlang/rusti)
src/rusti/lib.rs:12:1: 12:31 error: unstable feature
src/rusti/lib.rs:12 #![feature(unsafe_destructor)]
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: this feature may not be used in the beta release channel
src/rusti/lib.rs:13:1: 14:41 error: unstable feature
src/rusti/lib.rs:13 #![feature(collections, exit_status, file_path, libc, path_ext,
src/rusti/lib.rs:14     rustc_private, set_stdio, std_misc)]
note: this feature may not be used in the beta release channel
error: aborting due to 2 previous errors
Could not compile `rusti`.

Anyway to get this working ?

Add a way to time how long functions take to execute

e.g. In F# interactive you would use:

> #time;;
--> Timing now on
> let rec fib n = if n < 2 then 1 else fib (n-1) + fib(n-2);;
Real: 00:00:00.000, CPU: 00:00:00.000, GC gen0: 0, gen1: 0
val fib : n:int -> int

> fib 42;;
Real: 00:00:02.615, CPU: 00:00:02.612, GC gen0: 0, gen1: 0
val it : int = 433494437

Its a nice feature in F#, I thought it may be useful in rusti. Im not exactly sure how easy it would be to add?

does not run with latest nightly

On nightly 2015-10-3:

$ cargo run --release
/Users/alex/Programming/rust/rusti/target/release/rusti: fork: retry: No child processes

The message repeats until the process is forcibly killed (^C, ^Z, etc, it takes a few).

OSX 10.9.5. Works fine with nightly-2015-09-19.

Compilation failure in Ubuntu 14.04

$ rustc --version
rustc 1.5.0 (3d7cd77e4 2015-12-04)

$ cargo build
Downloading tempfile v1.1.3
Downloading getopts v0.2.14
Downloading rand v0.3.12
Compiling getopts v0.2.14
Compiling winapi-build v0.1.1
Compiling regex-syntax v0.2.2
Compiling winapi v0.2.5
Compiling libc v0.2.4
Compiling kernel32-sys v0.2.1
Compiling advapi32-sys v0.1.2
Compiling memchr v0.1.7
Compiling log v0.3.4
Compiling aho-corasick v0.4.0
Compiling rand v0.3.12
Compiling regex v0.1.46
Compiling tempfile v1.1.3
Compiling env_logger v0.3.2
Compiling rusti v0.0.1 (file:///home/joepython/Downloads/rusti)
src/rusti/lib.rs:12:1: 12:38 error: #[feature] may not be used on the stable release channel
src/rusti/lib.rs:12 #![feature(rustc_private, set_stdio)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile rusti.

To learn more, run the command again with --verbose.

rusti does not build with latest nightly

Using rustc 1.5.0-nightly (81b3b27cf 2015-10-11)

src/rusti/exec.rs:320:47: 320:66 error: this function takes 2 parameters but 1 parameter was supplied [E0061]
src/rusti/exec.rs:320         let mut forest = ast_map::Forest::new(lower_crate(&krate));
                                                                    ^~~~~~~~~~~~~~~~~~~
src/rusti/exec.rs:320:47: 320:66 help: run `rustc --explain E0061` to see a detailed explanation
src/rusti/exec.rs:325:13: 325:17 error: mismatched types:
 expected `&rustc::session::Session`,
    found `rustc::session::Session`
(expected &-ptr,
    found struct `rustc::session::Session`) [E0308]
src/rusti/exec.rs:325             sess, ast_map, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
                                  ^~~~
src/rusti/exec.rs:325:13: 325:17 help: run `rustc --explain E0308` to see a detailed explanation
src/rusti/exec.rs:335:45: 335:54 error: the trait `core::iter::FromIterator<std::path::PathBuf>` is not implemented for the type `(_, _)` [E0277]
src/rusti/exec.rs:335                     .filter_map(|(_, p)| p).collect();
                                                                  ^~~~~~~~~
src/rusti/exec.rs:335:45: 335:54 help: run `rustc --explain E0277` to see a detailed explanation
src/rusti/exec.rs:335:45: 335:54 note: a collection of type `(_, _)` cannot be built from an iterator over elements of type `std::path::PathBuf`
src/rusti/exec.rs:348:36: 348:60 error: the type of this value must be known in this context
src/rusti/exec.rs:348         Ok((llmod, deps)) => Some((llmod as llvm::ModuleRef, deps)),
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~
src/rusti/exec.rs:383:47: 383:66 error: this function takes 2 parameters but 1 parameter was supplied [E0061]
src/rusti/exec.rs:383         let mut forest = ast_map::Forest::new(lower_crate(&krate));
                                                                    ^~~~~~~~~~~~~~~~~~~
src/rusti/exec.rs:383:47: 383:66 help: run `rustc --explain E0061` to see a detailed explanation
src/rusti/exec.rs:388:13: 388:17 error: mismatched types:
 expected `&rustc::session::Session`,
    found `rustc::session::Session`
(expected &-ptr,
    found struct `rustc::session::Session`) [E0308]
src/rusti/exec.rs:388             sess, ast_map, &arenas, id, MakeGlobMap::No,
                                  ^~~~
src/rusti/exec.rs:388:13: 388:17 help: run `rustc --explain E0308` to see a detailed explanation
src/rusti/exec.rs:387:9: 389:60 error: attempted tuple index `1` on type `R`, but the type was not a tuple or tuple struct
src/rusti/exec.rs:387         driver::phase_3_run_analysis_passes(
src/rusti/exec.rs:388             sess, ast_map, &arenas, id, MakeGlobMap::No,
src/rusti/exec.rs:389                 |tcx, analysis| f(&krate, tcx, analysis)).1
error: aborting due to 7 previous errors
Could not compile `rusti`.

compiler error with Rust 1.0 stable

~/.cargo/registry/src/github.com-1ecc6299db9ec823/tempfile-0.2.0/src/lib.rs:1:1: 1:34 error: unstable feature
~/.cargo/registry/src/github.com-1ecc6299db9ec823/tempfile-0.2.0/src/lib.rs:1 #![feature(convert, from_raw_os)]
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: this feature may not be used in the stable release channel
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `tempfile`.

To learn more, run the command again with --verbose.

Build failed on rustc 1.2.0-nightly (9ad0063a1 2015-06-20)

$ rustc --version
rustc 1.2.0-nightly (9ad0063a1 2015-06-20)
$ cargo build
   Compiling rusti v0.0.1 (file:///Users/xxx/Development/rust/rusti)
src/rusti/exec.rs:26:37: 26:53 error: unresolved import `rustc::session::config::UnstableFeatures`. There is no `UnstableFeatures` in `rustc::session::config`
src/rusti/exec.rs:26 use rustc::session::config::{Input, UnstableFeatures};
                                                         ^~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `rusti`.

To learn more, run the command again with --verbose.

rusti with Jupyter

I want to learn rust but in the context of data processing, and rusti looks like the way to go.

Do you have any plans to support a kernel for iPython like this?
It should at least make some common problems (readline, zmq, history, ...) easier, and a full integration means we can write notebooks that can run as examples on the web, look at some .ipynb files in this nice project.

Racer completion not working

I just installed rusti and racer, and added both to my path. Both are functional, but I can't get any completions in rusti. Did I install something wrong, or is this a bug?

multiline input causes 'parse_program' thread to panic.

Typing in a multiline statement (like a function definition) prints an error after every line, but seems to work otherwise.

I was just trying to type in some little function to make sure everything was working:

fn subber(i: i32) -> i32 {
    i - 1
}

Example:

rusti=> fn subber(i: i32) -> i32 {
thread 'parse_program' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/parse/mod.rs:244
rusti.> i - 1
thread 'parse_program' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/parse/mod.rs:244
rusti.> }
rusti=> println!("{}", subber(5));
4
rusti=>

I'm using the latest nightly from multirust:

  • rustc 1.2.0-nightly (613e57b44 2015-06-01) (built 2015-06-02)
  • cargo 0.3.0-nightly (06dbe65 2015-05-29) (built 2015-06-01)

latest rusti fails to build due to unstable feature with latest rust

I was unable to build rusti with my previous beta.2 of rust so I installed the
latest beta.4 of rust and cloned the latest rusti. I got the same problem:

$ cargo build
Compiling libc v0.1.6
Compiling regex v0.1.30
Compiling log v0.3.1
Compiling getopts v0.2.10
Compiling env_logger v0.3.0
Compiling rusti v0.0.1 (file:///home/greg/Play/Lang/Special/Rust/rusti)
src/rusti/lib.rs:12:1: 13:31 error: unstable feature
src/rusti/lib.rs:12 #![feature(collections, exit_status, libc, path_ext,
src/rusti/lib.rs:13 rustc_private, set_stdio)]
note: this feature may not be used in the beta release channel
error: aborting due to previous error
Could not compile rusti.

To learn more, run the command again with --verbose.

$ rustc --version
rustc 1.0.0-beta.4 (850151a75 2015-04-30) (built 2015-04-30)

Can't compile on rust 1.1

Rusti can't compiled on Rust 1.1. Can anybody help?

src/rusti/exec.rs:21:5: 21:19 error: unresolved import rustc::ast_map. There is no ast_map in rustc
src/rusti/exec.rs:21 use rustc::ast_map;
^~~~~~~~~~~~~~
src/rusti/exec.rs:32:5: 32:43 error: unresolved import syntax::feature_gate::UnstableFeatures. There is no UnstableFeatures in syntax::feature_gate
src/rusti/exec.rs:32 use syntax::feature_gate::UnstableFeatures;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile rusti.

Build error on nightly

Environment

rusti e021483
rustc 1.5.0-nightly (6e5a32547 2015-09-19)

Output

   Compiling getopts v0.2.14
   Compiling winapi v0.2.2
   Compiling regex-syntax v0.2.1
   Compiling libc v0.1.10
   Compiling winapi-build v0.1.1
   Compiling log v0.3.2
   Compiling memchr v0.1.6
   Compiling kernel32-sys v0.1.4
   Compiling advapi32-sys v0.1.2
   Compiling aho-corasick v0.3.2
   Compiling rand v0.3.11
   Compiling regex v0.1.41
   Compiling tempfile v1.1.1
   Compiling env_logger v0.3.1
   Compiling rusti v0.0.1 (file:///path/to/rusti)
src/rusti/exec.rs:324:9: 344:15 error: this function takes 6 parameters but 7 parameters were supplied [E0061]
src/rusti/exec.rs:324         driver::phase_3_run_analysis_passes(
src/rusti/exec.rs:325             sess, ast_map, &krate, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
src/rusti/exec.rs:326                 let trans = driver::phase_4_translate_to_llvm(tcx, analysis);
src/rusti/exec.rs:327
src/rusti/exec.rs:328                 tcx.sess.abort_if_errors();
src/rusti/exec.rs:329
                      ...
src/rusti/exec.rs:324:9: 344:15 help: run `rustc --explain E0061` to see a detailed explanation
src/rusti/exec.rs:348:36: 348:60 error: the type of this value must be known in this context
src/rusti/exec.rs:348         Ok((llmod, deps)) => Some((llmod as llvm::ModuleRef, deps)),
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~
src/rusti/exec.rs:387:9: 389:58 error: this function takes 6 parameters but 7 parameters were supplied [E0061]
src/rusti/exec.rs:387         driver::phase_3_run_analysis_passes(
src/rusti/exec.rs:388             sess, ast_map, &krate, &arenas, id, MakeGlobMap::No,
src/rusti/exec.rs:389                 |tcx, analysis| f(&krate, tcx, analysis)).1
src/rusti/exec.rs:387:9: 389:58 help: run `rustc --explain E0061` to see a detailed explanation
error: aborting due to 3 previous errors
Could not compile `rusti`.

To learn more, run the command again with --verbose.

Linking Error

Trying to build rusti gives this error:

    Compiling rusti v0.0.1 (file:///Users/.../Documents/RProjects/rusti)
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/.../Documents/RProjects/rusti/target/debug/rusti" "/Users/.../Documents/RProjects/rusti/target/debug/rusti.o" "-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a" "-Wl,-dead_strip" "-nodefaultlibs" "/Users/.../Documents/RProjects/rusti/target/debug/librusti.rlib" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_driver-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_privacy-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_resolve-11582ce5" "/Users/.../Documents/RProjects/rusti/target/debug/deps/libenv_logger-63352e48193fbb80.rlib" "/Users/.../Documents/RProjects/rusti/target/debug/deps/liblog-54cf393d3c69686f.rlib" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_borrowck-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_trans-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_typeck-11582ce5" "/Users/.../Documents/RProjects/rusti/target/debug/deps/libregex-3bea3061fd389532.rlib" "/Users/.../Documents/RProjects/rusti/target/debug/deps/libgetopts-d6ecf60df5ea72e6.rlib" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_lint-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_back-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lsyntax-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lterm-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lgraphviz-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrbml-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-larena-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lflate-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_llvm-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lrustc_data_structures-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lserialize-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-llog-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lfmt_macros-11582ce5" "/Users/.../Documents/RProjects/rusti/target/debug/deps/libtempfile-1e8a000811fae654.rlib" "/Users/.../Documents/RProjects/rusti/target/debug/deps/librand-b924d9fc5b3eb5b8.rlib" "/Users/.../Documents/RProjects/rusti/target/debug/deps/liblibc-2eda841eb12a3090.rlib" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lgetopts-11582ce5" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-lstd-11582ce5" "-L" "/Users/.../Documents/RProjects/rusti/target/debug" "-L" "/Users/.../Documents/RProjects/rusti/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/Users/.../Documents/RProjects/rusti/.rust/lib/x86_64-apple-darwin" "-L" "/Users/.../Documents/RProjects/rusti/lib/x86_64-apple-darwin" "-lmorestack" "-lreadline" "-lpthread" "-ledit" "-lm" "-lc++" "-lc" "-lm" "-lSystem" "-lpthread" "-lc" "-lm" "-lcompiler-rt"
note: ld: warning: directory not found for option '-L/Users/.../Documents/RProjects/rusti/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/Users/.../Documents/RProjects/rusti/lib/x86_64-apple-darwin'
Undefined symbols for architecture x86_64:
  "_rl_completion_suppress_append", referenced from:
      readline::completion_fn::__rust_abi in librusti.rlib(rusti.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
Could not compile `rusti`.

Occurs on OS X 10.10.3 using rustc 1.2.0-nightly (0cc99f9cc 2015-05-17) (built 2015-05-17)

The license must be GPL

GNU libreadline is released under GPL rather than LGPL. That requires you to release your software which links to it under GPL when you distribute it.

I retract this statement: Also, my understanding is GPL is compatible with neither of MIT nor Apache 2 License.

See the former article for possible alternatives of libreadline.

When compiling: Unresolved enum variant, struct or const `FkItemFn` [E0419]

I'm on rustc 1.4.0-nightly (7780408af 2015-09-01), and when I run cargo build, I get:

 Downloading tempfile v1.1.1
 Downloading advapi32-sys v0.1.2
 Downloading getopts v0.2.14
 Downloading aho-corasick v0.3.2
 Downloading memchr v0.1.6
 Downloading rand v0.3.11
    Compiling libc v0.1.10
   Compiling regex-syntax v0.2.1
   Compiling winapi v0.2.2
   Compiling getopts v0.2.14
   Compiling winapi-build v0.1.1
   Compiling memchr v0.1.6
   Compiling log v0.3.2
   Compiling kernel32-sys v0.1.4
   Compiling advapi32-sys v0.1.2
   Compiling aho-corasick v0.3.2
   Compiling rand v0.3.11
   Compiling regex v0.1.41
   Compiling tempfile v1.1.1
       Compiling env_logger v0.3.1
   Compiling rusti v0.0.1 (file:///Users/christopherdumas/rusti)
src/rusti/repl.rs:456:16: 456:31 error: unresolved enum variant, struct or const `FkItemFn` [E0419]
src/rusti/repl.rs:456         if let visit::FkItemFn(ident, _, _, _, _, _) = fk {
                                     ^~~~~~~~~~~~~~~
note: in expansion of if let expansion
src/rusti/repl.rs:456:9: 467:10 note: expansion site
src/rusti/repl.rs:456:16: 456:31 help: run `rustc --explain E0419` to see a detailed explanation
error: aborting due to previous error
Could not compile `rusti`.

To learn more, run the command again with --verbose.

Verbose output (if it helps, which I doubt):

   Compiling regex-syntax v0.2.1
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/regex-syntax-0.2.1/src/lib.rs --crate-name regex_syntax --crate-type lib -g -C metadata=0276adb4f6478fcb -C extra-filename=-0276adb4f6478fcb --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --cap-lints allow`
   Compiling winapi-build v0.1.1
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/winapi-build-0.1.1/src/lib.rs --crate-name build --crate-type lib -g -C metadata=304afb6bdff23d72 -C extra-filename=-304afb6bdff23d72 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --cap-lints allow`
   Compiling getopts v0.2.14
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/getopts-0.2.14/src/lib.rs --crate-name getopts --crate-type lib -g -C metadata=1be2f24cd9708e15 -C extra-filename=-1be2f24cd9708e15 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --cap-lints allow`
   Compiling winapi v0.2.2
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/winapi-0.2.2/src/lib.rs --crate-name winapi --crate-type lib -g -C metadata=5f5742ec99eeaf34 -C extra-filename=-5f5742ec99eeaf34 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --cap-lints allow`
   Compiling libc v0.1.10
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.10/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"cargo-build\" --cfg feature=\"default\" -C metadata=144c435538abd757 -C extra-filename=-144c435538abd757 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --cap-lints allow`
   Compiling kernel32-sys v0.1.4
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/kernel32-sys-0.1.4/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/christopherdumas/rusti/target/debug/build/kernel32-sys-62844336d3806e02 --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern build=/Users/christopherdumas/rusti/target/debug/deps/libbuild-304afb6bdff23d72.rlib --cap-lints allow`
   Compiling advapi32-sys v0.1.2
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/advapi32-sys-0.1.2/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/christopherdumas/rusti/target/debug/build/advapi32-sys-cfef7a1f30f1e5f6 --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern build=/Users/christopherdumas/rusti/target/debug/deps/libbuild-304afb6bdff23d72.rlib --cap-lints allow`
     Running `/Users/christopherdumas/rusti/target/debug/build/kernel32-sys-62844336d3806e02/build-script-build`
     Running `/Users/christopherdumas/rusti/target/debug/build/advapi32-sys-cfef7a1f30f1e5f6/build-script-build`
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/kernel32-sys-0.1.4/src/lib.rs --crate-name kernel32 --crate-type lib -g -C metadata=62844336d3806e02 -C extra-filename=-62844336d3806e02 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern winapi=/Users/christopherdumas/rusti/target/debug/deps/libwinapi-5f5742ec99eeaf34.rlib --cap-lints allow`
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/advapi32-sys-0.1.2/src/lib.rs --crate-name advapi32 --crate-type lib -g -C metadata=cfef7a1f30f1e5f6 -C extra-filename=-cfef7a1f30f1e5f6 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern winapi=/Users/christopherdumas/rusti/target/debug/deps/libwinapi-5f5742ec99eeaf34.rlib --cap-lints allow`
   Compiling log v0.3.2
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/log-0.3.2/src/lib.rs --crate-name log --crate-type lib -g -C metadata=f18a3e885170bd3f -C extra-filename=-f18a3e885170bd3f --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern libc=/Users/christopherdumas/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow`
   Compiling memchr v0.1.6
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/memchr-0.1.6/src/lib.rs --crate-name memchr --crate-type lib -g -C metadata=1ef94c8f78e37fc7 -C extra-filename=-1ef94c8f78e37fc7 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern libc=/Users/christopherdumas/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow`
   Compiling rand v0.3.11
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/rand-0.3.11/src/lib.rs --crate-name rand --crate-type lib -g -C metadata=bdfcc55d3466feb3 -C extra-filename=-bdfcc55d3466feb3 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern libc=/Users/christopherdumas/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --extern winapi=/Users/christopherdumas/rusti/target/debug/deps/libwinapi-5f5742ec99eeaf34.rlib --extern advapi32=/Users/christopherdumas/rusti/target/debug/deps/libadvapi32-cfef7a1f30f1e5f6.rlib --cap-lints allow`
   Compiling aho-corasick v0.3.2
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/aho-corasick-0.3.2/src/lib.rs --crate-name aho_corasick --crate-type lib -g -C metadata=4235a5ba781fe1b1 -C extra-filename=-4235a5ba781fe1b1 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern memchr=/Users/christopherdumas/rusti/target/debug/deps/libmemchr-1ef94c8f78e37fc7.rlib --cap-lints allow`
   Compiling regex v0.1.41
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/regex-0.1.41/src/lib.rs --crate-name regex --crate-type lib -g -C metadata=c5abedf84fe61ddb -C extra-filename=-c5abedf84fe61ddb --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern memchr=/Users/christopherdumas/rusti/target/debug/deps/libmemchr-1ef94c8f78e37fc7.rlib --extern aho_corasick=/Users/christopherdumas/rusti/target/debug/deps/libaho_corasick-4235a5ba781fe1b1.rlib --extern regex_syntax=/Users/christopherdumas/rusti/target/debug/deps/libregex_syntax-0276adb4f6478fcb.rlib --cap-lints allow`
   Compiling tempfile v1.1.1
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/tempfile-1.1.1/src/lib.rs --crate-name tempfile --crate-type lib -g -C metadata=91489cdece569e6b -C extra-filename=-91489cdece569e6b --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern rand=/Users/christopherdumas/rusti/target/debug/deps/librand-bdfcc55d3466feb3.rlib --extern libc=/Users/christopherdumas/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --extern kernel32=/Users/christopherdumas/rusti/target/debug/deps/libkernel32-62844336d3806e02.rlib --extern winapi=/Users/christopherdumas/rusti/target/debug/deps/libwinapi-5f5742ec99eeaf34.rlib --cap-lints allow`
   Compiling env_logger v0.3.1
     Running `rustc /Users/christopherdumas/.cargo/registry/src/github.com-0a35038f75765ae4/env_logger-0.3.1/src/lib.rs --crate-name env_logger --crate-type lib -g -C metadata=9877a407b506c549 -C extra-filename=-9877a407b506c549 --out-dir /Users/christopherdumas/rusti/target/debug/deps --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug/deps -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern regex=/Users/christopherdumas/rusti/target/debug/deps/libregex-c5abedf84fe61ddb.rlib --extern log=/Users/christopherdumas/rusti/target/debug/deps/liblog-f18a3e885170bd3f.rlib --cap-lints allow`
   Compiling rusti v0.0.1 (file:///Users/christopherdumas/rusti)
     Running `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g --out-dir /Users/christopherdumas/rusti/target/debug --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern log=/Users/christopherdumas/rusti/target/debug/deps/liblog-f18a3e885170bd3f.rlib --extern env_logger=/Users/christopherdumas/rusti/target/debug/deps/libenv_logger-9877a407b506c549.rlib --extern tempfile=/Users/christopherdumas/rusti/target/debug/deps/libtempfile-91489cdece569e6b.rlib --extern libc=/Users/christopherdumas/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --extern getopts=/Users/christopherdumas/rusti/target/debug/deps/libgetopts-1be2f24cd9708e15.rlib`
src/rusti/repl.rs:456:16: 456:31 error: unresolved enum variant, struct or const `FkItemFn` [E0419]
src/rusti/repl.rs:456         if let visit::FkItemFn(ident, _, _, _, _, _) = fk {
                                     ^~~~~~~~~~~~~~~
note: in expansion of if let expansion
src/rusti/repl.rs:456:9: 467:10 note: expansion site
src/rusti/repl.rs:456:16: 456:31 help: run `rustc --explain E0419` to see a detailed explanation
error: aborting due to previous error
Could not compile `rusti`.

Caused by:
  Process didn't exit successfully: `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g --out-dir /Users/christopherdumas/rusti/target/debug --emit=dep-info,link -L dependency=/Users/christopherdumas/rusti/target/debug -L dependency=/Users/christopherdumas/rusti/target/debug/deps --extern log=/Users/christopherdumas/rusti/target/debug/deps/liblog-f18a3e885170bd3f.rlib --extern env_logger=/Users/christopherdumas/rusti/target/debug/deps/libenv_logger-9877a407b506c549.rlib --extern tempfile=/Users/christopherdumas/rusti/target/debug/deps/libtempfile-91489cdece569e6b.rlib --extern libc=/Users/christopherdumas/rusti/target/debug/deps/liblibc-144c435538abd757.rlib --extern getopts=/Users/christopherdumas/rusti/target/debug/deps/libgetopts-1be2f24cd9708e15.rlib` (exit code: 101)

error running cargo build on windows

Currently I am trying to build rusti on my machine (Windows 8.1 64 bit). When I run cargo build from CL, I get this:

$ cargo build
   Compiling regex v0.1.19
   Compiling log v0.2.5
   Compiling getopts v0.2.4
   Compiling env_logger v0.2.2
   Compiling rusti v0.0.1 (file:///C:/Users/Jan/Documents/Remote%20Repositories/
rusti)
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nx
compat" "-static-libgcc" "-m64" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\
lib" "-o" "C:\Users\Jan\Documents\Remote Repositories\rusti\target\debug\rusti.e
xe" "C:\Users\Jan\Documents\Remote Repositories\rusti\target\debug\rusti.o" "-Wl
,--gc-sections" "C:\Users\Jan\Documents\Remote Repositories\rusti\target\debug\l
ibrusti-ff62320c4849f683.rlib" "C:\Users\Jan\Documents\Remote Repositories\rusti
\target\debug\deps\libgetopts-41fdc09a54721568.rlib" "C:\Users\Jan\Documents\Rem
ote Repositories\rusti\target\debug\deps\libenv_logger-9ed1456ce39bdb07.rlib" "C
:\Users\Jan\Documents\Remote Repositories\rusti\target\debug\deps\liblog-045aab9
d45b4c031.rlib" "C:\Users\Jan\Documents\Remote Repositories\rusti\target\debug\d
eps\libregex-7027c58d974554ef.rlib" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-
gnu\lib" "-lrustc_driver-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-g
nu\lib" "-lrustc_trans-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu
\lib" "-lrustc_privacy-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu
\lib" "-lrustc_borrowck-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gn
u\lib" "-lrustc_typeck-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu
\lib" "-lrustc_lint-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\li
b" "-lrustc_resolve-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\li
b" "-lrustc-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-lru
stc_back-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-lsynta
x-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-lfmt_macros-4
e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-larena-4e7c5e5c"
 "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-lflate-4e7c5e5c" "-L" "C
:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-lterm-4e7c5e5c" "-L" "C:\Rust\bi
n\rustlib\x86_64-pc-windows-gnu\lib" "-lrustc_llvm-4e7c5e5c" "-L" "C:\Rust\bin\r
ustlib\x86_64-pc-windows-gnu\lib" "-lgetopts-4e7c5e5c" "-L" "C:\Rust\bin\rustlib
\x86_64-pc-windows-gnu\lib" "-lrbml-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-p
c-windows-gnu\lib" "-lserialize-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-wi
ndows-gnu\lib" "-llog-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\
lib" "-lgraphviz-4e7c5e5c" "-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib"
"-lstd-4e7c5e5c" "-L" "C:\Users\Jan\Documents\Remote Repositories\rusti\target\d
ebug" "-L" "C:\Users\Jan\Documents\Remote Repositories\rusti\target\debug\deps"
"-L" "C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib" "-L" "C:\Users\Jan\Document
s\Remote Repositories\rusti\.rust\bin\x86_64-pc-windows-gnu" "-L" "C:\Users\Jan\
Documents\Remote Repositories\rusti\bin\x86_64-pc-windows-gnu" "-Wl,--whole-arch
ive" "-Wl,-Bstatic" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-lmorestack" "-lre
adline" "-lkernel32" "-lshell32" "-lpsapi" "-limagehlp" "-lm" "-lstdc++" "-lws2_
32" "-luserenv" "-lcompiler-rt"
note: ld: cannot find -lreadline

error: aborting due to previous error
Could not compile `rusti`.

To learn more, run the command again with --verbose.

How can I fix this? MinGW and gcc are installed. Running gcc gives me normal output.

Build fails with error: unresolved name `config::No` and mismatched types

Building rusti 4a66764 with rust master fails with

# cargo build
   Compiling libc v0.2.4
   Compiling winapi v0.2.5
   Compiling regex-syntax v0.2.2
   Compiling winapi-build v0.1.1
   Compiling getopts v0.2.14
   Compiling advapi32-sys v0.1.2
   Compiling kernel32-sys v0.2.1
   Compiling memchr v0.1.7
   Compiling rand v0.3.12
   Compiling log v0.3.4
   Compiling aho-corasick v0.4.0
   Compiling regex v0.1.46
   Compiling tempfile v1.1.3
   Compiling env_logger v0.3.2
   Compiling rusti v0.0.1 (file:///rustjail/rusti)
src/rusti/exec.rs:275:21: 275:31 error: unresolved name `config::No` [E0425]
src/rusti/exec.rs:275     opts.optimize = config::No;
                                          ^~~~~~~~~~
src/rusti/exec.rs:275:21: 275:31 help: run `rustc --explain E0425` to see a detailed explanation
src/rusti/exec.rs:271:40: 271:65 error: mismatched types:
 expected `rustc::session::config::ErrorOutputType`,
    found `syntax::errors::emitter::ColorConfig`
(expected enum `rustc::session::config::ErrorOutputType`,
    found enum `syntax::errors::emitter::ColorConfig`) [E0308]
src/rusti/exec.rs:271         opts.search_paths.add_path(&p, errors::ColorConfig::Auto);
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
src/rusti/exec.rs:271:40: 271:65 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 2 previous errors
Could not compile `rusti`.

To learn more, run the command again with --verbose.
# rustc --version
rustc 1.7.0-dev (257d3244f 2016-01-18)

Build fails on arm linux

Trying to build with an armv7 1.7 nightly from about a week ago, I'm getting this error:

Compiling rusti v0.0.1 (file:///tmp/rusti-master)
src/rusti/input.rs:26:22: 26:33 error: unresolved import `syntax::errors::ColorConfig`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:26 use syntax::errors::{ColorConfig, Handler, Level, RenderSpan};
                                           ^~~~~~~~~~~
src/rusti/input.rs:26:22: 26:33 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/input.rs:28:5: 28:30 error: unresolved import `syntax::errors::Level::*`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:28 use syntax::errors::Level::*;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
src/rusti/input.rs:28:5: 28:30 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/input.rs:27:40: 27:53 error: unresolved import `syntax::errors::emitter::EmitterWriter`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:27 use syntax::errors::emitter::{Emitter, EmitterWriter};
                                                             ^~~~~~~~~~~~~
src/rusti/input.rs:27:40: 27:53 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/input.rs:27:31: 27:38 error: unresolved import `syntax::errors::emitter::Emitter`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:27 use syntax::errors::emitter::{Emitter, EmitterWriter};
                                                    ^~~~~~~
src/rusti/input.rs:27:31: 27:38 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/input.rs:26:51: 26:61 error: unresolved import `syntax::errors::RenderSpan`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:26 use syntax::errors::{ColorConfig, Handler, Level, RenderSpan};
                                                                        ^~~~~~~~~~
src/rusti/input.rs:26:51: 26:61 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/input.rs:26:44: 26:49 error: unresolved import `syntax::errors::Level`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:26 use syntax::errors::{ColorConfig, Handler, Level, RenderSpan};
                                                                 ^~~~~
src/rusti/input.rs:26:44: 26:49 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/input.rs:26:35: 26:42 error: unresolved import `syntax::errors::Handler`. Could not find `errors` in `syntax` [E0432]
src/rusti/input.rs:26 use syntax::errors::{ColorConfig, Handler, Level, RenderSpan};
                                                        ^~~~~~~
src/rusti/input.rs:26:35: 26:42 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/exec.rs:37:5: 37:19 error: unresolved import `syntax::errors`. There is no `errors` in `syntax` [E0432]
src/rusti/exec.rs:37 use syntax::errors;
                         ^~~~~~~~~~~~~~
src/rusti/exec.rs:37:5: 37:19 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/exec.rs:38:40: 38:52 error: unresolved import `syntax::errors::emitter::BasicEmitter`. Could not find `errors` in `syntax` [E0432]
src/rusti/exec.rs:38 use syntax::errors::emitter::{Emitter, BasicEmitter};
                                                            ^~~~~~~~~~~~
src/rusti/exec.rs:38:40: 38:52 help: run `rustc --explain E0432` to see a detailed explanation
src/rusti/exec.rs:38:31: 38:38 error: unresolved import `syntax::errors::emitter::Emitter`. Could not find `errors` in `syntax` [E0432]
src/rusti/exec.rs:38 use syntax::errors::emitter::{Emitter, BasicEmitter};
                                                   ^~~~~~~
src/rusti/exec.rs:38:31: 38:38 help: run `rustc --explain E0432` to see a detailed explanation
error: aborting due to 10 previous errors
Could not compile `rusti`.

rusti cannot be compiled on beta or stable channels because it uses unstable Rust APIs

Note to users: In order to build and run rusti, you can use rustup to install a nightly build of rusti, by using the --channel=nightly flag. Further directions can be found on the rustup page.

Now, on to the details of the issue: Some of the minor unstable features currently in use will likely be worked out and stabilized as Rust progresses; however, rusti also makes use of private_rustc features which are internal to the rustc Rust compiler crate. These APIs are, of course, necessary for compiling input Rust code. As the compiler will be in flux for quite some time, it is not clear when, if ever, these APIs will be stabilized.

`std::task::try` crashes

rusti=> let _ = std::task::try(|| ());

crashes with:

LLVM ERROR: Cannot select: 0x7f386cdedcb8: i64 = X86ISD::WrapperRIP 0x7f386cde5b88 [ORD=18] [ID=12]
  0x7f386cde5b88: i64 = TargetGlobalTLSAddress<i8** @_ZN9local_ptr8compiled10RT_TLS_PTR20h9ee4d29dd28a13a9bkaE> 0 [TF=10] [ORD=18] [ID=10]
In function: _ZN9local_ptr8compiled4take21h17675256696310250279E

can't build/run master

i cloned rusti repo, have nightly rust installed, but can't build rusti

eplatonov@eplatonov-vb-mint ~/projects/github/rusti (master) $ cargo clean 
eplatonov@eplatonov-vb-mint ~/projects/github/rusti (master) $ rustc --version
rustc 1.8.0-nightly (c8fc4817d 2016-02-22)
eplatonov@eplatonov-vb-mint ~/projects/github/rusti (master) $ cargo --version 
cargo 0.9.0-nightly (93fb4c0 2016-02-22)
eplatonov@eplatonov-vb-mint ~/projects/github/rusti (master) $ cargo build 
   Compiling libc v0.2.4
   Compiling winapi-build v0.1.1
   Compiling kernel32-sys v0.2.1
   Compiling regex-syntax v0.2.2
   Compiling memchr v0.1.7
   Compiling aho-corasick v0.4.0
   Compiling log v0.3.4
   Compiling advapi32-sys v0.1.2
   Compiling getopts v0.2.14
   Compiling winapi v0.2.5
   Compiling regex v0.1.46
   Compiling rand v0.3.12
   Compiling tempfile v1.1.3
   Compiling env_logger v0.3.2
   Compiling rusti v0.0.1 (file:///home/eplatonov/projects/github/rusti)
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/eplatonov/projects/github/rusti/target/debug/rusti.0.o" "-o" "/home/eplatonov/projects/github/rusti/target/debug/rusti" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/eplatonov/projects/github/rusti/target/debug" "-L" "/home/eplatonov/projects/github/rusti/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/eplatonov/projects/github/rusti/target/debug/librusti.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/libenv_logger-2fedde90a22290a6.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/libgetopts-852fe11dd444cf81.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/liblog-87d547eff707fc8e.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/libregex-e2957abba0c5c748.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/libregex_syntax-695a6c2a2c33e892.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/libtempfile-7a516df1b247e424.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/librand-12e778fcd5eb28e9.rlib" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_driver-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_passes-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_typeck-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_lint-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_privacy-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "syntax_ext-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_plugin-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_resolve-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_borrowck-fd663c41" "/home/eplatonov/projects/github/rusti/target/debug/deps/libaho_corasick-32050201217e44e8.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/libmemchr-940d9877eaa7970c.rlib" "/home/eplatonov/projects/github/rusti/target/debug/deps/liblibc-adb8b8e7aaa2f93f.rlib" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_metadata-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_trans-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_platform_intrinsics-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_mir-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rbml-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_data_structures-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_back-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "flate-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "getopts-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "arena-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "fmt_macros-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "graphviz-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_front-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "syntax-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "term-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "serialize-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "log-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "rustc_llvm-fd663c41" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "std-fd663c41" "-l" "readline" "-l" "pthread" "-l" "rt" "-l" "dl" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "compiler-rt"
note: /usr/bin/ld: cannot find -lreadline
collect2: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile `rusti`.

To learn more, run the command again with --verbose.

is there something I'm missing?

failed fresh install on mac os x

Steps to reproduce:

1 As instructed by the readme, I've installed the nightly version of rust with:

curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly

2 Also installed gnu readline with

brew install readline

3 Cloned the repo with:

git clone [email protected]:murarth/rusti.git
cd rusti

4 Build the project with:

cargo build

Expected results

The REPL should be installed and usable

Actual results

Error prevented the project to build:

       Fresh libc v0.1.8
       Fresh regex v0.1.30
       Fresh rand v0.3.8
       Fresh log v0.3.1
   Compiling rusti v0.0.1 (file:///Users/fcz/work/rusti)
     Running `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g --out-dir /Users/fcz/work/rusti/target/debug --emit=dep-info,link -L dependency=/Users/fcz/work/rusti/target/debug -L dependency=/Users/fcz/work/rusti/target/debug/deps --extern env_logger=/Users/fcz/work/rusti/target/debug/deps/libenv_logger-9877a407b506c549.rlib --extern tempfile=/Users/fcz/work/rusti/target/debug/deps/libtempfile-c9be745af97f9817.rlib --extern log=/Users/fcz/work/rusti/target/debug/deps/liblog-8a6aba167994951e.rlib --extern getopts=/Users/fcz/work/rusti/target/debug/deps/libgetopts-1dade5d0522f070b.rlib`
       Fresh tempfile v0.3.0
       Fresh env_logger v0.3.1
       Fresh getopts v0.2.11
src/rusti/exec.rs:31:5: 31:20 error: unresolved import `syntax::ast_map`. There is no `ast_map` in `syntax`
src/rusti/exec.rs:31 use syntax::ast_map;
                         ^~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `rusti`.

Caused by:
  Process didn't exit successfully: `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g --out-dir /Users/fcz/work/rusti/target/debug --emit=dep-info,link -L dependency=/Users/fcz/work/rusti/target/debug -L dependency=/Users/fcz/work/rusti/target/debug/deps --extern env_logger=/Users/fcz/work/rusti/target/debug/deps/libenv_logger-9877a407b506c549.rlib --extern tempfile=/Users/fcz/work/rusti/target/debug/deps/libtempfile-c9be745af97f9817.rlib --extern log=/Users/fcz/work/rusti/target/debug/deps/liblog-8a6aba167994951e.rlib --extern getopts=/Users/fcz/work/rusti/target/debug/deps/libgetopts-1dade5d0522f070b.rlib` (exit code: 101)

Latest rust broke rusti ?

The latest rust release 2015-03-20 seems to have broken rusti.
I did a git pull --prune before running cargo run and here is what I got:

(item)➜  rusti git:(master) ✗ cargo run --verbose
       Fresh regex v0.1.19
       Fresh log v0.2.5
       Fresh env_logger v0.2.2
       Fresh getopts v0.2.4
   Compiling rusti v0.0.1 (file:///Users/lowks/Projects/src/rustlang/rusti)
     Running `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g -C metadata=33afacedde870a7c -C extra-filename=-33afacedde870a7c --out-dir /Users/lowks/Projects/src/rustlang/rusti/target/debug --emit=dep-info,link -L dependency=/Users/lowks/Projects/src/rustlang/rusti/target/debug -L dependency=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps --extern env_logger=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps/libenv_logger-9ed1456ce39bdb07.rlib --extern log=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps/liblog-045aab9d45b4c031.rlib --extern getopts=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps/libgetopts-41fdc09a54721568.rlib`
src/rusti/readline.rs:83:18: 83:30 error: the trait `std::ffi::c_str::IntoBytes` is not implemented for the type `&[u8; 4]` [E0277]
src/rusti/readline.rs:83         let sp = CString::new(b"    ").unwrap();
                                          ^~~~~~~~~~~~
error: aborting due to previous error
Could not compile `rusti`.

Caused by:
  Process didn't exit successfully: `rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g -C metadata=33afacedde870a7c -C extra-filename=-33afacedde870a7c --out-dir /Users/lowks/Projects/src/rustlang/rusti/target/debug --emit=dep-info,link -L dependency=/Users/lowks/Projects/src/rustlang/rusti/target/debug -L dependency=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps --extern env_logger=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps/libenv_logger-9ed1456ce39bdb07.rlib --extern log=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps/liblog-045aab9d45b4c031.rlib --extern getopts=/Users/lowks/Projects/src/rustlang/rusti/target/debug/deps/libgetopts-41fdc09a54721568.rlib` (exit code: 101)

exec.rs: Error with __morestack and LLVMRustCreateJITMemoryManager

Hi!

I experimented a bit with morestack_addr() from rusti/src/rusti/exec.rs for LLVMRustCreateJITMemoryManager(). The following rust source file fails with a gcc linker error, if rustc was used without -lmorestack (it fails with rustc, but succeeds with rustc -lmorestack). I found no traces of -lmorestack in the Cargo.toml, so I guess this might be an error for the rustc on Windows.

extern crate "rustc_llvm" as llvm;
use std::mem::transmute;

extern "C" {
    fn __morestack();
}

fn morestack_addr() -> *const () {
    unsafe { transmute(__morestack) }
}

fn main() {
    let morestack = morestack_addr();
    let memory_manager = unsafe {
        llvm::LLVMRustCreateJITMemoryManager(morestack);
    };
    println!("{}", memory_manager);
}

Compiler error:

error: linking with `gcc` failed: exit code: 1
note: gcc '-Wl,--enable-long-section-names' '-fno-use-linker-plugin' '-Wl,--nxcompat' '-static-libgcc' '-m64' '-L' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib' '-o' 'sample_03_add.exe' 'sample_03_add.o' '-Wl,--gc-sections' '-L' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib' '-lrustc_llvm-4e7c5e5c' '-L' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib' '-lstd-4e7c5e5c' '-L' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib' '-lrustrt-4e7c5e5c' '-L' 'D:\_rust\libcpu-rust\src\libcpu\.rust' '-L' 'D:\_rust\libcpu-rust\src\libcpu' '-Wl,--whole-archive' '-Wl,-Bstatic' '-Wl,--no-whole-archive' '-Wl,-Bdynamic' '-lshell32' '-lpsapi' '-limagehlp' '-lm' '-lstdc++' '-lws2_32' '-lcompiler-rt'
note: sample_03_add.o:(.text+0x3): undefined reference to `__morestack'

error: aborting due to previous error

Failed to build with rustc 1.4.0-nightly (1181679c8 2015-08-07)

src/rusti/repl.rs:436:18: 436:34 error: unresolved name token::get_ident [E0425]
src/rusti/repl.rs:436 if &*token::get_ident(ident) == self.fn_name {
^~~~~~~~~~~~~~~~
note: in expansion of if let expansion
src/rusti/repl.rs:435:9: 446:10 note: expansion site
src/rusti/repl.rs:436:18: 436:34 help: run rustc --explain E0425 to see a detailed explanation
error: aborting due to previous error
Could not compile rusti.

Can't compile with latest nightly build

Ubuntu 14.10 x64
Compiling rusti v0.0.1 (file:///home/roman/Development/rust/rusti)

error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/roman/Development/rust/rusti/target/debug/rusti" "/home/roman/Development/rust/rusti/target/debug/rusti.o" "-Wl,--whole-archive" "-lmorestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "/home/roman/Development/rust/rusti/target/debug/librusti-a202d6f610c7dea8.rlib" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_driver-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_resolve-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_borrowck-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_trans-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_lint-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_typeck-4e7c5e5c" "/home/roman/Development/rust/rusti/target/debug/deps/libenv_logger-0e0d1edb8b8745e2.rlib" "/home/roman/Development/rust/rusti/target/debug/deps/liblog-54cf393d3c69686f.rlib" "/home/roman/Development/rust/rusti/target/debug/deps/liblibc-8c77960f0e8d4e86.rlib" "/home/roman/Development/rust/rusti/target/debug/deps/libgetopts-13bfb58dc9e184de.rlib" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_privacy-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_back-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lgraphviz-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lsyntax-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-larena-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lflate-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lterm-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_llvm-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrbml-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lserialize-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-llog-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lfmt_macros-4e7c5e5c" "/home/roman/Development/rust/rusti/target/debug/deps/libregex-b0748aeea4ad5343.rlib" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lgetopts-4e7c5e5c" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-4e7c5e5c" "-L" "/home/roman/Development/rust/rusti/target/debug" "-L" "/home/roman/Development/rust/rusti/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/roman/Development/rust/rusti/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/roman/Development/rust/rusti/lib/x86_64-unknown-linux-gnu" "-Wl,--whole-archive" "-Wl,-Bstatic" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-lmorestack" "-lreadline" "-lc" "-lm" "-lpthread" "-lrt" "-ldl" "-lm" "-ldl" "-lpthread" "-lrt" "-lgcc_s" "-lpthread" "-lc" "-lm" "-lcompiler-rt"
note: /usr/bin/ld: cannot find -lreadline
collect2: error: ld returned 1 exit status

src/rusti/input.rs:31:38: 31:45 error: unresolved import `syntax::parse::PResult`. There is no `PResult` in `syntax::parse`

$ cargo build --verbose
Fresh regex v0.1.26
Fresh libc v0.1.5
Fresh log v0.3.1
Compiling rusti v0.0.1 (file:///home/aistis/Projects/rusti)
Running rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g -C metadata=0f5b8a2f76fd202b -C extra-filename=-0f5b8a2f76fd202b --out-dir /home/aistis/Projects/rusti/target/debug --emit=dep-info,link -L dependency=/home/aistis/Projects/rusti/target/debug -L dependency=/home/aistis/Projects/rusti/target/debug/deps --extern log=/home/aistis/Projects/rusti/target/debug/deps/liblog-54cf393d3c69686f.rlib --extern getopts=/home/aistis/Projects/rusti/target/debug/deps/libgetopts-13bfb58dc9e184de.rlib --extern env_logger=/home/aistis/Projects/rusti/target/debug/deps/libenv_logger-0e0d1edb8b8745e2.rlib
Fresh getopts v0.2.9
Fresh env_logger v0.3.0
src/rusti/input.rs:31:38: 31:45 error: unresolved import syntax::parse::PResult. There is no PResult in syntax::parse
src/rusti/input.rs:31 use syntax::parse::{classify, token, PResult};
^~~~~~~
error: aborting due to previous error
Could not compile rusti.

Caused by:
Process didn't exit successfully: rustc src/rusti/lib.rs --crate-name rusti --crate-type lib -g -C metadata=0f5b8a2f76fd202b -C extra-filename=-0f5b8a2f76fd202b --out-dir /home/aistis/Projects/rusti/target/debug --emit=dep-info,link -L dependency=/home/aistis/Projects/rusti/target/debug -L dependency=/home/aistis/Projects/rusti/target/debug/deps --extern log=/home/aistis/Projects/rusti/target/debug/deps/liblog-54cf393d3c69686f.rlib --extern getopts=/home/aistis/Projects/rusti/target/debug/deps/libgetopts-13bfb58dc9e184de.rlib --extern env_logger=/home/aistis/Projects/rusti/target/debug/deps/libenv_logger-0e0d1edb8b8745e2.rlib (exit code: 101)

Segmentation fault when calling `llvm::LLVMGetPointerToGlobal` on Windows (LLVM ERROR: Incompatible object format!)

I tried cleaning $PATH, using different rustc (dev or nightly), no good so far, always the same segmentation fault no matter you run from cli or repl.

bombless@bombless-PC ~/rusti
$ target/rusti.exe -e 0
DEBUG - searching for sysroot in PATH D:\msys64rust\mingw32\bin;D:\msys64rust\usr\local\bin;D:\msys64rust\usr\bin;D:\msys64rust\usr\bin;D:\msys64rust\home\bombless\rust\i686-pc-windows-gnu\stage1\bin
DEBUG - sysroot from PATH entry D:\msys64rust\home\bombless\rust\i686-pc-windows-gnu\stage1\bin
DEBUG - loading crate D:\msys64rust\home\bombless\rust\i686-pc-windows-gnu\stage1\bin\rustlib\i686-pc-windows-gnu\lib\std-4e7c5e5c.dll
DEBUG - compiling module
DEBUG - loading crate D:\msys64rust\home\bombless\rust\i686-pc-windows-gnu\stage1\bin\rustlib\i686-pc-windows-gnu\lib\std-4e7c5e5c.dll
LLVM ERROR: Incompatible object format!
Segmentation fault


bombless@bombless-PC ~/rusti
$ rustc -V -v
rustc 1.0.0-dev (b6d91a2bd 2015-02-15 07:53:07 +0000)
binary: rustc
commit-hash: b6d91a2bdac45cd919497a24207fab843124d4ba
commit-date: 2015-02-15 07:53:07 +0000
host: i686-pc-windows-gnu
release: 1.0.0-dev

bombless@bombless-PC ~/rusti
$

Cant run built executable

I can run rusti fine using cargo run, but whenever I build it using cargo build, both with and without --release and attempt to run rusti from the target/{debug|release} dir I get the following error:
dyld: Library not loaded: x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/librustc_driver-8cf6ce90.dylib Referenced from: /Users/mitur/gits/rusti/target/debug/./rusti Reason: image not found [1] 61341 trace trap ./rusti

I am building using multirust with nightly currently on rustc 1.6.0-nightly (8864f2c83 2015-12-07)

On osx 10.11.1

I would happily provide any other information that could help.

Thanks

Implement running a file

It's simple enough to do. I'm just not sure how the input should be handled.
Should it expect a main function and run that? Treat it like line-by-line input to the interactive mode? Even allowing, e.g. use after other items?

Crash trying to print value from external crate

Trying to print a value for a type defined in an external crate is crashing rusti:

$ cargo run -- -L testi/target/debug/
Running target/debug/rusti -L testi/target/debug/
rusti=> extern crate testi;
rusti=> use testi::Foo;
rusti=> Foo
LLVM ERROR: Program used external function '__ZN21Foo...std..fmt..Debug3fmt20h8530f8b2d5755ad6iaaE' which could not be resolved!
An unknown error occurred

To learn more, run the command again with --verbose.
$

Environment:

  • OS X Yosemite 10.10.3
  • rustc 1.5.0-nightly (6e5a32547 2015-09-19)
  • cargo 0.6.0-nightly (de11b58 2015-09-16)
  • rusti commit 842564d

Both rusti and the testi crate compiled clean with this version.

External crate:
$ cat testi/Cargo.toml
[package]
name = "testi"
version = "0.0.1"


$ cat testi/src/lib.rs

[derive(Debug)]

pub struct Foo;

Load other crates

Setting aside the technical challenge, rusti could know about cargo and fetch built dependencies/the project itself when asked, besides just the std crates.

Failed to build with nightly (82d40cb2b 2015-07-24)

src/rusti/exec.rs:174:29: 174:31 error: mismatched types:
 expected `*const ()`,
    found `*const libc::types::common::c95::c_void`
(expected (),
    found enum `libc::types::common::c95::c_void`) [E0308]
src/rusti/exec.rs:174                 return Some(fp);
                                                  ^~
note: in expansion of for loop expansion
src/rusti/exec.rs:166:9: 176:10 note: expansion site
src/rusti/exec.rs:174:29: 174:31 help: run `rustc --explain E0308` to see a detailed explanation
src/rusti/exec.rs:196:29: 196:31 error: mismatched types:
 expected `*const ()`,
    found `*const libc::types::common::c95::c_void`
(expected (),
    found enum `libc::types::common::c95::c_void`) [E0308]
src/rusti/exec.rs:196                 return Some(gp);
                                                  ^~
note: in expansion of for loop expansion
src/rusti/exec.rs:188:9: 198:10 note: expansion site
src/rusti/exec.rs:196:29: 196:31 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 2 previous errors
Could not compile `rusti`.

Build fails on rust nightly

I am getting the following errors:

~/D/rusti-master ❯ rustc --version
rustc 1.5.0-nightly (9d3e79ad3 2015-10-10)

~/D/rusti-master ❯ cargo build
   Compiling rusti v0.0.1 (file:///Users/yaser/Downloads/rusti-master)
src/rusti/exec.rs:326:38: 326:40 error: mismatched types:
 expected `collections::string::String`,
    found `&str`
(expected struct `collections::string::String`,
    found &-ptr) [E0308]
src/rusti/exec.rs:326             &sess, ast_map, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
                                                           ^~
src/rusti/exec.rs:326:38: 326:40 help: run `rustc --explain E0308` to see a detailed explanation
src/rusti/exec.rs:390:38: 390:40 error: mismatched types:
 expected `collections::string::String`,
    found `&str`
(expected struct `collections::string::String`,
    found &-ptr) [E0308]
src/rusti/exec.rs:390             &sess, ast_map, &arenas, id, MakeGlobMap::No,
                                                           ^~
src/rusti/exec.rs:390:38: 390:40 help: run `rustc --explain E0308` to see a detailed explanation
src/rusti/lib.rs:84:19: 84:28 error: no method named `is_file` found for type `std::path::PathBuf` in the current scope
src/rusti/lib.rs:84             if rc.is_file() {
                                      ^~~~~~~~~
src/rusti/lib.rs:84:19: 84:28 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
src/rusti/lib.rs:84:19: 84:28 help: candidate #1: use `std::fs::PathExt`
error: aborting due to 3 previous errors
Could not compile `rusti`.

To learn more, run the command again with --verbose.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.