Merge #6379
6379: Highlight never type as BuiltinType r=matklad a=Veykril Fixes #6374 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
53c7aead8f
@ -562,6 +562,9 @@ fn highlight_element(
|
||||
T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => {
|
||||
HighlightTag::Macro.into()
|
||||
}
|
||||
T![!] if element.parent().and_then(ast::NeverType::cast).is_some() => {
|
||||
HighlightTag::BuiltinType.into()
|
||||
}
|
||||
T![*] if element.parent().and_then(ast::PtrType::cast).is_some() => {
|
||||
HighlightTag::Keyword.into()
|
||||
}
|
||||
|
@ -110,6 +110,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||
<span class="function">foo</span><span class="operator">::</span><span class="punctuation"><</span><span class="lifetime">'a</span><span class="punctuation">,</span> <span class="builtin_type">i32</span><span class="punctuation">></span><span class="punctuation">(</span><span class="punctuation">)</span>
|
||||
<span class="punctuation">}</span>
|
||||
|
||||
<span class="keyword">fn</span> <span class="function declaration">never</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="operator">-></span> <span class="builtin_type">!</span> <span class="punctuation">{</span>
|
||||
<span class="keyword control">loop</span> <span class="punctuation">{</span><span class="punctuation">}</span>
|
||||
<span class="punctuation">}</span>
|
||||
|
||||
<span class="keyword">use</span> <span class="module">ops</span><span class="operator">::</span><span class="trait">Fn</span><span class="punctuation">;</span>
|
||||
<span class="keyword">fn</span> <span class="function declaration">baz</span><span class="punctuation"><</span><span class="type_param declaration">F</span><span class="punctuation">:</span> <span class="trait">Fn</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="value_param declaration callable">f</span><span class="punctuation">:</span> <span class="type_param">F</span><span class="punctuation">)</span> <span class="punctuation">{</span>
|
||||
<span class="value_param callable">f</span><span class="punctuation">(</span><span class="punctuation">)</span>
|
||||
@ -185,6 +189,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||
|
||||
<span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="numeric_literal">-</span><span class="numeric_literal">42</span><span class="punctuation">;</span>
|
||||
<span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="operator">-</span><span class="variable">baz</span><span class="punctuation">;</span>
|
||||
|
||||
<span class="keyword">let</span> <span class="punctuation">_</span> <span class="operator">=</span> <span class="operator">!</span><span class="bool_literal">true</span><span class="punctuation">;</span>
|
||||
<span class="punctuation">}</span>
|
||||
|
||||
<span class="keyword">enum</span> <span class="enum declaration">Option</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="punctuation">{</span>
|
||||
|
@ -84,6 +84,10 @@ fn foo<'a, T>() -> T {
|
||||
foo::<'a, i32>()
|
||||
}
|
||||
|
||||
fn never() -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
use ops::Fn;
|
||||
fn baz<F: Fn() -> ()>(f: F) {
|
||||
f()
|
||||
@ -159,6 +163,8 @@ fn main() {
|
||||
|
||||
let baz = -42;
|
||||
let baz = -baz;
|
||||
|
||||
let _ = !true;
|
||||
}
|
||||
|
||||
enum Option<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user