-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Description
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;
#[repr(u8)]
enum Bool {
False = 0,
True = 1,
}
// EMIT_MIR enums.set_discr_repr.built.after.mir
#[custom_mir(dialect = "runtime", phase = "initial")]
fn set_discr_repr(b: &mut Bool) {
mir!({
SetDiscriminant(*b, 0);
Return()
})
}
fn main() {
}
clippy::semicolon-if-nothing-returned
warns here:
warning: consider adding a `;` to the last statement for consistent formatting
--> ./tests/mir-opt/building/custom/enums.rs:17:5
|
17 | / mir!({
18 | | SetDiscriminant(*b, 0);
19 | | Return()
20 | | })
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
= note: requested on the command line with `-W clippy::semicolon-if-nothing-returned`
help: add a `;` here
|
17 ~ mir!({
18 + SetDiscriminant(*b, 0);
19 + Return()
20 + });
but if I add a semicolon, rustc find it cannot infer the type which it needs to make sure the macro does in fact return ()
error[E0282]: type annotations needed
--> ./tests/mir-opt/building/custom/enums.rs:17:5
|
17 | / mir!({
18 | | SetDiscriminant(*b, 0);
19 | | Return()
20 | | });
| |______^ cannot infer type
|
= note: this error originates in the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info)
Metadata
Metadata
Assignees
Labels
I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity