Uh oh!
There was an error while loading. Please reload this page.
Add intrinsics::unreachable - #16970
Conversation
thestinger
commented
Sep 3, 2014
A simple run-pass test making use of it would be nice, even though it can't be directly tested. |
alexcrichton
commented
Sep 3, 2014
What happens in a program like this? use std::intrinsics;fnmain(){unsafe{ intrinsics::unreachable();}} |
thestinger
commented
Sep 3, 2014
That has undefined behaviour, it's the point of the intrinsic. It's the same thing as |
kmcallister
commented
Sep 3, 2014
My use case is something like pubfnexit(n:uint) -> ! {staticNR_EXIT:uint = 60;unsafe{asm!("syscall"::"{rax}"(NR_EXIT),"{rdi}"(n));
intrinsics::unreachable()}}which compiles on x86-64 Linux to just Without the intrinsic I need something like |
kmcallister
commented
Sep 4, 2014
Not sure why the Travis build failed. The log shows |
Kimundi
commented
Sep 4, 2014
Travis always fails its llvm 3.4 build atm. The 3.3 one succeeded though, which is the important one. |
huonw
commented
Sep 4, 2014
Does this avoid crashing horribly? (iirc there have been crashes due to LLVM assertions about unreachability previously) fnfoo(){unreachable();println!("foo");} |
kmcallister
commented
Sep 4, 2014
It doesn't crash rustc, no. |
kmcallister
commented
Sep 14, 2014
@huonw, @thestinger: Any more thoughts about this? |
kmcallister
commented
Sep 15, 2014
Any way I can get the contents of |
alexcrichton
commented
Sep 16, 2014
Not at this point sadly, the bots clean out all previous runs when they make a new build. You could update the test, however, to print it out and we can push to try. |
vadimcn
commented
Sep 20, 2014
@kmcallister: Please note that on Win64, the 'unreachable' instruction actually emits code. |
kmcallister
commented
Sep 21, 2014
Aha! |
ghost
commented
Sep 24, 2014
FWIW, matching an empty enum will produce an unreachable instruction: use std::any::Void;use std::intrinsics::transmute;fnmain(){let x:Void = unsafe{transmute(())};match x {}}%"enum.core::any::Void<[]>[#3]" = type {}
; Function Attrs: uwtabledefineinternalvoid@_ZN4main20h31af98ebf3d86da3gaaE() unnamed_addr #0 {
entry-block:
%x = alloca %"enum.core::any::Void<[]>[#3]"unreachableso the |
There was a problem hiding this comment.
I'm not sure whether tests should feature idiomatic code, but in this case I think it'd be better if you'd mark this function unsafe.
kmcallister
commented
Oct 5, 2014
Rebased and addressed @tbu-'s comment. r? @thestinger |
I'm not sure how to add an automated test for this.
Fix tasks in tasks.json rust-lang#16839 refactored the representation of tasks inside the VS Code extension. However, this data type is exposed to users, who can define their own tasks in the same format in `tasks.json` or `.code-workspace`. Revert the data type to have a `command` field rather than a `program` field, and document the different fields. This code is also a little complex, so split out a `cargoToExecution` to handle the Task to Execution conversion logic. After this change, any tasks.json with a `command` field works again. For example, the following tasks.json works as expected: ``` { "version": "2.0.0", "tasks": [ { "type": "cargo", "command": "build", "problemMatcher": [ "$rustc" ], "group": "build", "label": "my example cargo build task" } ] } ``` Fixesrust-lang#16943rust-lang#16949
Fix tasks in tasks.json rust-lang#16839 refactored the representation of tasks inside the VS Code extension. However, this data type is exposed to users, who can define their own tasks in the same format in `tasks.json` or `.code-workspace`. Revert the data type to have a `command` field rather than a `program` field, and document the different fields. This code is also a little complex, so split out a `cargoToExecution` to handle the Task to Execution conversion logic. After this change, any tasks.json with a `command` field works again. For example, the following tasks.json works as expected: ``` { "version": "2.0.0", "tasks": [ { "type": "cargo", "command": "build", "problemMatcher": [ "$rustc" ], "group": "build", "label": "my example cargo build task" } ] } ``` Fixesrust-lang#16943rust-lang#16949
…ust-lang#16970) Closesrust-lang/rust-clippy#16968 changelog: [`manual_option_zip`] fix FP when the outer param is used in closure
I'm not sure how to add an automated test for this.