Comments (11)
Working on it.
from chalk.
Slow but steady progress... :)
from chalk.
@fabric-and-ink niko is not extremely available right now, but I'll try to help you soon :)
from chalk.
@fabric-and-ink How about:
pub struct FolderRef<'f, F> where F: 'f + ?Sized {
folder: &'f mut F,
}
impl<'f, F: ?Sized> FolderRef<'f, F> {
pub fn new(folder: &'f mut F) -> Self {
FolderRef {
folder,
}
}
}
impl<'f, F: Folder + ?Sized> Folder for FolderRef<'f, F> {
fn fold_ty(&mut self, ty: &Ty, binders: usize) -> Result<Ty> {
self.folder.fold_ty(ty, binders)
}
fn fold_lifetime(&mut self, lifetime: &Lifetime, binders: usize) -> Result<Lifetime> {
self.folder.fold_lifetime(lifetime, binders)
}
}
and then you use it like that:
impl<T: Fold> Fold for Shifted<T> {
type Result = T::Result;
fn fold_with(&self, folder: &mut Folder, binders: usize) -> Result<Self::Result> {
// I... think this is right if binders is not zero, but not sure,
// and don't care to think about it.
assert_eq!(binders, 0);
// First up-shift any variables. i.e., if `self.value`
// contains a free var with index 0, and `self.adjustment ==
// 2`, we will translate it to a free var with index 2; then
// we will fold *that* through `folder`.
let mut new_folder = (Shifter::new(self.adjustment), FolderRef::new(folder));
self.value.fold_with(&mut new_folder, binders)
}
}
With that I think you should be good :)
from chalk.
@fabric-and-ink cool, feel free to come to gitter channel with questions, if any arise
from chalk.
I followed your suggestion to implement a bridge trait. Now I am stuck at connecting both kinds of folders at this point:
fn fold_lifetime(&mut self, lifetime: &Lifetime, binders: usize) -> Result<Lifetime> {
match *lifetime {
Lifetime::Var(ref var) => self.fold_free_lifetime_var(*var, binders),
Lifetime::ForAll(universe_index) => {
unimplemented!();
},
}
}
I don't know what a universe is in this context (see #51) and therefore don't now how to proceed. Any hints? :)
from chalk.
@fabric-and-ink sorry, missed these comments! Maybe post your branch somewhere I can see it?
from chalk.
There you go: https://github.com/fabric-and-ink/chalk/commit/649689f2c5843a59ef941316e11641de78c6be13
Nevermind, I got it. 🤦
from chalk.
Replaced the old Folder
trait (now FolderVar
) with the new Folder
. Now I am at this point. The "bridge" impl
and the impl
for Folder + ?Sized ...
are in conflict. But the second impl
is necessary to make for example this work.
from chalk.
@nikomatsakis any hints on how to solve the trait conflict? (See last comment.)
from chalk.
Nice! Thank you! That worked well :)
from chalk.
Related Issues (20)
- CI Publish job using Mac runner HOT 2
- When Rust 1.55 hits stable, replace `ControlFlow` with std version
- Recursive solver reports ambiguity HOT 7
- Idea: rework how SLG solver uses the environment
- Auto traits are not handled for generic closures HOT 8
- Consider removing unused field
- Clean up coherence chapter in the Chalk book HOT 1
- Ambiguity through unrelated env clauses because of implied bounds HOT 1
- reconcile SLG/recursive solver's attempts to merge multiple results
- book: hard to read mermaid diagram in dark themes
- Lowered command panics with auto trait HOT 1
- Recursive solver hangs on cyclic traits HOT 3
- mdbook-mermaid needs updating
- Unable to deduce projection types of dyn types from supertrait bounds
- ICE: negative subgoal had delayed_subgoals HOT 2
- any progress and roadmap? HOT 1
- Automatic releases have been failing for a couple of months
- Branch protection prevents automatic releases from updating the version number on the `master` branch
- Recursive Solver fails to solve recursive associated type with GAT
- Fails to solve some existential clause HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chalk.