-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
#![feature(stmt_expr_attributes)]
pub fn foo() {
let f = #[target_feature(enable="magic")] || {};
// f();
}I expected to see this happen: error because the target feature does not exist and the closure is not unsafe.
Instead, this happened: the errors does not happen unless the closure is called in foo and foo is codegen'd. That is, I can get the expected errors by uncommenting the f(); line and running e.g. cargo build. but cargo check / rustc --emit metadata doesn't give any error, nor does cargo build give errors if foo is not codegen'd for other reasons (e.g., not pub in a library, or #[inline]).
Meta
rustc --version --verbose:
rustc 1.44.0-nightly (f509b26a7 2020-03-18)
binary: rustc
commit-hash: f509b26a7730d721ef87423a72b3fdf8724b4afa
commit-date: 2020-03-18
host: x86_64-unknown-linux-gnu
release: 1.44.0-nightly
LLVM version: 9.0
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.