Coming from C++, this always throws me a bit: if (0..=10).contains(&5) { I assume we are taking a ref to "5" (and not passing by value) because "Range" is a generic type that might be too big to want to copy (or it may not be copyable at all). But taking a reference to a number for a simple operation like this feels... weird. It makes me worry that Rust is going to be passing around pointers to some stack-allocated "…
Announcing Rust 1.35.0
91–100 of 111 posts
Re: Announcing Rust 1.35.0
#92Coming from C/C++. Is working with the online package manager (Cargo?) mandatory? Or is there a sustainable way of working/developing with Rust while completely offline? I'd like to start a project, manually import libraries (downloaded manually, no dependency hell), read documentation, etc. Is it possible?
The documentation for using rustc directly is hard to find, but it’s quite possible to skip Cargo entirely. I’ve had no trouble using it mostly like a C compiler, but I have run into a couple of quirks I needed to work around:
* I haven’t figured out how to get dependency information out of the compiler, so I had to write a likely-fragile script to grep the rust sources.
* In any project, crates have a single, flat namespace. If you want to treat them like you would object files in a C project you’ll need some scheme to prevent name conflicts between subdirectories. The more rust-y thing is to use the module system to include anything that shouldn’t be visible at the top level of your hierarchy.
Otherwise, it’s fairly similar to a traditional compiler:
rustc main.rs -o my-program # compile an executable
rustc main.rs --test -o ... # compile the test framework
rustc --crate-type=rlib ... # make an rlib (roughly equivalent to .o)
rustc --extern name=path/to/rlib ... # reference another crate (required during compilation)Re: Announcing Rust 1.35.0
#93Earlier quoted context omitted.
I found a comment on /r/rust that details the setup that one guy is using for doing Rust development in an air gapped environment. https://www.reddit.com/r/rust/comments/793evq/using_cargo_on... I do think though, that going down that route might be challenging if you try to do it the first time you are trying to develop in Rust. Furthermore, even then you are starting out with a pre-compiled toolchain and trusting q…
Don't forget, Rust is written in Rust, so if you want to compile Rust from source because you don't trust the precompiled toolchain, you're in for a very long and arduous journey all the way back to the last version of the compiler written in OCaml, and then compiling a bunch of intermediate compiler versions using the previously-compiled version to inch your way towards the current version. I'm not even sure how man…
Re: Announcing Rust 1.35.0
#94Earlier quoted context omitted.
Part of the problem is conceptualizing this as a reference (which, admittedly, it is without optimization). Instead, this is a borrow which indicates that the callee will not mutate the argument. It makes more sense in this context.
> Part of the problem is conceptualizing this as a reference (which, admittedly, it is without optimization). Isn't that also the official name of the feature in Rust? Isn't &T in Rust pronounced "reference to T" and "&mut T" pronounced "mutable reference to T"? That is the impression I get from: https://doc.rust-lang.org/book/ch04-02-references-and-borrow...
Rust is all about ownership, and `&` means "don't free() this".
Re: Announcing Rust 1.35.0
#95Earlier quoted context omitted.
They exposed all the options. That’s very useful. They made their case. That’s very useful. This is the most discussed feature of Rust ever. The team spent a lot of time and energy on it, way way way more than any other feature. Several team members flip flopped positions several times.
And the team seemed to ignore the users. The two polls I saw, both had the method syntax below 50% approval and below the other front runners. It seemed to me they basically said, "Sure, tell us want you want so we can note it and ignore it." Kind of a real dick move. Why bother even asking for input? (For disclosure, I preferred postfix punctuation similar to `?` that most people hated - so I'm not gettng my way eit…
Re: Announcing Rust 1.35.0
#96Earlier quoted context omitted.
Auditing rust and cargo sounds like easily 1000x more work than copying some source files.
Really? How did you get the source code for those dependencies in the first place? Whatever you used likely has just as much power as Cargo does. (And is perhaps similarly hard to audit.)
However, at this point I think we are WAY off the original topic. :-)
Re: Announcing Rust 1.35.0
#97Re: Announcing Rust 1.35.0
#98Earlier quoted context omitted.
It is a reference, yes, and without optimization, is a pointer to a value. Your parent is suggesting to not think of it in such a low-level way, and instead think of it as a permission. In this case, the pointer being optimized away makes more sense, as it’s not really about it being a pointer. I’m of two minds about it, to be honest.
Thanks for the book! A++ would read again. https://www.amazon.com/Rust-Programming-Language-Steve-Klabn...
Re: Announcing Rust 1.35.0
#99Earlier quoted context omitted.
It’s around a thousand builds.
I'm honestly kind of surprised someone's actually gone through the effort of figuring that out, and I'm afraid to ask how long it takes to build the whole chain.
I don't think anyone has actually done so, so I'm not sure how long, but probably a very, very long time. And you can't parallel it.
Re: Announcing Rust 1.35.0
#100Coming from C/C++. Is working with the online package manager (Cargo?) mandatory? Or is there a sustainable way of working/developing with Rust while completely offline? I'd like to start a project, manually import libraries (downloaded manually, no dependency hell), read documentation, etc. Is it possible?
I generally prefer to use Make as my build system everywhere, so that I only have to learn the quirks of one system, and it’s easier to handle mixed-language projects. The documentation for using rustc directly is hard to find, but it’s quite possible to skip Cargo entirely. I’ve had no trouble using it mostly like a C compiler, but I have run into a couple of quirks I needed to work around: * I haven’t figured out h…