mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
libsyntax: Remove "copy" pattern bindings from the language
This commit is contained in:
parent
8cd40f9032
commit
3fcd4dca30
@ -63,6 +63,7 @@ pub enum ObsoleteSyntax {
|
||||
ObsoleteNamedExternModule,
|
||||
ObsoleteMultipleLocalDecl,
|
||||
ObsoleteMutWithMultipleBindings,
|
||||
ObsoletePatternCopyKeyword,
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||
@ -229,6 +230,10 @@ impl Parser {
|
||||
"use multiple local declarations instead of e.g. `let mut \
|
||||
(x, y) = ...`."
|
||||
),
|
||||
ObsoletePatternCopyKeyword => (
|
||||
"`copy` in patterns",
|
||||
"`copy` in patterns no longer has any effect"
|
||||
),
|
||||
};
|
||||
|
||||
self.report(sp, kind, kind_str, desc);
|
||||
|
@ -84,6 +84,7 @@ use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
|
||||
use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
|
||||
use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
|
||||
use parse::obsolete::{ObsoleteMutWithMultipleBindings};
|
||||
use parse::obsolete::{ObsoletePatternCopyKeyword};
|
||||
use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident};
|
||||
use parse::token::{is_ident_or_path};
|
||||
use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
|
||||
@ -2445,8 +2446,7 @@ impl Parser {
|
||||
pat = self.parse_pat_ident(bind_by_ref(mutbl));
|
||||
} else if self.eat_keyword(keywords::Copy) {
|
||||
// parse copy pat
|
||||
self.warn("copy keyword in patterns no longer has any effect, \
|
||||
remove it");
|
||||
self.obsolete(*self.span, ObsoletePatternCopyKeyword);
|
||||
pat = self.parse_pat_ident(bind_infer);
|
||||
} else {
|
||||
let can_be_enum_or_struct;
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
extern mod extra;
|
||||
|
||||
fn o<T: Owned>(_: &T) {}
|
||||
fn c<T: Const>(_: &T) {}
|
||||
fn o<T: Send>(_: &T) {}
|
||||
fn c<T: Freeze>(_: &T) {}
|
||||
|
||||
fn main() {
|
||||
let x = extra::rc::rc_mut_from_owned(0);
|
||||
o(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Owned`
|
||||
c(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Const`
|
||||
o(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Send`
|
||||
c(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Freeze`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user