|
1150 | 1150 | <a href="#1149" id="1149">1149</a> |
1151 | 1151 | <a href="#1150" id="1150">1150</a> |
1152 | 1152 | <a href="#1151" id="1151">1151</a> |
1153 | | -<a href="#1152" id="1152">1152</a></pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::diagnostic_filter::ConflictingDiagnosticRuleError; |
| 1153 | +<a href="#1152" id="1152">1152</a> |
| 1154 | +<a href="#1153" id="1153">1153</a> |
| 1155 | +<a href="#1154" id="1154">1154</a> |
| 1156 | +<a href="#1155" id="1155">1155</a> |
| 1157 | +<a href="#1156" id="1156">1156</a> |
| 1158 | +<a href="#1157" id="1157">1157</a> |
| 1159 | +<a href="#1158" id="1158">1158</a> |
| 1160 | +<a href="#1159" id="1159">1159</a> |
| 1161 | +<a href="#1160" id="1160">1160</a> |
| 1162 | +<a href="#1161" id="1161">1161</a> |
| 1163 | +<a href="#1162" id="1162">1162</a> |
| 1164 | +<a href="#1163" id="1163">1163</a> |
| 1165 | +<a href="#1164" id="1164">1164</a> |
| 1166 | +<a href="#1165" id="1165">1165</a> |
| 1167 | +<a href="#1166" id="1166">1166</a> |
| 1168 | +<a href="#1167" id="1167">1167</a> |
| 1169 | +<a href="#1168" id="1168">1168</a> |
| 1170 | +<a href="#1169" id="1169">1169</a> |
| 1171 | +<a href="#1170" id="1170">1170</a> |
| 1172 | +<a href="#1171" id="1171">1171</a> |
| 1173 | +<a href="#1172" id="1172">1172</a> |
| 1174 | +<a href="#1173" id="1173">1173</a> |
| 1175 | +<a href="#1174" id="1174">1174</a> |
| 1176 | +<a href="#1175" id="1175">1175</a></pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::diagnostic_filter::ConflictingDiagnosticRuleError; |
1154 | 1177 | <span class="kw">use </span><span class="kw">crate</span>::front::wgsl::parse::directive::enable_extension::{ |
1155 | 1178 | EnableExtension, UnimplementedEnableExtension, |
1156 | 1179 | }; |
|
1414 | 1437 | found: u32, |
1415 | 1438 | }, |
1416 | 1439 | FunctionReturnsVoid(Span), |
| 1440 | + FunctionMustUseUnused(Span), |
| 1441 | + FunctionMustUseReturnsVoid(Span, Span), |
1417 | 1442 | InvalidWorkGroupUniformLoad(Span), |
1418 | 1443 | Internal(<span class="kw-2">&</span><span class="lifetime">'static </span>str), |
1419 | 1444 | ExpectedConstExprConcreteIntegerScalar(Span), |
|
1972 | 1997 | <span class="string">"perhaps you meant to call the function in a separate statement?"</span>.into(), |
1973 | 1998 | ], |
1974 | 1999 | }, |
| 2000 | + Error::FunctionMustUseUnused(call) => ParseError { |
| 2001 | + message: <span class="string">"unused return value from function annotated with @must_use"</span>.into(), |
| 2002 | + labels: <span class="macro">vec!</span>[(call, <span class="string">""</span>.into())], |
| 2003 | + notes: <span class="macro">vec!</span>[ |
| 2004 | + <span class="macro">format!</span>( |
| 2005 | + <span class="string">"function '{}' is declared with `@must_use` attribute"</span>, |
| 2006 | + <span class="kw-2">&</span>source[call], |
| 2007 | + ), |
| 2008 | + <span class="string">"use a phony assignment or declare a value using the function call as the initializer"</span>.into(), |
| 2009 | + ], |
| 2010 | + }, |
| 2011 | + Error::FunctionMustUseReturnsVoid(attr, signature) => ParseError { |
| 2012 | + message: <span class="string">"function annotated with @must_use but does not return any value"</span>.into(), |
| 2013 | + labels: <span class="macro">vec!</span>[ |
| 2014 | + (attr, <span class="string">""</span>.into()), |
| 2015 | + (signature, <span class="string">""</span>.into()), |
| 2016 | + ], |
| 2017 | + notes: <span class="macro">vec!</span>[ |
| 2018 | + <span class="string">"declare a return type or remove the attribute"</span>.into(), |
| 2019 | + ], |
| 2020 | + }, |
1975 | 2021 | Error::InvalidWorkGroupUniformLoad(span) => ParseError { |
1976 | 2022 | message: <span class="string">"incorrect type passed to workgroupUniformLoad"</span>.into(), |
1977 | 2023 | labels: <span class="macro">vec!</span>[(span, <span class="string">""</span>.into())], |
|
0 commit comments