-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #120586 - ShE3py:exprkind-err, r=fmease
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See #119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
- Loading branch information
Showing
38 changed files
with
785 additions
and
716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
// The compiler code necessary to support the compile_error! extension. | ||
|
||
use rustc_ast::tokenstream::TokenStream; | ||
use rustc_expand::base::{self, *}; | ||
use rustc_expand::base::{get_single_str_from_tts, DummyResult, ExtCtxt, MacResult}; | ||
use rustc_span::Span; | ||
|
||
pub fn expand_compile_error<'cx>( | ||
cx: &'cx mut ExtCtxt<'_>, | ||
sp: Span, | ||
tts: TokenStream, | ||
) -> Box<dyn base::MacResult + 'cx> { | ||
let Some(var) = get_single_str_from_tts(cx, sp, tts, "compile_error!") else { | ||
return DummyResult::any(sp); | ||
) -> Box<dyn MacResult + 'cx> { | ||
let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") { | ||
Ok(var) => var, | ||
Err(guar) => return DummyResult::any(sp, guar), | ||
}; | ||
|
||
#[expect( | ||
rustc::diagnostic_outside_of_impl, | ||
reason = "diagnostic message is specified by user" | ||
)] | ||
#[expect(rustc::diagnostic_outside_of_impl, reason = "diagnostic message is specified by user")] | ||
#[expect(rustc::untranslatable_diagnostic, reason = "diagnostic message is specified by user")] | ||
cx.dcx().span_err(sp, var.to_string()); | ||
let guar = cx.dcx().span_err(sp, var.to_string()); | ||
|
||
DummyResult::any(sp) | ||
DummyResult::any(sp, guar) | ||
} |
Oops, something went wrong.