about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-06-12 14:08:44 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-06-13 13:53:55 -0700
commitc9f3f47702602d196de414aa4f10bb2c2148ab9a (patch)
tree9a1b3943e8b6f01f77750333547178f2b92ce7ee /src/libstd
parent8c4a10a159a021a586a8a35552cbbe4f60e644a2 (diff)
downloadrust-c9f3f47702602d196de414aa4f10bb2c2148ab9a.tar.gz
rust-c9f3f47702602d196de414aa4f10bb2c2148ab9a.zip
librustc: Forbid `transmute` from being called on types whose size is
only known post-monomorphization, and report `transmute` errors before
the code is generated for that `transmute`.

This can break code that looked like:

    unsafe fn f<T>(x: T) {
        let y: int = transmute(x);
    }

Change such code to take a type parameter that has the same size as the
type being transmuted to.

Closes #12898.

[breaking-change]
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/dynamic_lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index fa6efc8a4b1..61f7997071e 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -134,7 +134,7 @@ impl DynamicLibrary {
     }
 
     /// Access the value at the symbol of the dynamic library
-    pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<T, String> {
+    pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*T, String> {
         // This function should have a lifetime constraint of 'a on
         // T but that feature is still unimplemented