Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: nikomatsakis/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: issue-5762-objects-dralston-c
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Jun 20, 2013

  1. WIP: Add AutoBorrowTraitObj AutoRefKind, and implement relevant adjus…

    …tments
    
    This implements 1-4 from my IRC conversation with Niko:
    
     (1) add a new adjustment for objects
     (2) modify code-generation (what we call `trans`) to deal with that
     (3) modify the method code to borrow in search_for_autosliced_method()
     (4) modify the method code to handle the @self etc coercions
    
    I also added FIXMEs to things I wasn't sure about. Remove them if the
    behaviour is correct, or fixed in the future.
    Sodel-the-Vociferous committed Jun 20, 2013
    Copy the full SHA
    5847475 View commit details
  2. Copy the full SHA
    af37d1a View commit details
  3. Copy the full SHA
    582a436 View commit details
  4. Copy the full SHA
    b635b1d View commit details
  5. Copy the full SHA
    0bd3fc9 View commit details
  6. Copy the full SHA
    c21214e View commit details
  7. Copy the full SHA
    8b92f05 View commit details

Commits on Aug 7, 2013

  1. Merge remote-tracking branch 'mozilla/master' into issue-5762-objects…

    …-dralston-c
    
    Conflicts:
    	src/librustc/metadata/creader.rs
    	src/librustc/metadata/loader.rs
    	src/librustc/middle/astencode.rs
    	src/librustc/middle/privacy.rs
    	src/librustc/middle/trans/common.rs
    	src/librustc/middle/trans/meth.rs
    	src/librustc/middle/trans/reflect.rs
    	src/librustc/middle/ty.rs
    	src/librustc/middle/typeck/check/method.rs
    	src/libsyntax/ast_map.rs
    	src/libsyntax/attr.rs
    	src/libsyntax/diagnostic.rs
    	src/libsyntax/ext/pipes/mod.rs
    	src/libsyntax/ext/trace_macros.rs
    	src/libsyntax/ext/tt/macro_parser.rs
    	src/libsyntax/ext/tt/macro_rules.rs
    	src/libsyntax/parse/mod.rs
    	src/libsyntax/parse/parser.rs
    	src/libsyntax/print/pprust.rs
    nikomatsakis committed Aug 7, 2013
    Copy the full SHA
    1e32344 View commit details

Commits on Aug 8, 2013

  1. Merge remote-tracking branch 'mozilla/master' into issue-5762-objects…

    …-dralston-c
    
    Conflicts:
    	src/librustc/middle/typeck/check/method.rs
    nikomatsakis committed Aug 8, 2013
    Copy the full SHA
    5edf7be View commit details
  2. Fix new type failures

    nikomatsakis committed Aug 8, 2013
    Copy the full SHA
    917b24b View commit details
  3. Copy the full SHA
    f3c821e View commit details
  4. Copy the full SHA
    523d426 View commit details

Commits on Aug 9, 2013

  1. Copy the full SHA
    d324bd5 View commit details
  2. Correct borrowing of ~objects to account for possibility of no header,

    correct cleanup of self value in method calls
    nikomatsakis committed Aug 9, 2013
    Copy the full SHA
    433342c View commit details

Commits on Aug 10, 2013

  1. Integrate auto-borrow-obj into borrowck, cleanup some residual mess

    around our treatment of mutability
    nikomatsakis committed Aug 10, 2013
    Copy the full SHA
    8ae29bf View commit details
  2. Copy the full SHA
    fbc1ade View commit details
  3. Copy the full SHA
    0d0b1fd View commit details
  4. Copy the full SHA
    5504a64 View commit details
  5. Merge remote-tracking branch 'mozilla/master' into issue-5762-objects…

    …-dralston-c
    
    Conflicts:
    	src/librustc/middle/trans/meth.rs
    nikomatsakis committed Aug 10, 2013
    Copy the full SHA
    2e0b0eb View commit details
  6. Remove outdated fixme

    nikomatsakis committed Aug 10, 2013
    Copy the full SHA
    db2b2d4 View commit details
  7. Copy the full SHA
    f3482ac View commit details

Commits on Aug 11, 2013

  1. Copy the full SHA
    5786e12 View commit details
