Comments (8)
from hydroflow.
#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]
trait Gats {
type Build<'a, 'b>: Fn() -> String;
fn build<'a, 'b>(a: &'a str, b: &'b str) -> Self::Build<'a, 'b>;
}
type AlphaBuild<'a, 'b> = impl Fn() -> String;
struct Alpha;
impl Gats for Alpha {
type Build<'a, 'b> = AlphaBuild<'a, 'b>;
fn build<'a, 'b>(a: &'a str, b: &'b str) -> Self::Build<'a, 'b> {
|| format!("{}{}", a, b)
}
}
from hydroflow.
doesn't quite reproduce
#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]
use std::fmt::Display;
trait GatsBase {
type Build<'a, 'b>: Fn() -> String;
}
trait Gats: GatsBase {
fn build<'a, 'b>(&'a self, b: &'b str) -> Self::Build<'a, 'b>;
}
type AlphaBuild<'a, 'b, T> = impl 'a + 'b + Fn() -> String;
struct Alpha<T: Display>(T);
impl<T: Display> GatsBase for Alpha<T> {
type Build<'a, 'b> = AlphaBuild<'a, 'b, T>;
}
impl<T: Display> Gats for Alpha<T> {
fn build<'a, 'b>(&'a self, b: &'b str) -> Self::Build<'a, 'b> {
|| format!("{}{}", self.0, b)
}
}
from hydroflow.
I know nothing about hydroflow but noticed that adding move
to the closure makes it pass.
Was it accpeted previously? That would be surprising!
from hydroflow.
Thanks! Yeah, that does fix this example, so I guess this wasn't a reproduction of the issue we're having in hf itself. Still working on it.
more complicated playground also works
from hydroflow.
reproduced on playground
Fixed by adding where T: 'a
to the GAT and to the type alias. playgound
from hydroflow.
Oh I didn't know the where Self: 'a
clause let you bound other type parameters as 'a
, I think that will work!
from hydroflow.
Although I guess writing where Self: 'a
(instead of where T: 'a
) also works? Since T
is a parameter of Self
, I guess.
from hydroflow.
Related Issues (20)
- Make sure that stageleft can handle `super` and `crate` references
- Rohit Onboarding Projects
- `surface_codegen.rs` `test_surface_syntax_reachability_generated` needs `'static` for join
- Stageleft sometimes double-captures a referenced value
- Documentation Improvements to the Networking Examples HOT 1
- Improvements to Hydroflow Template HOT 1
- Hydroflow surface syntax allows ports specification that isn't used `[0]out -> in`
- Deprecate/remove hydroflow surface syntax `import!("file.hf")` feature
- Hydroflow surface modules (`import!("file.hf")`) panics without input/output `mod` HOT 1
- persist should be lattice typed, e.g. to enforce uniqueness of sets HOT 2
- Expected a defer_tick to be required, but isn't HOT 5
- Create CONTRIBUTING.md with info for new developers HOT 3
- Properties/semantics/optimizations meta-issue (algebraic properties/lattices) HOT 1
- Stageleft doesn't allow `let _`
- Check & Update Client-Server Examples Based On Updated Template
- Running with `--profile profile` crashes with "Illegal instruction (core dumped)" HOT 2
- Support `let (a, b) = ...` in stageleft
- Generate code for locations even if they have no sinks
- Print a warning when a stream is dropped without being used by a sink HOT 1
- Sending a locally-defined struct with bincode results in bad references in the generated code
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 hydroflow.