Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f83ecd8
Refactor the two-phase check for impls and impl items
mu001999 May 22, 2025
65bdb31
Report text_direction_codepoint_in_literal when parsing
matthewjasper May 14, 2025
e5bfd02
Avoid including text direction codepoints in lint messages
matthewjasper May 14, 2025
f652067
Warn on non-crate level text direction lints
matthewjasper May 27, 2025
419897c
Add cfg for FormatShortCmd
mu001999 May 28, 2025
4794ea1
atomic_load intrinsic: use const generic parameter for ordering
RalfJung May 24, 2025
a387c86
get rid of rustc_codegen_ssa::common::AtomicOrdering
RalfJung May 28, 2025
5e71855
remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`
fee1-dead May 23, 2025
b2e9c72
`emit_xtensa_va_arg`: use `inbounds_ptradd` instead of `inbounds_gep`
folkertdev May 27, 2025
f80e3ac
Use `cfg_attr` AST placeholder AST `cfg_attr_trace` for diagnostics
estebank Dec 3, 2024
6eb6010
Add test for issue 127911 and 128839
mu001999 May 29, 2025
94cc726
implement `va_arg` for x86_64 systemv and macOS
folkertdev May 24, 2025
c6eb1d9
rustdoc: display doc(cfg(false)) properly
lolbinarycat May 29, 2025
6a79b27
float: Use a shared `assert_biteq!` macro for tests
tgross35 May 28, 2025
9907c5a
float: Replace some approximate assertions with exact
tgross35 May 28, 2025
5446ba3
float: Enable some f16 and f128 rounding tests on miri
tgross35 May 29, 2025
70cce1c
float: Use `assert_biteq!` where possible
tgross35 May 29, 2025
7aba37d
Rollup merge of #133823 - estebank:issue-56328, r=petrochenkov
matthiaskrgr May 30, 2025
5fc3f26
Rollup merge of #141004 - matthewjasper:unicode-before-expansion, r=d…
matthiaskrgr May 30, 2025
896be66
Rollup merge of #141407 - mu001999-contrib:dead-code/refactor, r=petr…
matthiaskrgr May 30, 2025
a87bc9d
Rollup merge of #141430 - fee1-dead-contrib:push-nmzoprvtsvww, r=petr…
matthiaskrgr May 30, 2025
ad2d91c
Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3
matthiaskrgr May 30, 2025
5023691
Rollup merge of #141538 - folkertdev:systemv-x86_64-va_arg, r=working…
matthiaskrgr May 30, 2025
3ebdd59
Rollup merge of #141669 - tgross35:float-test-cleanup, r=RalfJung
matthiaskrgr May 30, 2025
71529f5
Rollup merge of #141747 - lolbinarycat:rustdoc-cfg-138112, r=Guillaum…
matthiaskrgr May 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,7 @@ dependencies = [
name = "lint-docs"
version = "0.1.0"
dependencies = [
"rustc-literal-escaper",
"serde_json",
"tempfile",
"walkdir",
Expand Down
21 changes: 21 additions & 0 deletions compiler/rustc_lint/src/early/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,27 @@ pub fn decorate_builtin_lint(
lints::ReservedMultihash { suggestion }.decorate_lint(diag);
}
}
BuiltinLintDiag::HiddenUnicodeCodepoints {
label,
count,
span_label,
labels,
escape,
spans,
} => {
lints::HiddenUnicodeCodepointsDiag {
label: &label,
count,
span_label,
labels: labels.map(|spans| lints::HiddenUnicodeCodepointsDiagLabels { spans }),
sub: if escape {
lints::HiddenUnicodeCodepointsDiagSub::Escape { spans }
} else {
lints::HiddenUnicodeCodepointsDiagSub::NoEscape { spans }
},
}
.decorate_lint(diag);
}
BuiltinLintDiag::UnusedBuiltinAttribute { attr_name, macro_name, invoc_span } => {
lints::UnusedBuiltinAttribute { invoc_span, attr_name, macro_name }.decorate_lint(diag);
}
Expand Down
136 changes: 0 additions & 136 deletions compiler/rustc_lint/src/hidden_unicode_codepoints.rs

This file was deleted.

3 changes: 0 additions & 3 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ mod errors;
mod expect;
mod for_loops_over_fallibles;
mod foreign_modules;
pub mod hidden_unicode_codepoints;
mod if_let_rescope;
mod impl_trait_overcaptures;
mod internal;
Expand Down Expand Up @@ -92,7 +91,6 @@ use deref_into_dyn_supertrait::*;
use drop_forget_useless::*;
use enum_intrinsics_non_enums::EnumIntrinsicsNonEnums;
use for_loops_over_fallibles::*;
use hidden_unicode_codepoints::*;
use if_let_rescope::IfLetRescope;
use impl_trait_overcaptures::ImplTraitOvercaptures;
use internal::*;
Expand Down Expand Up @@ -177,7 +175,6 @@ early_lint_methods!(
DeprecatedAttr: DeprecatedAttr::default(),
WhileTrue: WhileTrue,
NonAsciiIdents: NonAsciiIdents,
HiddenUnicodeCodepoints: HiddenUnicodeCodepoints,
IncompleteInternalFeatures: IncompleteInternalFeatures,
RedundantSemicolons: RedundantSemicolons,
UnusedDocComment: UnusedDocComment,
Expand Down
42 changes: 39 additions & 3 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ declare_lint_pass! {
TAIL_EXPR_DROP_ORDER,
TEST_UNSTABLE_LINT,
TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
TEXT_DIRECTION_CODEPOINT_IN_LITERAL,
TRIVIAL_CASTS,
TRIVIAL_NUMERIC_CASTS,
TYVAR_BEHIND_RAW_POINTER,
Expand Down Expand Up @@ -3782,7 +3783,6 @@ declare_lint! {
}

declare_lint! {
#[allow(text_direction_codepoint_in_literal)]
/// The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that
/// change the visual representation of text on screen in a way that does not correspond to
/// their on memory representation.
Expand All @@ -3792,7 +3792,7 @@ declare_lint! {
/// ```rust,compile_fail
/// #![deny(text_direction_codepoint_in_comment)]
/// fn main() {
/// println!("{:?}"); // '');
#[doc = " println!(\"{:?}\"); // '\u{202E}');"]
/// }
/// ```
///
Expand All @@ -3807,7 +3807,43 @@ declare_lint! {
/// their use.
pub TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
Deny,
"invisible directionality-changing codepoints in comment"
"invisible directionality-changing codepoints in comment",
crate_level_only
}

