Skip to content

Commit 37fde4e

Browse files
linted -> back to: frontend; unlinted -> back to: backend
1 parent 2b7de30 commit 37fde4e

File tree

6 files changed

+46
-44
lines changed

6 files changed

+46
-44
lines changed

src/unlinted.rs renamed to src/backend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! "Unlinted" functionality (anything else than linted macros)
1+
//! "backend" functionality (anything else than linted macros)
22
//! - macros that don't need `warn/deny/forbid/allow/expect` lint rules
33
//! - non-macro functionality.
44
@@ -281,7 +281,7 @@ pub mod expecting_unsafe_fn {
281281
#[doc(hidden)]
282282
macro_rules! expecting_unsafe_fn_path {
283283
( $( $arg:expr ),+ ) => {
284-
$crate::expecting_unsafe_fn_path!( ~ { $( $arg ),+ }, $crate::unlinted::expecting_unsafe_fn )
284+
$crate::expecting_unsafe_fn_path!( ~ { $( $arg ),+ }, $crate::backend::expecting_unsafe_fn )
285285
};
286286
( ~ { $arg_first:expr, $( $arg_rest:expr ),+ }, $( $path_part:tt )+ ) => {
287287
$crate::expecting_unsafe_fn_path!( ~ { $( $arg_rest ),+ }, $( $path_part )+ ::arg )
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
// - Linted ("frontend"_ macros can (and do) invoke unlinted ("backend") macros, but not the other
2-
// way. That's because unlinted macros don't know the crate name where linted macros were loaded.
3-
// - linted macros can be recursive (between themselves, but not through unlinted ("backend")
1+
// - Linted ("frontend"_ macros can (and do) invoke backend ("backend") macros, but not the other
2+
// way. That's because backend macros don't know the crate name where linted macros were loaded.
3+
// - linted macros can be recursive (between themselves, but not through backend ("backend")
44
// macros")
55
/// "Load" prudent macros. Invoke this from the top level of your crate, and only once (once per
66
/// crate).
77
#[macro_export]
88
macro_rules! load {
99
// No lints.
1010
//
11-
// re-export all (both `linted` and `unlinted`) from `prudent` crate under module `prudent`.
11+
// re-export all (both `linted` and `backend`) from `prudent` crate under module `prudent`.
1212
() => {
1313
$crate::load!( prudent );
1414
};
1515
// No lints.
1616
//
17-
// re-export all (both `linted` and `unlinted`) from `prudent` crate, under given module name.
17+
// re-export all (both `linted` and `backend`) from `prudent` crate, under given module name.
1818
( $module_name:ident ) => {
1919
/// prudent exported in a module
2020
mod $module_name {
@@ -23,7 +23,7 @@ macro_rules! load {
2323
}
2424
};// -----------
2525

26-
// load `linted` from the given file; re-export `unlinted` from `prudent` crate; blend them
26+
// load `linted` from the given file; re-export `backend` from `prudent` crate; blend them
2727
// under a module with the given name. If `$module_name` is not given, it's `prudent`.
2828
//
2929
// Since `any` is **not** specified, this applies to `$[cfg(test)` only.
@@ -122,7 +122,7 @@ macro_rules! load {
122122
$crate::reexport_non_macros!( super::internal_prudent_linted_loaded_or_aliased );
123123
}
124124
const _VERIFY_VERSION: () = {
125-
::prudent::unlinted::verify_linted_version( $module_name::PRUDENT_INTERNAL_LINTED_VERSION );
125+
::prudent::backend::verify_linted_version( $module_name::PRUDENT_INTERNAL_LINTED_VERSION );
126126
};
127127
}
128128
}
@@ -158,7 +158,7 @@ macro_rules! reexport_macros {
158158

159159
/// Re-export
160160
/// 1. non-macros from the given `linted`_module/path. And
161-
/// 2. anything needed from `unlinted`.
161+
/// 2. anything needed from `backend`.
162162
///
163163
/// NOT a part of public API - internal.
164164
#[doc(hidden)]
@@ -172,6 +172,6 @@ macro_rules! reexport_non_macros {
172172
pub use $linted_path::{PRUDENT_INTERNAL_LINTED_VERSION};
173173

174174
#[allow(unused)]
175-
pub use ::prudent::unlinted::*;
175+
pub use ::prudent::backend::*;
176176
};
177177
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// https://github.com/prudent-rs/prudent/, https://crates.io/crates/prudent and
44
// https://docs.rs/prudent/latest/prudent.
55

6-
// For docs see linted_with_tests.rs
6+
// For docs see frontend_with_tests.rs
77
#![allow(missing_docs)]
88

99
#[doc(hidden)]
@@ -17,7 +17,7 @@ const _VERIFY_MODULE_PATH: () = {
1717
[b'p', b'r', b'u', b'd', b'e', b'n', b't', b':', b':', ..]
1818
) {
1919
panic!(
20-
"Use ONLY linted.rs in your crate(s). Do not use linted_internal.rs, as that is internal."
20+
"Use ONLY linted.rs in your crate(s). Do not use frontend_unlinted.rs, as that is internal."
2121
);
2222
}
2323
};
@@ -59,7 +59,7 @@ macro_rules! internal_prudent_unsafe_fn {
5959
// block(s).
6060
//
6161
// The rest of this comment block/lines exists the same in both linted.rs and
62-
// linted_internal.rs, but it applies to linted.rs ONLY.
62+
// frontend_unlinted.rs, but it applies to linted.rs ONLY.
6363
//
6464
// (That minimizes the number of differences between those two files.)
6565
//
@@ -113,7 +113,7 @@ macro_rules! internal_prudent_unsafe_fn {
113113
// Ensure that $fn is not safe, but `unsafe`. Using
114114
// https://doc.rust-lang.org/reference/types/function-item.html#r-type.fn-item.coercion
115115
let _ = if false {
116-
::prudent::unlinted::expecting_unsafe_fn::fun
116+
::prudent::backend::expecting_unsafe_fn::fun
117117
} else {
118118
fun
119119
};
@@ -271,7 +271,7 @@ macro_rules! internal_prudent_unsafe_method {
271271
#[expect(unsafe_code)]
272272
)?
273273
let rref = &( $self );
274-
::prudent::unlinted::shared_to_mut( rref )
274+
::prudent::backend::shared_to_mut( rref )
275275
};
276276
#[allow(unused_mut)]
277277
#[allow(invalid_value)]
@@ -510,13 +510,13 @@ pub use internal_prudent_unsafe_mut;
510510
macro_rules! internal_prudent_unsafe_val {
511511
($ptr:expr) => {{
512512
let ptr: *const _ = $ptr;
513-
::prudent::unlinted::expect_copy_ptr(ptr);
513+
::prudent::backend::expect_copy_ptr(ptr);
514514
unsafe { *ptr }
515515
}};
516516
($ptr:expr, $ptr_type:ty) => {{
517517
let ptr = $ptr;
518518
let ptr = ptr as *const $ptr_type;
519-
::prudent::unlinted::expect_copy_ptr(ptr);
519+
::prudent::backend::expect_copy_ptr(ptr);
520520
unsafe { *ptr }
521521
}};
522522
}
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ error: circular modules: src/internal_front_end.rs -> src/internal_front_end.rs
2020
const _VERIFY_MODULE_PATH: () = {
2121
let path = core::module_path!().as_bytes();
2222
if !matches!(path, b"prudent::linted") {
23-
panic!("Do NOT load linted_with_tests.rs in other crates. It's internal in prudent only.");
23+
panic!(
24+
"Do NOT load frontend_with_tests.rs in other crates. It's internal in prudent only."
25+
);
2426
}
2527
};
2628

2729
#[doc(hidden)]
2830
#[allow(unused)]
29-
pub use crate::linted_untested::PRUDENT_INTERNAL_LINTED_VERSION;
31+
pub use crate::frontend_untested::PRUDENT_INTERNAL_LINTED_VERSION;
3032

3133
/// ```compile_fail
3234
/// // @TODO Docs: at your crate's top level, use either self::prudent, or crate:;prudent (but NOT
@@ -103,7 +105,7 @@ pub use crate::linted_untested::PRUDENT_INTERNAL_LINTED_VERSION;
103105
/// }
104106
/// ```
105107
#[doc(inline)]
106-
pub use crate::linted_untested::internal_prudent_unsafe_fn;
108+
pub use crate::frontend_untested::internal_prudent_unsafe_fn;
107109

108110
// Same `compile_fail` tests as listed above for `unsafe_fn`, but here we validate the error
109111
// numbers.
@@ -149,13 +151,13 @@ pub const _: () = {};
149151
//----------------------
150152

151153
#[doc(hidden)]
152-
pub use crate::linted_untested::internal_prudent_unsafe_fn_internal_build_tuple_tree;
154+
pub use crate::frontend_untested::internal_prudent_unsafe_fn_internal_build_tuple_tree;
153155

154156
#[doc(hidden)]
155-
pub use crate::linted_untested::internal_prudent_unsafe_fn_internal_build_accessors_and_call;
157+
pub use crate::frontend_untested::internal_prudent_unsafe_fn_internal_build_accessors_and_call;
156158

157159
#[doc(hidden)]
158-
pub use crate::linted_untested::internal_prudent_unsafe_fn_internal_access_tuple_tree_field;
160+
pub use crate::frontend_untested::internal_prudent_unsafe_fn_internal_access_tuple_tree_field;
159161
//----------------------
160162

161163
/// ```compile_fail
@@ -187,7 +189,7 @@ pub use crate::linted_untested::internal_prudent_unsafe_fn_internal_access_tuple
187189
#[doc = include_str!("../violations_coverage/unsafe_method/unused_expect_unsafe/some_args.rs")]
188190
/// ```
189191
#[doc(inline)]
190-
pub use crate::linted_untested::internal_prudent_unsafe_method;
192+
pub use crate::frontend_untested::internal_prudent_unsafe_method;
191193

192194
/// ```compile_fail,E0133
193195
#[doc = include_str!("../violations_coverage/unsafe_method/sneaked_unsafe/arg.rs")]
@@ -209,10 +211,10 @@ pub const _: () = {};
209211
//----------------------
210212

211213
#[doc(hidden)]
212-
pub use crate::linted_untested::internal_prudent_unsafe_method_internal_check_args_etc;
214+
pub use crate::frontend_untested::internal_prudent_unsafe_method_internal_check_args_etc;
213215

214216
#[doc(hidden)]
215-
pub use crate::linted_untested::internal_prudent_unsafe_method_internal_build_accessors_check_args_call;
217+
pub use crate::frontend_untested::internal_prudent_unsafe_method_internal_build_accessors_check_args_call;
216218
//----------------------
217219

218220
#[allow(clippy::useless_attribute)]
@@ -259,21 +261,21 @@ pub use crate::linted_untested::internal_prudent_unsafe_method_internal_build_ac
259261
/// }
260262
/// ```
261263
#[doc(inline)]
262-
pub use crate::linted_untested::internal_prudent_unsafe_static_set;
264+
pub use crate::frontend_untested::internal_prudent_unsafe_static_set;
263265
//----------------------
264266

265267
#[doc(inline)]
266-
pub use crate::linted_untested::internal_prudent_unsafe_ref;
268+
pub use crate::frontend_untested::internal_prudent_unsafe_ref;
267269
//----------------------
268270

269271
#[doc(inline)]
270-
pub use crate::linted_untested::internal_prudent_unsafe_mut;
272+
pub use crate::frontend_untested::internal_prudent_unsafe_mut;
271273
//----------------------
272274

273275
#[doc(inline)]
274-
pub use crate::linted_untested::internal_prudent_unsafe_val;
276+
pub use crate::frontend_untested::internal_prudent_unsafe_val;
275277
//----------------------
276278

277279
#[doc(inline)]
278-
pub use crate::linted_untested::internal_prudent_unsafe_set;
280+
pub use crate::frontend_untested::internal_prudent_unsafe_set;
279281
//----------------------

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,18 @@ macro_rules! internal_coverage_positive {
120120
};
121121
}
122122

123-
pub mod unlinted;
123+
pub mod backend;
124124

125125
/// Linted macros.
126-
#[path = "linted_internal.rs"]
127-
mod linted_untested;
126+
#[path = "frontend_unlinted.rs"]
127+
mod frontend_untested;
128128

129-
#[path = "linted_with_tests.rs"]
129+
#[path = "frontend_with_tests.rs"]
130130
#[doc(hidden)]
131131
pub mod linted;
132132

133133
/// No need to be public. The only functionality is macros, which are exported even if private.
134-
mod linted_loader;
134+
mod frontend_loader;
135135

136136
const _VERIFY_CRATE_NAME: () = {
137137
let path = core::module_path!().as_bytes();

src/linted.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// https://github.com/prudent-rs/prudent/, https://crates.io/crates/prudent and
66
// https://docs.rs/prudent/latest/prudent.
77

8-
// For docs see linted_with_tests.rs
8+
// For docs see frontend_with_tests.rs
99
#![allow(missing_docs)]
1010

1111
#[doc(hidden)]
@@ -19,7 +19,7 @@ const _VERIFY_MODULE_PATH: () = {
1919
[b'p', b'r', b'u', b'd', b'e', b'n', b't', b':', b':', ..]
2020
) {
2121
panic!(
22-
"Use ONLY linted.rs in your crate(s). Do not use linted_internal.rs, as that is internal."
22+
"Use ONLY linted.rs in your crate(s). Do not use frontend_unlinted.rs, as that is internal."
2323
);
2424
}
2525
};
@@ -61,7 +61,7 @@ macro_rules! internal_prudent_unsafe_fn {
6161
// block(s).
6262
//
6363
// The rest of this comment block/lines exists the same in both linted.rs and
64-
// linted_internal.rs, but it applies to linted.rs ONLY.
64+
// frontend_unlinted.rs, but it applies to linted.rs ONLY.
6565
//
6666
// (That minimizes the number of differences between those two files.)
6767
//
@@ -115,7 +115,7 @@ macro_rules! internal_prudent_unsafe_fn {
115115
// Ensure that $fn is not safe, but `unsafe`. Using
116116
// https://doc.rust-lang.org/reference/types/function-item.html#r-type.fn-item.coercion
117117
let _ = if false {
118-
::prudent::unlinted::expecting_unsafe_fn::fun
118+
::prudent::backend::expecting_unsafe_fn::fun
119119
} else {
120120
fun
121121
};
@@ -274,7 +274,7 @@ macro_rules! internal_prudent_unsafe_method {
274274
#[expect(unsafe_code)]
275275
)?
276276
let rref = &( $self );
277-
::prudent::unlinted::shared_to_mut( rref )
277+
::prudent::backend::shared_to_mut( rref )
278278
};
279279
#[allow(unused_mut)]
280280
#[allow(invalid_value)] // for &str and other types where zeroed() issues invalid_value warning.
@@ -512,13 +512,13 @@ pub use internal_prudent_unsafe_mut;
512512
macro_rules! internal_prudent_unsafe_val {
513513
($ptr:expr) => {{
514514
let ptr: *const _ = $ptr;
515-
::prudent::unlinted::expect_copy_ptr(ptr);
515+
::prudent::backend::expect_copy_ptr(ptr);
516516
unsafe { *ptr }
517517
}};
518518
($ptr:expr, $ptr_type:ty) => {{
519519
let ptr = $ptr;
520520
let ptr = ptr as *const $ptr_type;
521-
::prudent::unlinted::expect_copy_ptr(ptr);
521+
::prudent::backend::expect_copy_ptr(ptr);
522522
unsafe { *ptr }
523523
}};
524524
}

0 commit comments

Comments
 (0)