Make global_asm!() work

Because apparently, we were not accepting inline asm in item position, completely breaking it.
This commit is contained in:
Chayim Refael Friedman 2025-07-09 18:55:27 +03:00
parent bd8087e86e
commit 95c04c4503
13 changed files with 58 additions and 36 deletions

View file

@ -143,6 +143,8 @@ impl<'a> Ctx<'a> {
ast::Item::MacroRules(ast) => self.lower_macro_rules(ast)?.into(),
ast::Item::MacroDef(ast) => self.lower_macro_def(ast)?.into(),
ast::Item::ExternBlock(ast) => self.lower_extern_block(ast).into(),
// FIXME: Handle `global_asm!()`.
ast::Item::AsmExpr(_) => return None,
};
let attrs = RawAttrs::new(self.db, item, self.span_map());
self.add_attrs(mod_item.ast_id(), attrs);

View file

@ -33,10 +33,9 @@ macro_rules! global_asm {() => {}}
#[rustc_builtin_macro]
macro_rules! naked_asm {() => {}}
// FIXME: This creates an error
// global_asm! {
// ""
// }
global_asm! {
""
}
#[unsafe(naked)]
extern "C" fn foo() {
@ -64,10 +63,7 @@ macro_rules! global_asm {() => {}}
#[rustc_builtin_macro]
macro_rules! naked_asm {() => {}}
// FIXME: This creates an error
// global_asm! {
// ""
// }
builtin #global_asm ("")
#[unsafe(naked)]
extern "C" fn foo() {

View file

@ -1052,17 +1052,6 @@ impl<'db> Scope<'db> {
}
}
pub fn resolver_for_expr(
db: &dyn DefDatabase,
owner: DefWithBodyId,
expr_id: ExprId,
) -> Resolver<'_> {
let r = owner.resolver(db);
let scopes = db.expr_scopes(owner);
let scope_id = scopes.scope_for(expr_id);
resolver_for_scope_(db, scopes, scope_id, r, owner)
}
pub fn resolver_for_scope(
db: &dyn DefDatabase,
owner: DefWithBodyId,