rust/compiler/rustc_ast/src
bors 10d9ecda48 Auto merge of #96800 - nbdd0121:const, r=nagisa
Permit `asm_const` and `asm_sym` to reference generic params

Related #96557

These constructs will be allowed:
```rust
fn foofoo<const N: usize>() {}

unsafe fn foo<const N: usize>() {
    asm!("/* {0} */", const N);
    asm!("/* {0} */", const N + 1);
    asm!("/* {0} */", sym foofoo::<N>);
}

fn barbar<T>() {}

unsafe fn bar<T>() {
    asm!("/* {0} */", const std::mem::size_of::<T>());
    asm!("/* {0} */", const std::mem::size_of::<(T, T)>());
    asm!("/* {0} */", sym barbar::<T>);
    asm!("/* {0} */", sym barbar::<(T, T)>);
}
```

`@Amanieu,` I didn't switch inline asms to use `DefKind::InlineAsm`, as I see little value doing that; given that no type inference is needed, it will only make typecking slower and more complex but will have no real gains. I did switch them to follow the same code path as inline asm during symbol resolution, though.
The `error: unconstrained generic constant` you mentioned in #76001 is due to the fact that `to_const` will actually add a wfness obligation to the constant, which we don't need for `asm_const`, so I have that removed.

`@rustbot` label: +A-inline-assembly +F-asm
2022-05-18 15:07:47 +00:00
..
ast mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
attr Overhaul MacArgs::Eq. 2022-05-05 07:06:12 +10:00
expand Make allocator_kind a query. 2021-06-20 11:52:51 +02:00
util Add do yeet expressions to allow experimentation in nightly 2022-04-30 17:40:27 -07:00
ast.rs ast: Introduce some traits to get AST node properties generically 2022-05-11 12:43:27 +03:00
ast_traits.rs ast: Introduce some traits to get AST node properties generically 2022-05-11 12:43:27 +03:00
entry.rs Fix ICE when main is declared in an extern block 2021-06-09 23:14:02 -04:00
lib.rs ast: Introduce some traits to get AST node properties generically 2022-05-11 12:43:27 +03:00
mut_visit.rs Auto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkov 2022-05-04 21:16:28 +00:00
node_id.rs Use LocalExpnId where possible. 2021-07-17 19:41:02 +02:00
ptr.rs Use const Box::default in P::<[T]>::new 2022-04-11 12:14:18 -07:00
token.rs Rollup merge of #96682 - nnethercote:show-invisible-delims, r=petrochenkov 2022-05-05 15:43:05 +02:00
tokenstream.rs rustc_ast: Harmonize delimiter naming with proc_macro::Delimiter 2022-04-28 10:04:29 +03:00
visit.rs Permit asm_const and asm_sym to reference outer generic params 2022-05-07 03:32:27 +01:00