]> git.lizzy.rs Git - rust.git/commit
Translate zero-sized return types as void
authorBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 15 Jan 2016 16:34:38 +0000 (17:34 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 15 Jan 2016 17:29:29 +0000 (18:29 +0100)
commitf10af2e5fa505a217f7b22591b29953e9c75d835
tree116fe8906c676f8fdf0d5edb6618d91df27d1ed2
parenta70a60a02bca4c1fb75a0eb0ecf80acb73972f66
Translate zero-sized return types as void

The only way to get a value for a zero-sized type is `undef`, so
there's really no point in actually having a return type other than
void for such types. Also, while the comment in return_type_is_void
mentioned something about aiding C ABI support, @eddyb correctly
pointed out on IRC that there is no such thing as a zero-sized type in
C. And even with clang, which allows empty structs, those get
translated as void return types as well.

Fixes #28766
src/librustc_trans/trans/common.rs
src/test/run-make/issue-28766/Makefile [new file with mode: 0644]
src/test/run-make/issue-28766/foo.rs [new file with mode: 0644]
src/test/run-make/issue-28766/main.rs [new file with mode: 0644]