rust/compiler/rustc_resolve/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
..
diagnostics Implement the unused_macro_rules lint 2022-05-05 19:13:00 +02:00
late Forbid nested opaque types to reference HRTB from opaque types. 2022-05-14 11:38:25 +02:00
access_levels.rs resolve/metadata: Stop encoding macros as reexports 2022-02-24 22:55:40 +03:00
build_reduced_graph.rs resolve: Move collection of all macro_rules in the crate to rustdoc 2022-05-13 21:43:36 +03:00
check_unused.rs Omit unnecessary help to add #[cfg(test)] when already annotated 2022-05-17 06:50:07 +09:00
def_collector.rs Replace DefPathData::Misc by two appropriately-named variants. 2022-05-12 20:12:35 +02:00
diagnostics.rs Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkov 2022-05-12 00:08:08 +00:00
ident.rs Permit asm_const and asm_sym to reference outer generic params 2022-05-07 03:32:27 +01:00
imports.rs rustc: Panic by default in DefIdTree::parent 2022-05-02 01:56:50 +03:00
late.rs Permit asm_const and asm_sym to reference outer generic params 2022-05-07 03:32:27 +01:00
lib.rs resolve: Move collection of all macro_rules in the crate to rustdoc 2022-05-13 21:43:36 +03:00
macros.rs Implement the unused_macro_rules lint 2022-05-05 19:13:00 +02:00