rust/src
Zack M. Davis aba56ddd05 type error method suggestions use whitelisted identity-like conversions
Previously, on a type mismatch (and if this wasn't preëmpted by a
higher-priority suggestion), we would look for argumentless methods
returning the expected type, and list them in a `help` note.

This had two major shortcomings. Firstly, a lot of the suggestions didn't
really make sense (if you used a &str where a String was expected,
`.to_ascii_uppercase()` is probably not the solution you were hoping
for). Secondly, we weren't generating suggestions from the most useful
traits!

We address the first problem with an internal
`#[rustc_conversion_suggestion]` attribute meant to mark methods that keep
the "same value" in the relevant sense, just converting the type. We
address the second problem by making `FnCtxt.probe_for_return_type` pass
the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe
because grep reveals no other callers of `probe_for_return_type`.

Also, structured suggestions are preferred (because they're pretty, but
also for RLS and friends).

Also also, we make the E0055 autoderef recursion limit error use the
one-time-diagnostics set, because we can potentially hit the limit a lot
during probing. (Without this,
test/ui/did_you_mean/recursion_limit_deref.rs would report "aborting due to
51 errors").

Unfortunately, the trait probing is still not all one would hope for: at a
minimum, we don't know how to rule out `into()` in cases where it wouldn't
actually work, and we don't know how to rule in `.to_owned()` where it
would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME.

This is hoped to resolve #42929, #44672, and #45777.
2018-01-06 17:15:59 -08:00
..
binaryen@1c9bf65aa0 Update miri to rustc changes 2017-12-06 09:25:29 +01:00
bootstrap Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton 2018-01-06 14:50:14 +00:00
build_helper Revert "Add a file to trivially disable tool building or testing" 2017-12-27 00:00:45 +08:00
ci Bump to 1.25.0 2018-01-04 07:21:22 -08:00
dlmalloc@d3812c3acc Update miri to rustc changes 2017-12-06 09:25:29 +01:00
doc Rollup merge of #47117 - tinaun:no_more_dups, r=frewsxcv 2018-01-03 16:57:58 +08:00
etc Correct the return type for x86_mm256_sad_epu8 2017-12-21 22:58:03 +00:00
grammar Update miri to rustc changes 2017-12-06 09:25:29 +01:00
jemalloc@1f5a28755e
liballoc type error method suggestions use whitelisted identity-like conversions 2018-01-06 17:15:59 -08:00
liballoc_jemalloc Add CloudABI to the list of systems on which we stub out alloc_jemalloc. 2017-12-30 10:00:35 +01:00
liballoc_system Build the right platform module on CloudABI. 2017-12-31 13:21:46 +01:00
libarena Fix docs for future pulldown migration 2018-01-01 14:44:12 +01:00
libbacktrace Update miri to rustc changes 2017-12-06 09:25:29 +01:00
libcompiler_builtins@0ba07e4926 Update compiler_builtins 2017-12-26 22:22:21 -02:00
libcore Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton 2018-01-06 14:50:14 +00:00
libfmt_macros Update miri to rustc changes 2017-12-06 09:25:29 +01:00
libgetopts Update miri to rustc changes 2017-12-06 09:25:29 +01:00
libgraphviz Fix docs for future pulldown migration 2018-01-01 14:44:12 +01:00
liblibc@ef9eefb6df add aarch64-unknown-openbsd support 2017-12-17 19:48:31 +01:00
libpanic_abort Update miri to rustc changes 2017-12-06 09:25:29 +01:00
libpanic_unwind Update miri to rustc changes 2017-12-06 09:25:29 +01:00
libproc_macro Auto merge of #47099 - SergioBenitez:master, r=jseyfried 2018-01-06 12:02:36 +00:00
libprofiler_builtins Update miri to rustc changes 2017-12-06 09:25:29 +01:00
librustc Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton 2018-01-06 14:50:14 +00:00
librustc_allocator Update miri to rustc changes 2017-12-06 09:25:29 +01:00
librustc_apfloat Fix docs for future pulldown migration 2018-01-01 14:44:12 +01:00
librustc_asan
librustc_back Rollup merge of #47110 - EdSchouten:cloudabi-tls, r=kennytm 2018-01-05 17:22:06 +08:00
librustc_binaryen Update miri to rustc changes 2017-12-06 09:25:29 +01:00
librustc_borrowck Auto merge of #47124 - estebank:loan-paths, r=nikomatsakis 2018-01-04 05:52:39 +00:00
librustc_const_eval rustc: Don't use relative paths for extended errors 2018-01-04 07:21:22 -08:00
librustc_const_math Update miri to rustc changes 2017-12-06 09:25:29 +01:00
librustc_cratesio_shim
librustc_data_structures Fix docs for future pulldown migration 2018-01-01 14:44:12 +01:00
librustc_driver rustc: Don't use relative paths for extended errors 2018-01-04 07:21:22 -08:00
librustc_errors Only bump error count when we are sure that the diagnostic is not a repetition. 2018-01-03 00:42:12 +01:00
librustc_incremental incr.comp.: Use an IndexVec instead of a hashmap for storing result hashes. 2017-12-20 11:14:31 +01:00
librustc_lint Auto merge of #46907 - varkor:contrib-8, r=nagisa 2018-01-05 05:20:23 +00:00
librustc_llvm Remove unused function LLVMRustGetValueContext() 2018-01-04 08:57:14 +01:00
librustc_lsan
librustc_metadata Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton 2018-01-06 14:50:14 +00:00
librustc_mir Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton 2018-01-06 14:50:14 +00:00
librustc_msan
librustc_passes rustc: Don't use relative paths for extended errors 2018-01-04 07:21:22 -08:00
librustc_platform_intrinsics Correct the return type for x86_mm256_sad_epu8 2017-12-21 22:58:03 +00:00
librustc_plugin rustc: Don't use relative paths for extended errors 2018-01-04 07:21:22 -08:00
librustc_privacy rustc: Don't use relative paths for extended errors 2018-01-04 07:21:22 -08:00
librustc_resolve rustc: Don't use relative paths for extended errors 2018-01-04 07:21:22 -08:00
librustc_save_analysis Add GenericParam, refactor Generics in ast, hir, rustdoc 2017-12-21 13:38:10 +01:00
librustc_trans Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichton 2018-01-06 14:50:14 +00:00
librustc_trans_utils Update crates and submodules to pull doc fixes 2018-01-01 14:44:10 +01:00
librustc_tsan
librustc_typeck type error method suggestions use whitelisted identity-like conversions 2018-01-06 17:15:59 -08:00
librustdoc Auto merge of #47083 - CAD97:issue-46976, r=nikomatsakis 2018-01-06 09:22:16 +00:00
libserialize Add trailing newlines to files which have no trailing newlines. 2017-12-30 15:50:52 +08:00
libstd type error method suggestions use whitelisted identity-like conversions 2018-01-06 17:15:59 -08:00
libstd_unicode Move static code outside of unciode.py. 2018-01-02 22:51:22 -05:00
libsyntax type error method suggestions use whitelisted identity-like conversions 2018-01-06 17:15:59 -08:00
libsyntax_ext Prefer to use attr::contains_name() and attr::find_by_name() 2017-12-28 12:32:24 +09:00
libsyntax_pos Fix docs for future pulldown migration 2018-01-01 14:44:12 +01:00
libterm Use Try syntax for Option in place of macros or match 2017-12-09 14:18:33 -08:00
libtest Restore a FIXME that was removed by one of my previous changes. 2018-01-03 15:40:37 +01:00
libunwind Link against -lunwind on CloudABI. 2017-12-26 23:32:42 +01:00
llvm@2717444753 Try to find a better pass manager order 2017-12-24 00:15:12 +02:00
rt
rtstartup Update miri to rustc changes 2017-12-06 09:25:29 +01:00
rustc Update miri to rustc changes 2017-12-06 09:25:29 +01:00
rustllvm Rollup merge of #47173 - dotdash:cleanup, r=michaelwoerister 2018-01-06 02:13:34 +01:00
test type error method suggestions use whitelisted identity-like conversions 2018-01-06 17:15:59 -08:00
tools Auto merge of #47155 - nerd2:debuginfo_test_fix, r=alexcrichton 2018-01-06 05:20:22 +00:00
Cargo.lock Remove dependency on regex 2018-01-02 01:06:17 +00:00
Cargo.toml cargo update and add miri as the rustc workspace member. 2017-12-27 00:00:44 +08:00
stage0.txt Bump to 1.25.0 2018-01-04 07:21:22 -08:00