libsyntax: Remove ~fn()
from the language
This commit is contained in:
parent
ba739b2135
commit
f977bedafd
5 changed files with 13 additions and 19 deletions
|
@ -41,7 +41,8 @@ pub enum ObsoleteSyntax {
|
|||
ObsoleteLoopAsContinue,
|
||||
ObsoleteEnumWildcard,
|
||||
ObsoleteStructWildcard,
|
||||
ObsoleteVecDotDotWildcard
|
||||
ObsoleteVecDotDotWildcard,
|
||||
ObsoleteBoxedClosure,
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||
|
@ -128,6 +129,11 @@ impl ParserObsoleteMethods for Parser {
|
|||
"vec slice wildcard",
|
||||
"use `..` instead of `.._` for matching slices"
|
||||
),
|
||||
ObsoleteBoxedClosure => (
|
||||
"managed or owned closure",
|
||||
"managed closures have been removed and owned closures are \
|
||||
now written `proc()`"
|
||||
),
|
||||
};
|
||||
|
||||
self.report(sp, kind, kind_str, desc);
|
||||
|
|
|
@ -1273,15 +1273,17 @@ impl Parser {
|
|||
pub fn parse_box_or_uniq_pointee(&self,
|
||||
sigil: ast::Sigil,
|
||||
ctor: &fn(v: mt) -> ty_) -> ty_ {
|
||||
// ~'foo fn() or ~fn() are parsed directly as fn types:
|
||||
// ~'foo fn() or ~fn() are parsed directly as obsolete fn types:
|
||||
match *self.token {
|
||||
token::LIFETIME(*) => {
|
||||
let lifetime = self.parse_lifetime();
|
||||
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
|
||||
return self.parse_ty_closure(Some(sigil), Some(lifetime));
|
||||
}
|
||||
|
||||
token::IDENT(*) => {
|
||||
token::IDENT(*) if sigil == ast::BorrowedSigil => {
|
||||
if self.token_is_old_style_closure_keyword() {
|
||||
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
|
||||
return self.parse_ty_closure(Some(sigil), None);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let _: @'static whatever fn(); //~ ERROR expected `fn`, found `whatever`
|
||||
let _: @'static fn();
|
||||
}
|
|
@ -16,7 +16,7 @@ extern mod extra;
|
|||
use extra::arc;
|
||||
use std::util;
|
||||
|
||||
fn foo(blk: ~once fn()) {
|
||||
fn foo(blk: proc()) {
|
||||
blk();
|
||||
blk(); //~ ERROR use of moved value
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ extern mod extra;
|
|||
use extra::arc;
|
||||
use std::util;
|
||||
|
||||
fn foo(blk: ~once fn()) {
|
||||
fn foo(blk: proc()) {
|
||||
blk();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue