Fix issue #41652.
Don't print the source code in emit_message_default() and render_source_line() if the source code is None.
This commit is contained in:
parent
0634f0a30f
commit
81bfdc83ca
4 changed files with 63 additions and 2 deletions
16
src/test/ui/issue-41652/auxiliary/issue_41652_b.rs
Normal file
16
src/test/ui/issue-41652/auxiliary/issue_41652_b.rs
Normal file
|
|
@ -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.
|
||||
|
||||
pub trait Tr {
|
||||
// Note: The function needs to be declared over multiple lines to reproduce
|
||||
// the crash. DO NOT reformat.
|
||||
fn f()
|
||||
where Self: Sized;
|
||||
}
|
||||
26
src/test/ui/issue-41652/issue_41652.rs
Normal file
26
src/test/ui/issue-41652/issue_41652.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// 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.
|
||||
|
||||
// aux-build:issue_41652_b.rs
|
||||
|
||||
extern crate issue_41652_b;
|
||||
|
||||
struct S;
|
||||
|
||||
impl issue_41652_b::Tr for S {
|
||||
fn f() {
|
||||
3.f()
|
||||
//~^ ERROR no method named `f` found for type `{integer}` in the current scope
|
||||
//~| NOTE found the following associated functions
|
||||
//~| NOTE candidate #1 is defined in the trait `issue_41652_b::Tr`
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
12
src/test/ui/issue-41652/issue_41652.stderr
Normal file
12
src/test/ui/issue-41652/issue_41652.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error: no method named `f` found for type `{integer}` in the current scope
|
||||
--> $DIR/issue_41652.rs:19:11
|
||||
|
|
||||
19 | 3.f()
|
||||
| ^
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
note: candidate #1 is defined in the trait `issue_41652_b::Tr`
|
||||
= help: to disambiguate the method call, write `issue_41652_b::Tr::f(3)` instead
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue