summaryrefslogtreecommitdiff
path: root/dhall/src/semantics
diff options
context:
space:
mode:
authorNadrieril2020-12-07 13:47:21 +0000
committerNadrieril2020-12-07 19:34:39 +0000
commit3c522217b7445c6df9e170d830f485086ad7e062 (patch)
tree2b32d2c9106e6f0f6ad5edc7b3144f33b5991d8c /dhall/src/semantics
parentc785b7c0c6cd8b3b1cc15eb79caf982a757020ba (diff)
Tag cx ids with the cx lifetime
To make sure we don't let ids escape and we don't mix scopes.
Diffstat (limited to 'dhall/src/semantics')
-rw-r--r--dhall/src/semantics/resolve/env.rs6
-rw-r--r--dhall/src/semantics/resolve/resolve.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/dhall/src/semantics/resolve/env.rs b/dhall/src/semantics/resolve/env.rs
index 2b998f8..ba6205f 100644
--- a/dhall/src/semantics/resolve/env.rs
+++ b/dhall/src/semantics/resolve/env.rs
@@ -17,7 +17,7 @@ pub type CyclesStack = Vec<ImportLocation>;
pub struct ImportEnv<'cx> {
cx: Ctxt<'cx>,
disk_cache: Option<Cache>, // `None` if it failed to initialize
- mem_cache: HashMap<ImportLocation, ImportResultId>,
+ mem_cache: HashMap<ImportLocation, ImportResultId<'cx>>,
stack: CyclesStack,
}
@@ -82,7 +82,7 @@ impl<'cx> ImportEnv<'cx> {
pub fn get_from_mem_cache(
&self,
location: &ImportLocation,
- ) -> Option<ImportResultId> {
+ ) -> Option<ImportResultId<'cx>> {
Some(*self.mem_cache.get(location)?)
}
@@ -98,7 +98,7 @@ impl<'cx> ImportEnv<'cx> {
pub fn write_to_mem_cache(
&mut self,
location: ImportLocation,
- result: ImportResultId,
+ result: ImportResultId<'cx>,
) {
self.mem_cache.insert(location, result);
}
diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs
index 488c516..9021155 100644
--- a/dhall/src/semantics/resolve/resolve.rs
+++ b/dhall/src/semantics/resolve/resolve.rs
@@ -398,7 +398,7 @@ fn traverse_resolve_expr<'cx>(
/// Fetch the import and store the result in the global context.
fn fetch_import<'cx>(
env: &mut ImportEnv<'cx>,
- import_id: ImportId,
+ import_id: ImportId<'cx>,
) -> Result<(), Error> {
let cx = env.cx();
let import = &cx[import_id].import;