Skip to content

Commit 87c6778

Browse files
committed
---
yaml --- r: 42978 b: refs/heads/try c: b368cb2 h: refs/heads/master v: v3
1 parent 6e823aa commit 87c6778

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 6a4483ec7a92bedab69b363aeeb6931b1bb5951f
5+
refs/heads/try: b368cb234126d1ada88ad5214102c68898eeffc7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/librustc/middle/resolve.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5061,9 +5061,13 @@ pub impl Resolver {
50615061
Some(def) => {
50625062
match def {
50635063
def_ty(trait_def_id) => {
5064-
self.
5064+
let added = self.
50655065
add_trait_info_if_containing_method(
50665066
found_traits, trait_def_id, name);
5067+
if added {
5068+
import_resolution.state.used =
5069+
true;
5070+
}
50675071
}
50685072
_ => {
50695073
// Continue.
@@ -5096,7 +5100,7 @@ pub impl Resolver {
50965100

50975101
fn add_trait_info_if_containing_method(found_traits: @DVec<def_id>,
50985102
trait_def_id: def_id,
5099-
name: ident) {
5103+
name: ident) -> bool {
51005104

51015105
debug!("(adding trait info if containing method) trying trait %d:%d \
51025106
for method '%s'",
@@ -5112,9 +5116,10 @@ pub impl Resolver {
51125116
trait_def_id.node,
51135117
self.session.str_of(name));
51145118
(*found_traits).push(trait_def_id);
5119+
true
51155120
}
51165121
Some(_) | None => {
5117-
// Continue.
5122+
false
51185123
}
51195124
}
51205125
}

branches/try/src/test/compile-fail/unused-imports-warn.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ use core::util::*; // shouldn't get errors for not using
2020
// Should only get one error instead of two errors here
2121
use core::option::{Some, None}; //~ ERROR unused import
2222

23+
use core::io::ReaderUtil; //~ ERROR unused import
24+
// Be sure that if we just bring some methods into scope that they're also
25+
// counted as being used.
26+
use core::io::WriterUtil;
27+
2328
mod foo {
2429
pub struct Point{x: int, y: int}
2530
pub struct Square{p: Point, h: uint, w: uint}
@@ -37,4 +42,5 @@ fn main() {
3742
cal(foo::Point{x:3, y:9});
3843
let a = 3;
3944
ignore(a);
45+
io::stdout().write_str(~"a");
4046
}

0 commit comments

Comments
 (0)