Skip to content

Conversation

AlisdairO
Copy link
Contributor

I've seen quite a bit of confusion around regarding the use of Rc, so I thought I'd take a stab at adding some examples.

@@ -21,6 +21,127 @@ freed.
For example, a tree with parent pointers can be represented by putting the nodes behind `Strong`
pointers, and then storing the parent pointers as `Weak` pointers.


#Examples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space here, and I think we use h2 for this, not h1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steveklabnik will do on the h2. Not sure where you want the space to be put, though? Do you mean a space character, or vertical space? Thanks :-).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the #.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, thanks! Latest commit should have fixed it up.

@steveklabnik
Copy link
Contributor

I just gave this a quick look-over, and it seems like a decent example to me. Eventually, we'll have big explanations like this in an ownership guide, but always better to improve things early and often.


```rust
use std::rc::Rc;
use std::string::String;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String is in the prelude so you shouldn't need to import it.

@AlisdairO
Copy link
Contributor Author

Thanks for the comments - I've updated to resolve the issues you raised. The only one I couldn't fix was making an actual link to the Cell docs, as I don't know how to make a link in rustdoc: the docs seem to suggest that free text @see equivalents don't exist at the moment.

@alexcrichton
Copy link
Member

Looks great to me, thanks! It's ok if it's not an actual url, a reference is good enough (we have search!)

With a squash I think bors is ready for this.

@AlisdairO
Copy link
Contributor Author

@alexcrichton great! I'm moderately sure that the build error was a problem with the build engine rather than the code changes: make check works flawlessly on my system, and the build engine error was '/home/travis/build.sh: line 226: travis_wait: command not found'. Is there a way to get it to retry the build?

@alexcrichton
Copy link
Member

It's ok to ignore an error like that on travis, it's likely just spurious

@AlisdairO
Copy link
Contributor Author

OK great - I've squashed it now.

bors added a commit that referenced this pull request Jul 1, 2014
I've seen quite a bit of confusion around regarding the use of Rc, so I thought I'd take a stab at adding some examples.
@bors bors closed this Jul 1, 2014
@bors bors merged commit 88008b3 into rust-lang:master Jul 1, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 17, 2023
Skip building subtrees for builtin derives

This is a waste of resources, we go from node to subtree just to go from subtree to node in the expander impl. We can skip the subtree building and only build the tokenmap instead.
flip1995 added a commit to flip1995/rust that referenced this pull request Aug 7, 2025
Follow-up of rust-lang/rust-clippy#15208.

This PR removes the CSS `bootstrap` dependency which contains 1504 CSS
rules and weights 16.1 kB minified. Considering we used less than 50 of
these rules, it's quite a waste.

So this time, there are minor UI changes:
* The "expand/collapse all" buttons icon changed. It now uses the one
from font-awesome. It's quite close but not exactly the same.
* The layout is slightly different (you need to switch between two tabs
to actually see the difference).

Before this PR:

<img width="719" height="515" alt="image"
src="https://github.com/user-attachments/assets/1f067046-4ee9-49ee-bf38-50a8bf9888f2"
/>

With this PR:

<img width="719" height="515" alt="image"
src="https://github.com/user-attachments/assets/80331c98-1a1e-418f-b481-5b3f5c276926"
/>

With this, we will be able to go even further on reducing the page size
next. =D

This time, the DOM size itself reduced a bit but the difference is too
small to be noteworthy.

r? @samueltardieu

changelog: Remove CSS bootstrap dependency
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.

5 participants