-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add example to std::os documentation. #14641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
add @LeoTestard in cc. |
/// ```rust | ||
/// // We assume that we are in a valid directory. | ||
/// let pwd = getcwd(); | ||
/// ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our current documentation style is to put the failure/example sections under their own header, like:
# Failure
...
# Example
...
Additionally, can you inline the failure modes from getcwd
to here? Invoking the libc function is mostly just an implementation detail of this function, and we should try to document these functions as much as possible where they are.
Finally, you may want to make sure that this patch runs past make check
, because the example here doesn't look like it's going to pass the tests. You also may want to consider adding more code to the example because just calling the function isn't very descriptive of how the function works or what you can do with the return value.
And thank you @darnuria! I always love seeing more documentation :) |
For both window and unix platforms.
@alexcrichton: It's not a problem to wait before review/landing it? I need some time for ending up this. I expect something like 4days. I make it on my spare time. :) |
Oh! sorry! I forgot to come back to this. This looks great to me! |
…lexcrichton Just opening a pull request for adding code examples and documentation to std::os. More to come soon.
…=Veykril Register obligations during path inference Fixes rust-lang#14635 When we infer path expressions that resolve to some generic item, we need to consider their generic bounds. For example, when we resolve a path `Into::into` to `fn into<?0, ?1>` (note that `?0` is the self type of trait ref), we should register an obligation `?0: Into<?1>` or else their relationship would be lost. Relevant part in rustc is [`add_required_obligations_with_code()`] that's called in [`instantiate_value_path()`]. [`instantiate_value_path()`]: https://github.com/rust-lang/rust/blob/3462f79e94f466a56ddaccfcdd3a3d44dd1dda9f/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs#L1052 [`add_required_obligations_with_code()`]: https://github.com/rust-lang/rust/blob/3462f79e94f466a56ddaccfcdd3a3d44dd1dda9f/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs#L1411
) Limit the recursion depth, as each level of nesting adds another deeper projection. There might be a more complex way of handling the problem, but infinite recursions are bad, and don't allow Clippy to terminate properly. changelog: [`significant_drop_tightening`]: do not recurse forever when checking for attribute on type or its constituent Fixes rust-lang/rust-clippy#13544 @rustbot label +L-nursery
Just opening a pull request for adding code examples and documentation to std::os.
More to come soon.