-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Audit #[derive]s in std for stability #22511
Comments
cc @aturon, @alexcrichton
|
|
|
/// This structure represents a safely precompiled version of a format string | |
/// and its arguments. This cannot be generated at runtime because it cannot | |
/// safely be done so, so no constructors are given and the fields are private | |
/// to prevent modification. | |
/// | |
/// The `format_args!` macro will safely create an instance of this structure | |
/// and pass it to a function or closure, passed as the first argument. The | |
/// macro validates the format string at compile-time so usage of the `write` | |
/// and `format` functions can be safely performed. | |
#[stable(feature = "rust1", since = "1.0.0")] | |
#[derive(Copy)] | |
pub struct Arguments<'a> { | |
// Format string pieces to print. | |
pieces: &'a [&'a str], | |
// Placeholder specs, or `None` if all specs are default (as in "{}{}"). | |
fmt: Option<&'a [rt::v1::Argument]>, | |
// Dynamic arguments for interpolation, to be interleaved with string | |
// pieces. (Every argument is preceded by a string piece.) | |
args: &'a [ArgumentV1<'a>], | |
} |
RangeFull
and RangeTo
are Copy
but Range
and RangeFrom
are not.
The Ord
ering/PartialOrd
ering of Option
and Result
is inconsistent (in the sense of Option<T>
≅ Result<T, ()>
): None < Some(_)
, but Err(_) > Ok(_)
.
|
Either |
Hm I feel like this was some other structure we may remove the
I believe that we used to pass the structure by reference but we now pass it by value sometimes necessitating the
cc #21846 |
cc me |
I think so: it is useful for generic code (e.g. when storing things in a tree, the details of the ordering usually don't matter, as long as one exists) and #[derive(PartialOrd)]
struct Foo {
x: T
y: U,
z: Option<V>
} The first two fields will usually completely distinguish instances of |
It’s not quite the same as |
The |
Ugh that's bad. Hopefully the Pod/Copy RFC will help us clean this up. |
I'm going to close this as complete. Thanks for heading this up, @huonw! |
#[derive(Foo)]
currently just takes the stability ofFoo
, which may not be what we want for some types instd
.cc #22500
According to
these files have a
#[derive]
attribute near a#[stable]
one:Replacing the
sed ...
withwc -l
gives 77, i.e. there are approximately 77#[derive]
s to look at (nearly 25% of which are in core::iter, hence it being listed separately).Comment below if you wish to handle some of these.
The text was updated successfully, but these errors were encountered: