forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add changes for confusing type params
- Loading branch information
1 parent
15a1e28
commit 4ba359b
Showing
8 changed files
with
38 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,7 +239,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { | |
if p.is_self() { | ||
"Self".to_string() | ||
} else { | ||
"type parameter".to_string() | ||
p.to_string() | ||
} | ||
} | ||
ty::TyAnon(..) => "anonymized type".to_string(), | ||
|
@@ -256,13 +256,21 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { | |
use self::TypeError::*; | ||
|
||
match err.clone() { | ||
Sorts(values) => { | ||
let expected_str = values.expected.sort_string(self); | ||
let found_str = values.found.sort_string(self); | ||
if expected_str == found_str && expected_str == "closure" { | ||
db.note("no two closures, even if identical, have the same type"); | ||
db.help("consider boxing your closure and/or using it as a trait object"); | ||
} | ||
Sorts(values) | ||
=> { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
debug!("values = {:?}", values); | ||
match values | ||
{ | ||
This comment has been minimized.
Sorry, something went wrong. |
||
(ty.sty:TypeVariants::Param(param), _) | | ||
(_, ty.sty:TypeVariants::Param(param)) => { | ||
let expected_str = values.expected.sort_string(self); | ||
let found_str = values.found.sort_string(self); | ||
if expected_str == found_str && expected_str == "closure" { | ||
db.note("no two closures, even if identical, have the same type"); | ||
db.help("consider boxing your closure and/or using it as a trait object"); | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
estebank
|
||
}, | ||
_=> {}} | ||
}, | ||
TyParamDefaultMismatch(values) => { | ||
let expected = values.expected; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove prior newline