Skip to content

Rollup of 8 pull requests #59271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3477939
[CI] Update binutils for powerpc64 and powerpc64le
cuviper Mar 7, 2019
c843fe7
Wrap a long configure line
cuviper Mar 7, 2019
b9d12ed
Be more discerning on when to attempt suggesting a comma in a macro i…
estebank Mar 11, 2019
27abd52
Fix operator precedence
estebank Mar 13, 2019
4e5692d
test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X…
pnkfelix Jan 18, 2019
a7bd36c
Add peer_addr function to UdpSocket
LinusU Mar 11, 2019
bf473e3
Mark UdpSocket peer_addr unstable w/ tracking issue
LinusU Mar 12, 2019
24e3fa0
Document UdpSocket peer_addr NotConnected error
LinusU Mar 12, 2019
7f7cfae
Add test for UdpSocket peer_addr
LinusU Mar 12, 2019
7e73cd4
Fix test names regarding ip version
LinusU Mar 12, 2019
214110b
Add UdpSocket peer_addr implementation for L4Re
LinusU Mar 16, 2019
81d5fb5
Add UdpSocket peer_addr implementation for Wasm
LinusU Mar 16, 2019
b392c5e
use the identifier span for missing struct field
euclio Mar 16, 2019
498bead
Tweak spans for E0599
estebank Mar 10, 2019
713f96d
Swap const evaluation lint spans to point at problem in primary span
estebank Mar 11, 2019
690bc57
Swap primary/secondary spans for E0458
estebank Mar 11, 2019
18d727f
Tweak unsupported negative trait bounds message
estebank Mar 11, 2019
bb15af1
Tweak unnecessary import suggestion
estebank Mar 11, 2019
b616cca
Hide obvious suggestion from cli output
estebank Mar 11, 2019
743d019
Deduplicate const eval error spans for better output
estebank Mar 11, 2019
b53ca90
Mark duplicate import removal suggestion tool only
estebank Mar 11, 2019
d1656f1
Fix rebase
estebank Mar 17, 2019
6430318
Use a valid name for graphviz graphs
matthewjasper Mar 17, 2019
98b2672
update mailmap for Bastian Kauschke
lcnr Mar 17, 2019
9200f05
Rollup merge of #57729 - pnkfelix:issue-55748-pat-types-are-constrain…
sanxiyn Mar 18, 2019
d46ba07
Rollup merge of #58986 - cuviper:ppc64-binutils, r=alexcrichton
sanxiyn Mar 18, 2019
02c2e84
Rollup merge of #59084 - estebank:diagnostic-spans, r=davidtwco
sanxiyn Mar 18, 2019
fbdaf3e
Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm
sanxiyn Mar 18, 2019
f62585f
Rollup merge of #59116 - estebank:comma-sugg, r=petrochenkov
sanxiyn Mar 18, 2019
859c9a5
Rollup merge of #59240 - euclio:struct-field-span, r=oli-obk
sanxiyn Mar 18, 2019
00fb9d9
Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
sanxiyn Mar 18, 2019
9dd8cb2
Rollup merge of #59252 - lcnr:mailmap, r=Centril
sanxiyn Mar 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweak spans for E0599
  • Loading branch information
estebank committed Mar 17, 2019
commit 498beaddf42092f91df3bc9a0af9a80489b2a38a
35 changes: 21 additions & 14 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,26 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}
}

