Issue 1:
In rustc 1.3.0 stable the following code triggers an ICE:

struct FooBar<'a> {
func: &'a Fn(&mut u32),
}

const FOO: FooBar<'static> = FooBar {
func: &|bar: &mut u32| {
println!("{}", *bar);
// This statement results in an ICE.
let inner = |bar: &mut u32| {
println!("{}", *bar);
};
// Uncomment this for a different(?) ICE.
//(inner)(bar);
}
};

fn main() {
let mut bar = 5;
(FOO.func)(&mut bar);
}

The above code as-is produces the following stack trace:

Compiling ice_nested_closure v0.1.0 (file:///home/faultyram/code/rust/ice_nested_closure)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:363

stack backtrace:
1: 0x7f0bc200f66e - sys::backtrace::write::ha67a6a2049d22fadIvs
2: 0x7f0bc2017d55 - panicking::on_panic::hfa4bf0215983f759lzx
3: 0x7f0bc1fd894e - rt::unwind::begin_unwind_inner::ha1b5da93bdf7e8ffC0w
4: 0x7f0bc1fd96b6 - rt::unwind::begin_unwind_fmt::hac9e09b20e42a51cIZw
5: 0x7f0bc20178f6 - rust_begin_unwind
6: 0x7f0bc205eb64 - panicking::panic_fmt::hd75b6cee85f3afe4SgC
7: 0x7f0bc205891d - panicking::panic::h25435899636f1091pfC
8: 0x7f0bc01adc45 - middle::ty::ctxt<'tcx>::closure_kind::h3ef8af572aaca971Em8
9: 0x7f0bc0def7af - trans::base::self_type_for_closure::hce2ac9a27a7229f9cWg
10: 0x7f0bc0df0585 - trans::declare::declare_rust_fn::h23ae5856407a285cI0A
11: 0x7f0bc0e534b1 - trans::declare::define_internal_rust_fn::he183aa012af49686gcB
12: 0x7f0bc0e526e9 - trans::closure::get_or_create_closure_declaration::hf10894c31fc3f525pmr
13: 0x7f0bc0e542cb - trans::closure::trans_closure_expr::hcc02521c6bd07707qrr
14: 0x7f0bc0e67f76 - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
15: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
16: 0x7f0bc0e66a9a - trans::consts::get_const_expr_as_global::hd38709c357ba535cxjt
17: 0x7f0bc0e7d935 - trans::expr::trans_into::hd80da72fd88f78b0voB
18: 0x7f0bc0eebcf0 - trans::_match::mk_binding_alloca::h8933109284487913883
19: 0x7f0bc0df68d4 - trans::base::init_local::h05162f2d49649b99pOh
20: 0x7f0bc0e0bec6 - trans::controlflow::trans_block::h712a0dbbff7e0feau1v
21: 0x7f0bc0ea4b4f - trans::expr::trans_rvalue_dps_unadjusted::h0c5c402374fadccbRyC
22: 0x7f0bc0e7dbc8 - trans::expr::trans_into::hd80da72fd88f78b0voB
23: 0x7f0bc0e0c213 - trans::controlflow::trans_block::h712a0dbbff7e0feau1v
24: 0x7f0bc0e0afd6 - trans::base::trans_closure::h5ba05285462a4747sDi
25: 0x7f0bc0e544f9 - trans::closure::trans_closure_expr::hcc02521c6bd07707qrr
26: 0x7f0bc0e67f76 - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
27: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
28: 0x7f0bc0e6a4c2 - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
29: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
30: 0x7f0bc0e71727 - trans::consts::const_expr_unadjusted::closure.49914
31: 0x7f0bc0e7149e - vec::Vec<T>.FromIterator<T>::from_iter::h17887475302167253138
32: 0x7f0bc0e71089 - trans::consts::const_expr_unadjusted::closure.49903
33: 0x7f0bc0e69212 - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
34: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
35: 0x7f0bc0e66a9a - trans::consts::get_const_expr_as_global::hd38709c357ba535cxjt
36: 0x7f0bc0e6901d - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
37: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
38: 0x7f0bc0e6800b - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
39: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
40: 0x7f0bc0e68cdf - trans::consts::const_expr_unadjusted::h1d2d83c04c480e728Et
41: 0x7f0bc0e65e7f - trans::consts::const_expr::h08aedd7988733ed6Yot
42: 0x7f0bc0e66a9a - trans::consts::get_const_expr_as_global::hd38709c357ba535cxjt
43: 0x7f0bc0deb10c - trans::expr::trans::h0a46d0057de341dfLuB
44: 0x7f0bc0e414ff - trans::callee::trans_args::h9758e89dd2def684Efp
45: 0x7f0bc0ec727f - trans::callee::trans_call_inner::h3610184059173036198
46: 0x7f0bc0ea5666 - trans::expr::trans_rvalue_dps_unadjusted::h0c5c402374fadccbRyC
47: 0x7f0bc0e7dbc8 - trans::expr::trans_into::hd80da72fd88f78b0voB
48: 0x7f0bc0e7d4a2 - trans::controlflow::trans_stmt_semi::haea6d90b71002e6cy0v
49: 0x7f0bc0e0be9a - trans::controlflow::trans_block::h712a0dbbff7e0feau1v
50: 0x7f0bc0e0afd6 - trans::base::trans_closure::h5ba05285462a4747sDi
51: 0x7f0bc0e0c808 - trans::base::trans_fn::h05022c5934c7e8c7fNi
52: 0x7f0bc0e0f928 - trans::base::trans_item::hd3ac3af06c93993fPdj
53: 0x7f0bc0e1c40c - trans::base::trans_crate::h14e6ea6d455593f8i0j
54: 0x7f0bc25812f4 - driver::phase_4_translate_to_llvm::h8ce7c7bfb0fd9b185Oa
55: 0x7f0bc257b885 - driver::phase_3_run_analysis_passes::closure.16542
56: 0x7f0bc2575ab1 - middle::ty::ctxt<'tcx>::create_and_enter::h9578579149294230291
57: 0x7f0bc2570991 - driver::phase_3_run_analysis_passes::h8415522514568150077
58: 0x7f0bc2554a90 - driver::compile_input::h52c7dafd49963360Tba
59: 0x7f0bc263aa63 - run_compiler::h473c62e00f865fa9A7b
60: 0x7f0bc26384de - boxed::F.FnBox<A>::call_box::h10713159552398332324
61: 0x7f0bc2637e09 - rt::unwind::try::try_fn::h16887904248528792425
62: 0x7f0bc201784d - __rust_try
63: 0x7f0bc20028f7 - rt::unwind::try::inner_try::hafffff77ddacfa5fvWw
64: 0x7f0bc2638028 - boxed::F.FnBox<A>::call_box::h5417278073590676257
65: 0x7f0bc2016991 - sys::thread::Thread::new::thread_start::h29dca2a2cf2294b535v
66: 0x7f0bbc88e4a3 - start_thread
67: 0x7f0bc1c7013c - clone
68: 0x0 - <unknown>

Uncommenting the line //(inner)(foobar); produces:

Compiling ice_nested_closure v0.1.0 (file:///home/faultyram/code/rust/ice_nested_closure)
thread 'rustc' panicked at 'assertion failed: self.inh.deferred_call_resolutions.borrow().is_empty()', src/librustc_typeck/check/mod.rs:1971

stack backtrace:
1: 0x7fef4483766e - sys::backtrace::write::ha67a6a2049d22fadIvs
2: 0x7fef4483fd55 - panicking::on_panic::hfa4bf0215983f759lzx
3: 0x7fef4480094e - rt::unwind::begin_unwind_inner::ha1b5da93bdf7e8ffC0w
4: 0x7fef43f8ed91 - rt::unwind::begin_unwind::h12043835423437895913
5: 0x7fef43fb2712 - check::FnCtxt<'a, 'tcx>::select_all_obligations_or_error::h1fb080f55aa6bc05Vyp
6: 0x7fef4401f29f - check::check_const::hdf9e82e64dc18ba9pns
7: 0x7fef4400ee1f - check::check_item_type::h2be86c0a5866445bdRn
8: 0x7fef44015124 - check::check_item_types::he8badf30eb589763ewn
9: 0x7fef440d4bab - check_crate::h341139d405597625laD
10: 0x7fef44d9f199 - driver::phase_3_run_analysis_passes::closure.16542
11: 0x7fef44d9dab1 - middle::ty::ctxt<'tcx>::create_and_enter::h9578579149294230291
12: 0x7fef44d98991 - driver::phase_3_run_analysis_passes::h8415522514568150077
13: 0x7fef44d7ca90 - driver::compile_input::h52c7dafd49963360Tba
14: 0x7fef44e62a63 - run_compiler::h473c62e00f865fa9A7b
15: 0x7fef44e604de - boxed::F.FnBox<A>::call_box::h10713159552398332324
16: 0x7fef44e5fe09 - rt::unwind::try::try_fn::h16887904248528792425
17: 0x7fef4483f84d - __rust_try
18: 0x7fef4482a8f7 - rt::unwind::try::inner_try::hafffff77ddacfa5fvWw
19: 0x7fef44e60028 - boxed::F.FnBox<A>::call_box::h5417278073590676257
20: 0x7fef4483e991 - sys::thread::Thread::new::thread_start::h29dca2a2cf2294b535v
21: 0x7fef3f0b64a3 - start_thread
22: 0x7fef4449813c - clone
23: 0x0 - <unknown>

Note that the following compiles and runs successfully:

struct FooBar<'a> {
func: &'a Fn(&mut u32),
}

fn main() {
let foo = FooBar {
func: &|bar: &mut u32| {
println!("{}", *bar);
// This statement results in an ICE.
let inner = |bar: &mut u32| {
println!("{}", *bar);
};
// Uncomment this for a different(?) ICE.
(inner)(bar);
}
};
let mut bar = 5;
(foo.func)(&mut bar);
}

Issue 2:
I tried this code:

const X: u8 = || -> u8 { 5 }();

I expected to see this happen: Either a compilation error, or to be equivalent to const X: u8 = 5.

Instead, this happened: Internal compiler error

Meta

rustc --version --verbose:

rustc 1.4.0-nightly (20a8412e0 2015-08-28)
binary: rustc
commit-hash: 20a8412e09e2883489736b4ae3dc138f243d1a17
commit-date: 2015-08-28
host: x86_64-unknown-linux-gnu
release: 1.4.0-nightly

Backtrace:

thread 'rustc' panicked at 'assertion failed: self.inh.deferred_call_resolutions.borrow().is_empty()', ../src/librustc_typeck/check/mod.rs:2023

stack backtrace:
1: 0x7fc7fbaf90a9 - sys::backtrace::tracing::imp::write::he11991336d112ae3Aes
2: 0x7fc7fbb00d76 - panicking::on_panic::hd741984fb33f3e317ex
3: 0x7fc7fbac55de - rt::unwind::begin_unwind_inner::h837b3c3463e1a06eLHw
4: 0x7fc7fab0ca9f - rt::unwind::begin_unwind::h10622579821064218427
5: 0x7fc7fab3216c - check::FnCtxt<'a, 'tcx>::select_all_obligations_or_error::h966bbb42357b6836dvr
6: 0x7fc7fabd43fc - check::check_const::hbed0eb360d678b26Acu
7: 0x7fc7fabc22c7 - check::check_item_type::h25c10dc6ab99c072tKp
8: 0x7fc7fac84392 - check_crate::hf540b00aced9403awAE
9: 0x7fc7fc049a8e - driver::phase_3_run_analysis_passes::closure.20656
10: 0x7fc7fc02c0c3 - middle::ty::ctxt<'tcx>::create_and_enter::h8301109304510330010
11: 0x7fc7fc02745d - driver::phase_3_run_analysis_passes::h13747097652036984327
12: 0x7fc7fc00a876 - driver::compile_input::h0626ad86fff9a5b9Tba
13: 0x7fc7fc16c98b - run_compiler::h4c5bab99983d75bd0bc
14: 0x7fc7fc16a257 - boxed::F.FnBox<A>::call_box::h7998076066074844987
15: 0x7fc7fc169cc4 - rt::unwind::try::try_fn::h11048267709636862519
16: 0x7fc7fbb00918 - __rust_try
17: 0x7fc7fbaed1d2 - rt::unwind::try::inner_try::h62b49309b595e978EDw
18: 0x7fc7fc169e58 - boxed::F.FnBox<A>::call_box::h8109257951937123469
19: 0x7fc7fbaffd63 - sys::thread::Thread::new::thread_start::h78cb9ca46e8b6bb6rNv
20: 0x7fc7f56c0181 - start_thread
21: 0x7fc7fb77947c - __clone
22: 0x0 - <unknown>