libsyntax: Stop parsing structural record types

This commit is contained in:
Patrick Walton 2013-03-05 17:36:59 -08:00
parent 6b5d1afeec
commit 239e64242c
11 changed files with 21 additions and 37 deletions

View File

@ -22,14 +22,14 @@ use str;
pub type FreeGlue = &self/fn(*TypeDesc, *c_void);
// Corresponds to runtime type_desc type
pub enum TypeDesc = {
pub struct TypeDesc {
size: uint,
align: uint,
take_glue: uint,
drop_glue: uint,
free_glue: uint
// Remaining fields not listed
};
}
/// The representation of a Rust closure
pub struct Closure {

View File

@ -22,11 +22,11 @@ pub mod intrinsic {
}
}
pub enum TyDesc = {
pub struct TyDesc {
size: uint,
align: uint
// Remaining fields not listed
};
}
pub trait TyVisitor {
fn visit_bot(&self) -> bool;

View File

@ -36,13 +36,6 @@ use syntax::{ast, visit};
pub type parent = Option<ast::node_id>;
/* Records the parameter ID of a region name. */
pub type binding = {
node_id: ast::node_id,
name: ~str,
br: ty::bound_region
};
/**
Encodes the bounding lifetime for a given AST node:

View File

@ -22,19 +22,6 @@ use util::ppaux::ty_to_str;
// ______________________________________________________________________
// compute sizeof / alignof
pub type metrics = {
bcx: block,
sz: ValueRef,
align: ValueRef
};
pub type tag_metrics = {
bcx: block,
sz: ValueRef,
align: ValueRef,
payload_align: ValueRef
};
// Returns the number of bytes clobbered by a Store to this type.
pub fn llsize_of_store(cx: @CrateContext, t: TypeRef) -> uint {
unsafe {

View File

@ -775,7 +775,6 @@ type constness_cache = HashMap<ast::def_id, const_eval::constness>;
pub type node_type_table = @mut SmallIntMap<t>;
fn mk_rcache() -> creader_cache {
type val = {cnum: int, pos: uint, len: uint};
return oldmap::HashMap();
}

View File

@ -94,6 +94,12 @@ pub fn collect_item_types(ccx: @mut CrateCtxt, crate: @ast::crate) {
(intrinsic_item.ident, (def_id, ty));
}
ast::item_struct(*) => {
let ty = ty::mk_struct(ccx.tcx, def_id, substs);
ccx.tcx.intrinsic_defs.insert
(intrinsic_item.ident, (def_id, ty));
}
_ => {}
}
}

View File

@ -26,9 +26,9 @@ use core::prelude::*;
/// The base price of a muffin on a non-holiday
const price_of_a_muffin: float = 70f;
type WaitPerson = {
struct WaitPerson {
hair_color: ~str
};
}
/// The type of things that produce omnomnom
enum OmNomNomy {

View File

@ -217,7 +217,6 @@ pub struct FileLines {
pub enum FileSubstr {
pub FssNone,
pub FssInternal(span),
pub FssExternal({filename: ~str, line: uint, col: CharPos})
}
/// Identifies an offset of a multi-byte character in a FileMap
@ -348,12 +347,6 @@ pub impl CodeMap {
FssInternal(sp) =>
self.lookup_char_pos_adj(
sp.lo + (pos - loc.file.start_pos)),
FssExternal(ref eloc) =>
LocWithOpt {
filename: /* FIXME (#2543) */ copy (*eloc).filename,
line: (*eloc).line + loc.line - 1u,
col: if loc.line == 1 {eloc.col + loc.col} else {loc.col},
file: None}
}
}
@ -368,7 +361,6 @@ pub impl CodeMap {
expn_info: sp.expn_info
})
}
FssExternal(_) => sp
}
}

View File

@ -49,6 +49,7 @@ pub enum ObsoleteSyntax {
ObsoleteMutOwnedPointer,
ObsoleteMutVector,
ObsoleteTraitImplVisibility,
ObsoleteRecordType,
}
impl to_bytes::IterBytes for ObsoleteSyntax {
@ -145,6 +146,10 @@ pub impl Parser {
because the `impl...for...` form defines overloads for \
methods that already exist; remove the `pub` or `priv`"
),
ObsoleteRecordType => (
"structural record type",
"use a structure instead"
),
};
self.report(sp, kind, kind_str, desc);

View File

@ -75,6 +75,7 @@ use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
use parse::obsolete::{ObsoleteRecordType};
use parse::prec::{as_prec, token_to_binop};
use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
@ -657,6 +658,7 @@ pub impl Parser {
if elems.len() == 0 {
self.unexpected_last(&token::RBRACE);
}
self.obsolete(*self.last_span, ObsoleteRecordType);
ty_rec(elems)
} else if *self.token == token::LBRACKET {
self.expect(&token::LBRACKET);

View File

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
type pair<A,B> = {
struct pair<A,B> {
a: A, b: B
};
}
fn f<A:Copy + &static>(a: A, b: u16) -> @fn() -> (A, u16) {
let result: @fn() -> (A, u16) = || (a, b);