Skip to content

Commit 50d5b2b

Browse files
committed
Deploying to master from @ gfx-rs/wgpu@826db5e 🚀
1 parent 4fd7884 commit 50d5b2b

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

doc/naga/proc/struct.ConstantEvaluator.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
expressions - to the arena. See the <a href="struct.ConstantEvaluator.html#method.try_eval_and_append" title="method naga::proc::ConstantEvaluator::try_eval_and_append"><code>try_eval_and_append</code></a> method for details.</p>
99
<p>A <code>ConstantEvaluator</code> also holds whatever information we need to carry out
1010
that evaluation: types, other constants, and so on.</p>
11-
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ConstantEvaluator%3C'a%3E" class="impl"><a class="src rightside" href="../../src/naga/proc/constant_evaluator.rs.html#589-2173">source</a><a href="#impl-ConstantEvaluator%3C'a%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="struct" href="struct.ConstantEvaluator.html" title="struct naga::proc::ConstantEvaluator">ConstantEvaluator</a>&lt;'a&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.for_wgsl_module" class="method"><a class="src rightside" href="../../src/naga/proc/constant_evaluator.rs.html#594-608">source</a><h4 class="code-header">pub fn <a href="#method.for_wgsl_module" class="fn">for_wgsl_module</a>(
11+
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ConstantEvaluator%3C'a%3E" class="impl"><a class="src rightside" href="../../src/naga/proc/constant_evaluator.rs.html#589-2167">source</a><a href="#impl-ConstantEvaluator%3C'a%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="struct" href="struct.ConstantEvaluator.html" title="struct naga::proc::ConstantEvaluator">ConstantEvaluator</a>&lt;'a&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.for_wgsl_module" class="method"><a class="src rightside" href="../../src/naga/proc/constant_evaluator.rs.html#594-608">source</a><h4 class="code-header">pub fn <a href="#method.for_wgsl_module" class="fn">for_wgsl_module</a>(
1212
module: &amp;'a mut <a class="struct" href="../struct.Module.html" title="struct naga::Module">Module</a>,
1313
global_expression_kind_tracker: &amp;'a mut <a class="struct" href="struct.ExpressionKindTracker.html" title="struct naga::proc::ExpressionKindTracker">ExpressionKindTracker</a>,
1414
in_override_ctx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>

doc/src/naga/proc/constant_evaluator.rs.html

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2964,12 +2964,6 @@
29642964
<a href="#2963" id="2963">2963</a>
29652965
<a href="#2964" id="2964">2964</a>
29662966
<a href="#2965" id="2965">2965</a>
2967-
<a href="#2966" id="2966">2966</a>
2968-
<a href="#2967" id="2967">2967</a>
2969-
<a href="#2968" id="2968">2968</a>
2970-
<a href="#2969" id="2969">2969</a>
2971-
<a href="#2970" id="2970">2970</a>
2972-
<a href="#2971" id="2971">2971</a>
29732967
</pre></div><pre class="rust"><code><span class="kw">use </span>std::iter;
29742968

29752969
<span class="kw">use </span>arrayvec::ArrayVec;
@@ -4780,29 +4774,23 @@
47804774

47814775
<span class="kw">_ </span>=&gt; <span class="kw">match </span>(left_value, right_value) {
47824776
(Literal::I32(a), Literal::I32(b)) =&gt; Literal::I32(<span class="kw">match </span>op {
4783-
BinaryOperator::Add =&gt; a.checked_add(b).ok_or_else(|| {
4784-
ConstantEvaluatorError::Overflow(<span class="string">"addition"</span>.into())
4785-
})<span class="question-mark">?</span>,
4786-
BinaryOperator::Subtract =&gt; a.checked_sub(b).ok_or_else(|| {
4787-
ConstantEvaluatorError::Overflow(<span class="string">"subtraction"</span>.into())
4788-
})<span class="question-mark">?</span>,
4789-
BinaryOperator::Multiply =&gt; a.checked_mul(b).ok_or_else(|| {
4790-
ConstantEvaluatorError::Overflow(<span class="string">"multiplication"</span>.into())
4791-
})<span class="question-mark">?</span>,
4792-
BinaryOperator::Divide =&gt; a.checked_div(b).ok_or_else(|| {
4777+
BinaryOperator::Add =&gt; a.wrapping_add(b),
4778+
BinaryOperator::Subtract =&gt; a.wrapping_sub(b),
4779+
BinaryOperator::Multiply =&gt; a.wrapping_mul(b),
4780+
BinaryOperator::Divide =&gt; {
47934781
<span class="kw">if </span>b == <span class="number">0 </span>{
4794-
ConstantEvaluatorError::DivisionByZero
4782+
<span class="kw">return </span><span class="prelude-val">Err</span>(ConstantEvaluatorError::DivisionByZero);
47954783
} <span class="kw">else </span>{
4796-
ConstantEvaluatorError::Overflow(<span class="string">"division"</span>.into())
4784+
a.wrapping_div(b)
47974785
}
4798-
})<span class="question-mark">?</span>,
4799-
BinaryOperator::Modulo =&gt; a.checked_rem(b).ok_or_else(|| {
4786+
}
4787+
BinaryOperator::Modulo =&gt; {
48004788
<span class="kw">if </span>b == <span class="number">0 </span>{
4801-
ConstantEvaluatorError::RemainderByZero
4789+
<span class="kw">return </span><span class="prelude-val">Err</span>(ConstantEvaluatorError::RemainderByZero);
48024790
} <span class="kw">else </span>{
4803-
ConstantEvaluatorError::Overflow(<span class="string">"remainder"</span>.into())
4791+
a.wrapping_rem(b)
48044792
}
4805-
})<span class="question-mark">?</span>,
4793+
}
48064794
BinaryOperator::And =&gt; a &amp; b,
48074795
BinaryOperator::ExclusiveOr =&gt; a ^ b,
48084796
BinaryOperator::InclusiveOr =&gt; a | b,

0 commit comments

Comments
 (0)