Andrew Cann canndrew Perth, Australia

push eventcanndrew/patchall

Andrew Cann

commit sha 42a705c47ce724bb23b656f0e0b4d11fd89ac109

initial commit

view details

push time in 2 days

create barnchcanndrew/patchall

branch : master

created branch time in 2 days

created repositorycanndrew/patchall

NixOS tool for finding and patching executables

created time in 2 days

issue commentagda/agda

Feature request: Interleaving mutually-defined functions & datatypes

Any updates on this? I've been trying to define type theory in type theory ever since I started learning type theory years ago. First I had to wait for people to invent HoTT, then I had to wait for people to make HoTT computable, then I had to wait for cubical types to make it into Agda, now it looks like the only thing holding me back is Agda's mutual blocks not being mutual enough.

If I fork Agda is there some slapdash change I can make that'll make interleaving constructor definitions possible? I don't care if it makes typechecking 100x slower if it works.

gallais

comment created time in 20 days

pull request commentrust-lang-nursery/futures-rs

Add sink::for_each function

Ah, cool! Thanks for that, though I don't remember what I needed it for now :p

Nemo157

comment created time in a month

issue commenttokio-rs/tokio

Using `stdin` prevents `tokio::run` from shutting down.

How would you suggest switching stdin / stdout to non-blocking mode? It should be done once per process, ideally in the main function or some other "initialization" function.

