diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-27 09:51:49 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-27 09:51:49 +0000 |
commit | 8cfc1cd95b6eb9c94f037cfe866c92d51c58c930 (patch) | |
tree | e539dcb18229e328628720661c50d928a72afea1 /crates/ide | |
parent | 7f346f9ae17ff9ebaeb24e5bfc4aa56f6ec13191 (diff) | |
parent | ae6376d74cf354a71a83d8c1dcc93589acbce6ea (diff) |
Merge #6376
6376: Avoid impls_fnonce to return true when the trait solving is ambiguous r=flodiebold a=GrayJack
This PR should fix #6375
This adds a variation of `method_resolution::implements_trait` called `method_resolution::implements_trait_unique`, that only returns true when the trait solving is unique, and also change `impls_fnonce` to use the later instead.
I also added a test just to be sure.
Co-authored-by: GrayJack <[email protected]>
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/syntax_highlighting/test_data/highlighting.html | 6 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/tests.rs | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index c6b4f5a00..ee115972b 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html | |||
@@ -115,6 +115,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
115 | <span class="value_param callable">f</span><span class="punctuation">(</span><span class="punctuation">)</span> | 115 | <span class="value_param callable">f</span><span class="punctuation">(</span><span class="punctuation">)</span> |
116 | <span class="punctuation">}</span> | 116 | <span class="punctuation">}</span> |
117 | 117 | ||
118 | <span class="keyword">fn</span> <span class="function declaration">foobar</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="operator">-></span> <span class="keyword">impl</span> <span class="unresolved_reference">Copy</span> <span class="punctuation">{</span><span class="punctuation">}</span> | ||
119 | |||
120 | <span class="keyword">fn</span> <span class="function declaration">foo</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> | ||
121 | <span class="keyword">let</span> <span class="variable declaration">bar</span> <span class="operator">=</span> <span class="function">foobar</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> | ||
122 | <span class="punctuation">}</span> | ||
123 | |||
118 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> <span class="punctuation">{</span> | 124 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> <span class="punctuation">{</span> |
119 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">}</span> | 125 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">}</span> |
120 | <span class="punctuation">}</span> | 126 | <span class="punctuation">}</span> |
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index dd43f9dd9..5ea712cf5 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -89,6 +89,12 @@ fn baz<F: Fn() -> ()>(f: F) { | |||
89 | f() | 89 | f() |
90 | } | 90 | } |
91 | 91 | ||
92 | fn foobar() -> impl Copy {} | ||
93 | |||
94 | fn foo() { | ||
95 | let bar = foobar(); | ||
96 | } | ||
97 | |||
92 | macro_rules! def_fn { | 98 | macro_rules! def_fn { |
93 | ($($tt:tt)*) => {$($tt)*} | 99 | ($($tt:tt)*) => {$($tt)*} |
94 | } | 100 | } |