Showing with 1,217 additions and 560 deletions.
  1. +2 −1 src/librustc/back/abi.rs
  2. +1 −1 src/librustc/driver/driver.rs
  3. +2 −2 src/librustc/driver/session.rs
  4. +3 −3 src/librustc/metadata/creader.rs
  5. +2 −2 src/librustc/metadata/encoder.rs
  6. +2 −2 src/librustc/metadata/loader.rs
  7. +1 −1 src/librustc/metadata/tyencode.rs
  8. +2 −2 src/librustc/middle/astencode.rs
  9. +1 −1 src/librustc/middle/borrowck/check_loans.rs
  10. +1 −1 src/librustc/middle/borrowck/gather_loans/gather_moves.rs
  11. +3 −3 src/librustc/middle/borrowck/gather_loans/lifetime.rs
  12. +9 −1 src/librustc/middle/borrowck/gather_loans/mod.rs
  13. +2 −2 src/librustc/middle/borrowck/gather_loans/restrictions.rs
  14. +3 −3 src/librustc/middle/lint.rs
  15. +49 −44 src/librustc/middle/mem_categorization.rs
  16. +1 −1 src/librustc/middle/privacy.rs
  17. +1 −6 src/librustc/middle/trans/base.rs
  18. +0 −1 src/librustc/middle/trans/callee.rs
  19. +1 −1 src/librustc/middle/trans/common.rs
  20. +34 −1 src/librustc/middle/trans/context.rs
  21. +98 −3 src/librustc/middle/trans/expr.rs
  22. +0 −2 src/librustc/middle/trans/foreign.rs
  23. +24 −6 src/librustc/middle/trans/glue.rs
  24. +39 −107 src/librustc/middle/trans/meth.rs
  25. +1 −5 src/librustc/middle/trans/reflect.rs
  26. +17 −5 src/librustc/middle/trans/type_.rs
  27. +38 −9 src/librustc/middle/ty.rs
  28. +298 −158 src/librustc/middle/typeck/check/method.rs
  29. +2 −1 src/librustc/middle/typeck/check/mod.rs
  30. +4 −2 src/librustc/middle/typeck/check/regionck.rs
  31. +41 −1 src/librustc/middle/typeck/infer/coercion.rs
  32. +1 −1 src/librustc/middle/typeck/mod.rs
  33. +2 −3 src/librustc/util/ppaux.rs
  34. +103 −0 src/libstd/repr.rs
  35. +6 −1 src/libstd/unstable/intrinsics.rs
  36. +25 −25 src/libsyntax/ast_map.rs
  37. +25 −25 src/libsyntax/ast_util.rs
  38. +1 −1 src/libsyntax/attr.rs
  39. +9 −9 src/libsyntax/diagnostic.rs
  40. +20 −20 src/libsyntax/ext/expand.rs
  41. +1 −1 src/libsyntax/ext/trace_macros.rs
  42. +2 −2 src/libsyntax/ext/tt/macro_parser.rs
  43. +3 −3 src/libsyntax/ext/tt/macro_rules.rs
  44. +2 −2 src/libsyntax/ext/tt/transcribe.rs
  45. +2 −2 src/libsyntax/parse/comments.rs
  46. +11 −10 src/libsyntax/parse/lexer.rs
  47. +4 −4 src/libsyntax/parse/mod.rs
  48. +2 −2 src/libsyntax/parse/parser.rs
  49. +1 −1 src/libsyntax/print/pprust.rs
  50. +48 −48 src/libsyntax/visit.rs
  51. +1 −0 src/rt/rust_type.h
  52. +1 −0 src/rt/rust_util.cpp
  53. +9 −14 src/test/{run-pass/unique-object.rs → compile-fail/borrowck-borrow-mut-object-twice.rs}
  54. +42 −0 src/test/compile-fail/borrowck-object-lifetime.rs
  55. +47 −0 src/test/compile-fail/borrowck-object-mutability.rs
  56. +0 −1 src/test/compile-fail/kindck-owned-trait-contains.rs
  57. +64 −0 src/test/compile-fail/object-pointer-types.rs
  58. +1 −1 src/test/compile-fail/selftype-traittype.rs
  59. +21 −0 src/test/run-fail/borrowck-wg-fail-object.rs
  60. +1 −1 src/test/run-pass/class-cast-to-trait.rs
  61. +39 −0 src/test/run-pass/objects-owned-object-borrowed-method-header.rs
  62. +4 −0 src/test/run-pass/{owned-trait-objects.rs → objects-owned-object-borrowed-method-headerless.rs}
  63. +32 −0 src/test/run-pass/objects-owned-object-owned-method.rs
  64. +2 −2 src/test/run-pass/reflect-visit-data.rs
  65. +3 −3 src/test/run-pass/reflect-visit-type.rs
3 changes: 2 additions & 1 deletion src/librustc/back/abi.rs
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
@@ -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,
4 changes: 2 additions & 2 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
@@ -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,
@@ -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 {
6 changes: 3 additions & 3 deletions src/librustc/metadata/creader.rs
Original file line number Diff line number Diff line change
@@ -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,
@@ -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::*;

@@ -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,
4 changes: 2 additions & 2 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
@@ -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>,
@@ -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,
4 changes: 2 additions & 2 deletions src/librustc/metadata/loader.rs
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ pub enum os {
}

pub struct Context {
diag: @span_handler,
diag: @mut span_handler,
filesearch: @FileSearch,
span: span,
ident: @str,
@@ -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() {
2 changes: 1 addition & 1 deletion src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/check_loans.rs
Original file line number Diff line number Diff line change
@@ -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;
}
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
@@ -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)
}
6 changes: 3 additions & 3 deletions src/librustc/middle/borrowck/gather_loans/lifetime.rs
Original file line number Diff line number Diff line change
@@ -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)
}
@@ -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)
}
@@ -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) |
10 changes: 9 additions & 1 deletion src/librustc/middle/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
@@ -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(_) => {}
}
}
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/gather_loans/restrictions.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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
}
6 changes: 3 additions & 3 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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));
}

@@ -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 => {},
Loading