Issue 1:
STR

#![crate_type = "lib"]

use std::mem;
use std::ops::Deref;

fn ice(sample: &Sample<f32>) {
let slice: &[f32] = sample;
}

fn ok(sample: &Sample<f32>) {
let slice: &[f32] = unsafe { mem::transmute(sample) };
}

struct Sample<A>([A]);

impl<A> Deref for Sample<A> {
type Target = [A];

fn deref(&self) -> &[A] {
unsafe {
mem::transmute(self)
}
}
}

Backtrace

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'unsized_part_of_type failed even though ty is unsized', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/common.rs:166

stack backtrace:
1: 0x7fdc3bc535b0 - sys::backtrace::write::h0cbfc88baae43aa021y
2: 0x7fdc3bc779b0 - failure::on_fail::h0a7ead13585065c0rcH
3: 0x7fdc3bbd5970 - rt::unwind::begin_unwind_inner::h5389a239af7b06eeMQG
4: 0x7fdc3a8a7d50 - rt::unwind::begin_unwind::h16123941288702621176
5: 0x7fdc3a980310 - trans::common::unsized_part_of_type::ha72e8603712ad74dSRk
6: 0x7fdc3a9b12a0 - trans::type_of::type_of::type_of_unsize_info::h8f9f7a388a336e9dm8o
7: 0x7fdc3a903650 - trans::type_of::type_of::h26bd2a95f0ad4a3727o
8: 0x7fdc3a9208a0 - trans::datum::Datum<'tcx, Rvalue>::to_ref_datum::h75fa0e01c0664e30YQf
9: 0x7fdc3a920a00 - trans::datum::Datum<'tcx, Rvalue>::to_appropriate_datum::h6c5a00ca4a6144b7SRf
10: 0x7fdc3a93fe30 - trans::callee::trans_arg_datum::h5d56fde4db281665Rqh
11: 0x7fdc3a9330c0 - trans::callee::trans_args::h82e8228688fa879cShh
12: 0x7fdc3a95d7a0 - trans::expr::trans_overloaded_op::h7dcf7ba6da813cf5I6j
13: 0x7fdc3a979e60 - trans::expr::deref_once::h6284489ab9f07c9eBzk
14: 0x7fdc3a94cf50 - trans::expr::deref_multiple::h48c0e59f95e290f1Zxk
15: 0x7fdc3a8f9cb0 - trans::expr::trans::h4aa11cd527e88cd0dIh
16: 0x7fdc3a8f8b20 - trans::expr::trans_into::h792bd9b430d8f7dfJEh
17: 0x7fdc3a9fa950 - trans::_match::mk_binding_alloca::h4494187384434577009
18: 0x7fdc3a8f81c0 - trans::base::init_local::he96ac71055395945not
19: 0x7fdc3a8f9130 - trans::controlflow::trans_block::hd445a33426df7637Bde
20: 0x7fdc3a9c4530 - trans::base::trans_closure::h899ff1df83d7583b9du
21: 0x7fdc3a8e55e0 - trans::base::trans_fn::hc2298bc13eeb8cfappu
22: 0x7fdc3a8e0570 - trans::base::trans_item::h03200b520668f12feOu
23: 0x7fdc3a9cb990 - trans::base::trans_crate::ha94cd7a9cd13cad4yLv
24: 0x7fdc3c269210 - driver::phase_4_translate_to_llvm::he09ab588c39cf70ewPa
25: 0x7fdc3c242200 - driver::compile_input::h0eb7a1103ff8aba2Eba
26: 0x7fdc3c3136e0 - run_compiler::ha9d14025fcb8e9fc5bc
27: 0x7fdc3c311d40 - thunk::F.Invoke<A, R>::invoke::h5646167225587318028
28: 0x7fdc3c310c30 - rt::unwind::try::try_fn::h4383208440922308355
29: 0x7fdc3bce3d40 - rust_try_inner
30: 0x7fdc3bce3d30 - rust_try
31: 0x7fdc3c310ee0 - thunk::F.Invoke<A, R>::invoke::h10387639015308431532
32: 0x7fdc3bc63ea0 - sys::thread::thread_start::h5a97a888379df6e9FQC
33: 0x7fdc35c722b0 - start_thread
34: 0x7fdc3b861249 - __clone
35: 0x0 - <unknown>

Version

rustc 1.0.0-nightly (a954663db 2015-02-10 22:08:30 +0000)

cc @nick29581 @eddyb

(NB #16812 has the same ICE message, but it don't think it's a duplicate because that issue is about "complex" (unsupported?) DST structs that can't be obtained/created via a mem::transmute. On the other hand, this issue is about the known-to-work NewType(Dst)/NewType { inner: Dst } pattern)

Issue 2:
As per fixme.