]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #42480 - eddyb:issue-42463, r=nikomatsakis
authorbors <bors@rust-lang.org>
Wed, 7 Jun 2017 07:52:12 +0000 (07:52 +0000)
committerbors <bors@rust-lang.org>
Wed, 7 Jun 2017 07:52:12 +0000 (07:52 +0000)
rustc_typeck: do not overlap a borrow of TypeckTables with method lookup.

If trait selection is reached, it could potentially request a closure signature, which will have to borrow the `TypeckTables` of the current function, and so those tables *should not* be mutably borrowed.

Fixes #42463.
r? @nikomatsakis

50 files changed:
src/bootstrap/check.rs
src/bootstrap/compile.rs
src/libcollections/borrow.rs
src/libcore/macros.rs
src/libcore/marker.rs
src/librustc/diagnostics.rs
src/librustc/hir/def.rs
src/librustc/hir/def_id.rs
src/librustc/hir/lowering.rs
src/librustc/infer/region_inference/graphviz.rs
src/librustc/infer/region_inference/mod.rs
src/librustc/lint/context.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc_llvm/build.rs
src/librustc_typeck/check/method/suggest.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/render.rs
src/libstd/process.rs
src/libstd/sys/redox/process.rs
src/libstd/sys/unix/process/magenta.rs
src/libstd/sys/unix/process/process_common.rs
src/libstd/sys/windows/process.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax_pos/symbol.rs
src/test/compile-fail/E0602.rs [new file with mode: 0644]
src/test/compile-fail/auxiliary/no_method_suggested_traits.rs [deleted file]
src/test/compile-fail/issue-21659-show-relevant-trait-impls-3.rs [deleted file]
src/test/compile-fail/issue-26638.rs
src/test/compile-fail/issue-30255.rs
src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
src/test/compile-fail/method-call-err-msg.rs
src/test/compile-fail/method-suggestion-no-duplication.rs [deleted file]
src/test/compile-fail/no-method-suggested-traits.rs [deleted file]
src/test/parse-fail/underscore-suffix-for-string.rs [new file with mode: 0644]
src/test/run-make/windows-spawn/Makefile [new file with mode: 0644]
src/test/run-make/windows-spawn/hello.rs [new file with mode: 0644]
src/test/run-make/windows-spawn/spawn.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/stdio-from.rs [new file with mode: 0644]
src/test/run-pass/issue-30490.rs
src/test/run-pass/weird-exprs.rs
src/test/rustdoc/issue-35169-2.rs
src/test/rustdoc/issue-35169.rs
src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs [new file with mode: 0644]
src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs [new file with mode: 0644]
src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr [new file with mode: 0644]
src/test/ui/impl-trait/method-suggestion-no-duplication.rs [new file with mode: 0644]
src/test/ui/impl-trait/method-suggestion-no-duplication.stderr [new file with mode: 0644]
src/test/ui/impl-trait/no-method-suggested-traits.rs [new file with mode: 0644]
src/test/ui/impl-trait/no-method-suggested-traits.stderr [new file with mode: 0644]
src/test/ui/span/issue-7575.stderr

index 5483b6a914b29a3bdd9fde93c02f99e57a03e437..385376333c1d7ce106677a6f1451d43025aecd68 100644 (file)
 use std::collections::HashSet;
 use std::env;
 use std::fmt;
-use std::fs;
+use std::fs::{self, File};
 use std::path::{PathBuf, Path};
 use std::process::Command;
+use std::io::Read;
 
 use build_helper::output;
 
@@ -328,25 +329,15 @@ pub fn docs(build: &Build, compiler: &Compiler) {
 
     while let Some(p) = stack.pop() {
         if p.is_dir() {
-            stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
+            stack.extend(t!(p.read_dir()).map(|p| t!(p).path()).filter(|p| {
+                p.extension().and_then(|s| s.to_str()) == Some("md") &&
+                // The nostarch directory in the book is for no starch, and so isn't guaranteed to
+                // build. We don't care if it doesn't build, so skip it.
+                p.to_str().map_or(true, |p| !p.contains("nostarch"))
+            }));
             continue
         }
 
-        if p.extension().and_then(|s| s.to_str()) != Some("md") {
-            continue
-        }
-
-        // The nostarch directory in the book is for no starch, and so isn't guaranteed to build.
-        // we don't care if it doesn't build, so skip it.
-        use std::ffi::OsStr;
-        let path: &OsStr = p.as_ref();
-        if let Some(path) = path.to_str() {
-            if path.contains("nostarch") {
-                continue;
-            }
-        }
-
-        println!("doc tests for: {}", p.display());
         markdown_test(build, compiler, &p);
     }
 }
@@ -376,6 +367,14 @@ pub fn error_index(build: &Build, compiler: &Compiler) {
 }
 
 fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
+    let mut file = t!(File::open(markdown));
+    let mut contents = String::new();
+    t!(file.read_to_string(&mut contents));
+    if !contents.contains("```") {
+        return;
+    }
+
+    println!("doc tests for: {}", markdown.display());
     let mut cmd = Command::new(build.rustdoc(compiler));
     build.add_rustc_lib_path(compiler, &mut cmd);
     build.add_rust_test_threads(&mut cmd);
index 9946c93913fe7292fd502c6d2e726831a6af3e5c..9a07e8a8b1091da983213917f9ab46fd7be21630 100644 (file)
@@ -276,6 +276,10 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
     if build.is_rust_llvm(target) {
         cargo.env("LLVM_RUSTLLVM", "1");
     }
+    if let Some(ref cfg_file) = build.flags.config {
+        let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
+        cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
+    }
     cargo.env("LLVM_CONFIG", build.llvm_config(target));
     let target_config = build.config.target_config.get(target);
     if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
index 0de52b6696fcf02febb16085c5eb2860edbb52c1..a662e4b1f4f931de28292c8ed094f559e4d0b031 100644 (file)
@@ -191,13 +191,16 @@ impl<'a, B: ?Sized> Cow<'a, B>
     /// # Examples
     ///
     /// ```
+    /// use std::ascii::AsciiExt;
     /// use std::borrow::Cow;
     ///
-    /// let mut cow: Cow<[_]> = Cow::Owned(vec![1, 2, 3]);
+    /// let mut cow = Cow::Borrowed("foo");
+    /// cow.to_mut().make_ascii_uppercase();
     ///
