about summary refs log tree commit diff
diff options
context:
space:
mode:
authorF001 <changchun.fan@qq.com>2018-05-23 08:59:08 +0800
committerF001 <changchun.fan@qq.com>2018-05-23 08:59:08 +0800
commit88f810f52e628795875260a31d479af4f28a5edb (patch)
tree1766cf94f5304798e75d0f97bc6d94ee72975bae
parentf837c34a865c46faef122e2c65b5f78c3fb954f8 (diff)
downloadrust-88f810f52e628795875260a31d479af4f28a5edb.tar.gz
rust-88f810f52e628795875260a31d479af4f28a5edb.zip
inverting speculative flag
-rw-r--r--src/librustc_typeck/astconv.rs2
-rw-r--r--src/test/ui/lint/issue-50589-multiple-associated-types.stderr11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 35d5619969d..8fe5b74ccb9 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -568,7 +568,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
         }
         tcx.check_stability(assoc_ty.def_id, Some(ref_id), binding.span);
 
-        if speculative {
+        if !speculative {
             dup_bindings.entry(assoc_ty.def_id)
                 .and_modify(|prev_span| {
                     let mut err = self.tcx().struct_span_lint_node(
diff --git a/src/test/ui/lint/issue-50589-multiple-associated-types.stderr b/src/test/ui/lint/issue-50589-multiple-associated-types.stderr
index e115e523d87..7f0a1ee1f33 100644
--- a/src/test/ui/lint/issue-50589-multiple-associated-types.stderr
+++ b/src/test/ui/lint/issue-50589-multiple-associated-types.stderr
@@ -10,3 +10,14 @@ LL | fn test() ->  Box<Iterator<Item = (), Item = Unit>> {
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #50589 <https://github.com/rust-lang/rust/issues/50589>
 
+warning: associated type binding `Item` specified more than once
+  --> $DIR/issue-50589-multiple-associated-types.rs:17:39
+   |
+LL | fn test() ->  Box<Iterator<Item = (), Item = Unit>> {
+   |                            ---------  ^^^^^^^^^^^ used more than once
+   |                            |
+   |                            first use of `Item`
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #50589 <https://github.com/rust-lang/rust/issues/50589>
+