Handle ambiguity between const unsafe fn and const unsafe impl(path) trait

This commit is contained in:
CoCo-Japan-pan
2026-02-23 12:25:17 +09:00
parent f55f6b4451
commit 2b39beaeee
+2 -2
View File
@@ -2923,8 +2923,8 @@ pub(super) fn check_fn_front_matter(&mut self, check_pub: bool, case: Case) -> b
&& !self.is_unsafe_foreign_mod()
// Rule out `async gen {` and `async gen move {`
&& !self.is_async_gen_block()
// Rule out `const unsafe auto` and `const unsafe trait`.
&& !self.is_keyword_ahead(2, &[kw::Auto, kw::Trait])
// Rule out `const unsafe auto` and `const unsafe trait` and `const unsafe impl`.
&& !self.is_keyword_ahead(2, &[kw::Auto, kw::Trait, kw::Impl])
)
})
// `extern ABI fn`