Skip to content

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

Merged
merged 3 commits into from
Jun 6, 2014
Merged

Add example to std::os documentation. #14641

merged 3 commits into from
Jun 6, 2014

Conversation

darnuria
Copy link
Contributor

@darnuria darnuria commented Jun 4, 2014

Just opening a pull request for adding code examples and documentation to std::os.

More to come soon.

@darnuria
Copy link
Contributor Author

darnuria commented Jun 4, 2014

add @LeoTestard in cc.

/// ```rust
/// // We assume that we are in a valid directory.
/// let pwd = getcwd();
/// ```
Copy link
Member

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.

@alexcrichton
Copy link
Member

And thank you @darnuria! I always love seeing more documentation :)

@darnuria
Copy link
Contributor Author

darnuria commented Jun 5, 2014

@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. :)

@alexcrichton
Copy link
Member

Oh! sorry! I forgot to come back to this. This looks great to me!

bors added a commit that referenced this pull request Jun 5, 2014
…lexcrichton

Just opening a pull request for adding code examples and documentation to std::os.

More to come soon.
@bors bors closed this Jun 6, 2014
@bors bors merged commit 85adc09 into rust-lang:master Jun 6, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
…=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
bors pushed a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants