about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-07-31 21:29:01 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-07-31 21:29:01 +0000
commitd6b10beb884bf3a2379ba694bc44b933ad5164c6 (patch)
tree452bb49a390c3e85671104b1c23ef317553bf983 /src
parent93fd214d61749ecae05a9ff240d51fcf77ca086c (diff)
downloadrust-d6b10beb884bf3a2379ba694bc44b933ad5164c6.tar.gz
rust-d6b10beb884bf3a2379ba694bc44b933ad5164c6.zip
Make "type aliases cannot be used for traits" a note instead of a span_label.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_resolve/lib.rs17
-rw-r--r--src/test/compile-fail/issue-3907.rs4
-rw-r--r--src/test/compile-fail/issue-5035.rs3
3 files changed, 4 insertions, 20 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 33e5282188c..c1511b29c9e 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -1822,22 +1822,7 @@ impl<'a> Resolver<'a> {
 
             // If it's a typedef, give a note
             if let Def::TyAlias(..) = path_res.base_def {
-                let trait_name = trait_path.segments.last().unwrap().identifier.name;
-                err.span_label(trait_path.span, &format!("`{}` is not a trait", trait_name));
-
-                let definition_site = {
-                    let segments = &trait_path.segments;
-                    if trait_path.global {
-                        self.resolve_crate_relative_path(trait_path.span, segments, TypeNS)
-                    } else {
-                        self.resolve_module_relative_path(trait_path.span, segments, TypeNS)
-                    }.map(|binding| binding.span).unwrap_or(syntax_pos::DUMMY_SP)
-                };
-
-                if definition_site != syntax_pos::DUMMY_SP {
-                    err.span_label(definition_site,
-                                   &format!("type aliases cannot be used for traits"));
-                }
+                err.note(&format!("type aliases cannot be used for traits"));
             }
             err.emit();
             Err(true)
diff --git a/src/test/compile-fail/issue-3907.rs b/src/test/compile-fail/issue-3907.rs
index c99ff1813e0..cbc09a028c2 100644
--- a/src/test/compile-fail/issue-3907.rs
+++ b/src/test/compile-fail/issue-3907.rs
@@ -11,14 +11,14 @@
 // aux-build:issue_3907.rs
 extern crate issue_3907;
 
-type Foo = issue_3907::Foo; //~ NOTE: type aliases cannot be used for traits
+type Foo = issue_3907::Foo;
 
 struct S {
     name: isize
 }
 
 impl Foo for S { //~ ERROR: `Foo` is not a trait
-    //~| `Foo` is not a trait
+                 //~| NOTE: type aliases cannot be used for traits
     fn bar() { }
 }
 
diff --git a/src/test/compile-fail/issue-5035.rs b/src/test/compile-fail/issue-5035.rs
index 61080ef6096..9648d64d1fb 100644
--- a/src/test/compile-fail/issue-5035.rs
+++ b/src/test/compile-fail/issue-5035.rs
@@ -10,9 +10,8 @@
 
 trait I {}
 type K = I;
-//~^ NOTE: aliases cannot be used for traits
 impl K for isize {} //~ ERROR: `K` is not a trait
-//~| is not a trait
+                    //~| NOTE: aliases cannot be used for traits
 
 use ImportError; //~ ERROR unresolved
 impl ImportError for () {} // check that this is not an additional error (c.f. #35142)