internal: Remove synstructure const hack support

This commit is contained in:
Lukas Wirth 2024-03-08 11:36:37 +01:00
parent 09b9a921a8
commit 558feeab61
8 changed files with 48 additions and 68 deletions

View file

@ -213,7 +213,7 @@ impl TraitImpls {
// To better support custom derives, collect impls in all unnamed const items.
// const _: () = { ... };
for konst in module_data.scope.unnamed_consts(db.upcast()) {
for konst in module_data.scope.unnamed_consts() {
let body = db.body(konst.into());
for (_, block_def_map) in body.blocks(db.upcast()) {
Self::collect_def_map(db, map, &block_def_map);
@ -337,7 +337,7 @@ impl InherentImpls {
// To better support custom derives, collect impls in all unnamed const items.
// const _: () = { ... };
for konst in module_data.scope.unnamed_consts(db.upcast()) {
for konst in module_data.scope.unnamed_consts() {
let body = db.body(konst.into());
for (_, block_def_map) in body.blocks(db.upcast()) {
self.collect_def_map(db, &block_def_map);

View file

@ -1461,28 +1461,6 @@ fn f() {
);
}
#[test]
fn trait_impl_in_synstructure_const() {
check_types(
r#"
struct S;
trait Tr {
fn method(&self) -> u16;
}
const _DERIVE_Tr_: () = {
impl Tr for S {}
};
fn f() {
S.method();
//^^^^^^^^^^ u16
}
"#,
);
}
#[test]
fn inherent_impl_in_unnamed_const() {
check_types(