about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-01-25 16:57:39 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-01-29 10:42:45 -0800
commiteb4d39e1fef918242a5dba2a09d7b9faa437b911 (patch)
tree92d923119a6d8f1b16d83c2214e8acf9d0dd25e6 /src/libsyntax
parentf1e78c6dd7dc41a9937c466a7af5d0efc779909f (diff)
downloadrust-eb4d39e1fef918242a5dba2a09d7b9faa437b911.tar.gz
rust-eb4d39e1fef918242a5dba2a09d7b9faa437b911.zip
libstd: Remove "dual impls" from the language and enforce coherence rules. r=brson
"Dual impls" are impls that are both type implementations and trait
implementations. They can lead to ambiguity and so this patch removes them
from the language.

This also enforces coherence rules. Without this patch, records can implement
traits not defined in the current crate. This patch fixes this, and updates
all of rustc to adhere to the new enforcement. Most of this patch is fixing
rustc to obey the coherence rules, which involves converting a bunch of records
to structs.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs2
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/codemap.rs2
-rw-r--r--src/libsyntax/diagnostic.rs2
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/ext/pipes/mod.rs1
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs5
-rw-r--r--src/libsyntax/ext/pipes/proto.rs2
-rw-r--r--src/libsyntax/ext/quote.rs2
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/lexer.rs2
12 files changed, 14 insertions, 12 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index ddd0f846f9d..201d53c0c3f 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -12,7 +12,7 @@ use core::prelude::*;
 
 use ast::*;
 use ast;
-use ast_util::{path_to_ident, stmt_id};
+use ast_util::{inlined_item_utils, path_to_ident, stmt_id};
 use ast_util;
 use attr;
 use codemap;
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 23ea27e7c5c..7b134a8db24 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -376,7 +376,7 @@ pure fn struct_field_visibility(field: ast::struct_field) -> visibility {
     }
 }
 
-trait inlined_item_utils {
+pub trait inlined_item_utils {
     fn ident() -> ident;
     fn id() -> ast::node_id;
     fn accept<E>(e: E, v: visit::vt<E>);
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 7a7c2312f56..7e3cbd18f52 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -33,7 +33,7 @@ use core::uint;
 use core::vec;
 use std::serialize::{Encodable, Decodable, Encoder, Decoder};
 
-trait Pos {
+pub trait Pos {
     static pure fn from_uint(n: uint) -> self;
     pure fn to_uint(&self) -> uint;
 }
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 6112313cf48..4c0cc161fdd 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -10,7 +10,7 @@
 
 use core::prelude::*;
 
-use codemap::span;
+use codemap::{Pos, span};
 use codemap;
 
 use core::cmp;
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 343ce4b039b..8a5b8a127d0 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -66,7 +66,7 @@ impl @ast::path: append_types {
     }
 }
 
-trait ext_ctxt_ast_builder {
+pub trait ext_ctxt_ast_builder {
     fn ty_param(id: ast::ident, +bounds: ~[ast::ty_param_bound])
         -> ast::ty_param;
     fn arg(name: ident, ty: @ast::Ty) -> ast::arg;
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index 8eef065395e..f91ec1ea48f 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -49,6 +49,7 @@ use codemap::span;
 use ext::base;
 use ext::base::ext_ctxt;
 use ext::pipes::parse_proto::proto_parser;
+use ext::pipes::pipec::gen_init;
 use ext::pipes::proto::{visit, protocol};
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index e53057cb312..774a5596258 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -13,7 +13,8 @@
 use ast::ident;
 use ast_util::dummy_sp;
 use ext::base::ext_ctxt;
-use ext::pipes::ast_builder::{append_types, path, path_global};
+use ext::pipes::ast_builder::{append_types, ext_ctxt_ast_builder, path};
+use ext::pipes::ast_builder::{path_global};
 use ext::pipes::proto::*;
 use ext::quote::rt::*;
 use parse::*;
@@ -35,7 +36,7 @@ trait to_type_decls {
     fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item];
 }
 
-trait gen_init {
+pub trait gen_init {
     fn gen_init(cx: ext_ctxt) -> @ast::item;
     fn compile(cx: ext_ctxt) -> @ast::item;
     fn buffer_ty_path(cx: ext_ctxt) -> @ast::Ty;
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 26638cd8cd6..9d24b3db724 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -13,7 +13,7 @@ use core::prelude::*;
 use ast;
 use codemap::span;
 use ext::base::ext_ctxt;
-use ext::pipes::ast_builder::{path, append_types};
+use ext::pipes::ast_builder::{append_types, ext_ctxt_ast_builder, path};
 
 use core::cmp;
 use core::dvec::DVec;
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 3354d015476..7605e01fbf0 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -10,7 +10,7 @@
 
 use ast;
 use attr;
-use codemap::{span, BytePos};
+use codemap::{BytePos, Pos, span};
 use ext::base::ext_ctxt;
 use ext::base;
 use ext::build;
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 3ade0bf86b1..4ecbbdc9760 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use codemap;
-use codemap::{span, Loc, FileMap};
+use codemap::{FileMap, Loc, Pos, span};
 use ext::base::*;
 use ext::base;
 use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str};
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 66c3111b309..fbe258852e2 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -11,7 +11,7 @@
 use core::prelude::*;
 
 use ast;
-use codemap::{BytePos, CharPos, CodeMap, FileMap};
+use codemap::{BytePos, CharPos, CodeMap, FileMap, Pos};
 use diagnostic;
 use parse::lexer::{is_whitespace, get_str_from, reader};
 use parse::lexer::{string_reader, bump, is_eof, nextch};
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 1574a037a46..5a0f40f3c12 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -12,7 +12,7 @@ use core::prelude::*;
 
 use ast;
 use ast_util;
-use codemap::{span, CodeMap, CharPos, BytePos};
+use codemap::{BytePos, CharPos, CodeMap, Pos, span};
 use codemap;
 use diagnostic::span_handler;
 use ext::tt::transcribe::{tt_next_token};