Skip to content

Commit

Permalink
encode trait lifetime params in metadata to allow cross-crate usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Dec 8, 2013
1 parent a6310f6 commit d99efe8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustc/metadata/encoder.rs
Expand Up @@ -1140,6 +1140,8 @@ fn encode_info_for_item(ecx: &EncodeContext,
encode_ty_type_param_defs(ebml_w, ecx,
trait_def.generics.type_param_defs,
tag_items_data_item_ty_param_bounds);
encode_region_param_defs(ebml_w, ecx,
trait_def.generics.region_param_defs);
encode_trait_ref(ebml_w, ecx, trait_def.trait_ref, tag_item_trait_ref);
encode_name(ecx, ebml_w, item.ident);
encode_attributes(ebml_w, item.attrs);
Expand Down
13 changes: 13 additions & 0 deletions src/test/auxiliary/xcrate-trait-lifetime-param.rs
@@ -0,0 +1,13 @@
// 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.

pub trait FromBuf<'a> {
fn from_buf(&'a [u8]) -> Self;
}
26 changes: 26 additions & 0 deletions src/test/run-pass/xcrate-trait-lifetime-param.rs
@@ -0,0 +1,26 @@
// 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.

// xfail-fast
// aux-build:xcrate-trait-lifetime-param.rs

extern mod other(name = "xcrate-trait-lifetime-param");

struct Reader<'a> {
b : &'a [u8]
}

impl <'a> other::FromBuf<'a> for Reader<'a> {
fn from_buf(b : &'a [u8]) -> Reader<'a> {
Reader { b : b }
}
}

pub fn main () {}

5 comments on commit d99efe8

@bors
Copy link
Contributor

@bors bors commented on d99efe8 Dec 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at dwrensha@d99efe8

@bors
Copy link
Contributor

@bors bors commented on d99efe8 Dec 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging dwrensha/rust/xcrate-lifetime-param = d99efe8 into auto

@bors
Copy link
Contributor

@bors bors commented on d99efe8 Dec 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dwrensha/rust/xcrate-lifetime-param = d99efe8 merged ok, testing candidate = 898d2c3

@bors
Copy link
Contributor

@bors bors commented on d99efe8 Dec 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d99efe8 Dec 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 898d2c3

Please sign in to comment.