pub fn report_method_error<'b>(&self,
span: Span,
rcvr_ty: Ty<'tcx>,
item_name: ast::Ident,
source: SelfSource<'b>,
error: MethodError<'tcx>,
args: Option<&'gcx [hir::Expr]>) {
pub fn report_method_error<'b>(
&self,
span: Span,
rcvr_ty: Ty<'tcx>,
item_name: ast::Ident,
source: SelfSource<'b>,
error: MethodError<'tcx>,
args: Option<&'gcx [hir::Expr]>,
) {
let mut span = span;
// Avoid suggestions when we don't know what's going on.
if rcvr_ty.references_error() {
return;
}

let report_candidates = |err: &mut DiagnosticBuilder<'_>,
mut sources: Vec<CandidateSource>| {
let report_candidates = |
span: Span,
err: &mut DiagnosticBuilder<'_>,
mut sources: Vec<CandidateSource>,
| {
sources.sort();
sources.dedup();
// Dynamic limit to avoid hiding just one candidate, which is silly.
Expand Down Expand Up @@ -291,9 +297,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
err.emit();
return;
} else {
span = item_name.span;
let mut err = struct_span_err!(
tcx.sess,
item_name.span,
span,
E0599,
"no {} named `{}` found for type `{}` in the current scope",
item_kind,
Expand All @@ -303,7 +310,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if let Some(suggestion) = suggestion {
// enum variant
err.span_suggestion(
item_name.span,
span,
"did you mean",
suggestion.to_string(),
Applicability::MaybeIncorrect,
Expand Down Expand Up @@ -414,9 +421,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.ty_to_string(actual), item_name));
}

report_candidates(&mut err, static_sources);
report_candidates(span, &mut err, static_sources);
} else if static_sources.len() > 1 {
report_candidates(&mut err, static_sources);
report_candidates(span, &mut err, static_sources);
}

if !unsatisfied_predicates.is_empty() {
Expand Down Expand Up @@ -461,7 +468,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
"multiple applicable items in scope");
err.span_label(span, format!("multiple `{}` found", item_name));

report_candidates(&mut err, sources);
report_candidates(span, &mut err, sources);
err.emit();
}

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/associated-const/associated-const-no-item.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no associated item named `ID` found for type `i32` in the current
--> $DIR/associated-const-no-item.rs:5:23
|
LL | const X: i32 = <i32>::ID;
| -------^^
| |
| associated item not found in `i32`
| ^^ associated item not found in `i32`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `ID`, perhaps you need to implement it:
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bogus-tag.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
| ---------- variant `Hsl` not found here
...
LL | Color::Hsl(h, s, l) => { println!("hsl"); }
| -------^^^--------- variant not found in `Color`
| ^^^ variant not found in `Color`

error: aborting due to previous error

Expand Down
16 changes: 4 additions & 12 deletions src/test/ui/did_you_mean/bad-assoc-pat.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,25 @@ error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the
--> $DIR/bad-assoc-pat.rs:3:15
|
LL | [u8]::AssocItem => {}
| ------^^^^^^^^^
| |
| associated item not found in `[u8]`
| ^^^^^^^^^ associated item not found in `[u8]`

error[E0599]: no associated item named `AssocItem` found for type `(u8, u8)` in the current scope
--> $DIR/bad-assoc-pat.rs:6:19
|
LL | (u8, u8)::AssocItem => {}
| ----------^^^^^^^^^
| |
| associated item not found in `(u8, u8)`
| ^^^^^^^^^ associated item not found in `(u8, u8)`

error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope
--> $DIR/bad-assoc-pat.rs:9:12
|
LL | _::AssocItem => {}
| ---^^^^^^^^^
| |
| associated item not found in `_`
| ^^^^^^^^^ associated item not found in `_`

error[E0599]: no associated item named `AssocItem` found for type `(u8,)` in the current scope
--> $DIR/bad-assoc-pat.rs:14:17
|
LL | &(u8,)::AssocItem => {}
| -------^^^^^^^^^
| |
| associated item not found in `(u8,)`
| ^^^^^^^^^ associated item not found in `(u8,)`

error: aborting due to 8 previous errors

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/dont-suggest-private-trait-method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ LL | struct T;
| --------- function or associated item `new` not found for this
...
LL | T::new();
| ---^^^
| |
| function or associated item not found in `T`
| ^^^ function or associated item not found in `T`

error: aborting due to previous error

Expand Down
16 changes: 8 additions & 8 deletions src/test/ui/empty/empty-struct-braces-expr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the
--> $DIR/empty-struct-braces-expr.rs:22:19
|
LL | let xe3 = XE::Empty3;
| ----^^^^^^
| | |
| | help: did you mean: `XEmpty3`
| variant not found in `empty_struct::XE`
| ^^^^^^
| |
| variant not found in `empty_struct::XE`
| help: did you mean: `XEmpty3`

error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope
--> $DIR/empty-struct-braces-expr.rs:23:19
|
LL | let xe3 = XE::Empty3();
| ----^^^^^^
| | |
| | help: did you mean: `XEmpty3`
| variant not found in `empty_struct::XE`
| ^^^^^^
| |
| variant not found in `empty_struct::XE`
| help: did you mean: `XEmpty3`

error: aborting due to 8 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0599.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | struct Foo;
| ----------- associated item `NotEvenReal` not found for this
...
LL | || if let Foo::NotEvenReal() = Foo {};
| -----^^^^^^^^^^^-- associated item not found in `Foo`
| ^^^^^^^^^^^ associated item not found in `Foo`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/invalid/invalid-path-in-const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in th
--> $DIR/invalid-path-in-const.rs:2:23
|
LL | fn f(a: [u8; u32::DOESNOTEXIST]) {}
| -----^^^^^^^^^^^^
| |
| associated item not found in `u32`
| ^^^^^^^^^^^^ associated item not found in `u32`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-22933-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ LL | enum Delicious {
| -------------- variant `PIE` not found here
...
LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize,
| -----------^^^
| |
| variant not found in `Delicious`
| ^^^ variant not found in `Delicious`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-22933-3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no associated item named `MIN` found for type `u8` in the current
--> $DIR/issue-22933-3.rs:1:22
|
LL | const FOO: [u32; u8::MIN as usize] = [];
| ----^^^
| |
| associated item not found in `u8`
| ^^^ associated item not found in `u8`

error: aborting due to previous error

Expand Down
16 changes: 4 additions & 12 deletions src/test/ui/issues/issue-23173.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ }
| ---------- variant `Homura` not found here
...
LL | use_token(&Token::Homura);
| -------^^^^^^
| |
| variant not found in `Token`
| ^^^^^^ variant not found in `Token`

error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope
--> $DIR/issue-23173.rs:11:13
Expand All @@ -16,9 +14,7 @@ LL | struct Struct {
| ------------- function or associated item `method` not found for this
...
LL | Struct::method();
| --------^^^^^^
| |
| function or associated item not found in `Struct`
| ^^^^^^ function or associated item not found in `Struct`

error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope
--> $DIR/issue-23173.rs:13:13
Expand All @@ -27,9 +23,7 @@ LL | struct Struct {
| ------------- function or associated item `method` not found for this
...
LL | Struct::method;
| --------^^^^^^
| |
| function or associated item not found in `Struct`
| ^^^^^^ function or associated item not found in `Struct`

error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope
--> $DIR/issue-23173.rs:15:13
Expand All @@ -38,9 +32,7 @@ LL | struct Struct {
| ------------- associated item `Assoc` not found for this
...
LL | Struct::Assoc;
| --------^^^^^
| |
| associated item not found in `Struct`
| ^^^^^ associated item not found in `Struct`

error: aborting due to 4 previous errors

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/issues/issue-23217.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ error[E0599]: no variant named `A` found for type `SomeEnum` in the current scop
LL | pub enum SomeEnum {
| ----------------- variant `A` not found here
LL | B = SomeEnum::A,
| ----------^
| | |
| | help: did you mean: `B`
| variant not found in `SomeEnum`
| ^
| |
| variant not found in `SomeEnum`
| help: did you mean: `B`

error: aborting due to previous error

Expand Down
16 changes: 8 additions & 8 deletions src/test/ui/issues/issue-28344.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ error[E0599]: no function or associated item named `bitor` found for type `dyn s
--> $DIR/issue-28344.rs:4:25
|
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
| --------^^^^^
| |
| function or associated item not found in `dyn std::ops::BitXor<_>`
| help: did you mean: `bitxor`
| ^^^^^
| |
| function or associated item not found in `dyn std::ops::BitXor<_>`
| help: did you mean: `bitxor`

error[E0191]: the value of the associated type `Output` (from the trait `std::ops::BitXor`) must be specified
--> $DIR/issue-28344.rs:8:13
Expand All @@ -23,10 +23,10 @@ error[E0599]: no function or associated item named `bitor` found for type `dyn s
--> $DIR/issue-28344.rs:8:21
|
LL | let g = BitXor::bitor;
| --------^^^^^
| |
| function or associated item not found in `dyn std::ops::BitXor<_>`
| help: did you mean: `bitxor`
| ^^^^^
| |
| function or associated item not found in `dyn std::ops::BitXor<_>`
| help: did you mean: `bitxor`

error: aborting due to 4 previous errors

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-28586.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no associated item named `BYTES` found for type `usize` in the cur
--> $DIR/issue-28586.rs:4:26
|
LL | impl Foo for [u8; usize::BYTES] {}
| -------^^^^^
| |
| associated item not found in `usize`
| ^^^^^ associated item not found in `usize`

error: aborting due to previous error

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/issues/issue-28971.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ LL | enum Foo {
| -------- variant `Baz` not found here
...
LL | Foo::Baz(..) => (),
| -----^^^----
| | |
| | help: did you mean: `Bar`
| variant not found in `Foo`
| ^^^
| |
| variant not found in `Foo`
| help: did you mean: `Bar`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-30123.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no function or associated item named `new_undirected` found for ty
--> $DIR/issue-30123.rs:7:33
|
LL | let ug = Graph::<i32, i32>::new_undirected();
| -------------------^^^^^^^^^^^^^^
| |
| function or associated item not found in `issue_30123_aux::Graph<i32, i32>`
| ^^^^^^^^^^^^^^ function or associated item not found in `issue_30123_aux::Graph<i32, i32>`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-38919.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no associated item named `Item` found for type `T` in the current
--> $DIR/issue-38919.rs:2:8
|
LL | T::Item;
| ---^^^^
| |
| associated item not found in `T`
| ^^^^ associated item not found in `T`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-39559.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no function or associated item named `dim` found for type `D` in t
--> $DIR/issue-39559.rs:14:21
|
LL | entries: [T; D::dim()],
| ---^^^
| |
| function or associated item not found in `D`
| ^^^ function or associated item not found in `D`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `dim`, perhaps you need to implement it:
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-3973.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ LL | struct Point {
| ------------ function or associated item `new` not found for this
...
LL | let p = Point::new(0.0, 0.0);
| -------^^^
| |
| function or associated item not found in `Point`
| ^^^ function or associated item not found in `Point`

error: aborting due to 2 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-42880.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no associated item named `String` found for type `std::string::Str
--> $DIR/issue-42880.rs:4:22
|
LL | let f = |&Value::String(_)| ();
| -------^^^^^^--- associated item not found in `std::string::String`
| ^^^^^^ associated item not found in `std::string::String`

error: aborting due to previous error

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/issues/issue-57362-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ error[E0599]: no function or associated item named `make_g` found for type `for<
--> $DIR/issue-57362-2.rs:22:25
|
LL | let x = <fn (&())>::make_g();
| ------------^^^^^^
| |
| function or associated item not found in `for<'r> fn(&'r ())`
| ^^^^^^ function or associated item not found in `for<'r> fn(&'r ())`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `make_g`, perhaps you need to implement it:
Expand Down
Loading