Issue 1:
With this code: retep998/term@2b94c82

I get an ICE

Peter@Win81-SSD MINGW64 ~/term
$ cargo run --example something
Compiling kernel32-sys v0.1.0
Compiling libc v0.1.6
Compiling winapi v0.1.17
Compiling term v0.2.7 (file:///C:/msys64/home/Peter/term)
examples\something.rs:19:14: 2:54 error: source trait is private
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/masterCONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'capacity overflow', C:/msys64/home/Peter/rust/src/libcore\option.rs:330

Could not compile `term`.

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

Peter@Win81-SSD MINGW64 ~/term
$ rustc -vV
rustc 1.1.0-dev (9c88f3be1 2015-04-27) (built 2015-04-27)
binary: rustc
commit-hash: 9c88f3be126d0fe02a92c20e1d78192f4b648401
commit-date: 2015-04-27
build-date: 2015-04-27
host: x86_64-pc-windows-gnu
release: 1.1.0-dev

Backtrace by @kballard using rustc 1.1.0-nightly (5fb0259 2015-04-26) (built 2015-04-26)

$ env RUST_BACKTRACE=1 cargo run --example something
Compiling term v0.2.7 (file:///Users/kevin/Dev/rust/Scratch/term)
examples/something.rs:19:14: 2:54 error: source trait is private
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'capacity overflow', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libcore/option.rs:330

stack backtrace:
1: 0x105cb7b3f - sys::backtrace::write::h7c4b7b31b5a98994KVr
2: 0x105cc0242 - panicking::on_panic::h130becb52f065864NVv
3: 0x105c7c985 - rt::unwind::begin_unwind_inner::hf2ec506d50a3ea22wDv
4: 0x105c7d7bc - rt::unwind::begin_unwind_fmt::he465542fba1a288eCCv
5: 0x105cbfd9c - rust_begin_unwind
6: 0x105d0f7b5 - panicking::panic_fmt::h39c9227a84864bb7yKy
7: 0x105449ce3 - codemap::CodeMap::span_to_lines::h8832e04ed2aff1a62gA
8: 0x10548fd2b - diagnostic::emit::h695a3e055df98e351UB
9: 0x10548d4cc - diagnostic::EmitterWriter.Emitter::emit::h786e8cf93696a544JRB
10: 0x10543ff39 - diagnostic::SpanHandler::span_err::h9f68fad8e64a9d63PnB
11: 0x102e69e33 - session::Session::span_err::h2d09ffe9b87a2a3fIOp
12: 0x102879295 - PrivacyVisitor<'a, 'tcx>::report_error::had53c10fa374641a2Ra
13: 0x10287c29b - PrivacyVisitor<'a, 'tcx>.Visitor<'v>::visit_expr::h1cd280cef77a740dHhb
14: 0x10287dcc3 - visit::Visitor::visit_block::h7884039954563752346
15: 0x10287d549 - visit::Visitor::visit_fn::h18293213297878176316
16: 0x10287b631 - PrivacyVisitor<'a, 'tcx>.Visitor<'v>::visit_item::h83709f09c8dd29dfxdb
17: 0x10288241a - check_crate::h0ad7434cff2b8431EVb
18: 0x102437393 - driver::phase_3_run_analysis_passes::h84861191833defe7tGa
19: 0x102419588 - driver::compile_input::h65cad254ac62afa6Qba
20: 0x1024d8613 - run_compiler::hbd6a992aacaf1248F4b
21: 0x1024d5d7a - boxed::F.FnBox<A>::call_box::h9480122591250505076
22: 0x1024d52c7 - rt::unwind::try::try_fn::h5956310425634165804
23: 0x105d42618 - rust_try_inner
24: 0x105d42605 - rust_try
25: 0x1024d559e - boxed::F.FnBox<A>::call_box::h8195565033996650298
26: 0x105cbec3d - sys::thread::Thread::new::thread_start::h8efe8b1c3780385fvYu
27: 0x7fff94dfe267 - _pthread_body
28: 0x7fff94dfe1e4 - _pthread_start

Could not compile `term`.

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

Issue 2:
This error is related to #22050, not sure if it's a dupe. Some of the following code snippets rely on the term library (but the issue seems to be in Rust, not term).

The following builds fine:

fn foo() {
let mut s = String::new();
writeln!(s, "foo").unwrap();
}

This gives an error:

extern crate term;

fn foo() {
let mut t = term::stdout().unwrap();
writeln!(t, "foo").unwrap();
}

Output:

lib.rs:5:5: 5:23 error: source trait is private
lib.rs:5 writeln!(t, "foo").unwrap();

This is the error mentioned in #22050. Importing std::io::Write fixes the error. However, if println is used, we get no errors:

extern crate term;

fn foo() {
let mut t = term::stdout().unwrap();
writeln!(t, "foo").unwrap();
println!("foo");
}