Issue 1:
The std::raw module exports some representation details for the purposes of transmuting and taking things apart. Stabilizing these means pinning down the representation details forever.

One possibility is to instead provide various conversions, rather than asking people to use transmute, when we're sure the conversions will always be possible. Methods like from_raw_parts are already doing this.

The TraitObject case in particular is unsettled due to the potential for upcasting in the future.

cc @carllerche

CURRENT STATUS AS OF 2016-08-18: Discussed in @rust-lang/lang meeting. The situation is this. We expect that this will be insufficient in the future, particularly if/when we support trait objects like Trait1+Trait2 (which would require 2 vtables). We could stabilize it, since it would remain correct for all existing objects, but it'd be a shame. In contrast, the various "custom DST" proposals would allow for a much more flexible way of extracting and creating this data (sort of like from_raw_parts), so we think we'd prefer to explore that route. (from #27751 (comment))

Issue 2:
rustc 0.8-pre (570431f 2013-09-19 15:56:04 -0700)

RUST_THREADS=1 must not allow the rust runtime to start a second thread, which it does now. This is really bad.

Background: If I wish to fork(2) and use the resulting image, only the thread that calls fork(2) gets duplicated. If any other thread has locked a mutex (say for printf, or malloc) and was in the middle of a critical section, then those locks remain locked, the other threads vanish, and my new child process is hosed.

From the rust-dev thread on rusti - the - repl renovation: (20 sept 2013):

I'm trying some sanity checks. This one had a curious result. I did

$ export RUST_THREADS=1

and then started rusti under gdb. Expected: only one thread going. Observed: I have two threads going instead.

(This is troublesome, because fork will never work if Rust doesn't honor the request of RUST_THREADS=1; you can't mix threads and fork; explanation: http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them )

Q: Is there a way to really just get one thread in the rust runtime? Best case, I'm hoping the two threads observed is just a bug that can be fixed.

Jason

From: Alex Crichton alex@crichton.co

Date: Fri, Sep 20, 2013 at 4:24 PM

Subject: Re: [rust-dev] rusti - the - repl renovation

To: "Jason E. Aten" j.e.aten@gmail.com

Q: Is there a way to really just get one thread in the rust runtime? Best

case, I'm hoping the two threads observed is just a bug that can be fixed.

Right now the runtime will always spawn at least one thread, so

without turning off the runtime you'll have at least two threads.

That's arguably a bug in the runtime though...

jaten@fre:/usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin$ ./rustc -v
./rustc 0.8-pre (570431f 2013-09-19 15:56:04 -0700)
host: x86_64-unknown-linux-gnu
jaten@fre:/usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin$

jaten@fre:/usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin$ env|grep RUST
RUST_THREADS=1
jaten@fre:/usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin$ gdb ./rusti
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/rusti...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/rusti
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7fd3700 (LWP 11639)]
WARNING: The Rust REPL is experimental and may be
unstable. If you encounter problems, please use the
compiler instead. Type :help for help.
rusti> C-c C-c
Program received signal SIGINT, Interrupt.
0x00007ffff4356148 in pthread_join () from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb) bt
#0 0x00007ffff4356148 in pthread_join () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007ffff49369d4 in rust_thread::join (this=0x7ffff001f2e0) at src/rt/sync/rust_thread.cpp:65
#2 0x00007ffff4937469 in rust_raw_thread_join (thread=0x7ffff001f2e0) at src/rt/rust_builtin.cpp:417
#3 0x00007ffff768f2e9 in rt::thread::Thread::join::hf3525925b944a51ZTas::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#4 0x00007ffff77cddd3 in rt::run_::h82e8c355ab8d949faz::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#5 0x00007ffff77cb694 in rt::run::hd3cab0f3a053bc41ab::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#6 0x00007ffff770968e in rt::start::h98ebfd32a7b8f1ad::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#7 0x00007ffff77095f7 in unstable::lang::start::h76d6c774aa357c7aaj::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#8 0x0000000000400c2b in main ()
(gdb) i th
Id Target Id Frame
2 Thread 0x7ffff7fd3700 (LWP 11639) "rusti" 0x00007ffff46508cd in read () from /lib/x86_64-linux-gnu/libc.so.6
* 1 Thread 0x7ffff7fd5780 (LWP 11636) "rusti" 0x00007ffff4356148 in pthread_join () from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb) thread 2
[Switching to thread 2 (Thread 0x7ffff7fd3700 (LWP 11639))]
#0 0x00007ffff46508cd in read () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff46508cd in read () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff45e4ff8 in _IO_file_underflow () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff45e603e in _IO_default_uflow () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff45da18a in _IO_getline_info () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff45d906b in fgets () from /lib/x86_64-linux-gnu/libc.so.6
#5 0x00007ffff4946358 in linenoise (prompt=0x7fffefc58058 "rusti> ") at src/rt/linenoise/linenoise.c:1405
#6 0x00007ffff70a8061 in rl::rustrt::linenoise::h64cc97493178b67aa3::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#7 0x00007ffff70a8b26 in rl::read::anon::expr_fn::a1 () from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#8 0x00007ffff70a8aba in c_str::CString::with_ref::hb23b2a52bcdd1fsya0::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#9 0x00007ffff70a89b4 in c_str::ToCStr::with_c_str::hb23b2a52bcdd1faZ::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#10 0x00007ffff70a8936 in rl::read::h55e92cb2e4e46fea8::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#11 0x00007ffff4d691a2 in get_line::hacc817425f24a23caR::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librusti-53e0ef2ae196aaff-0.8-pre.so
#12 0x00007ffff4d7b1d2 in main_args::h37a11c4051c2827aO::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librusti-53e0ef2ae196aaff-0.8-pre.so
#13 0x00007ffff4d7a947 in main::h3a346db0adc4cf51aB::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librusti-53e0ef2ae196aaff-0.8-pre.so
#14 0x0000000000400bb9 in main::h4eb1c8bbff1fac2ag::v0.0 ()
#15 0x00007ffff7709758 in unstable::lang::start::anon::expr_fn::a1 ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#16 0x00007ffff7719814 in rt::task::__extensions__::build_start_wrapper::anon::anon::expr_fn::ab ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#17 0x00007ffff761849c in unstable::finally::Finally$__extensions__::finally::h199ab8d6eb226980ECan::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#18 0x00007ffff77170d5 in rt::task::__extensions__::run::anon::expr_fn::at ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#19 0x00007ffff7719ce9 in rt::task::Unwinder::try::try_fn::__rust_abi::Vc ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#20 0x00007ffff7719c47 in rt::task::Unwinder::try::try_fn::hae27117228cab98fVca9::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#21 0x00007ffff4937787 in rust_try (f=0x7ffff7719bf0 <rt::task::Unwinder::try::try_fn::hae27117228cab98fVca9::v0.8$x2dpre>, fptr=0x7ffff7717080, env=0x7ffff0236348)
at src/rt/rust_builtin.cpp:523
#22 0x00007ffff7716fa2 in rt::task::Unwinder::try::h199ab8d6eb226980Vcas::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#23 0x00007ffff7716e36 in rt::task::Task::run::h199ab8d6eb226980iXar::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#24 0x00007ffff7719467 in rt::task::__extensions__::build_start_wrapper::anon::expr_fn::a2 ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#25 0x00007ffff77b0db5 in rt::context::Context::new::task_start_wrapper::__rust_abi::se ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#26 0x00007ffff77b0d67 in rt::context::Context::new::task_start_wrapper::h1b9fdc38dc3bcfa4sea8::v0.8$x2dpre ()
from /usr/cn/rust/debug-build/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#27 0x0000000000000000 in ?? ()
(gdb)