Skip to content

Commit f5c0820

Browse files
committed
Prepare for WIP PR opening
1 parent 98407bd commit f5c0820

File tree

6 files changed

+11
-67
lines changed

6 files changed

+11
-67
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Session.vim
3030
!/tests/run-make/thumb-none-qemu/example/.cargo
3131

3232
## Configuration
33-
config.toml
33+
/config.toml
3434
/Makefile
3535
config.mk
3636
config.stamp

compiler/rustc_builtin_macros/src/compile_error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pub(crate) fn expand_compile_error<'cx>(
1818
Err(guar) => return ExpandResult::Ready(DummyResult::any(sp, guar)),
1919
};
2020

21-
// #[expect(rustc::diagnostic_outside_of_impl, reason = "diagnostic message is specified by user")]
22-
// #[expect(rustc::untranslatable_diagnostic, reason = "diagnostic message is specified by user")]
21+
#[expect(rustc::diagnostic_outside_of_impl, reason = "diagnostic message is specified by user")]
22+
#[expect(rustc::untranslatable_diagnostic, reason = "diagnostic message is specified by user")]
2323
let guar = cx.dcx().span_err(sp, var.to_string());
2424

2525
ExpandResult::Ready(DummyResult::any(sp, guar))

compiler/rustc_builtin_macros/src/errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,10 @@ pub(crate) struct EnvNotDefinedWithUserMessage {
428428
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for EnvNotDefinedWithUserMessage {
429429
#[track_caller]
430430
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
431-
// #[expect(
432-
// rustc::untranslatable_diagnostic,
433-
// reason = "cannot translate user-provided messages"
434-
// )]
431+
#[expect(
432+
rustc::untranslatable_diagnostic,
433+
reason = "cannot translate user-provided messages"
434+
)]
435435
let mut diag = Diag::new(dcx, level, self.msg_from_user.to_string());
436436
diag.span(self.span);
437437
diag

compiler/rustc_lint/src/late.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
376376
// let lints_to_emit = &lints_that_can_emit.0;
377377
// let lints_allowed = &lints_that_can_emit.1;
378378

379-
// Now, we'll filtered passes in a way that discards any lint that
379+
// Now, we'll filtered passes in a way that discards any lint that won't trigger.
380+
// If any lint is a given pass is detected to be emitted, we will keep that pass.
381+
// Otherwise, we don't
380382
let mut filtered_passes: Vec<Box<dyn LateLintPass<'tcx>>> = passes
381383
.into_iter()
382384
.filter(|pass| {
@@ -390,17 +392,6 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
390392
|| (!lints_allowed.contains(&lint_name)
391393
&& lint.default_level != crate::Level::Allow)
392394
})
393-
// if passes_lints[i].iter().any(|&lint| {
394-
// let symbol =
395-
// &lint.name.to_lowercase()
396-
// // Doing some calculations here to account for those separators
397-
// [lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
398-
399-
// // ^^^ Expensive, but more expensive would be having to
400-
// // cast every element to &str
401-
402-
// (!lints_allowed.contains(&lint.name)
403-
// && lint.default_level != crate::Level::Allow)
404395
})
405396
.collect();
406397

compiler/rustc_lint/src/levels.rs

-47
Original file line numberDiff line numberDiff line change
@@ -520,53 +520,6 @@ impl<'tcx> LintLevelMinimum<'tcx> {
520520
}
521521
}
522522

523-
// impl<'tcx> Visitor<'tcx> for LintLevelMinimum<'tcx> {
524-
// type NestedFilter = nested_filter::All;
525-
526-
// fn nested_visit_map(&mut self) -> Self::Map {
527-
// self.tcx.hir()
528-
// }
529-
530-
// fn visit_attribute(&mut self, attribute: &'tcx ast::Attribute) {
531-
// if let Some(meta) = attribute.meta() {
532-
// if [sym::warn, sym::deny, sym::forbid, sym::expect]
533-
// .iter()
534-
// .any(|kind| meta.has_name(*kind))
535-
// {
536-
// // SAFETY: Lint attributes are always a metalist inside a
537-
// // metalist (even with just one lint).
538-
// for meta_list in meta.meta_item_list().unwrap() {
539-
// // If it's a tool lint (e.g. clippy::my_clippy_lint)
540-
// if let ast::NestedMetaItem::MetaItem(meta_item) = meta_list {
541-
// if meta_item.path.segments.len() == 1 {
542-
// self.lints_to_emit.push(
543-
// // SAFETY: Lint attributes can only have literals
544-
// meta_list.ident().unwrap().name,
545-
// );
546-
// } else {
547-
// self.lints_to_emit.push(meta_item.path.segments[1].ident.name);
548-
// }
549-
// }
550-
// }
551-
// // We handle #![allow]s differently, as these remove checking rather than adding.
552-
// } else if meta.has_name(sym::allow)
553-
// && let ast::AttrStyle::Inner = attribute.style
554-
// {
555-
// for meta_list in meta.meta_item_list().unwrap() {
556-
// // If it's a tool lint (e.g. clippy::my_clippy_lint)
557-
// if let ast::NestedMetaItem::MetaItem(meta_item) = meta_list {
558-
// if meta_item.path.segments.len() == 1 {
559-
// self.lints_allowed.push(meta_list.name_or_empty())
560-
// } else {
561-
// self.lints_allowed.push(meta_item.path.segments[1].ident.name);
562-
// }
563-
// }
564-
// }
565-
// }
566-
// }
567-
// }
568-
// }
569-
570523
pub struct LintLevelsBuilder<'s, P> {
571524
sess: &'s Session,
572525
features: &'s Features,

compiler/rustc_parse/src/parser/attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'a> Parser<'a> {
139139
&& let Some(meta) = attr.meta()
140140
{
141141
if let Some(first) = meta.path.segments.first() {
142-
if [sym::warn, sym::deny, sym::forbid]
142+
if [sym::warn, sym::deny, sym::forbid, sym::expect]
143143
.iter()
144144
.any(|symbol| first.ident.name == *symbol)
145145
{

0 commit comments

Comments
 (0)