Comments (12)
I just realized, the a = '?0, b = Array3<i32>
that was output is from a println!()
statement I added to figure out what was going on (and then subsequently forgot about). This diff shows exactly what it's printing out:
diff --git a/src/zip.rs b/src/zip.rs
index 9f1f92e..b9398ff 100644
--- a/src/zip.rs
+++ b/src/zip.rs
@@ -256,6 +256,7 @@ impl<T: Zip, L: Zip> Zip for ParameterKind<T, L> {
Zip::zip_with(zipper, a, b),
(&ParameterKind::Ty(_), _) |
(&ParameterKind::Lifetime(_), _) => {
+ println!("a = {:?}, b = {:?}", a, b);
panic!("zipping things of mixed kind")
}
}
from chalk.
That is indeed a bug, though it may be that the bug is in the input. Chalk doesn't do that much sanity checking just now.
from chalk.
I think that this is indeed a bug (I encountered it as well), which seems to occur when dealing with higher kinded associated types. The fix I guess is just to change the panic!
message into a
return Err(NoSolution);
from chalk.
That sounds suspicious to me! Is it possible to reduce the test case at all?
from chalk.
I don't actually get this result:
Mr-Darcy. target/debug/chalki --program=$HOME/tmp/foo.chalk --goal='Array3<i32>: IntoStreamingIterator'
Unique; substitution [], lifetime constraints []
Mr-Darcy. target/debug/chalki --program=$HOME/tmp/foo.chalk --goal='Array3<i32>: IntoStreamingIterator' --solver slg
Unique; substitution [], lifetime constraints []
from chalk.
I've had this error before and I think — that is to say, if I've bisected correctly :) — that it was recently fixed by removing the fallback clauses: c92c25d
from chalk.
The bug at the origin of this issue was still there though, but was fixed in #82.
from chalk.
Since this issue has been closed, I tested out the above code with the current version of chalk, and indeed it no longer panics. Instead, it outputs "error: trait impl for "IntoStreamingIterator" does not meet well-formedness requirements".
Does anyone know why it is not well-formed, and what would need to be changed to make it well-formed?
from chalk.
The recursive solver has some problems with projection types, try with the option --solver slg
, it will work if you replace unselected projections (e.g. S::Item<'a>
) with explicit projections (e.g. <S as StreamingInterator>::Item<'a>
). However, it seems like there is still a bug with unselected projections.
from chalk.
@scalexm no dice. The following two examples both produce the same well-formedness error message, even with --solver slg
.
trait StreamingIterator {
type Item<'a>;
}
trait IntoStreamingIterator where Self::IntoIter: StreamingIterator {
type Item<'a>;
type IntoIter;
}
impl<S> IntoStreamingIterator for S where S: StreamingIterator {
type Item<'a> = <S as StreamingIterator>::Item<'a>;
type IntoIter = S;
}
trait StreamingIterator {
type Item<'a>;
}
trait IntoStreamingIterator where Self::IntoIter: StreamingIterator {
type IntoIter;
}
impl<S> IntoStreamingIterator for S where S: StreamingIterator {
type IntoIter = S;
}
from chalk.
There's still Self::IntoIter
which should be changed to <Self as IntoStreamingIterator>::IntoIter
. So forgetting about the bug with unselected projections which does give a zipping things of mixed kind
panic and which I'm currently fixing, unselected projections only work if you explicitly add an InScope
assumption, for example:
if (InScope(IntoStreamingIterator)) {
/* inside here you can use `MyType::IntoIter` without explicitly writing
`<MyType as IntoStreamingIterator>::IntoIter` */
}
However, since well-formedness requirements are enforced during lowering (i.e. the program is loading, you cannot write any goal), one cannot use InScope
during this phase unless it is explicitly written in the where clauses. This is a limitation indeed, I think we should add some InScope
rules during lowering anyway, and this should be a separate issue.
from chalk.
@scalexm good point, I replaced Self::IntoIter
with the explicit version and it worked
from chalk.
Related Issues (20)
- Opaque type issue HOT 1
- identifying which method will run for a trait HOT 9
- Publishing is broken HOT 1
- 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
- Fix/upgrade Chalk in wake of librarifying Copy/Clone on arrays and reinstate test 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
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.