declare_lint! {
/// The `text_direction_codepoint_in_literal` lint detects Unicode codepoints that change the
/// visual representation of text on screen in a way that does not correspond to their on
/// memory representation.
///
/// ### Explanation
///
/// The unicode characters `\u{202A}`, `\u{202B}`, `\u{202D}`, `\u{202E}`, `\u{2066}`,
/// `\u{2067}`, `\u{2068}`, `\u{202C}` and `\u{2069}` make the flow of text on screen change
/// its direction on software that supports these codepoints. This makes the text "abc" display
/// as "cba" on screen. By leveraging software that supports these, people can write specially
/// crafted literals that make the surrounding code seem like it's performing one action, when
/// in reality it is performing another. Because of this, we proactively lint against their
/// presence to avoid surprises.
///
/// ### Example
///
/// ```rust,compile_fail
/// #![deny(text_direction_codepoint_in_literal)]
/// fn main() {
// ` - convince tidy that backticks match
#[doc = " println!(\"{:?}\", '\u{202E}');"]
// `
/// }
/// ```
///
/// {{produces}}
///
pub TEXT_DIRECTION_CODEPOINT_IN_LITERAL,
Deny,
"detect special Unicode codepoints that affect the visual representation of text on screen, \
changing the direction in which text flows",
crate_level_only
}

declare_lint! {
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,14 @@ pub enum BuiltinLintDiag {
is_string: bool,
suggestion: Span,
},
HiddenUnicodeCodepoints {
label: String,
count: usize,
span_label: Span,
labels: Option<Vec<(char, Span)>>,
escape: bool,
spans: Vec<(char, Span)>,
},
TrailingMacro(bool, Ident),
BreakWithLabelAndLoop(Span),
UnicodeTextFlow(Span, String),
Expand Down
Loading