about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-01-18 20:30:00 -0800
committerGitHub <noreply@github.com>2017-01-18 20:30:00 -0800
commitad78c04a9a0abd5b2332b5046060f16edef2b05b (patch)
tree8fbdaa2905266f76a7cf0974077047ee5845e17b
parentfd490b80ba2655af60dcb6f7318c04e6299ab95a (diff)
parent27ceb8c685c4bfcfbfde84e0cc0a99fd6851e0f2 (diff)
downloadrust-ad78c04a9a0abd5b2332b5046060f16edef2b05b.tar.gz
rust-ad78c04a9a0abd5b2332b5046060f16edef2b05b.zip
Merge pull request #39170 from brson/beta-next
Beta next
-rw-r--r--mk/main.mk2
-rw-r--r--src/librustc_typeck/check/method/probe.rs11
-rw-r--r--src/libsyntax/json.rs2
-rw-r--r--src/test/compile-fail/issue-38919.rs15
4 files changed, 26 insertions, 4 deletions
diff --git a/mk/main.mk b/mk/main.mk
index 3ac693ed204..fe333dae08a 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.15.0
 # An optional number to put after the label, e.g. '.2' -> '-beta.2'
 # NB Make sure it starts with a dot to conform to semver pre-release
 # versions (section 9)
-CFG_PRERELEASE_VERSION=.3
+CFG_PRERELEASE_VERSION=.4
 
 ifeq ($(CFG_RELEASE_CHANNEL),stable)
 # This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 5cb0804b1bc..0f28be90abf 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -1140,10 +1140,17 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
     ///////////////////////////////////////////////////////////////////////////
     // MISCELLANY
     fn has_applicable_self(&self, item: &ty::AssociatedItem) -> bool {
-        // "fast track" -- check for usage of sugar
+        // "Fast track" -- check for usage of sugar when in method call
+        // mode.
+        //
+        // In Path mode (i.e., resolving a value like `T::next`), consider any
+        // associated value (i.e., methods, constants) but not types.
         match self.mode {
             Mode::MethodCall => item.method_has_self_argument,
-            Mode::Path => true
+            Mode::Path => match item.kind {
+                ty::AssociatedKind::Type => false,
+                ty::AssociatedKind::Method | ty::AssociatedKind::Const => true
+            },
         }
         // FIXME -- check for types that deref to `Self`,
         // like `Rc<Self>` and so on.
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs
index a1c273baeea..adab76309fe 100644
--- a/src/libsyntax/json.rs
+++ b/src/libsyntax/json.rs
@@ -296,7 +296,7 @@ impl DiagnosticSpanLine {
                          h_end: usize)
                          -> DiagnosticSpanLine {
         DiagnosticSpanLine {
-            text: fm.get_line(index).unwrap().to_owned(),
+            text: fm.get_line(index).unwrap_or("").to_owned(),
             highlight_start: h_start,
             highlight_end: h_end,
         }
diff --git a/src/test/compile-fail/issue-38919.rs b/src/test/compile-fail/issue-38919.rs
new file mode 100644
index 00000000000..e6cee4afd59
--- /dev/null
+++ b/src/test/compile-fail/issue-38919.rs
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T: Iterator>() {
+    T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope
+}
+
+fn main() { }