Allow defining opaques in statics and consts
This commit is contained in:
@@ -11,15 +11,20 @@ pub(crate) fn expand(
|
||||
let define_opaque = match &mut item {
|
||||
Annotatable::Item(p) => match &mut p.kind {
|
||||
ast::ItemKind::Fn(f) => Some(&mut f.define_opaque),
|
||||
ast::ItemKind::Const(ct) => Some(&mut ct.define_opaque),
|
||||
ast::ItemKind::Static(si) => Some(&mut si.define_opaque),
|
||||
_ => None,
|
||||
},
|
||||
Annotatable::AssocItem(i, _assoc_ctxt) => match &mut i.kind {
|
||||
ast::AssocItemKind::Fn(func) => Some(&mut func.define_opaque),
|
||||
ast::AssocItemKind::Const(ct) => Some(&mut ct.define_opaque),
|
||||
_ => None,
|
||||
},
|
||||
Annotatable::Stmt(s) => match &mut s.kind {
|
||||
ast::StmtKind::Item(p) => match &mut p.kind {
|
||||
ast::ItemKind::Fn(f) => Some(&mut f.define_opaque),
|
||||
ast::ItemKind::Const(ct) => Some(&mut ct.define_opaque),
|
||||
ast::ItemKind::Static(si) => Some(&mut si.define_opaque),
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
|
||||
@@ -285,6 +285,7 @@ pub(crate) fn expand_test_or_bench(
|
||||
defaultness: ast::Defaultness::Final,
|
||||
generics: ast::Generics::default(),
|
||||
ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
|
||||
define_opaque: None,
|
||||
// test::TestDescAndFn {
|
||||
expr: Some(
|
||||
cx.expr_struct(
|
||||
|
||||
Reference in New Issue
Block a user