Skip to content

Commit

Permalink
Add documentation for type RET = ...
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeuw committed Mar 20, 2023
1 parent 9da1da9 commit 9dc275b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions library/core/src/intrinsics/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
//!
//! The input to the [`mir!`] macro is:
//!
//! - An optional return type annotation in the form of `type RET = ...;`. This may be required
//! if the compiler cannot infer the type of RET.
//! - A possibly empty list of local declarations. Locals can also be declared inline on
//! assignments via `let`. Type inference generally works. Shadowing does not.
//! - A list of basic blocks. The first of these is the start block and is where execution begins.
Expand Down Expand Up @@ -124,6 +126,18 @@
//! }
//! )
//! }
//!
//! #[custom_mir(dialect = "runtime", phase = "optimized")]
//! fn annotated_return_type() -> (i32, bool) {
//! mir!(
//! type RET = (i32, bool);
//! {
//! RET.0 = 1;
//! RET.1 = true;
//! Return()
//! }
//! )
//! }
//! ```
//!
//! We can also set off compilation failures that happen in sufficiently late stages of the
Expand Down

0 comments on commit 9dc275b

Please sign in to comment.