File tree 3 files changed +4
-20
lines changed
3 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -1822,22 +1822,7 @@ impl<'a> Resolver<'a> {
1822
1822
1823
1823
// If it's a typedef, give a note
1824
1824
if let Def :: TyAlias ( ..) = path_res. base_def {
1825
- let trait_name = trait_path. segments . last ( ) . unwrap ( ) . identifier . name ;
1826
- err. span_label ( trait_path. span , & format ! ( "`{}` is not a trait" , trait_name) ) ;
1827
-
1828
- let definition_site = {
1829
- let segments = & trait_path. segments ;
1830
- if trait_path. global {
1831
- self . resolve_crate_relative_path ( trait_path. span , segments, TypeNS )
1832
- } else {
1833
- self . resolve_module_relative_path ( trait_path. span , segments, TypeNS )
1834
- } . map ( |binding| binding. span ) . unwrap_or ( syntax_pos:: DUMMY_SP )
1835
- } ;
1836
-
1837
- if definition_site != syntax_pos:: DUMMY_SP {
1838
- err. span_label ( definition_site,
1839
- & format ! ( "type aliases cannot be used for traits" ) ) ;
1840
- }
1825
+ err. note ( & format ! ( "type aliases cannot be used for traits" ) ) ;
1841
1826
}
1842
1827
err. emit ( ) ;
1843
1828
Err ( true )
Original file line number Diff line number Diff line change 11
11
// aux-build:issue_3907.rs
12
12
extern crate issue_3907;
13
13
14
- type Foo = issue_3907:: Foo ; //~ NOTE: type aliases cannot be used for traits
14
+ type Foo = issue_3907:: Foo ;
15
15
16
16
struct S {
17
17
name : isize
18
18
}
19
19
20
20
impl Foo for S { //~ ERROR: `Foo` is not a trait
21
- //~| `Foo` is not a trait
21
+ //~| NOTE: type aliases cannot be used for traits
22
22
fn bar ( ) { }
23
23
}
24
24
Original file line number Diff line number Diff line change 10
10
11
11
trait I { }
12
12
type K = I ;
13
- //~^ NOTE: aliases cannot be used for traits
14
13
impl K for isize { } //~ ERROR: `K` is not a trait
15
- //~| is not a trait
14
+ //~| NOTE: aliases cannot be used for traits
16
15
17
16
use ImportError ; //~ ERROR unresolved
18
17
impl ImportError for ( ) { } // check that this is not an additional error (c.f. #35142)
You can’t perform that action at this time.
0 commit comments