Stabilize the copy_closures and clone_closures features
In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do.
This commit is contained in:
@@ -391,10 +391,6 @@ declare_features! (
|
||||
// Future-proofing enums/structs with #[non_exhaustive] attribute (RFC 2008)
|
||||
(active, non_exhaustive, "1.22.0", Some(44109), None),
|
||||
|
||||
// Copy/Clone closures (RFC 2132)
|
||||
(active, clone_closures, "1.22.0", Some(44490), None),
|
||||
(active, copy_closures, "1.22.0", Some(44490), None),
|
||||
|
||||
// allow `'_` placeholder lifetimes
|
||||
(active, underscore_lifetimes, "1.22.0", Some(44524), None),
|
||||
|
||||
@@ -556,6 +552,9 @@ declare_features! (
|
||||
(accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
|
||||
// allow `..=` in patterns (RFC 1192)
|
||||
(accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
|
||||
// Copy/Clone closures (RFC 2132)
|
||||
(accepted, clone_closures, "1.26.0", Some(44490), None),
|
||||
(accepted, copy_closures, "1.26.0", Some(44490), None),
|
||||
);
|
||||
|
||||
// If you change this, please modify src/doc/unstable-book as well. You must
|
||||
@@ -1867,8 +1866,6 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
|
||||
struct FeatureChecker {
|
||||
proc_macro: Option<Span>,
|
||||
custom_attribute: Option<Span>,
|
||||
copy_closures: Option<Span>,
|
||||
clone_closures: Option<Span>,
|
||||
}
|
||||
|
||||
impl FeatureChecker {
|
||||
@@ -1884,14 +1881,6 @@ impl FeatureChecker {
|
||||
if features.custom_attribute {
|
||||
self.custom_attribute = self.custom_attribute.or(Some(span));
|
||||
}
|
||||
|
||||
if features.copy_closures {
|
||||
self.copy_closures = self.copy_closures.or(Some(span));
|
||||
}
|
||||
|
||||
if features.clone_closures {
|
||||
self.clone_closures = self.clone_closures.or(Some(span));
|
||||
}
|
||||
}
|
||||
|
||||
fn check(self, handler: &Handler) {
|
||||
@@ -1903,15 +1892,6 @@ impl FeatureChecker {
|
||||
|
||||
FatalError.raise();
|
||||
}
|
||||
|
||||
if let (Some(span), None) = (self.copy_closures, self.clone_closures) {
|
||||
handler.struct_span_err(span, "`#![feature(copy_closures)]` can only be used with \
|
||||
`#![feature(clone_closures)]`")
|
||||
.span_note(span, "`#![feature(copy_closures)]` declared here")
|
||||
.emit();
|
||||
|
||||
FatalError.raise();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user