-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added noreturn checking for nevertype, new test
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Added noreturn checking for nevertype gcc/testsuite/ChangeLog: * rust/compile/inline_asm_typecheck.rs: New test.
- Loading branch information
1 parent
e0b05ae
commit a8c24ef
Showing
2 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#![feature(rustc_attrs)] | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! asm { | ||
() => {}; | ||
} | ||
|
||
fn main() { | ||
let mut _num1: i32 = 10; | ||
let mut _num2: i32 = 10; | ||
unsafe { | ||
// This demonstrates that asm!'s is inferred with a unit type is parsed correctly. | ||
let _ = asm!("nop"); | ||
|
||
// This errors out per rust spec | ||
// The asm! block never returns, and its return type is defined as ! (never). | ||
// Behavior is undefined if execution falls through past the end of the asm code. | ||
// A noreturn asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked. | ||
let _ = asm!("nop", options(noreturn)); | ||
} | ||
} |