Skip to content
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

Docify std::vec_ng #12955

Merged
merged 1 commit into from
Mar 19, 2014
Merged

Docify std::vec_ng #12955

merged 1 commit into from
Mar 19, 2014

Conversation

sfackler
Copy link
Member

I also removed a couple of methods that were silly and added sort.

@@ -40,7 +40,7 @@ case.
An example is the method `.slice(a, b)` that returns an immutable "view" into
a vector or a vector slice from the index interval `[a, b)`:

```rust
``rust
Copy link
Member

Choose a reason for hiding this comment

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

lost a backtick

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@alexcrichton
Copy link
Member

This documentation was all mostly copied from std::vec?

@sfackler
Copy link
Member Author

Most of the text was, but I think most of the examples are new..


/// An owned, growable vector
///
/// `Vec<T>` is the replacement for the deprecated `~[T]` type. The API is
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should mention ~[T]. This belongs in the 0.10 release notes + extended release notes, and is already a lint. This documentation will just become outdated.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll get rid of that when I expand that section of the docs.
On Mar 16, 2014 5:25 PM, "Daniel Micay" notifications@github.com wrote:

In src/libstd/vec_ng.rs:

@@ -32,8 +28,21 @@ use ptr;
use rt::global_heap::{malloc_raw, realloc_raw};
use raw::Slice;
use vec::{ImmutableEqVector, ImmutableVector, Items, MutItems, MutableVector};

-use vec::{RevItems};

+use vec::{MutableTotalOrdVector};
+
+/// An owned, growable vector
+///
+/// Vec<T> is the replacement for the deprecated ~[T] type. The API is

I don't think this should mention ~[T]. This belongs in the 0.10 release
notes + extended release notes, and is already a lint. This documentation
will just become outdated.

Reply to this email directly or view it on GitHubhttps://github.com//pull/12955/files#r10643022
.

I also removed a couple of methods that were silly and added sort.
bors added a commit that referenced this pull request Mar 19, 2014
I also removed a couple of methods that were silly and added sort.
@bors bors closed this Mar 19, 2014
@bors bors merged commit 0f2d46f into rust-lang:master Mar 19, 2014
@sfackler sfackler deleted the vec_ng-doc branch May 15, 2014 05:02
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2022
feat: Display the value of enum variant on hover

fixes rust-lang#12955

This PR adds const eval support for enums, as well as showing their value on hover, just as consts currently have.

I developed these two things at the same time, but I've realized now that they are separate. However since the hover is just a 10 line change (not including tests), I figured I may as well put them in the same PR. Though if you want them split up into "enum const eval support"  and "show enum variant value on hover", I think that's reasonable too.

Since this adds const eval support for enums this also allows consts that reference enums to have their values computed now too.

The const evaluation itself is quite rudimentary, it doesn't keep track of the actual type of the enum, but it turns out that Rust doesn't actually either, and `E::A as u8` is valid regardless of the `repr` on `E`.

It also doesn't really care about what expression the enum variant contains, it could for example be a string, despite that not being allowed, but I guess it's up to the `cargo check` diagnostics to inform of such issues anyway?
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.

4 participants