|
After a bit of looking around, there's a pretty simple workaround to this. Run it in gdb, enter 'break rust_panic', and when it hits the breakpoint 'bt' for a stacktrace. Apparently rust_panic is specifically there so you can place breakpoints on panics, which is pretty neat.
|
# ? Jan 11, 2016 12:52 |
|
|
# ? May 16, 2024 18:01 |
|
Found this joke on the rust subreddit and enjoyed it:quote:The 1st rule of Rust Club is: you don't talk about Rust Club.
|
# ? Jan 11, 2016 22:19 |
Bognar posted:Found this joke on the rust subreddit and enjoyed it: I love it.
|
|
# ? Jan 12, 2016 01:14 |
|
That's pretty great. The Cavern of COBOL › Rust: error: The Cavern of COBOL does not live long enough
|
# ? Jan 15, 2016 05:15 |
|
Rust seems really cool and interesting but this: https://www.rust-lang.org/conduct.html is loving cancer. I hate it that this tumblr level safe-space bullshit is invading CS topics. It encourages outrage and taking offense while simultaneously discouraging being an adult and hardening the gently caress up. It also serves to minimize the contributions of people that don't have a place in the reverse hierarchy of 'privilege' that tumblr likes to go on about, sorry I'm not a disabled, mayonnaise gendered, polysexual, fartkin gypsy black woman quadriplegic, I hope my pull request gets some attention nonetheless because I'm trying to add value despite being a cis-het white male AKA literally hitler. (USER WAS PUT ON PROBATION FOR THIS POST)
|
# ? Feb 7, 2016 21:05 |
|
I'm not going to touch the rest of your post but the text of that code does not seem particularly unreasonable? Like I don't see how it could get anyone in trouble who's not actively looking for it. Silencing discussion on controversial social issues might be wrong for a general forum, but seems to make sense for a programming language community
|
# ? Feb 7, 2016 21:19 |
|
The code is eminently reasonable, and the vast majority of pull requests come from cis-het males. There is an imaginary problem being invented here, but it's not by the authors of the code.
|
# ? Feb 7, 2016 22:11 |
|
Lunixnerd posted:Rust seems really cool and interesting but this: https://www.rust-lang.org/conduct.html is loving cancer. I hate it that this tumblr level safe-space bullshit is invading CS topics. It encourages outrage and taking offense while simultaneously discouraging being an adult and hardening the gently caress up. It also serves to minimize the contributions of people that don't have a place in the reverse hierarchy of 'privilege' that tumblr likes to go on about, sorry I'm not a disabled, mayonnaise gendered, polysexual, fartkin gypsy black woman quadriplegic, I hope my pull request gets some attention nonetheless because I'm trying to add value despite being a cis-het white male AKA literally hitler. Sorry you're not a rape victim/breast cancer haver. quote:We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic. Translation: Hail Hydra.
|
# ? Feb 7, 2016 22:21 |
|
You've got some real problems if you read that and parse it as anything other than "be nice to people, don't be a dick"
|
# ? Feb 7, 2016 22:24 |
|
quote:We interpret the term "harassment" as including the definition in the Citizen Code of Conduct; Never mind building, you can't even read their code of conduct without downloading an external dependency.
|
# ? Feb 7, 2016 22:31 |
|
piratepilates posted:You've got some real problems if you read that and parse it as anything other than "be nice to people, don't be a dick" Seriously? Online forums have had "rules" that are about "be nice to people, don't be a dick," since forever, for example, and they read a lot differently when they aren't full of dog-whistles and designed to reinforce a certain political thesis about how the world is.
|
# ? Feb 7, 2016 22:57 |
|
sarehu posted:Seriously? Online forums have had "rules" that are about "be nice to people, don't be a dick," since forever, for example, and they read a lot differently when they aren't full of dog-whistles and designed to reinforce a certain political thesis about how the world is. Online forums, noted bastions of professionalism and decency.
|
# ? Feb 8, 2016 00:19 |
|
sarehu posted:Seriously? Online forums have had "rules" that are about "be nice to people, don't be a dick," since forever, for example, and they read a lot differently when they aren't full of dog-whistles and designed to reinforce a certain political thesis about how the world is. I think the rules could use tightening, considering you are still posting.
|
# ? Feb 8, 2016 03:56 |
|
Tarion posted:You're not really supposed to use unwrap in 'production' code anyways. Sure you are. Maybe not as much, or in all the same ways, as when you're hacking together a prototype, though.
|
# ? Feb 8, 2016 09:12 |
|
We are not having this stupid loving argument in this thread or forum If you really want to post about it ask a D&D mod if you can have a thread.
|
# ? Feb 8, 2016 16:29 |
Rust is officially getting some new syntactic sugar to make error handling less painful (specificially, a ? operator and a catch edit: fixed link, and statement -> expression VikingofRock fucked around with this message at 23:34 on Feb 8, 2016 |
|
# ? Feb 8, 2016 21:26 |
|
It's a catch expression thank you very much
|
# ? Feb 8, 2016 22:43 |
Vanadium posted:It's a catch expression thank you very much So it is. I've edited my post.
|
|
# ? Feb 8, 2016 23:35 |
|
Does anybody want to critique my babby's first data structure? http://codepad.org/SG2ERyJn There were a few things that I tried to do and failed. I know that the methods should probably be implemented in an impl with a &self parameter but I'm ignoring that for now.
|
# ? Feb 17, 2016 00:09 |
gonadic io posted:Does anybody want to critique my babby's first data structure? http://codepad.org/SG2ERyJn I took a stab at re-writing this a little more idiomatically, which should hopefully be helpful. I would probably write the OctreeNode as this, or as this if keeping the ull indexing is important to you. I also made a more-minimally modified version of you code here, keeping the no-impl way of doing things intact.
|
|
# ? Feb 19, 2016 00:29 |
|
Thanks very much, that's enough to get me started. I've decided to go back and finish the Rust introduction though, as I'm hoping things like into_iter will he explained by its end. E: let's just say that I'm getting a renewed sense of the frustrations that people often feel when learning haskell gonadic io fucked around with this message at 13:50 on Feb 19, 2016 |
# ? Feb 19, 2016 13:37 |
You might want to do something besides data structures for your first Rust project--they often have difficult ownership relations, so you'll spend a *ton* of time fighting the borrow checker, which is tough when you first start out. I've been coding in Rust for a year and a half now and I still had trouble with the borrow checker when I was coding up some of those Octree examples. Of course, I guess you could also make the case that going straight for data structures is a good way to dive into Rust head first, in which case go for it!
|
|
# ? Feb 19, 2016 20:59 |
|
I'm a bad Rust programmer because once some data structures, especially graphs or trees that require knowing their parents, are involved, I inevitably end up with a couple unsafe blocks. Like, I make 95% of my Rust code safe. I even endeavor to make it effectively impossible to have runtime crashes in FFI wrappers. But a lot of data structures? My feelings end up being, "God drat it, mom! Don't tell me how to live my life! I know what I'm doing!" E: Actually, on a mostly unrelated note, can someone explain Box to me? I mean, I know what it does. It's a lot like a malloc'd pointer in C. I just can never find a place to use it because every time I try it feels like the Box type ends up infecting the return stack of the entire program. Linear Zoetrope fucked around with this message at 00:09 on Feb 20, 2016 |
# ? Feb 19, 2016 21:53 |
|
It works! https://play.rust-lang.org/?gist=3c137f16de010859622b&version=stable And after only 2 and a half glasses of wine too! This is step 1 on my plan for e: and now to implement ray casting... although I am cheating slightly because I've already implemented all of this in F# before I restarted in Scala and now I'm restarting again in Rust so I'm pretty familiar with the actual logic. gonadic io fucked around with this message at 00:33 on Feb 20, 2016 |
# ? Feb 19, 2016 23:44 |
|
Curious - how easy is Rust to integrate into F#/Unity?
|
# ? Feb 20, 2016 00:16 |
|
Not that I've actually done it yet, but Rust's FFI can be used in place of a C++ external function as described by this blog post:code:
And then F# in place of C# is trivial although I might need one or two C# wrappers if Unity demands C# in places? I'm not sure there either. Basically this is a fun adventure where I throw myself into the deep end and learn some new technologies/languages! I've never used Rust before, nor Unity, the only non-GC'd language I've used before is 1-2 tiny toy C programs, and I haven't really done all that much in F# before. I am however pretty good at Haskell gonadic io fucked around with this message at 00:32 on Feb 20, 2016 |
# ? Feb 20, 2016 00:23 |
|
Deus Rex posted:Sure you are. Maybe not as much, or in all the same ways, as when you're hacking together a prototype, though. Ideally, you would have production code that doesn't allow panics to get to the user. That would be a more nuanced way of saying what I originally did.
|
# ? Feb 20, 2016 22:12 |
|
Is there a better way to get the first Some in a list of Options (and if there isn't any, return None) than this?code:
If anybody is interesting in my ongoing project, the ray casting functionality is done now. Also the file's reached 200 lines so I guess I should probably split it into modules and stuff. Any pointers or references are appreciated: https://gist.github.com/anonymous/224fcfb0e171941715a6 gonadic io fucked around with this message at 19:25 on Feb 21, 2016 |
# ? Feb 21, 2016 19:10 |
|
gonadic io posted:Is there a better way to get the first Some in a list of Options (and if there isn't any, return None) than this? map is lazy though: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map and find is short circuiting: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.find
|
# ? Feb 21, 2016 19:55 |
|
FamDav posted:map is lazy though: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map What I have (map and find) works and is short-circuiting, I was just wondering if there was a cleaner solution like [].cat_maybes().head_option() or something. gonadic io fucked around with this message at 20:16 on Feb 21, 2016 |
# ? Feb 21, 2016 20:04 |
|
gonadic io posted:What I have (map and find) works and is short-circuiting, I was just wondering if there was a cleaner solution like [].cat_maybes.head_option or something. oh gotcha. from your first post it sounded like you were arguing it wasn't. nothing in the stdlib that handles this, though if you wanted to you could create your own on iterators via an extension code:
|
# ? Feb 21, 2016 20:18 |
|
Jsor posted:E: Actually, on a mostly unrelated note, can someone explain Box to me? I mean, I know what it does. It's a lot like a malloc'd pointer in C. I just can never find a place to use it because every time I try it feels like the Box type ends up infecting the return stack of the entire program. The only use case I've found that requires a Box is doing direct recursive relationships. http://is.gd/z1z4yB You'd also want to wrap big data structures in a Box, the stack you're given is probably around 2MB. So stuff like images, or if you're doing data visualisation, you'll probably have a huge dataset, which would probably cause a stack overflow.
|
# ? Feb 21, 2016 22:36 |
|
super confused; why doescode:
code:
|
# ? Feb 22, 2016 01:23 |
|
FamDav posted:super confused; why does .iter() doesn't consume the collection it is based on, which is why it gives references. So you can have the Iterator, and the collection. If don't want the collection anymore, you can call .into_iter(), which will take the collection, and convert it into an Iterator. The reason the map works where you dereference x, is because i32 has the trait Copy, so when you dereference it, you're implicitly cloning the value. Neither one of these will compile with a non Copyable type such as a String. Aaronepower fucked around with this message at 02:07 on Feb 22, 2016 |
# ? Feb 22, 2016 02:04 |
|
Alright so I'm learning Rust again, and I'm trying to make a program that modifies images. I'm making a function that takes an image and returns a copy of that image that is grayscale, but I can't get it to compile yet. Here's what I have so far: (The image library is the piston image library (https://github.com/PistonDevelopers/image) code:
If I change the function to be generic I get this: code:
[E0277]{" on the function definition line. Making the function definition read like "fn grayscale_image_buffer<P: image::Pixel, C>" just gives me more errors about, well, everything. Can't find methods for the image passed in that I know exist on ImageBuffer, mismatched types, "error: the type of this value must be known in this context". Basically all hell breaks loose and I'm not sure what the compiler is expecting of me at this point. What am I missing to make this function work?
|
# ? Mar 5, 2016 21:33 |
|
Generally: Getting more errors when you fix one error is perfectly normal and just means the compiler now understands enough of your code to be really unhappy about it. Being unable to find methods you know exist probably has to do with the trait bounds of the impl where the methods are defined not being fulfilled. The type-must-be-known thing is a what you usually get when you try to make it do more inference than it reasonably can, or I guess when it tries to figure out how to continue with code that's already erroneous. It looks like you need to do input_image.get_pixel(x, y).to_rgb(); before you can get at the data field, because the data field is a thing defined on the concrete Rgb type and not on the Pixel trait (traits don't define fields), but it also looks like you could just call .to_luma() instead and skip the manual averaging and also get some weird weighting they do for each channel.
|
# ? Mar 5, 2016 22:09 |
|
Today I wrote the line code:
|
# ? Mar 5, 2016 22:24 |
piratepilates posted:Alright so I'm learning Rust again, and I'm trying to make a program that modifies images. I'm making a function that takes an image and returns a copy of that image that is grayscale, but I can't get it to compile yet. I took a stab at this, and I'll walk you through my thought process: First step: the code that you gave has the following error: quote:src/lib.rs:10:42: 10:52 error: no method named `dimensions` found for type `image::buffer::ImageBuffer<P, C>` in the current scope Reading the note there, it seems like we were just not meeting enough of the trait bounds for `dimensions` to exist. It only exists for ImageBuffer<P, C> where P is a Pixel and C is a container which implements `Deref<Target=[P::Subpixel]>` (see http://www.piston.rs/image/image/struct.ImageBuffer.html), but we haven't specified the latter. So now we have this: code:
quote:src/lib.rs:15:17: 15:27 error: attempted access of field `data` on type `&P`, but no field with that name was found Okay, so what is `data`? I can't find it under the documentation for Pixel, which makes sense because the error is saying it's not there. My guess is that you wanted to implement this for RGB images though (given your variable names), and `image::Rgb<T>` does have a field called `data`. Now this is not generic over all Pixel types: instead, we will just implement it for `image::RGB<T>`, with the appropriate bounds on `T`. code:
quote:src/lib.rs:13:5: 20:7 error: mismatched types: This is because from_fn() returns an ImageBuffer<P, Vec<P::Subpixel>>. So we need to specify this in our return type. After doing that, there are just a few more type errors to fix (you over-specified a few things). The final version looks like this: code:
|
|
# ? Mar 5, 2016 22:37 |
|
So I'm experimenting with Rust after using Go for a while and I'm having trouble with the classic threading model (I really like Go's process model/goroutine stuff but I want generics and immutability). Are there any solid libraries that let me do CSP-style stuff/selects over channels etc. easily?
|
# ? Mar 6, 2016 23:32 |
|
|
# ? May 16, 2024 18:01 |
|
Is this a reasonable way to pass an optional value over a FFI boundary? Passing a (nullable) pointer and then having the C# code calling another function to free it seems like lots of pain.code:
gonadic io fucked around with this message at 22:04 on Mar 13, 2016 |
# ? Mar 13, 2016 22:00 |