File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -5061,9 +5061,13 @@ pub impl Resolver {
5061
5061
Some ( def) => {
5062
5062
match def {
5063
5063
def_ty( trait_def_id) => {
5064
- self .
5064
+ let added = self .
5065
5065
add_trait_info_if_containing_method(
5066
5066
found_traits, trait_def_id, name) ;
5067
+ if added {
5068
+ import_resolution. state. used =
5069
+ true;
5070
+ }
5067
5071
}
5068
5072
_ => {
5069
5073
// Continue.
@@ -5096,7 +5100,7 @@ pub impl Resolver {
5096
5100
5097
5101
fn add_trait_info_if_containing_method( found_traits: @DVec <def_id>,
5098
5102
trait_def_id: def_id,
5099
- name: ident) {
5103
+ name: ident) -> bool {
5100
5104
5101
5105
debug!( "( adding trait info if containing method) trying trait %d: %d \
5102
5106
for method ' %s' ",
@@ -5112,9 +5116,10 @@ pub impl Resolver {
5112
5116
trait_def_id. node,
5113
5117
self . session. str_of( name) ) ;
5114
5118
( * found_traits) . push( trait_def_id) ;
5119
+ true
5115
5120
}
5116
5121
Some ( _) | None => {
5117
- // Continue.
5122
+ false
5118
5123
}
5119
5124
}
5120
5125
}
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ use core::util::*; // shouldn't get errors for not using
20
20
// Should only get one error instead of two errors here
21
21
use core:: option:: { Some , None } ; //~ ERROR unused import
22
22
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
+
23
28
mod foo {
24
29
pub struct Point { x : int , y : int }
25
30
pub struct Square { p : Point , h : uint , w : uint }
@@ -37,4 +42,5 @@ fn main() {
37
42
cal ( foo:: Point { x : 3 , y : 9 } ) ;
38
43
let a = 3 ;
39
44
ignore ( a) ;
45
+ io:: stdout ( ) . write_str ( ~"a") ;
40
46
}
You can’t perform that action at this time.
0 commit comments