Skip to content

Commit fa5a5a2

Browse files
committed
---
yaml --- r: 65085 b: refs/heads/master c: e02716e h: refs/heads/master i: 65083: e2c9bc3 v: v3
1 parent 858a79b commit fa5a5a2

File tree

5 files changed

+27
-47
lines changed

5 files changed

+27
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 58777272857526eb301bfedd909e6826e5edf716
2+
refs/heads/master: e02716e6d3a65bde24f49207274a74a22790a201
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/libcore/io.rs

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,16 @@ pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader {
10101010
// top-level functions that take a reader, or a set of default methods on
10111011
// reader (which can then be called reader)
10121012

1013+
/**
1014+
* Gives a `Reader` that allows you to read values from standard input.
1015+
*
1016+
* # Examples
1017+
* ~~~
1018+
* let stdin = core::io::stdin();
1019+
* let line = stdin.read_line();
1020+
* core::io::print(line);
1021+
* ~~~
1022+
*/
10131023
pub fn stdin() -> @Reader {
10141024
unsafe {
10151025
@rustrt::rust_get_stdin() as @Reader
@@ -1561,57 +1571,13 @@ pub fn buffered_file_writer(path: &Path) -> Result<@Writer, ~str> {
15611571
// FIXME (#2004) it would be great if this could be a const
15621572
// FIXME (#2004) why are these different from the way stdin() is
15631573
// implemented?
1564-
1565-
1566-
/**
1567-
* Gives a `Writer` which allows you to write to the standard output.
1568-
*
1569-
* # Examples
1570-
* ~~~
1571-
* let stdout = core::io::stdout();
1572-
* stdout.write_str("hello\n");
1573-
* ~~~
1574-
*/
15751574
pub fn stdout() -> @Writer { fd_writer(libc::STDOUT_FILENO as c_int, false) }
1576-
1577-
/**
1578-
* Gives a `Writer` which allows you to write to standard error.
1579-
*
1580-
* # Examples
1581-
* ~~~
1582-
* let stderr = core::io::stderr();
1583-
* stderr.write_str("hello\n");
1584-
* ~~~
1585-
*/
15861575
pub fn stderr() -> @Writer { fd_writer(libc::STDERR_FILENO as c_int, false) }
15871576
1588-
/**
1589-
* Prints a string to standard output.
1590-
*
1591-
* This string will not have an implicit newline at the end. If you want
1592-
* an implicit newline, please see `println`.
1593-
*
1594-
* # Examples
1595-
* ~~~
1596-
* // print is imported into the prelude, and so is always available.
1597-
* print("hello");
1598-
* ~~~
1599-
*/
16001577
pub fn print(s: &str) {
16011578
stdout().write_str(s);
16021579
}
16031580
1604-
/**
1605-
* Prints a string to standard output, followed by a newline.
1606-
*
1607-
* If you do not want an implicit newline, please see `print`.
1608-
*
1609-
* # Examples
1610-
* ~~~
1611-
* // println is imported into the prelude, and so is always available.
1612-
* println("hello");
1613-
* ~~~
1614-
*/
16151581
pub fn println(s: &str) {
16161582
stdout().write_line(s);
16171583
}

trunk/src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,10 @@ fn encode_reexported_static_methods(ecx: @EncodeContext,
386386
match ecx.tcx.trait_methods_cache.find(&exp.def_id) {
387387
Some(methods) => {
388388
match ecx.tcx.items.find(&exp.def_id.node) {
389-
Some(&ast_map::node_item(_, path)) => {
390-
if mod_path != *path {
389+
Some(&ast_map::node_item(item, path)) => {
390+
let interner = ecx.tcx.sess.parse_sess.interner;
391+
let original_name = ecx.tcx.sess.str_of(item.ident);
392+
if mod_path != *path || *exp.name != *original_name {
391393
for methods.each |&m| {
392394
if m.explicit_self == ast::sty_static {
393395
encode_reexported_static_method(ecx,

trunk/src/test/auxiliary/mod_trait_with_static_methods_lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
// except according to those terms.
1010

1111
pub use sub_foo::Foo;
12+
pub use Baz = self::Bar;
13+
14+
pub trait Bar {
15+
pub fn bar() -> Self;
16+
}
17+
18+
impl Bar for int {
19+
pub fn bar() -> int { 84 }
20+
}
1221

1322
pub mod sub_foo {
1423
pub trait Foo {
@@ -18,4 +27,5 @@ pub mod sub_foo {
1827
impl Foo for int {
1928
pub fn foo() -> int { 42 }
2029
}
30+
2131
}

trunk/src/test/run-pass/trait_with_static_methods_cross_crate.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
extern mod mod_trait_with_static_methods_lib;
1414

1515
use mod_trait_with_static_methods_lib::Foo;
16+
use mod_trait_with_static_methods_lib::Baz;
1617

1718
pub fn main() {
1819
assert_eq!(42, Foo::foo());
20+
assert_eq!(84, Baz::bar());
1921
}

0 commit comments

Comments
 (0)