-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use
Free
variables internally, substitute at the end
- Loading branch information
Showing
14 changed files
with
177 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Check that all supplied generic types match the corresponding generic parameters. | ||
use derive_visitor::DriveMut; | ||
|
||
use crate::ast::types_utils::SubstVisitor; | ||
|
||
use super::{ctx::TransformPass, TransformCtx}; | ||
|
||
pub struct Check; | ||
impl TransformPass for Check { | ||
fn transform_ctx(&self, ctx: &mut TransformCtx) { | ||
for mut item in ctx.translated.all_items_mut() { | ||
let args = item.generic_params().free_identity_args(); | ||
let mut visitor = SubstVisitor::new(&args); | ||
item.drive_mut(&mut visitor); | ||
} | ||
for decl in &ctx.translated.fun_decls { | ||
if let Ok(body_id) = decl.body { | ||
if let Some(body) = ctx.translated.bodies.get_mut(body_id) { | ||
let args = decl.signature.generics.free_identity_args(); | ||
let mut visitor = SubstVisitor::new(&args); | ||
body.drive_mut(&mut visitor); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Final LLBC before serialization: | ||
|
||
trait test_crate::Idx<Self> | ||
|
||
struct test_crate::IndexVec<I> | ||
where | ||
[@TraitClause1]: test_crate::Idx<I>, | ||
= | ||
{ | ||
i: I, | ||
} | ||
|
||
struct test_crate::Vector<I> | ||
where | ||
[@TraitClause1]: test_crate::Idx<I>, | ||
= | ||
{ | ||
vector: test_crate::IndexVec<I>[@TraitClause1], | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ charon-args=--hide-marker-traits | ||
//! Reproduces a crash when substituting variables with the `--hide-marker-traits` option. | ||
trait Idx {} | ||
|
||
pub struct IndexVec<I> | ||
where | ||
I: Idx, | ||
{ | ||
i: I, | ||
} | ||
|
||
pub struct Vector<I> | ||
where | ||
I: Idx, | ||
{ | ||
vector: IndexVec<I>, | ||
} |