-    /// let hello = cow.to_mut();
-    ///
-    /// assert_eq!(hello, &[1, 2, 3]);
+    /// assert_eq!(
+    ///   cow,
+    ///   Cow::Owned(String::from("FOO")) as Cow<str>
+    /// );
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned {
@@ -219,14 +222,33 @@ pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned {
     ///
     /// # Examples
     ///
+    /// Calling `into_owned` on a `Cow::Borrowed` clones the underlying data
+    /// and becomes a `Cow::Owned`:
+    ///
     /// ```
     /// use std::borrow::Cow;
     ///
-    /// let cow: Cow<[_]> = Cow::Owned(vec![1, 2, 3]);
+    /// let s = "Hello world!";
+    /// let cow = Cow::Borrowed(s);
+    ///
+    /// assert_eq!(
+    ///   cow.into_owned(),
+    ///   Cow::Owned(String::from(s))
+    /// );
+    /// ```
+    ///
+    /// Calling `into_owned` on a `Cow::Owned` is a no-op:
+    ///
+    /// ```
+    /// use std::borrow::Cow;
     ///
-    /// let hello = cow.into_owned();
+    /// let s = "Hello world!";
+    /// let cow: Cow<str> = Cow::Owned(String::from(s));
     ///
-    /// assert_eq!(vec![1, 2, 3], hello);
+    /// assert_eq!(
+    ///   cow.into_owned(),
+    ///   Cow::Owned(String::from(s))
+    /// );
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_owned(self) -> <B as ToOwned>::Owned {
index bf4e414d416849318ef9f73949fdafe626104768..99000a031feab4aca7fc82363af4b99865d1f39b 100644 (file)
@@ -35,6 +35,8 @@ macro_rules! panic {
 /// This will invoke the [`panic!`] macro if the provided expression cannot be
 /// evaluated to `true` at runtime.
 ///
+/// # Uses
+///
 /// Assertions are always checked in both debug and release builds, and cannot
 /// be disabled. See [`debug_assert!`] for assertions that are not enabled in
 /// release builds by default.
@@ -45,7 +47,9 @@ macro_rules! panic {
 /// Other use-cases of `assert!` include [testing] and enforcing run-time
 /// invariants in safe code (whose violation cannot result in unsafety).
 ///
-/// This macro has a second version, where a custom panic message can
+/// # Custom Messages
+///
+/// This macro has a second form, where a custom panic message can
 /// be provided with or without arguments for formatting.
 ///
 /// [`panic!`]: macro.panic.html
@@ -85,14 +89,15 @@ macro_rules! assert {
     );
 }
 
-/// Asserts that two expressions are equal to each other.
+/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
 ///
 /// On panic, this macro will print the values of the expressions with their
 /// debug representations.
 ///
-/// Like [`assert!`], this macro has a second version, where a custom
+/// Like [`assert!`], this macro has a second form, where a custom
 /// panic message can be provided.
 ///
+/// [`PartialEq`]: cmp/trait.PartialEq.html
 /// [`assert!`]: macro.assert.html
 ///
 /// # Examples
@@ -130,14 +135,15 @@ macro_rules! assert_eq {
     });
 }
 
-/// Asserts that two expressions are not equal to each other.
+/// Asserts that two expressions are not equal to each other (using [`PartialEq`]).
 ///
 /// On panic, this macro will print the values of the expressions with their
 /// debug representations.
 ///
-/// Like `assert!()`, this macro has a second version, where a custom
+/// Like [`assert!`], this macro has a second form, where a custom
 /// panic message can be provided.
 ///
+/// [`PartialEq`]: cmp/trait.PartialEq.html
 /// [`assert!`]: macro.assert.html
 ///
 /// # Examples
@@ -183,6 +189,8 @@ macro_rules! assert_ne {
 /// Like [`assert!`], this macro also has a second version, where a custom panic
 /// message can be provided.
 ///
+/// # Uses
+///
 /// Unlike [`assert!`], `debug_assert!` statements are only enabled in non
 /// optimized builds by default. An optimized build will omit all
 /// `debug_assert!` statements unless `-C debug-assertions` is passed to the
index 6602fccd5898282fd59d94450cfa2d07603dd45e..05df84708e05d3aa1629e00c2826dc827c7c7575 100644 (file)
@@ -205,7 +205,7 @@ pub trait Unsize<T: ?Sized> {
 /// but not `Copy`.
 ///
 /// [`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement
-/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation need only return `*self`
+/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`
 /// (see the example above).
 ///
 /// ## When can my type be `Copy`?
index 2beb40d6b2f1ab34598a52849779be57a9ca4f72..800e678405aa9e953187bd504507356e76fe29ad 100644 (file)
@@ -1900,6 +1900,19 @@ fn main() {
 started: https://doc.rust-lang.org/book/
 "##,
 
+E0602: r##"
+An unknown lint was used on the command line.
+
+Erroneous example:
+
+```ignore
+rustc -D bogus omse_file.rs
+```
+
+Maybe you just misspelled the lint name or the lint doesn't exist anymore.
+Either way, try to update/remove it in order to fix the error.
+"##,
+
 }
 
 
index feded417ce17fb7910d62a4e671c7ea0a48575be..c500d770cef0583b2a6e2fe6e9070eb5854845a0 100644 (file)
 
 #[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
 pub enum CtorKind {
-    // Constructor function automatically created by a tuple struct/variant.
+    /// Constructor function automatically created by a tuple struct/variant.
     Fn,
-    // Constructor constant automatically created by a unit struct/variant.
+    /// Constructor constant automatically created by a unit struct/variant.
     Const,
-    // Unusable name in value namespace created by a struct variant.
+    /// Unusable name in value namespace created by a struct variant.
     Fictive,
 }
 
@@ -109,17 +109,21 @@ pub fn kind_name(&self) -> &'static str {
     }
 }
 
-// Definition mapping
+/// Definition mapping
 pub type DefMap = NodeMap<PathResolution>;
-// This is the replacement export map. It maps a module to all of the exports
-// within.
+
+/// This is the replacement export map. It maps a module to all of the exports
+/// within.
 pub type ExportMap = NodeMap<Vec<Export>>;
 
 #[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
 pub struct Export {
-    pub ident: ast::Ident, // The name of the target.
-    pub def: Def, // The definition of the target.
-    pub span: Span, // The span of the target definition.
+    /// The name of the target.
+    pub ident: ast::Ident,
+    /// The definition of the target.
+    pub def: Def,
+    /// The span of the target definition.
+    pub span: Span,
 }
 
 impl CtorKind {
@@ -160,6 +164,7 @@ pub fn def_id(&self) -> DefId {
         }
     }
 
+    /// A human readable kind name
     pub fn kind_name(&self) -> &'static str {
         match *self {
             Def::Fn(..) => "function",
index 47604b961ae4ac04f505fe9b013d504575cfaee6..ce2baa738975b683b5cdc2d4aec1b458cc691f7e 100644 (file)
@@ -187,6 +187,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 
 impl DefId {
+    /// Make a local `DefId` with the given index.
     pub fn local(index: DefIndex) -> DefId {
         DefId { krate: LOCAL_CRATE, index: index }
     }
index 4c436fb640f01797f22a08ea489f9c6fdcc04402..a6ab67e04693d4f9805546a5c9abda0084a795ef 100644 (file)
@@ -8,37 +8,37 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Lowers the AST to the HIR.
-//
-// Since the AST and HIR are fairly similar, this is mostly a simple procedure,
-// much like a fold. Where lowering involves a bit more work things get more
-// interesting and there are some invariants you should know about. These mostly
-// concern spans and ids.
-//
-// Spans are assigned to AST nodes during parsing and then are modified during
-// expansion to indicate the origin of a node and the process it went through
-// being expanded. Ids are assigned to AST nodes just before lowering.
-//
-// For the simpler lowering steps, ids and spans should be preserved. Unlike
-// expansion we do not preserve the process of lowering in the spans, so spans
-// should not be modified here. When creating a new node (as opposed to
-// 'folding' an existing one), then you create a new id using `next_id()`.
-//
-// You must ensure that ids are unique. That means that you should only use the
-// id from an AST node in a single HIR node (you can assume that AST node ids
-// are unique). Every new node must have a unique id. Avoid cloning HIR nodes.
-// If you do, you must then set the new node's id to a fresh one.
-//
-// Spans are used for error messages and for tools to map semantics back to
-// source code. It is therefore not as important with spans as ids to be strict
-// about use (you can't break the compiler by screwing up a span). Obviously, a
-// HIR node can only have a single span. But multiple nodes can have the same
-// span and spans don't need to be kept in order, etc. Where code is preserved
-// by lowering, it should have the same span as in the AST. Where HIR nodes are
-// new it is probably best to give a span for the whole AST node being lowered.
-// All nodes should have real spans, don't use dummy spans. Tools are likely to
-// get confused if the spans from leaf AST nodes occur in multiple places
-// in the HIR, especially for multiple identifiers.
+//! Lowers the AST to the HIR.
+//!
+//! Since the AST and HIR are fairly similar, this is mostly a simple procedure,
+//! much like a fold. Where lowering involves a bit more work things get more
+//! interesting and there are some invariants you should know about. These mostly
+//! concern spans and ids.
+//!
+//! Spans are assigned to AST nodes during parsing and then are modified during
+//! expansion to indicate the origin of a node and the process it went through
+//! being expanded. Ids are assigned to AST nodes just before lowering.
+//!
+//! For the simpler lowering steps, ids and spans should be preserved. Unlike
+//! expansion we do not preserve the process of lowering in the spans, so spans
+//! should not be modified here. When creating a new node (as opposed to
+//! 'folding' an existing one), then you create a new id using `next_id()`.
+//!
+//! You must ensure that ids are unique. That means that you should only use the
+//! id from an AST node in a single HIR node (you can assume that AST node ids
+//! are unique). Every new node must have a unique id. Avoid cloning HIR nodes.
+//! If you do, you must then set the new node's id to a fresh one.
+//!
+//! Spans are used for error messages and for tools to map semantics back to
+//! source code. It is therefore not as important with spans as ids to be strict
+//! about use (you can't break the compiler by screwing up a span). Obviously, a
+//! HIR node can only have a single span. But multiple nodes can have the same
+//! span and spans don't need to be kept in order, etc. Where code is preserved
+//! by lowering, it should have the same span as in the AST. Where HIR nodes are
+//! new it is probably best to give a span for the whole AST node being lowered.
+//! All nodes should have real spans, don't use dummy spans. Tools are likely to
+//! get confused if the spans from leaf AST nodes occur in multiple places
+//! in the HIR, especially for multiple identifiers.
 
 use hir;
 use hir::map::{Definitions, DefKey, REGULAR_SPACE};
 
 pub struct LoweringContext<'a> {
     crate_root: Option<&'static str>,
+
     // Use to assign ids to hir nodes that do not directly correspond to an ast node
     sess: &'a Session,
+
     // As we walk the AST we must keep track of the current 'parent' def id (in
     // the form of a DefIndex) so that if we create a new node which introduces
     // a definition, then we can properly create the def id.
@@ -102,14 +104,14 @@ pub struct LoweringContext<'a> {
 }
 
 pub trait Resolver {
-    // Resolve a hir path generated by the lowerer when expanding `for`, `if let`, etc.
+    /// Resolve a hir path generated by the lowerer when expanding `for`, `if let`, etc.
     fn resolve_hir_path(&mut self, path: &mut hir::Path, is_value: bool);
 
-    // Obtain the resolution for a node id
+    /// Obtain the resolution for a node id
     fn get_resolution(&mut self, id: NodeId) -> Option<PathResolution>;
 
-    // We must keep the set of definitions up to date as we add nodes that weren't in the AST.
-    // This should only return `None` during testing.
+    /// We must keep the set of definitions up to date as we add nodes that weren't in the AST.
+    /// This should only return `None` during testing.
     fn definitions(&mut self) -> &mut Definitions;
 }
 
index cce253c1a1a43b8e77b73e5d5e66bf02e005d25b..81a8984e7530eb011811736a16c97eecff9661cc 100644 (file)
@@ -133,7 +133,6 @@ enum Node {
     Region(ty::RegionKind),
 }
 
-// type Edge = Constraint;
 #[derive(Clone, PartialEq, Eq, Debug, Copy)]
 enum Edge<'tcx> {
     Constraint(Constraint<'tcx>),
index acc1a397b456041a6523ad5360f9b64b16f3a8ef..f62470fab723ec1ad4676cc069b1c81839ca83f6 100644 (file)
 
 mod graphviz;
 
-// A constraint that influences the inference process.
+/// A constraint that influences the inference process.
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
 pub enum Constraint<'tcx> {
-    // One region variable is subregion of another
+    /// One region variable is subregion of another
     ConstrainVarSubVar(RegionVid, RegionVid),
 
-    // Concrete region is subregion of region variable
+    /// Concrete region is subregion of region variable
     ConstrainRegSubVar(Region<'tcx>, RegionVid),
 
-    // Region variable is subregion of concrete region. This does not
-    // directly affect inference, but instead is checked after
-    // inference is complete.
+    /// Region variable is subregion of concrete region. This does not
+    /// directly affect inference, but instead is checked after
+    /// inference is complete.
     ConstrainVarSubReg(RegionVid, Region<'tcx>),
 
-    // A constraint where neither side is a variable. This does not
-    // directly affect inference, but instead is checked after
-    // inference is complete.
+    /// A constraint where neither side is a variable. This does not
+    /// directly affect inference, but instead is checked after
+    /// inference is complete.
     ConstrainRegSubReg(Region<'tcx>, Region<'tcx>),
 }
 
-// VerifyGenericBound(T, _, R, RS): The parameter type `T` (or
-// associated type) must outlive the region `R`. `T` is known to
-// outlive `RS`. Therefore verify that `R <= RS[i]` for some
-// `i`. Inference variables may be involved (but this verification
-// step doesn't influence inference).
+/// VerifyGenericBound(T, _, R, RS): The parameter type `T` (or
+/// associated type) must outlive the region `R`. `T` is known to
+/// outlive `RS`. Therefore verify that `R <= RS[i]` for some
+/// `i`. Inference variables may be involved (but this verification
+/// step doesn't influence inference).
 #[derive(Debug)]
 pub struct Verify<'tcx> {
     kind: GenericKind<'tcx>,
@@ -74,29 +74,29 @@ pub enum GenericKind<'tcx> {
     Projection(ty::ProjectionTy<'tcx>),
 }
 
-// When we introduce a verification step, we wish to test that a
-// particular region (let's call it `'min`) meets some bound.
-// The bound is described the by the following grammar:
+/// When we introduce a verification step, we wish to test that a
+/// particular region (let's call it `'min`) meets some bound.
+/// The bound is described the by the following grammar:
 #[derive(Debug)]
 pub enum VerifyBound<'tcx> {
-    // B = exists {R} --> some 'r in {R} must outlive 'min
-    //
-    // Put another way, the subject value is known to outlive all
-    // regions in {R}, so if any of those outlives 'min, then the
-    // bound is met.
+    /// B = exists {R} --> some 'r in {R} must outlive 'min
+    ///
+    /// Put another way, the subject value is known to outlive all
+    /// regions in {R}, so if any of those outlives 'min, then the
+    /// bound is met.
     AnyRegion(Vec<Region<'tcx>>),
 
-    // B = forall {R} --> all 'r in {R} must outlive 'min
-    //
-    // Put another way, the subject value is known to outlive some
-    // region in {R}, so if all of those outlives 'min, then the bound
-    // is met.
+    /// B = forall {R} --> all 'r in {R} must outlive 'min
+    ///
+    /// Put another way, the subject value is known to outlive some
+    /// region in {R}, so if all of those outlives 'min, then the bound
+    /// is met.
     AllRegions(Vec<Region<'tcx>>),
 
-    // B = exists {B} --> 'min must meet some bound b in {B}
+    /// B = exists {B} --> 'min must meet some bound b in {B}
     AnyBound(Vec<VerifyBound<'tcx>>),
 
-    // B = forall {B} --> 'min must meet all bounds b in {B}
+    /// B = forall {B} --> 'min must meet all bounds b in {B}
     AllBounds(Vec<VerifyBound<'tcx>>),
 }
 
@@ -183,35 +183,35 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'gcx, 'tcx>,
     var_origins: RefCell<Vec<RegionVariableOrigin>>,
 
-    // Constraints of the form `A <= B` introduced by the region
-    // checker.  Here at least one of `A` and `B` must be a region
-    // variable.
+    /// Constraints of the form `A <= B` introduced by the region
+    /// checker.  Here at least one of `A` and `B` must be a region
+    /// variable.
     constraints: RefCell<FxHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>>,
 
-    // A "verify" is something that we need to verify after inference is
-    // done, but which does not directly affect inference in any way.
-    //
-    // An example is a `A <= B` where neither `A` nor `B` are
-    // inference variables.
+    /// A "verify" is something that we need to verify after inference is
+    /// done, but which does not directly affect inference in any way.
+    ///
+    /// An example is a `A <= B` where neither `A` nor `B` are
+    /// inference variables.
     verifys: RefCell<Vec<Verify<'tcx>>>,
 
-    // A "given" is a relationship that is known to hold. In particular,
-    // we often know from closure fn signatures that a particular free
-    // region must be a subregion of a region variable:
-    //
-    //    foo.iter().filter(<'a> |x: &'a &'b T| ...)
-    //
-    // In situations like this, `'b` is in fact a region variable
-    // introduced by the call to `iter()`, and `'a` is a bound region
-    // on the closure (as indicated by the `<'a>` prefix). If we are
-    // naive, we wind up inferring that `'b` must be `'static`,
-    // because we require that it be greater than `'a` and we do not
-    // know what `'a` is precisely.
-    //
-    // This hashmap is used to avoid that naive scenario. Basically we
-    // record the fact that `'a <= 'b` is implied by the fn signature,
-    // and then ignore the constraint when solving equations. This is
-    // a bit of a hack but seems to work.
+    /// A "given" is a relationship that is known to hold. In particular,
+    /// we often know from closure fn signatures that a particular free
+    /// region must be a subregion of a region variable:
+    ///
+    ///    foo.iter().filter(<'a> |x: &'a &'b T| ...)
+    ///
+    /// In situations like this, `'b` is in fact a region variable
+    /// introduced by the call to `iter()`, and `'a` is a bound region
+    /// on the closure (as indicated by the `<'a>` prefix). If we are
+    /// naive, we wind up inferring that `'b` must be `'static`,
+    /// because we require that it be greater than `'a` and we do not
+    /// know what `'a` is precisely.
+    ///
+    /// This hashmap is used to avoid that naive scenario. Basically we
+    /// record the fact that `'a <= 'b` is implied by the fn signature,
+    /// and then ignore the constraint when solving equations. This is
+    /// a bit of a hack but seems to work.
     givens: RefCell<FxHashSet<(Region<'tcx>, ty::RegionVid)>>,
 
     lubs: RefCell<CombineMap<'tcx>>,
@@ -219,20 +219,21 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
     skolemization_count: Cell<u32>,
     bound_count: Cell<u32>,
 
-    // The undo log records actions that might later be undone.
-    //
-    // Note: when the undo_log is empty, we are not actively
-    // snapshotting. When the `start_snapshot()` method is called, we
-    // push an OpenSnapshot entry onto the list to indicate that we
-    // are now actively snapshotting. The reason for this is that
-    // otherwise we end up adding entries for things like the lower
-    // bound on a variable and so forth, which can never be rolled
-    // back.
+    /// The undo log records actions that might later be undone.
+    ///
+    /// Note: when the undo_log is empty, we are not actively
+    /// snapshotting. When the `start_snapshot()` method is called, we
+    /// push an OpenSnapshot entry onto the list to indicate that we
+    /// are now actively snapshotting. The reason for this is that
+    /// otherwise we end up adding entries for things like the lower
+    /// bound on a variable and so forth, which can never be rolled
+    /// back.
     undo_log: RefCell<Vec<UndoLogEntry<'tcx>>>,
+
     unification_table: RefCell<UnificationTable<ty::RegionVid>>,
 
-    // This contains the results of inference.  It begins as an empty
-    // option and only acquires a value after inference is complete.
+    /// This contains the results of inference.  It begins as an empty
+    /// option and only acquires a value after inference is complete.
     values: RefCell<Option<Vec<VarValue<'tcx>>>>,
 }
 
index 4c25a455f292d4a9d62033e833c0957b48c19246..2022565d533bcc8fb3205de6589d89896a3d7638 100644 (file)
@@ -746,8 +746,8 @@ fn with_lint_attrs<F>(&mut self,
                                     continue;
                                 }
                             }
-                        },
-                        Err(FindLintError::Removed) => { continue; }
+                        }
+                        Err(FindLintError::Removed) => continue,
                     }
                 }
             };
@@ -1298,7 +1298,7 @@ fn check_lint_name_cmdline(sess: &Session, lint_cx: &LintStore,
             Some(sess.struct_warn(msg))
         },
         CheckLintNameResult::NoLint => {
-            Some(sess.struct_err(&format!("unknown lint: `{}`", lint_name)))
+            Some(struct_err!(sess, E0602, "unknown lint: `{}`", lint_name))
         }
     };
 
