These are chat archives for rust-lang/rust

Oct 2018
Diego Antonio Rosario Palomino
Oct 27 2018 00:12
where can i get instructions on how to use rust on windows preferably with atom
Sonny Scroggin
Oct 27 2018 03:38
I'm trying to change this for<'a> fn(Env<'a>, &[Term<'a>]) -> Result<Term<'a>> to for<'a> fn(Env<'a>, &[Term<'a>]) -> impl Encoder
but I keep getting the following error: 'impl Trait' not allowed outside of function and inherent method return types

when I run rustic --explain on the error, it says:

Make sure impl Trait only appears in return-type position.

I'm not sure I understand why this is not allowed
Carl Dong
Oct 27 2018 04:45
Trying to understand who I'm getting a "borrowed value only lives until here" error for this snippet:
Oct 27 2018 06:17
You're trying to borrow something (&[u8]) which is created locally and then thrown away when the function ends.
Someone needs to keep owning those fixed-length arrays in order for the borrow to be valid. Generally in that case people will return a Vec which owns the content rather than fixed-length arrays.
Oct 27 2018 06:26
The other possibility is to create an enum that carries the two variants. You can then return that enum directly (and have something else that can pull out a &[u8] for the variant you've got). Here's an example of two sizes of array in one enum:
Oct 27 2018 06:58
how to get one row from Scylladb using cdrs dependency i am not able to get one row ?
Matthew de Detrich
Oct 27 2018 14:50
I have kind of a noob question here, I am starting with Rust and I am attempting to use extern crate on a nested projected however I get the error that it cannot find the crate. Do I have to publish crates locally before I use extern crate?
I am basically trying to copy what is here
i.e. gluon is marking a local directory as a dependency in the root project
It then includes gluon_parser here
I have basically copied this structure however it doesn't appear to work
Oct 27 2018 14:54
Have you renamed everything correctly? path in Cargo.toml, directory for subcrate, and subcrate's name
Matthew de Detrich
Oct 27 2018 14:57
@red75prime Is it just a naming thing? If so I will triple check
Matthew de Detrich
Oct 27 2018 15:57
@red75prime Actually I found the issue, I was missing
Seems its some special file that you need for every library
Oct 27 2018 16:59

Seems its some special file that you need for every library

I think, your guess is not far from the truth :-)

Oct 27 2018 20:40
Hi, newb question, feel free to redirect to a more appropriate forum. I'm writing a web scraper as a n excuse to learn rust. My usual workflow is to commit an example of the page I'm scraping and write tests as if exploring the page interactively in a REPL. But this relies on having a test framework like CRAM ( that lets my test code write some output, diffs it against an expected output, and lets me accept changes. Does Rust have such a thing?
Sean Perry
Oct 27 2018 22:47
Use cram. Output from your code. Use its diff power.
Oct 27 2018 23:45
If I understand correctly, cargo is the build system. Is there a way to get cargo to run cram tests? I realize I could always layer another build system on top of cargo, but I'd like ideally to learn how to do things the idiomatic rust way.
Denis Lisov
Oct 27 2018 23:47
@wang-d Why do you want to actually write something and check the text output instead of checking the real data structures you build/return?