Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/hir.rs')
-rw-r--r--crates/hir-def/src/hir.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs
index 494644d8ef..0fc7857d97 100644
--- a/crates/hir-def/src/hir.rs
+++ b/crates/hir-def/src/hir.rs
@@ -13,11 +13,12 @@
//! See also a neighboring `body` module.
pub mod format_args;
+pub mod generics;
pub mod type_ref;
use std::fmt;
-use hir_expand::{name::Name, MacroDefId};
+use hir_expand::{MacroDefId, name::Name};
use intern::Symbol;
use la_arena::Idx;
use rustc_apfloat::ieee::{Half as f16, Quad as f128};
@@ -25,10 +26,13 @@ use syntax::ast;
use type_ref::TypeRefId;
use crate::{
+ BlockId,
builtin_type::{BuiltinFloat, BuiltinInt, BuiltinUint},
- path::{GenericArgs, Path},
+ expr_store::{
+ HygieneId,
+ path::{GenericArgs, Path},
+ },
type_ref::{Mutability, Rawness},
- BlockId, ConstBlockId,
};
pub use syntax::ast::{ArithOp, BinaryOp, CmpOp, LogicOp, Ordering, RangeOp, UnaryOp};
@@ -137,11 +141,7 @@ pub enum LiteralOrConst {
impl Literal {
pub fn negate(self) -> Option<Self> {
- if let Literal::Int(i, k) = self {
- Some(Literal::Int(-i, k))
- } else {
- None
- }
+ if let Literal::Int(i, k) = self { Some(Literal::Int(-i, k)) } else { None }
}
}
@@ -212,7 +212,7 @@ pub enum Expr {
statements: Box<[Statement]>,
tail: Option<ExprId>,
},
- Const(ConstBlockId),
+ Const(ExprId),
// FIXME: Fold this into Block with an unsafe flag?
Unsafe {
id: Option<BlockId>,
@@ -555,6 +555,9 @@ pub struct Binding {
pub name: Name,
pub mode: BindingAnnotation,
pub problems: Option<BindingProblems>,
+ /// Note that this may not be the direct `SyntaxContextId` of the binding's expansion, because transparent
+ /// expansions are attributed to their parent expansion (recursively).
+ pub hygiene: HygieneId,
}
#[derive(Debug, Clone, Eq, PartialEq)]