Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRWIB Mission 7: FAQ fixes #181
Comments
edunham
added
the
RWIB Missions
label
Aug 28, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Aug 30, 2015
Contributor
One thing to note is that some of the material in the existing FAQs is likely worth preserving, although it should be restructured into an actual question-and-answer style. The material needs to be refreshed in many cases, but it shouldn't be removed completely.
I am happy to go through the existing material and update it if that's something we'd like to have done.
|
One thing to note is that some of the material in the existing FAQs is likely worth preserving, although it should be restructured into an actual question-and-answer style. The material needs to be refreshed in many cases, but it shouldn't be removed completely. I am happy to go through the existing material and update it if that's something we'd like to have done. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
brson
Aug 31, 2015
Contributor
@AndrewBrinker yes, I agree. Some of the information is still useful, and refreshing what already exists would be a good starting point.
|
@AndrewBrinker yes, I agree. Some of the information is still useful, and refreshing what already exists would be a good starting point. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Havvy
Sep 2, 2015
Contributor
A good question I see asked frequently: What are the weaknesses of Rust?
|
A good question I see asked frequently: What are the weaknesses of Rust? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Sep 2, 2015
Contributor
@Havvy: Absolutely. I'll add that to the list. The answer is going to be something to put serious thought into. It may be something to take to the community and solicit some thoughts on.
|
@Havvy: Absolutely. I'll add that to the list. The answer is going to be something to put serious thought into. It may be something to take to the community and solicit some thoughts on. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Sep 4, 2015
Contributor
Okay. All the usable questions and answers from the existing FAQs have been moved over and updated where necessary. A basic design has also been put together. As I see it, the things remaining to do are:
- Solicit questions from the community (http://users.rust-lang.org and http://reddit.com/r/rust are the two places I intend to start).
- Write answers to the most common questions.
- Review all the answers in the FAQ and make sure they are correct for the latest version of Rust.
|
Okay. All the usable questions and answers from the existing FAQs have been moved over and updated where necessary. A basic design has also been put together. As I see it, the things remaining to do are:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Havvy
Sep 4, 2015
Contributor
Asking on Hacker News and the Twitter account would also possibly help.
|
Asking on Hacker News and the Twitter account would also possibly help. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Sep 10, 2015
Contributor
Okay, a thread soliciting input for the new FAQ has been posted to:
- Hacker News: https://news.ycombinator.com/item?id=10201150
- /r/rust: https://www.reddit.com/r/rust/comments/3kgzpd/taking_suggestions_for_the_new_rust_faq/
- /r/programming: https://www.reddit.com/r/programming/comments/3kh02t/taking_suggestions_for_the_new_rust_faq/
- users.rust-lang.org: https://users.rust-lang.org/t/taking-suggestions-for-the-new-rust-faq/2813
- Lobste.rs: https://lobste.rs/s/knzaqe/taking_suggestions_for_the_new_rust_faq
It may also be good to solicit feedback on this through the official Rust Twitter account, which I believe @steveklabnik runs.
Let me know if there's anywhere else this should be posted.
|
Okay, a thread soliciting input for the new FAQ has been posted to:
It may also be good to solicit feedback on this through the official Rust Twitter account, which I believe @steveklabnik runs. Let me know if there's anywhere else this should be posted. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Sep 13, 2015
Contributor
Based on the responses so far, here are the possible questions. I am not necessarily going to include all of these, but each of them will receive consideration for the FAQ:
- Why is Rust's HashMap so slow?
- Why doesn't Rust support try and catch / Why no exceptions? (3 votes)
- Why can't I compare floats?
- Why the split between Eq/PartialEq and Ord/PartialOrd?
- Why curly braces? Why can't everything be like Haskell/Python?
- Why lifetimes? (2 votes)
- What's the deal with unwrap() everywhere?
- I already write perfect C++. What does Rust give me?
- Why is the lifetime syntax the way it is?
- Why do I get an error when I try to run example code that uses the
try!macro? - Can I use unstable features in the beta or stable channel?
- Can I run benchmarks using
test::Bencheron the beta or stable channel? - How can I convert a
StringorVec<T>to a slice (&strand&[T])? - How can I convert from
&strtoString? - How can I join a
Vec(or an array) of strings into a single string? (2 votes) - How can I convert a scalar value to a different numeric type?
- How can I iterate over a
Vec<T>without moving/consuming it? - How can I read or write numeric types like
i32orf64in big-endian or little-endian format in a file or other byte stream? - How can I implement a graph or other data structure that contains cycles
- How can I define a struct that contains a pointer to its owner, or to one of its own fields?
- How can I convert a C-style enum to an integer, or vice-versa?
- Where do I report issues in the Rust documentation?
- How do I read a file into a
String? - How do I split a
Stringinto lines? - How can I make an HTTP request?
- How can I write a GUI application in Rust? (2 votes)
- How can I parse JSON/XML? (2 votes)
- What does it mean to "consume a value"?
- What is the difference between consuming and moving/taking ownership?
- How do I return a borrow to something I created from a function?
- How do I return a closure from a function?
- Who is using Rust?
- In which projects is Mozilla using Rust?
- Why when I pass a struct to a function the compiler says it's been moved and I can't use it anymore, when the same doesn't happen for integers?
- When are lifetimes required to be defined?
- Why can't the compiler find modules from an imported crate?
- When is it possible to avoid writing
*? - How do deref coercions work?
- Can I override operators? Which ones and how?
- How can I implement something like
struct X { static int X; };in Rust? - What examples are there of large Rust projects?
- Why is there no literal syntax for dictionaries like in Python, Ruby, Swift, etc?
- I can leave out parentheses on
ifconditions, why do I have to put brackets around single line blocks? Why is the C style not allowed? - Why does Rust not have the
?and!like in Swift? - Why do I have to declare module files with
modat the top level of the crate, instead of justuseing them? - Why does Rust not have an ABI like C does, and why do I have to annotate things with
extern? - Why is my program compiled with
cargo buildslow? - How do I read file input efficiently?
- How do I
memcpybytes? - How do I configure Cargo to use a proxy?
- How are Go and Rust similar, and how are they different?
- How can I detect when example code doesn't work because it's for an older version of the language (pre-1.0, usually)?
- How can I detect when documentation of a library is outdated?
- Why does storing trait objects in a
structgive me a confusing error aboutSized? - How do you deal with a "Use of moved value" error in
matchstatement on anenumorOption? - Why can't the compiler find the method implementation as
Traiteven through I'm alreadyuseing the crate? - What are the differences between the different string types?
- How do I map OO concepts to Rust?
- What's the different between a function and a closure that doesn't capture any variables?
- How do I debug Rust programs?
- What is "monomorphisation" in Rust?
- How do I view rustdoc documentation for a library my project depends on?
- How do I build a Windows binary that doesn't display the console window?
- How I make the console-less binary not crash on
panic!? - What's the idiomatic way to express platform-specific behavior in Rust?
- What projects are good examples of idiomatic Rust code?
- Why can't the compiler infer
usedeclarations for me? -
rustcsaid a panic occurred in standard library code. How do I locate the mistake in my code? - Is there an easier way to do error handling than having
Results everywhere? - What are the rules for using
self,&self, or&mut selfin a method declaration? - Should I default to using
f32orf64? -
gofmtis great. Where'srustfmt? - How do I handle configuration of an object with optional parameters?
- How do I do the equivalent of C++ template specialization in Rust?
- Can Rust reasonably function without the standard library?
- How do I do global variables in Rust?
- Can Rust be used for Android/iOS programming?
- Can I run my Rust program in a web browser?
- Can I write a macro to generate identifiers?
- What are higher-kinded types, why should I want them, and why doesn't Rust have them?
- Can I write an operating system in Rust?
- How do I do O(1) character access in a
String? - How can I set compile-time constants that are defined procedurally (equivalent to
constexprin C++)? - Why do I need to type the array size in the array declaration?
- Can I write a video game in Rust?
- When is
Rcuseful? - How can I understand the borrow checker?
- Can I run initialization code that happens before
main? - How do I do dynamic Rust library loading?
- Does Rust have type reflection?
- When should I use an implicit return?
- Is there a standard 2D+ dimensional vector and shape crate?
- How do I write an OpenGL app in Rust?
- Why can't I use
f32orf64as HashMap keys? - How can I interoperate with C++ from Rust, or with Rust from C++?
- How do I package and archive crates from http://crates.io?
- What do named type parameters in generic types mean?
- How does Rust's ownership system related to move semantics in C++?
- How do Rust traits compare to Haskell typeclasses?
- Why is Rust compilation slow?
- Why has Rust changed so much over time?
- How do I get command line arguments in Rust?
- How do you write a linked list in Rust?
- How do I get help with Rust issues?
- How can I try Rust easily?
- Why are so many Rust answers on StackOverflow wrong?
- Why doesn't http://crates.io have namespaces?
- Why are keywords and names in Rust so short?
- Why doesn't Rust have inheritance?
- How do I cross-compile in Rust?
- What IDE should I use?
This is a lot of questions (112, actually). I am going to be tackling them over the next week or so.
|
Based on the responses so far, here are the possible questions. I am not necessarily going to include all of these, but each of them will receive consideration for the FAQ:
This is a lot of questions (112, actually). I am going to be tackling them over the next week or so. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
carols10cents
Sep 25, 2015
Member
Hi, not sure if you're still watching the users/reddit/etc threads, but I just thought of another question so I'm adding it as a suggestion here; it gets asked about once a month on the subreddit:
- What IDE should I use?
Given that IDE support will change over time, http://areweideyet.com/ might be a good place to link to as an answer?
|
Hi, not sure if you're still watching the users/reddit/etc threads, but I just thought of another question so I'm adding it as a suggestion here; it gets asked about once a month on the subreddit:
Given that IDE support will change over time, http://areweideyet.com/ might be a good place to link to as an answer? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Sep 27, 2015
Contributor
Yup, that's definitely an important question. I will add it to the list.
|
Yup, that's definitely an important question. I will add it to the list. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Only 37 out of 132 questions left to be answered! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
brson
Oct 1, 2015
Contributor
Wow! I didn't realize you had so much progress already. Where's your branch with the answers?
|
Wow! I didn't realize you had so much progress already. Where's your branch with the answers? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Oct 2, 2015
Contributor
Right here: https://github.com/andrewbrinker/rust-www/tree/faq
For now I'm using JavaScript to generate the Table of Contents and make TODOs more noticeable. This is just to avoid having to reorganize the TOC whenever stuff gets reordered. I'll swap it out for straight HTML before anything gets merged.
There are also some styles I've added that will need some review and cleanup. They work well enough for now though.
|
Right here: https://github.com/andrewbrinker/rust-www/tree/faq For now I'm using JavaScript to generate the Table of Contents and make TODOs more noticeable. This is just to avoid having to reorganize the TOC whenever stuff gets reordered. I'll swap it out for straight HTML before anything gets merged. There are also some styles I've added that will need some review and cleanup. They work well enough for now though. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Oct 11, 2015
Contributor
Okay, I think I've answered all the questions I can. There are 7 left which I am not sure how to answer:
- What projects are good examples of idiomatic Rust code?
- How do I package and archive crates from http://crates.io?
- Does Rust have type reflection?
- rustc said a panic occurred in standard library code. How do I locate the mistake in my code?
- How do I build a Windows binary that doesn't display the console window?
- How I make the console-less binary not crash on panic!?
- How do I do the equivalent of C++ template specialization in Rust?
Here are my thoughts on each:
- This may be a good candidate for soliciting answers from the community.
- The easiest way I could think of for this would be to periodically grab the latest published version of the crates listed in the index and archive them. If there is a better way, let me know.
- I found some material on the
Reflecttrait, but none of it was super clear, and I don't feel confident doing a write-up. - I've never encountered this particular problem with Rust, and am not sure of the proper way of handling it.
- I've never used Rust on Windows, so I am not sure.
- Ditto.
- I found some material on coherence rules, but nothing that explicitly explained Rust's rules for specialization.
If anyone can point me in the right direction for these, I am happy to do the write-ups.
|
Okay, I think I've answered all the questions I can. There are 7 left which I am not sure how to answer:
Here are my thoughts on each:
If anyone can point me in the right direction for these, I am happy to do the write-ups. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
eddyb
Oct 11, 2015
Member
@AndrewBrinker:
3. The Reflect trait is merely a bound for Any (to prevent using Any on generic type parameters without requiring it in the signature).
All Any can do is type-equality-based downcasting (via TypeId), there is no introspection of types (which is what is usually regarded as "type reflection").
4. This is usually caused by .unwrap(). Enabling backtraces (setting the environment variable RUST_BACKTRACE=1) helps a lot, especially in debug mode.
Using an actual debugger can reveal more useful information.
7. Not currently possible in Rust, but specialization is coming (see rust-lang/rfcs#1210).
|
@AndrewBrinker: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Thanks! I've added answers for those questions to the FAQ. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Can we get the current state of this put up on the site? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AndrewBrinker
Oct 22, 2015
Contributor
Yup! Sorry about that. I am doing some cleanup right now, and then I'll make a pull request.
|
Yup! Sorry about that. I am doing some cleanup right now, and then I'll make a pull request. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
edunham
Oct 27, 2015
Member
Today I learned about https://old.etherpad-mozilla.org/rust-irc-faq , which might be of use in this mission.
|
Today I learned about https://old.etherpad-mozilla.org/rust-irc-faq , which might be of use in this mission. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
antoyo
commented
Nov 5, 2015
|
Can we get an answer to this question, please: Thanks. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mbrubeck
Nov 6, 2015
Contributor
Another very frequent question that's not on the list yet:
- Why does a tiny program like "Hello World" produce such a large executable file?
(Answer: Because rustc links the program statically by default. To link dynamically, use rustc -C prefer-dynamic.)
|
Another very frequent question that's not on the list yet:
(Answer: Because rustc links the program statically by default. To link dynamically, use |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This is done. I've opened another issue for additional FAQs. |
brson commentedAug 28, 2015
Link.
The FAQs have
more-or-less been bitrotting since the inception of the project. They
are only slightly better than useless.
Start a thread on users.rlo asking for people to write boths Q's and
A's. Throw away the 3 existing FAQs and write a single new one. Put
this one on the website, linked from the doc
page.
Q's
Why is the Rust [
HashMap] so slow?