Skip to content

Commit

Permalink
auto merge of rust-lang#8455 : nikomatsakis/rust/issue-5762-objects-d…
Browse files Browse the repository at this point in the history
…ralston-d, r=graydon

Fix rust-lang#5762 and various other aspects of object invocation.

r? @graydon
  • Loading branch information
bors committed Aug 11, 2013
2 parents 63c62be + 7343478 commit b285f1e
Show file tree
Hide file tree
Showing 65 changed files with 1,155 additions and 560 deletions.
3 changes: 2 additions & 1 deletion src/librustc/back/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub static tydesc_field_take_glue: uint = 2u;
pub static tydesc_field_drop_glue: uint = 3u;
pub static tydesc_field_free_glue: uint = 4u;
pub static tydesc_field_visit_glue: uint = 5u;
pub static n_tydesc_fields: uint = 6u;
pub static tydesc_field_borrow_offset: uint = 6u;
pub static n_tydesc_fields: uint = 7u;

// The two halves of a closure: code and environment.
pub static fn_field_code: uint = 0u;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ pub fn build_session(sopts: @session::options,
pub fn build_session_(sopts: @session::options,
cm: @codemap::CodeMap,
demitter: diagnostic::Emitter,
span_diagnostic_handler: @diagnostic::span_handler)
span_diagnostic_handler: @mut diagnostic::span_handler)
-> Session {
let target_cfg = build_target_config(sopts, demitter);
let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub struct Session_ {
// For a library crate, this is always none
entry_fn: @mut Option<(NodeId, codemap::span)>,
entry_type: @mut Option<EntryFnType>,
span_diagnostic: @diagnostic::span_handler,
span_diagnostic: @mut diagnostic::span_handler,
filesearch: @filesearch::FileSearch,
building_library: @mut bool,
working_dir: Path,
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Session_ {
pub fn next_node_id(@self) -> ast::NodeId {
return syntax::parse::next_node_id(self.parse_sess);
}
pub fn diagnostic(@self) -> @diagnostic::span_handler {
pub fn diagnostic(@self) -> @mut diagnostic::span_handler {
self.span_diagnostic
}
pub fn debugging_opt(@self, opt: uint) -> bool {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use syntax::oldvisit;

// Traverses an AST, reading all the information about use'd crates and extern
// libraries necessary for later resolving, typechecking, linking, etc.
pub fn read_crates(diag: @span_handler,
pub fn read_crates(diag: @mut span_handler,
crate: &ast::Crate,
cstore: @mut cstore::CStore,
filesearch: @FileSearch,
Expand Down Expand Up @@ -74,7 +74,7 @@ fn dump_crates(crate_cache: &[cache_entry]) {
}

fn warn_if_multiple_versions(e: @mut Env,
diag: @span_handler,
diag: @mut span_handler,
crate_cache: &[cache_entry]) {
use std::either::*;

Expand Down Expand Up @@ -113,7 +113,7 @@ fn warn_if_multiple_versions(e: @mut Env,
}

struct Env {
diag: @span_handler,
diag: @mut span_handler,
filesearch: @FileSearch,
cstore: @mut cstore::CStore,
os: loader::os,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub type encode_inlined_item<'self> = &'self fn(ecx: &EncodeContext,
ii: ast::inlined_item);

pub struct EncodeParams<'self> {
diag: @span_handler,
diag: @mut span_handler,
tcx: ty::ctxt,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'self HashMap<ast::NodeId, ~str>,
Expand All @@ -82,7 +82,7 @@ struct Stats {
}

pub struct EncodeContext<'self> {
diag: @span_handler,
diag: @mut span_handler,
tcx: ty::ctxt,
stats: @mut Stats,
reexports2: middle::resolve::ExportMap2,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub enum os {
}

pub struct Context {
diag: @span_handler,
diag: @mut span_handler,
filesearch: @FileSearch,
span: span,
ident: @str,
Expand Down Expand Up @@ -163,7 +163,7 @@ pub fn package_id_from_metas(metas: &[@ast::MetaItem]) -> Option<@str> {
}

pub fn note_linkage_attrs(intr: @ident_interner,
diag: @span_handler,
diag: @mut span_handler,
attrs: ~[ast::Attribute]) {
let r = attr::find_linkage_metas(attrs);
for mi in r.iter() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use syntax::diagnostic::span_handler;
use syntax::print::pprust::*;

pub struct ctxt {
diag: @span_handler,
diag: @mut span_handler,
// Def -> str Callback:
ds: @fn(def_id) -> ~str,
// The type context.
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ impl tr for method_origin {
}
)
}
typeck::method_trait(did, m, vstore) => {
typeck::method_trait(did.tr(xcx), m, vstore)
typeck::method_trait(did, m) => {
typeck::method_trait(did.tr(xcx), m)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/check_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl<'self> CheckLoanCtxt<'self> {
}

mc::cat_discr(b, _) |
mc::cat_deref(b, _, mc::uniq_ptr(*)) => {
mc::cat_deref(b, _, mc::uniq_ptr) => {
assert_eq!(cmt.mutbl, mc::McInherited);
cmt = b;
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/gather_loans/gather_moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fn check_is_legal_to_move_from(bccx: @BorrowckCtxt,
}
}

mc::cat_deref(b, _, mc::uniq_ptr(*)) |
mc::cat_deref(b, _, mc::uniq_ptr) |
mc::cat_discr(b, _) => {
check_is_legal_to_move_from(bccx, cmt0, b)
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/borrowck/gather_loans/lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl GuaranteeLifetimeContext {
mc::cat_arg(*) | // L-Local
mc::cat_self(*) | // L-Local
mc::cat_deref(_, _, mc::region_ptr(*)) | // L-Deref-Borrowed
mc::cat_deref(_, _, mc::unsafe_ptr) => {
mc::cat_deref(_, _, mc::unsafe_ptr(*)) => {
let scope = self.scope(cmt);
self.check_scope(scope)
}
Expand Down Expand Up @@ -108,7 +108,7 @@ impl GuaranteeLifetimeContext {
}

mc::cat_downcast(base) |
mc::cat_deref(base, _, mc::uniq_ptr(*)) | // L-Deref-Send
mc::cat_deref(base, _, mc::uniq_ptr) | // L-Deref-Send
mc::cat_interior(base, _) => { // L-Field
self.check(base, discr_scope)
}
Expand Down Expand Up @@ -347,7 +347,7 @@ impl GuaranteeLifetimeContext {
r
}
mc::cat_downcast(cmt) |
mc::cat_deref(cmt, _, mc::uniq_ptr(*)) |
mc::cat_deref(cmt, _, mc::uniq_ptr) |
mc::cat_deref(cmt, _, mc::gc_ptr(*)) |
mc::cat_interior(cmt, _) |
mc::cat_stack_upvar(cmt) |
Expand Down
10 changes: 9 additions & 1 deletion src/librustc/middle/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,21 @@ impl GatherLoanCtxt {
r)
}
ty::AutoBorrowFn(r) => {
let cmt_deref = mcx.cat_deref_fn(expr, cmt, 0);
let cmt_deref = mcx.cat_deref_fn_or_obj(expr, cmt, 0);
self.guarantee_valid(expr.id,
expr.span,
cmt_deref,
m_imm,
r)
}
ty::AutoBorrowObj(r, m) => {
let cmt_deref = mcx.cat_deref_fn_or_obj(expr, cmt, 0);
self.guarantee_valid(expr.id,
expr.span,
cmt_deref,
m,
r)
}
ty::AutoUnsafe(_) => {}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/gather_loans/restrictions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl RestrictionsContext {
self.extend(result, cmt.mutbl, LpInterior(i), restrictions)
}

mc::cat_deref(cmt_base, _, mc::uniq_ptr(*)) => {
mc::cat_deref(cmt_base, _, mc::uniq_ptr) => {
// R-Deref-Send-Pointer
//
// When we borrow the interior of an owned pointer, we
Expand Down Expand Up @@ -194,7 +194,7 @@ impl RestrictionsContext {
}
}

mc::cat_deref(_, _, mc::unsafe_ptr) => {
mc::cat_deref(_, _, mc::unsafe_ptr(*)) => {
// We are very trusting when working with unsafe pointers.
Safe
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ enum AnyVisitor {
// recursive call can use the original visitor's method, although the
// recursing visitor supplied to the method is the item stopping visitor.
OldVisitor(oldvisit::vt<@mut Context>, oldvisit::vt<@mut Context>),
NewVisitor(@visit::Visitor<()>),
NewVisitor(@mut visit::Visitor<()>),
}

struct Context {
Expand Down Expand Up @@ -465,7 +465,7 @@ impl Context {
self.visitors.push(OldVisitor(v, item_stopping_visitor(v)));
}

fn add_lint(&mut self, v: @visit::Visitor<()>) {
fn add_lint(&mut self, v: @mut visit::Visitor<()>) {
self.visitors.push(NewVisitor(v));
}

Expand Down Expand Up @@ -989,7 +989,7 @@ fn lint_unused_mut() -> oldvisit::vt<@mut Context> {
})
}

fn lint_session(cx: @mut Context) -> @visit::Visitor<()> {
fn lint_session(cx: @mut Context) -> @mut visit::Visitor<()> {
ast_util::id_visitor(|id| {
match cx.tcx.sess.lints.pop(&id) {
None => {},
Expand Down
Loading

0 comments on commit b285f1e

Please sign in to comment.