index 1a07423bcbc0f88d44224be61db72b5b53a53d92..ce5d58f5800c788c413d98bd42e087e72ec086c4 100644 (file)
@@ -1363,7 +1363,7 @@ fn report_elision_failure(&mut self,
             m.push_str(&(if n == 1 {
                 help_name
             } else {
-                format!("one of {}'s {} elided {}lifetimes", help_name, n,
+                format!("one of {}'s {} {}lifetimes", help_name, n,
                         if have_bound_regions { "free " } else { "" } )
             })[..]);
 
index ba568857959f881eccb8cc31ea96e62c35850d52..bdfc0a2fe855ccf0df522b661f5012ad2557895e 100644 (file)
@@ -61,6 +61,11 @@ fn main() {
 
     println!("cargo:rerun-if-changed={}", llvm_config.display());
 
+    if let Some(cfg_toml) = env::var_os("CFG_LLVM_TOML") {
+        let cfg_path = PathBuf::from(cfg_toml);
+        println!("cargo:rerun-if-changed={}", cfg_path.display());
+    }
+
     // Test whether we're cross-compiling LLVM. This is a pretty rare case
     // currently where we're producing an LLVM for a different platform than
     // what this build script is currently running on.
index 3ac5994cd1ac36354a07c1620f5a3a1592681f16..f8dd5774793a3f70c8df5d204cf8f1dc42f68794 100644 (file)
@@ -242,7 +242,7 @@ pub fn report_method_error(&self,
                     macro_rules! report_function {
                         ($span:expr, $name:expr) => {
                             err.note(&format!("{} is a function, perhaps you wish to call it",
-                                         $name));
+                                              $name));
                         }
                     }
 
@@ -329,9 +329,9 @@ fn suggest_traits_to_import(&self,
             let mut candidates = valid_out_of_scope_traits;
             candidates.sort();
             candidates.dedup();
-            let msg = format!("items from traits can only be used if the trait is in scope; the \
-                               following {traits_are} implemented but not in scope, perhaps add \
-                               a `use` for {one_of_them}:",
+            err.help("items from traits can only be used if the trait is in scope");
+            let mut msg = format!("the following {traits_are} implemented but not in scope, \
+                                   perhaps add a `use` for {one_of_them}:",
                               traits_are = if candidates.len() == 1 {
                                   "trait is"
                               } else {
@@ -343,17 +343,17 @@ fn suggest_traits_to_import(&self,
                                   "one of them"
                               });
 
-            err.help(&msg[..]);
-
             let limit = if candidates.len() == 5 { 5 } else { 4 };
             for (i, trait_did) in candidates.iter().take(limit).enumerate() {
-                err.help(&format!("candidate #{}: `use {};`",
-                                  i + 1,
-                                  self.tcx.item_path_str(*trait_did)));
+                msg.push_str(&format!("\ncandidate #{}: `use {};`",
+                                      i + 1,
+                                      self.tcx.item_path_str(*trait_did)));
             }
             if candidates.len() > limit {
-                err.note(&format!("and {} others", candidates.len() - limit));
+                msg.push_str(&format!("\nand {} others", candidates.len() - limit));
             }
+            err.note(&msg[..]);
+
             return;
         }
 
@@ -383,28 +383,27 @@ fn suggest_traits_to_import(&self,
             // FIXME #21673 this help message could be tuned to the case
             // of a type parameter: suggest adding a trait bound rather
             // than implementing.
-            let msg = format!("items from traits can only be used if the trait is implemented \
-                               and in scope; the following {traits_define} an item `{name}`, \
-                               perhaps you need to implement {one_of_them}:",
-                              traits_define = if candidates.len() == 1 {
-                                  "trait defines"
-                              } else {
-                                  "traits define"
-                              },
-                              one_of_them = if candidates.len() == 1 {
-                                  "it"
-                              } else {
-                                  "one of them"
-                              },
-                              name = item_name);
-
-            err.help(&msg[..]);
+            err.help("items from traits can only be used if the trait is implemented and in scope");
+            let mut msg = format!("the following {traits_define} an item `{name}`, \
+                                   perhaps you need to implement {one_of_them}:",
+                                  traits_define = if candidates.len() == 1 {
+                                      "trait defines"
+                                  } else {
+                                      "traits define"
+                                  },
+                                  one_of_them = if candidates.len() == 1 {
+                                      "it"
+                                  } else {
+                                      "one of them"
+                                  },
+                                  name = item_name);
 
             for (i, trait_info) in candidates.iter().enumerate() {
-                err.help(&format!("candidate #{}: `{}`",
-                                  i + 1,
-                                  self.tcx.item_path_str(trait_info.def_id)));
+                msg.push_str(&format!("\ncandidate #{}: `{}`",
+                                      i + 1,
+                                      self.tcx.item_path_str(trait_info.def_id)));
             }
+            err.note(&msg[..]);
         }
     }
 
index 25e55ff36e7c63ed4697c6f532f445aa5652b022..20ce2c0249625b5270658d1fbbab68816c66f5d1 100644 (file)
@@ -124,6 +124,7 @@ fn clean(&self, cx: &DocContext) -> Crate {
             let mut r = cx.renderinfo.borrow_mut();
             r.deref_trait_did = cx.tcx.lang_items.deref_trait();
             r.deref_mut_trait_did = cx.tcx.lang_items.deref_mut_trait();
+            r.owned_box_did = cx.tcx.lang_items.owned_box();
         }
 
         let mut externs = Vec::new();
index a588460d467d2cc6597acfc5214b90e0eea6708c..0d9f98e05d2c2c90980ea1aa4ee7f1f67c93a50c 100644 (file)
@@ -262,6 +262,7 @@ pub struct Cache {
     stripped_mod: bool,
     deref_trait_did: Option<DefId>,
     deref_mut_trait_did: Option<DefId>,
+    owned_box_did: Option<DefId>,
 
     // In rare case where a structure is defined in one module but implemented
     // in another, if the implementing module is parsed before defining module,
@@ -280,6 +281,7 @@ pub struct RenderInfo {
     pub external_typarams: FxHashMap<DefId, String>,
     pub deref_trait_did: Option<DefId>,
     pub deref_mut_trait_did: Option<DefId>,
+    pub owned_box_did: Option<DefId>,
 }
 
 /// Helper struct to render all source code to HTML pages
@@ -507,6 +509,7 @@ pub fn run(mut krate: clean::Crate,
         external_typarams,
         deref_trait_did,
         deref_mut_trait_did,
+        owned_box_did,
     } = renderinfo;
 
     let external_paths = external_paths.into_iter()
@@ -530,6 +533,7 @@ pub fn run(mut krate: clean::Crate,
         traits: mem::replace(&mut krate.external_traits, FxHashMap()),
         deref_trait_did: deref_trait_did,
         deref_mut_trait_did: deref_mut_trait_did,
+        owned_box_did: owned_box_did,
         typarams: external_typarams,
     };
 
@@ -2933,17 +2937,18 @@ fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
                 };
 
                 if let Some(self_ty) = self_type_opt {
-                    let by_mut_ref = match self_ty {
-                        SelfTy::SelfBorrowed(_lifetime, mutability) => {
-                            mutability == Mutability::Mutable
-                        },
+                    let (by_mut_ref, by_box) = match self_ty {
+                        SelfTy::SelfBorrowed(_, mutability) |
                         SelfTy::SelfExplicit(clean::BorrowedRef { mutability, .. }) => {
-                            mutability == Mutability::Mutable
+                            (mutability == Mutability::Mutable, false)
+                        },
+                        SelfTy::SelfExplicit(clean::ResolvedPath { did, .. }) => {
+                            (false, Some(did) == cache().owned_box_did)
                         },
-                        _ => false,
+                        _ => (false, false),
                     };
 
-                    deref_mut_ || !by_mut_ref
+                    (deref_mut_ || !by_mut_ref) && !by_box
                 } else {
                     false
                 }
index da64704efbaa9452ec78a3976b9c043803bbb170..4c6d88c0ae88900defb49bb1a02eaa4137506658 100644 (file)
@@ -59,6 +59,7 @@
 
 use ffi::OsStr;
 use fmt;
+use fs;
 use io;
 use path::Path;
 use str;
@@ -544,8 +545,8 @@ pub fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut Command {
     ///         .expect("ls command failed to start");
     /// ```
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn stdin(&mut self, cfg: Stdio) -> &mut Command {
-        self.inner.stdin(cfg.0);
+    pub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Command {
+        self.inner.stdin(cfg.into().0);
         self
     }
 
@@ -564,8 +565,8 @@ pub fn stdin(&mut self, cfg: Stdio) -> &mut Command {
     ///         .expect("ls command failed to start");
     /// ```
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn stdout(&mut self, cfg: Stdio) -> &mut Command {
-        self.inner.stdout(cfg.0);
+    pub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Command {
+        self.inner.stdout(cfg.into().0);
         self
     }
 
@@ -584,8 +585,8 @@ pub fn stdout(&mut self, cfg: Stdio) -> &mut Command {
     ///         .expect("ls command failed to start");
     /// ```
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn stderr(&mut self, cfg: Stdio) -> &mut Command {
-        self.inner.stderr(cfg.0);
+    pub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Command {
+        self.inner.stderr(cfg.into().0);
         self
     }
 
@@ -753,6 +754,34 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
+#[stable(feature = "stdio_from", since = "1.20.0")]
+impl From<ChildStdin> for Stdio {
+    fn from(child: ChildStdin) -> Stdio {
+        Stdio::from_inner(child.into_inner().into())
+    }
+}
+
+#[stable(feature = "stdio_from", since = "1.20.0")]
+impl From<ChildStdout> for Stdio {
+    fn from(child: ChildStdout) -> Stdio {
+        Stdio::from_inner(child.into_inner().into())
+    }
+}
+
+#[stable(feature = "stdio_from", since = "1.20.0")]
+impl From<ChildStderr> for Stdio {
+    fn from(child: ChildStderr) -> Stdio {
+        Stdio::from_inner(child.into_inner().into())
+    }
+}
+
+#[stable(feature = "stdio_from", since = "1.20.0")]
+impl From<fs::File> for Stdio {
+    fn from(file: fs::File) -> Stdio {
+        Stdio::from_inner(file.into_inner().into())
+    }
+}
+
 /// Describes the result of a process after it has terminated.
 ///
 /// This `struct` is used to represent the exit status of a child process.
index 95e9438cd719121bc5eca9ece06e87ca87489855..62d873d257d8ffcd7651af05640a1266b667d5b1 100644 (file)
@@ -400,6 +400,18 @@ fn to_child_stdio(&self, readable: bool)
     }
 }
 
+impl From<AnonPipe> for Stdio {
+    fn from(pipe: AnonPipe) -> Stdio {
+        Stdio::Fd(pipe.into_fd())
+    }
+}
+
+impl From<File> for Stdio {
+    fn from(file: File) -> Stdio {
+        Stdio::Fd(file.into_fd())
+    }
+}
+
 impl ChildStdio {
     fn fd(&self) -> Option<usize> {
         match *self {
index 5b5e29c0374f021defbeac8ad0bc31410506c43d..ab609126cdb544443c957f14fcfb03351b6f0666 100644 (file)
@@ -102,7 +102,7 @@ pub struct mx_info_process_t {
 }
 
 extern {
-    static __magenta_job_default: mx_handle_t;
+    pub fn mx_job_default() -> mx_handle_t;
 
     pub fn mx_task_kill(handle: mx_handle_t) -> mx_status_t;
 
@@ -119,10 +119,6 @@ pub fn mx_object_get_info(handle: mx_handle_t, topic: u32, buffer: *mut c_void,
                               avail: *mut mx_size_t) -> mx_status_t;
 }
 
-pub fn mx_job_default() -> mx_handle_t {
-    unsafe { return __magenta_job_default; }
-}
-
 // From `enum special_handles` in system/ulib/launchpad/launchpad.c
 // HND_LOADER_SVC = 0
 // HND_EXEC_VMO = 1
index e9f41009064ca43ea267861b2bfe76cc8fd64718..32fcee1e461954e6195c43c4c1a7dfae424e6b4f 100644 (file)
@@ -315,6 +315,18 @@ pub fn to_child_stdio(&self, readable: bool)
     }
 }
 
+impl From<AnonPipe> for Stdio {
+    fn from(pipe: AnonPipe) -> Stdio {
+        Stdio::Fd(pipe.into_fd())
+    }
+}
+
+impl From<File> for Stdio {
+    fn from(file: File) -> Stdio {
+        Stdio::Fd(file.into_fd())
+    }
+}
+
 impl ChildStdio {
     pub fn fd(&self) -> Option<c_int> {
         match *self {
index dfbc1b581ee55f39b4bb22366beb1240e3c4c79a..0d1766d5aec6d91b967cd5ff20a45c30011fdb66 100644 (file)
@@ -306,6 +306,18 @@ fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>)
     }
 }
 
+impl From<AnonPipe> for Stdio {
+    fn from(pipe: AnonPipe) -> Stdio {
+        Stdio::Handle(pipe.into_handle())
+    }
+}
+
+impl From<File> for Stdio {
+    fn from(file: File) -> Stdio {
+        Stdio::Handle(file.into_handle())
+    }
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // Processes
 ////////////////////////////////////////////////////////////////////////////////
@@ -427,20 +439,22 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result<Vec<u16>> {
     // Encode the command and arguments in a command line string such
     // that the spawned process may recover them using CommandLineToArgvW.
     let mut cmd: Vec<u16> = Vec::new();
-    append_arg(&mut cmd, prog)?;
+    // Always quote the program name so CreateProcess doesn't interpret args as
+    // part of the name if the binary wasn't found first time.
+    append_arg(&mut cmd, prog, true)?;
     for arg in args {
         cmd.push(' ' as u16);
-        append_arg(&mut cmd, arg)?;
+        append_arg(&mut cmd, arg, false)?;
     }
     return Ok(cmd);
 
-    fn append_arg(cmd: &mut Vec<u16>, arg: &OsStr) -> io::Result<()> {
+    fn append_arg(cmd: &mut Vec<u16>, arg: &OsStr, force_quotes: bool) -> io::Result<()> {
         // If an argument has 0 characters then we need to quote it to ensure
         // that it actually gets passed through on the command line or otherwise
         // it will be dropped entirely when parsed on the other end.
         ensure_no_nuls(arg)?;
         let arg_bytes = &arg.as_inner().inner.as_inner();
-        let quote = arg_bytes.iter().any(|c| *c == b' ' || *c == b'\t')
+        let quote = force_quotes || arg_bytes.iter().any(|c| *c == b' ' || *c == b'\t')
             || arg_bytes.is_empty();
         if quote {
             cmd.push('"' as u16);
@@ -526,7 +540,7 @@ fn test_wrapper(prog: &str, args: &[&str]) -> String {
 
         assert_eq!(
             test_wrapper("prog", &["aaa", "bbb", "ccc"]),
-            "prog aaa bbb ccc"
+            "\"prog\" aaa bbb ccc"
         );
 
         assert_eq!(
@@ -539,15 +553,15 @@ fn test_wrapper(prog: &str, args: &[&str]) -> String {
         );
         assert_eq!(
             test_wrapper("echo", &["a b c"]),
-            "echo \"a b c\""
+            "\"echo\" \"a b c\""
         );
         assert_eq!(
             test_wrapper("echo", &["\" \\\" \\", "\\"]),
-            "echo \"\\\" \\\\\\\" \\\\\" \\"
+            "\"echo\" \"\\\" \\\\\\\" \\\\\" \\"
         );
         assert_eq!(
             test_wrapper("\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}", &[]),
-            "\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}"
+            "\"\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}\""
         );
     }
 }
index 0bcd457851890c6db66ecbae0d988c990cbf3865..e2656bea483396006b5ed530b832500bb566ab12 100644 (file)
@@ -480,6 +480,15 @@ fn scan_optional_raw_name(&mut self) -> Option<ast::Name> {
 
         self.with_str_from(start, |string| {
             if string == "_" {
+                self.sess.span_diagnostic
+                    .struct_span_warn(mk_sp(start, self.pos),
+                                      "underscore literal suffix is not allowed")
+                    .warn("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 #42326 \
+                          <https://github.com/rust-lang/rust/issues/42326>")
+                    .emit();
                 None
             } else {
                 Some(Symbol::intern(string))
index 73c0256f2c1f50babdde07d8a7a5c8c6e0e8f196..6b5caff27e8f020b7fdfcd74e199c7ebd29ac2b9 100644 (file)
@@ -81,6 +81,7 @@ fn decode<D: Decoder>(d: &mut D) -> Result<Ident, D::Error> {
 
 // The interner in thread-local, so `Symbol` shouldn't move between threads.
 impl !Send for Symbol { }
+impl !Sync for Symbol { }
 
 impl Symbol {
     /// Maps a string to its interned representation.
diff --git a/src/test/compile-fail/E0602.rs b/src/test/compile-fail/E0602.rs
new file mode 100644 (file)
index 0000000..cc3e436
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2017 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.
+
+// compile-flags:-D bogus
+
+// error-pattern:E0602
+// error-pattern:requested on the command line with `-D bogus`
+
+fn main() {}
diff --git a/src/test/compile-fail/auxiliary/no_method_suggested_traits.rs b/src/test/compile-fail/auxiliary/no_method_suggested_traits.rs
deleted file mode 100644 (file)
index 20cebb9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015 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.
-
-pub use reexport::Reexported;
-
-pub struct Foo;
-pub enum Bar { X }
-
-pub mod foo {
-    pub trait PubPub {
-        fn method(&self) {}
-
-        fn method3(&self) {}
-    }
-
-    impl PubPub for u32 {}
-    impl PubPub for i32 {}
-}
-pub mod bar {
-    trait PubPriv {
-        fn method(&self);
-    }
-}
-mod qux {
-    pub trait PrivPub {
-        fn method(&self);
-    }
-}
-mod quz {
-    trait PrivPriv {
-        fn method(&self);
-    }
-}
-
-mod reexport {
-    pub trait Reexported {
-        fn method(&self);
-    }
-}
diff --git a/src/test/compile-fail/issue-21659-show-relevant-trait-impls-3.rs b/src/test/compile-fail/issue-21659-show-relevant-trait-impls-3.rs
deleted file mode 100644 (file)
index 0bb944e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2015 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.
-
-trait Foo<A> {
-    fn foo(&self, a: A) -> A {
-        a
-    }
-}
-
-trait NotRelevant<A> {
-    fn nr(&self, a: A) -> A {
-        a
-    }
-}
-
-struct Bar;
-
-impl NotRelevant<usize> for Bar {}
-
-fn main() {
-    let f1 = Bar;
-
-    f1.foo(1usize);
-    //~^ error: method named `foo` found for type `Bar` in the current scope
-    //~| help: items from traits can only be used if the trait is implemented and in scope
-    //~| help: candidate #1: `Foo`
-}
index f918f0aed7a1098cdab57754bbed8b2a69a1df47..9b8c7b250763ef100c3cda9fa2e1f2d55b05bc1f 100644 (file)
@@ -10,7 +10,7 @@
 
 fn parse_type(iter: Box<Iterator<Item=&str>+'static>) -> &str { iter.next() }
 //~^ ERROR missing lifetime specifier [E0106]
-//~^^ HELP 2 elided lifetimes
+//~^^ HELP 2 lifetimes
 
 fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
 //~^ ERROR missing lifetime specifier [E0106]
index 1daa6a61f777ca5b183eccbbbae0591b0bb59c6c..e3f55ae51e8b65f28e98459167ecb378107a9a6c 100644 (file)
@@ -17,19 +17,19 @@ struct S<'a> {
 
 fn f(a: &S, b: i32) -> &i32 {
 //~^ ERROR missing lifetime specifier [E0106]
-//~^^ HELP does not say which one of `a`'s 2 elided lifetimes it is borrowed from
+//~^^ HELP does not say which one of `a`'s 2 lifetimes it is borrowed from
     panic!();
 }
 
 fn g(a: &S, b: bool, c: &i32) -> &i32 {
 //~^ ERROR missing lifetime specifier [E0106]
-//~^^ HELP does not say whether it is borrowed from one of `a`'s 2 elided lifetimes or `c`
+//~^^ HELP does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c`
     panic!();
 }
 
 fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 {
 //~^ ERROR missing lifetime specifier [E0106]
-//~^^ HELP does not say whether it is borrowed from `a`, one of `c`'s 2 elided lifetimes, or `d`
+//~^^ HELP does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d`
     panic!();
 }
 
index 43371eb6340f434d89aa8b903fe5cf4e463586ef..2d9de57a2659f52b8b59c6cdfe51637b7b178826 100644 (file)
@@ -28,7 +28,7 @@ struct Foo<'a> {
 // Lifetime annotation needed because we have two lifetimes: one as a parameter
 // and one on the reference.
 fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier
-//~^ HELP the signature does not say which one of `_x`'s 2 elided lifetimes it is borrowed from
+//~^ HELP the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from
     panic!()
 }
 
index b8eb8434b350619ae28e38446843f579038da216..14fa74d1f32e55b33b22a3632194aca8d40ed982 100644 (file)
@@ -33,5 +33,6 @@ fn main() {
     y.zero()
      .take()    //~ ERROR no method named `take` found for type `Foo` in the current scope
      //~^ NOTE the method `take` exists but the following trait bounds were not satisfied
+     //~| NOTE the following traits define an item `take`, perhaps you need to implement one of them
      .one(0);
 }
diff --git a/src/test/compile-fail/method-suggestion-no-duplication.rs b/src/test/compile-fail/method-suggestion-no-duplication.rs
deleted file mode 100644 (file)
index 390b8f0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 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.
-
-// issue #21405
-// ignore-tidy-linelength
-
-struct Foo;
-
-fn foo<F>(f: F) where F: FnMut(Foo) {}
-
-fn main() {
-    foo(|s| s.is_empty());
-    //~^ ERROR no method named `is_empty` found
-    //~^^ HELP #1: `std::iter::ExactSizeIterator`
-    //~^^^ HELP #2: `core::slice::SliceExt`
-    //~^^^^ HELP #3: `core::str::StrExt`
-    //~^^^^^ HELP items from traits can only be used if the trait is implemented and in scope; the following traits define an item `is_empty`, perhaps you need to implement one of them:
-}
diff --git a/src/test/compile-fail/no-method-suggested-traits.rs b/src/test/compile-fail/no-method-suggested-traits.rs
deleted file mode 100644 (file)
index a8d97d4..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2015 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.
-
-// aux-build:no_method_suggested_traits.rs
-
-extern crate no_method_suggested_traits;
-
-struct Foo;
-enum Bar { X }
-
-mod foo {
-    pub trait Bar {
-        fn method(&self) {}
-
-        fn method2(&self) {}
-    }
-
-    impl Bar for u32 {}
-
-    impl Bar for char {}
-}
-
-fn main() {
-    // test the values themselves, and autoderef.
-
-
-    1u32.method();
-    //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
-    //~^^ ERROR no method named
-    //~^^^ HELP `use foo::Bar;`
-    //~^^^^ HELP `use no_method_suggested_traits::foo::PubPub;`
-    std::rc::Rc::new(&mut Box::new(&1u32)).method();
-    //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
-    //~^^ ERROR no method named
-    //~^^^ HELP `use foo::Bar;`
-    //~^^^^ HELP `use no_method_suggested_traits::foo::PubPub;`
-
-    'a'.method();
-    //~^ ERROR no method named
-    //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
-    //~^^^ HELP `use foo::Bar;`
-    std::rc::Rc::new(&mut Box::new(&'a')).method();
-    //~^ ERROR no method named
-    //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
-    //~^^^ HELP `use foo::Bar;`
-
-    1i32.method();
-    //~^ ERROR no method named
-    //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
-    //~^^^ HELP `use no_method_suggested_traits::foo::PubPub;`
-    std::rc::Rc::new(&mut Box::new(&1i32)).method();
-    //~^ ERROR no method named
-    //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
-    //~^^^ HELP `use no_method_suggested_traits::foo::PubPub;`
-
-    Foo.method();
-    //~^ ERROR no method named
-    //~^^ HELP following traits define an item `method`, perhaps you need to implement one of them
-    //~^^^ HELP `foo::Bar`
-    //~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
-    //~^^^^^ HELP `no_method_suggested_traits::Reexported`
-    //~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
-    //~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
-    //~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
-    std::rc::Rc::new(&mut Box::new(&Foo)).method();
-    //~^ ERROR no method named
-    //~^^ HELP following traits define an item `method`, perhaps you need to implement one of them
-    //~^^^ HELP `foo::Bar`
-    //~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
-    //~^^^^^ HELP `no_method_suggested_traits::Reexported`
-    //~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
-    //~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
-    //~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
-
-    1u64.method2();
-    //~^ ERROR no method named
-    //~^^ HELP the following trait defines an item `method2`, perhaps you need to implement it
-    //~^^^ HELP `foo::Bar`
-    std::rc::Rc::new(&mut Box::new(&1u64)).method2();
-    //~^ ERROR no method named
-    //~^^ HELP the following trait defines an item `method2`, perhaps you need to implement it
-    //~^^^ HELP `foo::Bar`
-
-    no_method_suggested_traits::Foo.method2();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
-    //~^^^ HELP `foo::Bar`
-    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
-    //~^^^ HELP `foo::Bar`
-    no_method_suggested_traits::Bar::X.method2();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
-    //~^^^ HELP `foo::Bar`
-    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
-    //~^^^ HELP `foo::Bar`
-
-    Foo.method3();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
-    //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
-    std::rc::Rc::new(&mut Box::new(&Foo)).method3();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
-    //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
-    Bar::X.method3();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
-    //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
-    std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
-    //~^ ERROR no method named
-    //~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
-    //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
-
-    // should have no help:
-    1_usize.method3(); //~ ERROR no method named
-    std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named
-    no_method_suggested_traits::Foo.method3();  //~ ERROR no method named
-    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
-    //~^ ERROR no method named
-    no_method_suggested_traits::Bar::X.method3();  //~ ERROR no method named
-    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
-    //~^ ERROR no method named
-}
diff --git a/src/test/parse-fail/underscore-suffix-for-string.rs b/src/test/parse-fail/underscore-suffix-for-string.rs
new file mode 100644 (file)
index 0000000..05de5f8
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2017 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 main() {
+    let _ = "Foo"_;
+    //~^ WARNING underscore literal suffix is not allowed
+    //~| WARNING this was previously accepted
+    //~| NOTE issue #42326
+}
+
+FAIL
+//~^ ERROR
+//~| NOTE
diff --git a/src/test/run-make/windows-spawn/Makefile b/src/test/run-make/windows-spawn/Makefile
new file mode 100644 (file)
index 0000000..f0d4242
--- /dev/null
@@ -0,0 +1,14 @@
+-include ../tools.mk
+
+ifdef IS_WINDOWS
+
+all:
+       $(RUSTC) -o "$(TMPDIR)/hopefullydoesntexist bar.exe" hello.rs
+       $(RUSTC) spawn.rs
+       $(TMPDIR)/spawn.exe
+
+else
+
+all:
+
+endif
diff --git a/src/test/run-make/windows-spawn/hello.rs b/src/test/run-make/windows-spawn/hello.rs
new file mode 100644 (file)
index 0000000..b177f41
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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 main() {
+    println!("Hello World!");
+}
diff --git a/src/test/run-make/windows-spawn/spawn.rs b/src/test/run-make/windows-spawn/spawn.rs
new file mode 100644 (file)
index 0000000..2913cbe
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 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.
+
+use std::io::ErrorKind;
+use std::process::Command;
+
+fn main() {
+    // Make sure it doesn't try to run "hopefullydoesntexist bar.exe".
+    assert_eq!(Command::new("hopefullydoesntexist")
+                   .arg("bar")
+                   .spawn()
+                   .unwrap_err()
+                   .kind(),
+               ErrorKind::NotFound);
+}
diff --git a/src/test/run-pass-fulldeps/stdio-from.rs b/src/test/run-pass-fulldeps/stdio-from.rs
new file mode 100644 (file)
index 0000000..f64bbf9
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright 2017 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.
+
+// ignore-cross-compile
+
+#![feature(rustc_private)]
+
+extern crate rustc_back;
+
+use std::env;
+use std::fs::File;
+use std::io;
+use std::io::{Read, Write};
+use std::process::{Command, Stdio};
+
+use rustc_back::tempdir::TempDir;
+
+fn main() {
+    if env::args().len() > 1 {
+        child().unwrap()
+    } else {
+        parent().unwrap()
+    }
+}
+
+fn parent() -> io::Result<()> {
+    let td = TempDir::new("foo").unwrap();
+    let input = td.path().join("input");
+    let output = td.path().join("output");
+
+    File::create(&input)?.write_all(b"foo\n")?;
+
+    // Set up this chain:
+    //     $ me <file | me | me >file
+    // ... to duplicate each line 8 times total.
+
+    let mut child1 = Command::new(env::current_exe()?)
+        .arg("first")
+        .stdin(File::open(&input)?) // tests File::into()
+        .stdout(Stdio::piped())
+        .spawn()?;
+
+    let mut child3 = Command::new(env::current_exe()?)
+        .arg("third")
+        .stdin(Stdio::piped())
+        .stdout(File::create(&output)?) // tests File::into()
+        .spawn()?;
+
+    // Started out of order so we can test both `ChildStdin` and `ChildStdout`.
+    let mut child2 = Command::new(env::current_exe()?)
+        .arg("second")
+        .stdin(child1.stdout.take().unwrap()) // tests ChildStdout::into()
+        .stdout(child3.stdin.take().unwrap()) // tests ChildStdin::into()
+        .spawn()?;
+
+    assert!(child1.wait()?.success());
+    assert!(child2.wait()?.success());
+    assert!(child3.wait()?.success());
+
+    let mut data = String::new();
+    File::open(&output)?.read_to_string(&mut data)?;
+    for line in data.lines() {
+        assert_eq!(line, "foo");
+    }
+    assert_eq!(data.lines().count(), 8);
+    Ok(())
+}
+
+fn child() -> io::Result<()> {
+    // double everything
+    let mut input = vec![];
+    io::stdin().read_to_end(&mut input)?;
+    io::stdout().write_all(&input)?;
+    io::stdout().write_all(&input)?;
+    Ok(())
+}
index 035911302cf2499e1fe9d4985c55093734b2ba85..7658abc00c599636da09e54ba515c4acaece3fc0 100644 (file)
@@ -69,8 +69,8 @@ fn main() {
         Command::new(name)
             .arg("--child")
             .stdin(Stdio::inherit())
-            .stdout(unsafe { FromRawFd::from_raw_fd(libc::STDERR_FILENO) })
-            .stderr(unsafe { FromRawFd::from_raw_fd(libc::STDOUT_FILENO) })
+            .stdout(unsafe { Stdio::from_raw_fd(libc::STDERR_FILENO) })
+            .stderr(unsafe { Stdio::from_raw_fd(libc::STDOUT_FILENO) })
             .spawn()
     };
 
index b28760e6c91fb2977f1dd2e1be697d49a842411f..20f58301d45244adfa7c0ded2515b3234bce9be2 100644 (file)
@@ -77,6 +77,36 @@ fn angrydome() {
 
 fn evil_lincoln() { let _evil = println!("lincoln"); }
 
+fn dots() {
+    assert_eq!(String::from(".................................................."),
+               format!("{:?}", .. .. .. .. .. .. .. .. .. .. .. .. ..
+                               .. .. .. .. .. .. .. .. .. .. .. ..));
+}
+
+fn you_eight() {
+    assert_eq!(8, {
+        macro_rules! u8 {
+            (u8) => {
+                mod u8 {
+                    pub fn u8<'u8>(u8: &'u8 u8) -> &'u8 u8 {
+                        "u8";
+                        u8
+                    }
+                }
+            };
+        }
+
+        u8!(u8);
+        let &u8: &u8 = u8::u8(&8u8);
+        u8
+    });
+}
+
+fn fishy() {
+    assert_eq!(String::from("><>"),
+               String::<>::from::<>("><>").chars::<>().rev::<>().collect::<String>());
+}
+
 pub fn main() {
     strange();
     funny();
@@ -86,4 +116,7 @@ pub fn main() {
     canttouchthis();
     angrydome();
     evil_lincoln();
+    dots();
+    you_eight();
+    fishy();
 }
index d738fb2925964cc539726df6aaf409347119b5e1..b19fbaa5b953538593cb9607338e20cf6e052603 100644 (file)
@@ -19,6 +19,8 @@ pub fn by_ref(&self) {}
     pub fn by_explicit_ref(self: &Foo) {}
     pub fn by_mut_ref(&mut self) {}
     pub fn by_explicit_mut_ref(self: &mut Foo) {}
+    pub fn by_explicit_box(self: Box<Foo>) {}
+    pub fn by_explicit_self_box(self: Box<Self>) {}
     pub fn static_foo() {}
 }
 
@@ -41,5 +43,9 @@ fn deref_mut(&mut self) -> &mut Foo { loop {} }
 // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
 // @has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
 // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
+// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
+// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
 // @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
index 8764e4a390f763616e3c7cff2fdd9be037685901..95231f282e3ed634e76b41854e09f679a823238a 100644 (file)
@@ -18,6 +18,8 @@ pub fn by_ref(&self) {}
     pub fn by_explicit_ref(self: &Foo) {}
     pub fn by_mut_ref(&mut self) {}
     pub fn by_explicit_mut_ref(self: &mut Foo) {}
+    pub fn by_explicit_box(self: Box<Foo>) {}
+    pub fn by_explicit_self_box(self: Box<Self>) {}
     pub fn static_foo() {}
 }
 
@@ -36,5 +38,9 @@ fn deref(&self) -> &Foo { loop {} }
 // @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
 // @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
 // @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
+// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
+// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
 // @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
diff --git a/src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs b/src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs
new file mode 100644 (file)
index 0000000..20cebb9
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright 2015 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.
+
+pub use reexport::Reexported;
+
+pub struct Foo;
+pub enum Bar { X }
+
+pub mod foo {
+    pub trait PubPub {
+        fn method(&self) {}
+
+        fn method3(&self) {}
+    }
+
+    impl PubPub for u32 {}
+    impl PubPub for i32 {}
+}
+pub mod bar {
+    trait PubPriv {
+        fn method(&self);
+    }
+}
+mod qux {
+    pub trait PrivPub {
+        fn method(&self);
+    }
+}
+mod quz {
+    trait PrivPriv {
+        fn method(&self);
+    }
+}
+
+mod reexport {
+    pub trait Reexported {
+        fn method(&self);
+    }
+}
diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs
new file mode 100644 (file)
index 0000000..0bb944e
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2015 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.
+
+trait Foo<A> {
+    fn foo(&self, a: A) -> A {
+        a
+    }
+}
+
+trait NotRelevant<A> {
+    fn nr(&self, a: A) -> A {
+        a
+    }
+}
+
+struct Bar;
+
+impl NotRelevant<usize> for Bar {}
+
+fn main() {
+    let f1 = Bar;
+
+    f1.foo(1usize);
+    //~^ error: method named `foo` found for type `Bar` in the current scope
+    //~| help: items from traits can only be used if the trait is implemented and in scope
+    //~| help: candidate #1: `Foo`
+}
diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr
new file mode 100644 (file)
index 0000000..1b1e0ea
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0599]: no method named `foo` found for type `Bar` in the current scope
+  --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:30:8
+   |
+30 |     f1.foo(1usize);
+   |        ^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `foo`, perhaps you need to implement it:
+           candidate #1: `Foo`
+
+error: aborting due to previous error(s)
+
diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs
new file mode 100644 (file)
index 0000000..390b8f0
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2015 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.
+
+// issue #21405
+// ignore-tidy-linelength
+
+struct Foo;
+
+fn foo<F>(f: F) where F: FnMut(Foo) {}
+
+fn main() {
+    foo(|s| s.is_empty());
+    //~^ ERROR no method named `is_empty` found
+    //~^^ HELP #1: `std::iter::ExactSizeIterator`
+    //~^^^ HELP #2: `core::slice::SliceExt`
+    //~^^^^ HELP #3: `core::str::StrExt`
+    //~^^^^^ HELP items from traits can only be used if the trait is implemented and in scope; the following traits define an item `is_empty`, perhaps you need to implement one of them:
+}
diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr
new file mode 100644 (file)
index 0000000..fa08c3b
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0599]: no method named `is_empty` found for type `Foo` in the current scope
+  --> $DIR/method-suggestion-no-duplication.rs:19:15
+   |
+19 |     foo(|s| s.is_empty());
+   |               ^^^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following traits define an item `is_empty`, perhaps you need to implement one of them:
+           candidate #1: `std::iter::ExactSizeIterator`
+           candidate #2: `core::slice::SliceExt`
+           candidate #3: `core::str::StrExt`
+
+error: aborting due to previous error(s)
+
diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.rs b/src/test/ui/impl-trait/no-method-suggested-traits.rs
new file mode 100644 (file)
index 0000000..15891b0
--- /dev/null
@@ -0,0 +1,133 @@
+// Copyright 2015 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.
+
+// aux-build:no_method_suggested_traits.rs
+extern crate no_method_suggested_traits;
+
+struct Foo;
+enum Bar { X }
+
+mod foo {
+    pub trait Bar {
+        fn method(&self) {}
+
+        fn method2(&self) {}
+    }
+
+    impl Bar for u32 {}
+
+    impl Bar for char {}
+}
+
+fn main() {
+    // test the values themselves, and autoderef.
+
+
+    1u32.method();
+    //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
+    //~| ERROR no method named
+    //~| HELP `use foo::Bar;`
+    //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+    std::rc::Rc::new(&mut Box::new(&1u32)).method();
+    //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
+    //~| ERROR no method named
+    //~| HELP `use foo::Bar;`
+    //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+
+    'a'.method();
+    //~^ ERROR no method named
+    //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
+    //~| HELP `use foo::Bar;`
+    std::rc::Rc::new(&mut Box::new(&'a')).method();
+    //~^ ERROR no method named
+    //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
+    //~| HELP `use foo::Bar;`
+
+    1i32.method();
+    //~^ ERROR no method named
+    //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
+    //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+    std::rc::Rc::new(&mut Box::new(&1i32)).method();
+    //~^ ERROR no method named
+    //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
+    //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+
+    Foo.method();
+    //~^ ERROR no method named
+    //~| HELP following traits define an item `method`, perhaps you need to implement one of them
+    //~| HELP `foo::Bar`
+    //~| HELP `no_method_suggested_traits::foo::PubPub`
+    //~| HELP `no_method_suggested_traits::Reexported`
+    //~| HELP `no_method_suggested_traits::bar::PubPriv`
+    //~| HELP `no_method_suggested_traits::qux::PrivPub`
+    //~| HELP `no_method_suggested_traits::quz::PrivPriv`
+    std::rc::Rc::new(&mut Box::new(&Foo)).method();
+    //~^ ERROR no method named
+    //~| HELP following traits define an item `method`, perhaps you need to implement one of them
+    //~| HELP `foo::Bar`
+    //~| HELP `no_method_suggested_traits::foo::PubPub`
+    //~| HELP `no_method_suggested_traits::Reexported`
+    //~| HELP `no_method_suggested_traits::bar::PubPriv`
+    //~| HELP `no_method_suggested_traits::qux::PrivPub`
+    //~| HELP `no_method_suggested_traits::quz::PrivPriv`
+
+    1u64.method2();
+    //~^ ERROR no method named
+    //~| HELP the following trait defines an item `method2`, perhaps you need to implement it
+    //~| HELP `foo::Bar`
+    std::rc::Rc::new(&mut Box::new(&1u64)).method2();
+    //~^ ERROR no method named
+    //~| HELP the following trait defines an item `method2`, perhaps you need to implement it
+    //~| HELP `foo::Bar`
+
+    no_method_suggested_traits::Foo.method2();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method2`, perhaps you need to implement it
+    //~| HELP `foo::Bar`
+    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method2`, perhaps you need to implement it
+    //~| HELP `foo::Bar`
+    no_method_suggested_traits::Bar::X.method2();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method2`, perhaps you need to implement it
+    //~| HELP `foo::Bar`
+    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method2`, perhaps you need to implement it
+    //~| HELP `foo::Bar`
+
+    Foo.method3();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method3`, perhaps you need to implement it
+    //~| HELP `no_method_suggested_traits::foo::PubPub`
+    std::rc::Rc::new(&mut Box::new(&Foo)).method3();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method3`, perhaps you need to implement it
+    //~| HELP `no_method_suggested_traits::foo::PubPub`
+    Bar::X.method3();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method3`, perhaps you need to implement it
+    //~| HELP `no_method_suggested_traits::foo::PubPub`
+    std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
+    //~^ ERROR no method named
+    //~| HELP following trait defines an item `method3`, perhaps you need to implement it
+    //~| HELP `no_method_suggested_traits::foo::PubPub`
+
+    // should have no help:
+    1_usize.method3(); //~ ERROR no method named
+    std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named
+    no_method_suggested_traits::Foo.method3();  //~ ERROR no method named
+    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
+    //~^ ERROR no method named
+    no_method_suggested_traits::Bar::X.method3();  //~ ERROR no method named
+    std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
+    //~^ ERROR no method named
+}
diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr
new file mode 100644 (file)
index 0000000..95d3007
--- /dev/null
@@ -0,0 +1,230 @@
+error[E0599]: no method named `method` found for type `u32` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:33:10
+   |
+33 |     1u32.method();
+   |          ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is in scope
+   = note: the following traits are implemented but not in scope, perhaps add a `use` for one of them:
+           candidate #1: `use foo::Bar;`
+           candidate #2: `use no_method_suggested_traits::foo::PubPub;`
+
+error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&u32>>` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:38:44
+   |
+38 |     std::rc::Rc::new(&mut Box::new(&1u32)).method();
+   |                                            ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is in scope
+   = note: the following traits are implemented but not in scope, perhaps add a `use` for one of them:
+           candidate #1: `use foo::Bar;`
+           candidate #2: `use no_method_suggested_traits::foo::PubPub;`
+
+error[E0599]: no method named `method` found for type `char` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:44:9
+   |
+44 |     'a'.method();
+   |         ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is in scope
+   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+           candidate #1: `use foo::Bar;`
+
+error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&char>>` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:48:43
+   |
+48 |     std::rc::Rc::new(&mut Box::new(&'a')).method();
+   |                                           ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is in scope
+   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+           candidate #1: `use foo::Bar;`
+
+error[E0599]: no method named `method` found for type `i32` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:53:10
+   |
+53 |     1i32.method();
+   |          ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is in scope
+   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+           candidate #1: `use no_method_suggested_traits::foo::PubPub;`
+
+error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&i32>>` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:57:44
+   |
+57 |     std::rc::Rc::new(&mut Box::new(&1i32)).method();
+   |                                            ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is in scope
+   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+           candidate #1: `use no_method_suggested_traits::foo::PubPub;`
+
+error[E0599]: no method named `method` found for type `Foo` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:62:9
+   |
+62 |     Foo.method();
+   |         ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following traits define an item `method`, perhaps you need to implement one of them:
+           candidate #1: `foo::Bar`
+           candidate #2: `no_method_suggested_traits::foo::PubPub`
+           candidate #3: `no_method_suggested_traits::bar::PubPriv`
+           candidate #4: `no_method_suggested_traits::qux::PrivPub`
+           candidate #5: `no_method_suggested_traits::quz::PrivPriv`
+           candidate #6: `no_method_suggested_traits::Reexported`
+
+error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:71:43
+   |
+71 |     std::rc::Rc::new(&mut Box::new(&Foo)).method();
+   |                                           ^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following traits define an item `method`, perhaps you need to implement one of them:
+           candidate #1: `foo::Bar`
+           candidate #2: `no_method_suggested_traits::foo::PubPub`
+           candidate #3: `no_method_suggested_traits::bar::PubPriv`
+           candidate #4: `no_method_suggested_traits::qux::PrivPub`
+           candidate #5: `no_method_suggested_traits::quz::PrivPriv`
+           candidate #6: `no_method_suggested_traits::Reexported`
+
+error[E0599]: no method named `method2` found for type `u64` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:81:10
+   |
+81 |     1u64.method2();
+   |          ^^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `method2`, perhaps you need to implement it:
+           candidate #1: `foo::Bar`
+
+error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&u64>>` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:85:44
+   |
+85 |     std::rc::Rc::new(&mut Box::new(&1u64)).method2();
+   |                                            ^^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `method2`, perhaps you need to implement it:
+           candidate #1: `foo::Bar`
+
+error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Foo` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:90:37
+   |
+90 |     no_method_suggested_traits::Foo.method2();
+   |                                     ^^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `method2`, perhaps you need to implement it:
+           candidate #1: `foo::Bar`
+
+error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:94:71
+   |
+94 |     std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
+   |                                                                       ^^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `method2`, perhaps you need to implement it:
+           candidate #1: `foo::Bar`
+
+error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Bar` in the current scope
+  --> $DIR/no-method-suggested-traits.rs:98:40
+   |
+98 |     no_method_suggested_traits::Bar::X.method2();
+   |                                        ^^^^^^^
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `method2`, perhaps you need to implement it:
+           candidate #1: `foo::Bar`
+
+error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:102:74
+    |
+102 |     std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
+    |                                                                          ^^^^^^^
+    |
+    = help: items from traits can only be used if the trait is implemented and in scope
+    = note: the following trait defines an item `method2`, perhaps you need to implement it:
+            candidate #1: `foo::Bar`
+
+error[E0599]: no method named `method3` found for type `Foo` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:107:9
+    |
+107 |     Foo.method3();
+    |         ^^^^^^^
+    |
+    = help: items from traits can only be used if the trait is implemented and in scope
+    = note: the following trait defines an item `method3`, perhaps you need to implement it:
+            candidate #1: `no_method_suggested_traits::foo::PubPub`
+
+error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:111:43
+    |
+111 |     std::rc::Rc::new(&mut Box::new(&Foo)).method3();
+    |                                           ^^^^^^^
+    |
+    = help: items from traits can only be used if the trait is implemented and in scope
+    = note: the following trait defines an item `method3`, perhaps you need to implement it:
+            candidate #1: `no_method_suggested_traits::foo::PubPub`
+
+error[E0599]: no method named `method3` found for type `Bar` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:115:12
+    |
+115 |     Bar::X.method3();
+    |            ^^^^^^^
+    |
+    = help: items from traits can only be used if the trait is implemented and in scope
+    = note: the following trait defines an item `method3`, perhaps you need to implement it:
+            candidate #1: `no_method_suggested_traits::foo::PubPub`
+
+error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Bar>>` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:119:46
+    |
+119 |     std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
+    |                                              ^^^^^^^
+    |
+    = help: items from traits can only be used if the trait is implemented and in scope
+    = note: the following trait defines an item `method3`, perhaps you need to implement it:
+            candidate #1: `no_method_suggested_traits::foo::PubPub`
+
+error[E0599]: no method named `method3` found for type `usize` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:125:13
+    |
+125 |     1_usize.method3(); //~ ERROR no method named
+    |             ^^^^^^^
+
+error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:126:47
+    |
+126 |     std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named
+    |                                               ^^^^^^^
+
+error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:127:37
+    |
+127 |     no_method_suggested_traits::Foo.method3();  //~ ERROR no method named
+    |                                     ^^^^^^^
+
+error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:128:71
+    |
+128 |     std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
+    |                                                                       ^^^^^^^
+
+error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:130:40
+    |
+130 |     no_method_suggested_traits::Bar::X.method3();  //~ ERROR no method named
+    |                                        ^^^^^^^
+
+error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope
+   --> $DIR/no-method-suggested-traits.rs:131:74
+    |
+131 |     std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
+    |                                                                          ^^^^^^^
+
+error: aborting due to previous error(s)
+
index 9f368f0de9661d1a076b8875690fdbc9fbee32b4..9bf00b1b5749a2091f49c74fbdb9303a90ee7270 100644 (file)
@@ -23,10 +23,11 @@ note: candidate #3 is defined in the trait `UnusedTrait`
 29 |     fn f9(usize) -> usize; //~ NOTE candidate
    |     ^^^^^^^^^^^^^^^^^^^^^^
    = help: to disambiguate the method call, write `UnusedTrait::f9(u, 342)` instead
-   = help: items from traits can only be used if the trait is implemented and in scope; the following traits define an item `f9`, perhaps you need to implement one of them:
-   = help: candidate #1: `CtxtFn`
-   = help: candidate #2: `OtherTrait`
-   = help: candidate #3: `UnusedTrait`
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following traits define an item `f9`, perhaps you need to implement one of them:
+           candidate #1: `CtxtFn`
+           candidate #2: `OtherTrait`
+           candidate #3: `UnusedTrait`
 
 error[E0599]: no method named `fff` found for type `Myisize` in the current scope
   --> $DIR/issue-7575.rs:74:30
@@ -58,8 +59,9 @@ note: candidate #1 is defined in the trait `ManyImplTrait`
 59 | |     }
    | |_____^
    = help: to disambiguate the method call, write `ManyImplTrait::is_str(t)` instead
-   = help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `is_str`, perhaps you need to implement it:
-   = help: candidate #1: `ManyImplTrait`
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `is_str`, perhaps you need to implement it:
+           candidate #1: `ManyImplTrait`
 
 error: aborting due to previous error(s)