Maybe it should be a feature flag. If the feature is enabled then tokio::io::{stdin, stdout} first set the file descriptor to non-blocking (if it hasn't already been done), but otherwise they spawn a background thread to do blocking reads/writes and return a handle for doing async reads/writes to an intermediate buffer.

That way an application can opt-in to unbuffered, true-async stdio, and all its library dependencies would inherit that behaviour, but otherwise you still get Stdin/Stdout types which behave async and which don't interfere with the rest of the process.

carllerche

comment created time in a month

push eventcanndrew/netsim

Carl

commit sha 490bd61fe98d9cd17feeebbedbfd3176d00a25c0

bump libc

view details

Andrew Cann

commit sha a768a11347ae12cd3af1f7769a7cc77c095968fd

Merge pull request #23 from carllin/master bump libc

view details

push time in a month

PR merged canndrew/netsim

bump libc
+1 -1

4 comments

1 changed file

carllin

pr closed time in a month

pull request commentcanndrew/netsim

bump libc

Sorry for taking so long to get back to this! I'm always happy to update to a newer stable rust if it enables something.

carllin

comment created time in a month

issue commenttokio-rs/tokio

Using `stdin` prevents `tokio::run` from shutting down.

@parthsane you could look here: https://github.com/canndrew/termcandy/blob/master/src/io/non_blocking.rs

carllerche

comment created time in a month

issue commenttokio-rs/tokio

`tokio::run` doesn't propogate panics from futures

How about making it so tokio propagates panics in debug mode but not release mode?

canndrew

comment created time in a month

pull request commentNixOS/nixpkgs

picotts: init at 2018-10-19

@ryantm Sorry for the delay. I've committed those changes.

canndrew

comment created time in a month

push eventcanndrew/nixpkgs

Andrew Cann

commit sha 419d38f774ea9386af927696a3d8b7931dc9a20e

picotts: init at 2018-10-19

view details

push time in a month

issue commentunicode-rs/unicode-width

Emoji width

I'd been using this crate on the assumption that UnicodeWidthStr::width would give the actual displayed width in columns. It's a shame that that assumption doesn't hold :/

Is there a non-trivial subset of strings for which the displayed column width is exactly specified and we can rely on it being accurate for any standards-compliant terminal? If so, can we add another method to UnicodeWidthStr which returns an Option<usize>? That way my terminal GUI library can know when it might have lost track of the cursor position.

gwenn

comment created time in a month

push eventcanndrew/termcandy

Andrew Cann

commit sha caff0bc6ad18da937ec9ac05b59e0c97622f7d8e

update .gitignore

view details

push time in a month

push eventcanndrew/termcandy

Andrew Cann

commit sha e8b7a36ca325fd8e8da398240d2b936a75f493b3

add example

view details

push time in a month

push eventcanndrew/termcandy

Andrew Cann

commit sha 46e5f4c99610a7b3fbc974c004ec5dcbb1f95e47

initial commit

view details

Andrew Cann

commit sha 5d9c2064c959a785c4e17fb4e4463f3bd0b80fa1

Add more stuff

view details

Andrew Cann

commit sha d5d2405ca140e8f71d4e016cd3afbe891f7ab547

add screen_size + resize method

view details

Andrew Cann

commit sha a8ba3f357af1fb3a3e0f7dafdfde4cbed739054d

fixups. add documentation

view details

Andrew Cann

commit sha 168a167d2f48b19aa826c49c0f264ac9d3b22f38

Fix dependency versions

view details

Andrew Cann

commit sha 9a69ce2f0d63961bf42a603d54b2e9700603c9c0

Rename macro crate

view details

Andrew Cann

commit sha ab04db8f652911d9f58a0c7ec141066703dcfde1

add cargo metadata

view details

push time in a month

push eventcanndrew/termcandy

Andrew Cann

commit sha ea418d52353e0b27e4a9df35befd50578628aa1d

Fix dependency versions

view details

push time in a month

push eventcanndrew/termcandy

Andrew Cann

commit sha d74b8595a905a4f67d75d263c6bf054cf4c9509a

Fix dependency versions

view details

push time in a month

push eventcanndrew/termcandy

Andrew Cann

commit sha 8f705fbad058b20548b6637adf0bd2975a75b0e2

initial commit

view details

Andrew Cann

commit sha 838082e29d7baa8efc4a687d985c84397a8e3e89

Add more stuff

view details

Andrew Cann

commit sha 3abab6ecbc0b5d146ed04843a1c1567da87b1d87

add screen_size + resize method

view details

Andrew Cann

commit sha ac7a3611e99bff7eb8496e65ab41a8f8f6db4482

fixups. add documentation

view details

push time in a month

issue commentrust-lang/rfcs

Idea: Built-in way to go from bool to Option

Another +1 to this. Should I do a PR for it?

ElectricCoffee

comment created time in a month

issue openedNixOS/nixpkgs

Impossible to write a derivation for a stack application

I have a haskell application that uses stack as its build system. Building this application is as simple as it gets - just cd into the source directory and stack build. It doesn't seem possible to write a Nix package for this application.

Using buildStackProject fails due to #32005, ie. it can't find /etc/protocol inside the nix build sandbox. If try to just stdenv.mkDerivation with buildPhase = "mkdir $TMP/build; stack build --stack-root=$TMP/build it fails the same way. Adding the iana-etc package which supplies /etc/protocols to my package's buildInputs doesn't fix the problem unless I also use libredirect to direct open calls to /etc/protocols to the correct location. After that though stack is still unable to download the files it needs, this time due to DNS resolution not working. I gather this is by design since Nix derivations aren't supposed to download arbitrary files off the internet without specifying a content hash hash, so at this point I abandoned the idea of calling stack directly.

I then discovered stack2nix which supposedly generates a nix package from a stack.yaml. It works, except that the default.nix it generates is 49194 lines long and seems to include build instructions for every haskell package in existence, so I can't really include it in nixpkgs. I also tried stack2cabal thinking I could make a package that converts the application to cabal and builds from there, but the package for stack2cabal is broken and won't install.

At this point I'm out of ideas. I'm surprised that this is so difficult given that Nix and stack have such a large intersection of users and that stack even has some built-in support for Nix. At any rate, I think it should be considered a bug that there's no simple way to do this.

created time in a month

fork canndrew/luna

Hybrid textual and visual functional programming.

https://luna-lang.org

fork in a month

PR opened NixOS/nixpkgs

picotts: init at 2018-10-19
Motivation for this change

I wanted to be able to use this program: https://github.com/naggety/picotts

Things done

<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->

  • [ ] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • [X] NixOS
    • [ ] macOS
    • [ ] other Linux distributions
  • [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • [X] Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • [X] Tested execution of all binary files (usually in ./result/bin/)
  • [ ] Determined the impact on package closure size (by running nix path-info -S before and after)
  • [ ] Assured whether relevant documentation is up to date
  • [X] Fits CONTRIBUTING.md.

+25 -0

0 comment

2 changed files

pr created time in a month

issue commentrust-lang/rfcs

Support macro invocations in match branch position

Multiple match arms would be nice, yeah.

canndrew

comment created time in 2 months

push eventcanndrew/future-utils

Povilas Balciunas

commit sha 7bf96a6477b83e8e5d40130a3ca6f9cacf8dc128

Upgrade log crate

view details

Andrew Cann

commit sha 976f99f9b8c67348ec2124b182e45282d3e0f451

Merge pull request #3 from povilasb/update-log-crate Upgrade log crate

view details

push time in 2 months

PR merged canndrew/future-utils

Upgrade log crate
+11 -11

0 comment

5 changed files

povilasb

pr closed time in 2 months

issue openedrust-lang/rfcs

Support macro invocations in match branch position

Sorry if there's already and issue for this, but I couldn't find one.

On many occasions I've wanted to use macros to generate match branches. eg.

match x {
    macro_which_outputs_some_branches!(),
    Foo::Bar => 23,
}

Is there a reason not to support this?

created time in 2 months

issue commentrust-lang/rust

`TokenStream::from_str` returns spurious `Ok`s

Since TokenStream is used by syn this makes it impossible to write procedural macros which contain both rust and non-rust-friendly syntax. Could we instead make both these cases return Err and add a method to LexError which tries to return a recovered TokenStream?

canndrew

comment created time in 2 months

issue commentalexcrichton/proc-macro2

TokenStream::from_str does not return an error on invalid tokens

Okay. I figured that might be happening. Thanks!

canndrew

comment created time in 2 months

issue commentdtolnay/syn

syn accepts incomplete strings as valid syntax

Thanks! I've followed up here: https://github.com/rust-lang/rust/issues/58772. It would certainly be nice if I had the option to check for errors myself.

canndrew

comment created time in 2 months

issue commentalexcrichton/proc-macro2

TokenStream::from_str does not return an error on invalid tokens

Cargo.toml

[package]
name = "repro"
version = "0.0.0"
edition = "2018"

[lib]
proc-macro = true

[dependencies]
proc-macro2 = "0.4.27"

src/lib.rs

extern crate proc_macro;

use proc_macro::TokenStream;
use std::str::FromStr;

#[proc_macro_derive(ParseTokenStream)]
pub fn derive(_input: TokenStream) -> TokenStream {
    println!("{:#?}", proc_macro2::TokenStream::from_str("\\s"));
    TokenStream::new()
}

src/main.rs

extern crate proc_macro;

use proc_macro::TokenStream;
use std::str::FromStr;

#[proc_macro_derive(ParseTokenStream)]
pub fn derive(_input: TokenStream) -> TokenStream {
    println!("{:#?}", proc_macro2::TokenStream::from_str("\\s"));
    TokenStream::new()
}

Output of cargo check:

    Checking repro v0.0.0 (/home/shum/rust-test)
error: unknown start of token: \
 --> src/main.rs:1:10
  |
1 | #[derive(repro::ParseTokenStream)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^

error: proc-macro derive panicked
 --> src/main.rs:1:10
  |
1 | #[derive(repro::ParseTokenStream)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

error: Could not compile `repro`.

To learn more, run the command again with --verbose.
canndrew

comment created time in 2 months

issue openedrust-lang/rust

`TokenStream::from_str` returns spurious `Ok`s

Cargo.toml

[package]
name = "repro"
version = "0.0.0"
edition = "2018"

[lib]
proc-macro = true

src/lib.rs

extern crate proc_macro;

use proc_macro::TokenStream;
use std::str::FromStr;

#[proc_macro_derive(ParseTokenStream)]
pub fn derive(_input: TokenStream) -> TokenStream {
    println!("{:#?}", TokenStream::from_str("Foo::Bar { elem"));
    TokenStream::new()
}

src/main.rs

#[derive(repro::ParseTokenStream)]
struct S;

fn main() {}

Output of cargo check:

$ cargo check
   Compiling repro v0.0.0 (/media/david/coding/github/repro/repro)
error: this file contains an un-closed delimiter
 --> src/main.rs:1:10
  |
1 | #[derive(repro::ParseTokenStream)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ un-closed delimiter

Ok(
    TokenStream [
        Ident {
            ident: "Foo",
            span: #4 bytes(9..32)
        },
        Punct {
            ch: ':',
            spacing: Joint,
            span: #4 bytes(9..32)
        },
        Punct {
            ch: ':',
            spacing: Alone,
            span: #4 bytes(9..32)
        },
        Ident {
            ident: "Bar",
            span: #4 bytes(9..32)
        },
        Group {
            delimiter: Brace,
            stream: TokenStream [
                Ident {
                    ident: "elem",
                    span: #4 bytes(9..32)
                }
            ],
            span: #4 bytes(9..32)
        }
    ]
)
error: aborting due to previous error

error: Could not compile `repro`.

To learn more, run the command again with --verbose.

I originally raised this issue https://github.com/dtolnay/syn/issues/584. I'm writing a procedural macro and I'm unable to check for lexer errors because TokenStream::from_str can sometimes lie and say that lexing succeeded. The compiler secretly records that their was an error though and will fail my macro further down the line.

This seems related to https://github.com/rust-lang/rust/issues/58736, where the compiler will also not return an Err(LexError) and instead panics.

created time in 2 months

issue commentalexcrichton/proc-macro2

TokenStream::from_str does not return an error on invalid tokens

proc_macro2 fails for me too, at least when I run it inside a procedural macro.

canndrew

comment created time in 2 months

issue commentalexcrichton/proc-macro2

TokenStream::from_str does not return an error on invalid tokens

Yes, that would probably help. In my case I narrowed it down to TokenStream::from_str("\\s").

canndrew

comment created time in 2 months

issue openeddtolnay/syn

No way to parse something off the front a string

I'm trying to implement a DSL as a proc macro. I have a string which should start with a valid rust expression. I want to parse the expression off the front of the string and also get the remainder of the string.

eg.

"123 blah blah blah" => (Expr::Lit(123), " blah blah blah")

This doesn't seem possible.

The first problem is https://github.com/dtolnay/syn/issues/585 - since " blah blah blah" might not consist of valid Rust tokens I can't create a ParseStream to read off the expression from the front.

If I could determine where the valid Rust tokens end I could just create a ParseStream from those, but https://github.com/alexcrichton/proc-macro2/issues/168 makes this impossible.

I could also try parsing progessively larger strings until something successfully gets parsed, but https://github.com/dtolnay/syn/issues/584 makes this impossible.

Even if these attempts had worked though, there doesn't seem to be a way to get the position of a ParseStream in terms of the original string I created it with. I can get a Cursor, but from there I can only get tokens.

Is there any way to do this? Ideally it would be nice if there was a syn::parse_front_of_str<T>(&str) -> (T, &str) function but right now I'd settle for any gross hack at all.

created time in 2 months

issue openeddtolnay/syn

parse_str cannot handle arbitrary text

I want to implement a DSL which contains Rust expressions intermingled with my own syntax which can't be handled by Rust's tokenizer. There doesn't seem to be any way to do this since ParseStream fails immediately if created with text which contains invalid Rust tokens, even if those tokens are far outside of the text that I want to parse.

created time in 2 months

issue openedalexcrichton/proc-macro2

TokenStream::from_str does not return an error on invalid tokens

I tried passing some text which contains invalid Rust tokens to TokenStream::from_str hoping that I could inspect the Err variant to get information on where the lex error is. Instead from_str prints directly to stderr and panics.

This method should probably give me the option to handle the error myself since I can always .unwrap() if I want to.

created time in 2 months

issue openeddtolnay/syn

syn accepts incomplete strings as valid syntax

For some reason this string parses just fine as a syn::Expr

Foo::Bar { elem

Even without a closing parenthesis. Seems like this should probably return an Err.

created time in 2 months

fork canndrew/wasmparser.rs

A simple event-driven library for parsing WebAssembly binary files

fork in 2 months

PR opened wasmerio/wasmer

fix stack overflow in Error's Display impl

The Display impl for Error calls itself in an infinite loop and overflows the stack. This PR fixes the issue.

+18 -1

0 comment

1 changed file

pr created time in 2 months

create barnchcanndrew/wasmer

branch : fix-error-display

created branch time in 2 months

fork canndrew/wasmer

Universal Binaries Powered by WebAssembly

https://wasmer.io

fork in 2 months

create barnchcanndrew/nixpkgs

branch : picotts

created branch time in 2 months

create barnchcanndrew/malk-2018

branch : master

created branch time in 2 months

created repositorycanndrew/malk-2018

Yet another totally incomplete programming language implementation

created time in 2 months

push eventcanndrew/canndrews-misc-ext-traits

Andrew Cann

commit sha d27c09deacb68579a8871786cd5b8f70d018373c

Add net and tokio stuff

view details

push time in 3 months

push eventcanndrew/canndrews-misc-ext-traits

Andrew Cann

commit sha f3027d15cf83b8894105169c04182110d6f47def

Add net and tokio stuff

view details

push time in 3 months

push eventcanndrew/netsim

Andrew Cann

commit sha 56f723e6e5b40b482f0ad70dad2802ec64105e1a

fix default.nix for libpcap linking on NixOS

view details

push time in 3 months

PR merged canndrew/netsim

Refactoring

I'm planning to implement the packet broadcasting. My guess is that it should be implemented in router. So I did some code refactoring and added tests to router to make future changes safer.

+134 -39

0 comment

6 changed files

povilasb

pr closed time in 3 months

push eventcanndrew/netsim

Povilas Balciunas

commit sha b2d54f63644ae4a0434ab901405848bba412ad15

Use the new Network::spawn_xxx() method

view details

Povilas Balciunas

commit sha d133f6fb168bdcff2de72c3b3c8f687b8669e242

Fix integration tests Run those tests only on linux. They fail on other platforms because they depend on Linux features like network namespaces and virtual network devices.

view details

Povilas Balciunas

commit sha 39dea3cd456ba26773c313f0344ecd1e9a48ee27

Extract some code and add more tests. Makes it easier to change the code.

view details

Povilas Balciunas

commit sha dde275505ae91752d2ef8e71689129625da87518

Add some in-source docs

view details

Andrew Cann

commit sha af12c7835e72d925ac41ef45509e78fc66024972

Merge pull request #21 from povilasb/refactoring Refactoring

view details

push time in 3 months

push eventcanndrew/netsim

Povilas Balciunas

commit sha 98d9e0374eefd2c00bd39b474342a8d42f44867e

Update libc Latest mio version (0.6.16) depends on libc >= 0.2.42. I've tried upgrading libc to 0.2.43 which is the latest at a given moment. Unfortunately, some tests failed. But I noticed that tests pass with 0.2.42 so didn't do proper research what caused tests failure since this version satisfy my needs at this moment :)

view details

Andrew Cann

commit sha c51e7aca92c27142b1fbffc2deb39bdbc62f2260

Merge pull request #20 from povilasb/update-libc Update libc

view details

push time in 3 months

PR merged canndrew/netsim

Update libc

Latest mio version (0.6.16) depends on libc >= 0.2.42. I've tried upgrading libc to 0.2.43 which is the latest at a given moment. Unfortunately, some tests failed. But I noticed that tests pass with 0.2.42 so didn't do proper research what caused tests failure since this version satisfy my needs at this moment :)

+1 -1

0 comment

1 changed file

povilasb

pr closed time in 3 months

more