Skip to content

Commit c63e166

Browse files
frontend_linted/frontend_unlinted and backend
1 parent 37fde4e commit c63e166

23 files changed

+95
-96
lines changed

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The pains (that pend [rust-lang/rust#110613](https://github.com/rust-lang/rust/i
5151
macros are loaded in your crate's namespace, and hence they can't use `$crate` metavariable to
5252
refer to the rest of the macros and non-macro functionality).
5353
- In doctests
54-
- load with `any:` like `::prudent::load!(any: "linted.rs");`
54+
- load with `any:` like `::prudent::load!(any: "frontend_linted.rs");`
5555
- import with `use crate::prudent::*;` which you put outside of your `fn main()`
5656
- have `fn main()`
5757
- do **not** have the test logic at the top level, otherwise rustdoc/doctest mechanism
@@ -117,7 +117,7 @@ let _todo = ();
117117
```
118118

119119
```rust
120-
::prudent::load!(any: "linted.rs");
120+
::prudent::load!(any: "frontend_linted.rs");
121121
use crate::prudent::unsafe_method;
122122
struct SNonCopy {}
123123
impl SNonCopy {
@@ -137,7 +137,7 @@ fn main() {
137137

138138
## unsafe_method > self: mutable reference
139139
```rust
140-
::prudent::load!(any: "linted.rs");
140+
::prudent::load!(any: "frontend_linted.rs");
141141
use crate::prudent::unsafe_method;
142142
struct SNonCopy {}
143143
impl SNonCopy {
@@ -156,7 +156,7 @@ fn main() {
156156

157157
## unsafe_method > self: by value
158158
```rust
159-
::prudent::load!(any: "linted.rs");
159+
::prudent::load!(any: "frontend_linted.rs");
160160
use crate::prudent::unsafe_method;
161161
fn main() {
162162
{
@@ -190,7 +190,7 @@ fn main() {
190190
# unsafe_ref
191191
## unsafe_ref - one arg, basic reference
192192
```rust
193-
::prudent::load!(any: "linted.rs");
193+
::prudent::load!(any: "frontend_linted.rs");
194194
use crate::prudent::unsafe_ref;
195195
const B: bool = true;
196196
const PT: *const bool = &B as *const bool;
@@ -203,7 +203,7 @@ fn main() {
203203

204204
## unsafe_ref - one arg, slice
205205
```rust
206-
::prudent::load!(any: "linted.rs");
206+
::prudent::load!(any: "frontend_linted.rs");
207207
use crate::prudent::unsafe_ref;
208208
const BS: [bool; 2] = [true, false];
209209
const PT: *const [bool] = &BS as *const [bool];
@@ -216,7 +216,7 @@ fn main() {
216216

217217
## unsafe_ref - one arg, dyn reference
218218
```rust
219-
::prudent::load!(any: "linted.rs");
219+
::prudent::load!(any: "frontend_linted.rs");
220220
use crate::prudent::unsafe_ref;
221221
# use core::fmt::Display;
222222
const B: bool = true;
@@ -228,7 +228,7 @@ fn main() {}
228228

229229
## unsafe_ref - two args, lifetimed reference
230230
```rust
231-
::prudent::load!(any: "linted.rs");
231+
::prudent::load!(any: "frontend_linted.rs");
232232
use crate::prudent::unsafe_ref;
233233
const B: bool = true;
234234
const PT: *const bool = &B as *const bool;
@@ -241,7 +241,7 @@ fn main() {
241241

242242
## unsafe_ref - two args, lifetimed dyn reference
243243
```rust
244-
::prudent::load!(any: "linted.rs");
244+
::prudent::load!(any: "frontend_linted.rs");
245245
use crate::prudent::unsafe_ref;
246246
use core::fmt::Display;
247247
const B: bool = true;
@@ -253,7 +253,7 @@ fn main() {}
253253

254254
## unsafe_ref - two args, lifetimed slice
255255
```rust
256-
::prudent::load!(any: "linted.rs");
256+
::prudent::load!(any: "frontend_linted.rs");
257257
use crate::prudent::unsafe_ref;
258258
const BS: [bool; 2] = [true, false];
259259
const PT: *const [bool] = &BS as *const [bool];
@@ -266,7 +266,7 @@ fn main() {
266266

267267
## unsafe_ref - two args, typed basic reference
268268
```rust
269-
::prudent::load!(any: "linted.rs");
269+
::prudent::load!(any: "frontend_linted.rs");
270270
use crate::prudent::unsafe_ref;
271271
const B: bool = true;
272272
const PT: *const bool = &B as *const bool;
@@ -279,7 +279,7 @@ fn main() {
279279

280280
## unsafe_ref - two args, typed slice
281281
```rust
282-
::prudent::load!(any: "linted.rs");
282+
::prudent::load!(any: "frontend_linted.rs");
283283
use crate::prudent::unsafe_ref;
284284
const BS: [bool; 2] = [true, false];
285285
const PT: *const [bool] = &BS as *const [bool];
@@ -292,7 +292,7 @@ fn main() {
292292

293293
## unsafe_ref - two args, typed dyn reference
294294
```rust
295-
::prudent::load!(any: "linted.rs");
295+
::prudent::load!(any: "frontend_linted.rs");
296296
use crate::prudent::unsafe_ref;
297297
# use core::fmt::Display;
298298
const B: bool = true;
@@ -308,7 +308,7 @@ fn main() {
308308
# unsafe_mut
309309
## unsafe_mut - one arg, basic reference
310310
```rust
311-
::prudent::load!(any: "linted.rs");
311+
::prudent::load!(any: "frontend_linted.rs");
312312
use crate::prudent::unsafe_mut;
313313
fn main() {
314314
let mut b: bool = true;
@@ -321,7 +321,7 @@ fn main() {
321321

322322
## unsafe_mut - one arg, slice
323323
```rust
324-
::prudent::load!(any: "linted.rs");
324+
::prudent::load!(any: "frontend_linted.rs");
325325
use crate::prudent::unsafe_mut;
326326
fn main() {
327327
let mut bs: [bool; 2] = [true, false];
@@ -334,7 +334,7 @@ fn main() {
334334

335335
## unsafe_mut - one arg, dyn reference
336336
```rust
337-
::prudent::load!(any: "linted.rs");
337+
::prudent::load!(any: "frontend_linted.rs");
338338
use crate::prudent::unsafe_mut;
339339
# use core::fmt::Display;
340340
fn main() {
@@ -348,7 +348,7 @@ fn main() {
348348

349349
## unsafe_mut - two args, lifetimed reference
350350
```rust
351-
::prudent::load!(any: "linted.rs");
351+
::prudent::load!(any: "frontend_linted.rs");
352352
use crate::prudent::unsafe_mut;
353353
fn main() {
354354
let b: &'static mut bool = Box::leak( Box::new(true) );
@@ -362,7 +362,7 @@ fn main() {
362362

363363
## unsafe_mut - two args, lifetimed dyn reference
364364
```rust
365-
::prudent::load!(any: "linted.rs");
365+
::prudent::load!(any: "frontend_linted.rs");
366366
use crate::prudent::unsafe_mut;
367367
# use core::fmt::Display;
368368
fn main() {
@@ -377,7 +377,7 @@ fn main() {
377377

378378
## unsafe_mut - two args, lifetimed slice
379379
```rust
380-
::prudent::load!(any: "linted.rs");
380+
::prudent::load!(any: "frontend_linted.rs");
381381
use crate::prudent::unsafe_mut;
382382
fn main() {
383383
let bs: &'static mut [bool] = Box::leak( Box::new([true, false]) );
@@ -391,7 +391,7 @@ fn main() {
391391

392392
## unsafe_mut - two args, typed basic reference
393393
```rust
394-
::prudent::load!(any: "linted.rs");
394+
::prudent::load!(any: "frontend_linted.rs");
395395
use crate::prudent::unsafe_mut;
396396
fn main() {
397397
let mut b: bool = true;
@@ -404,7 +404,7 @@ fn main() {
404404

405405
## unsafe_mut - two args, typed slice
406406
```rust
407-
::prudent::load!(any: "linted.rs");
407+
::prudent::load!(any: "frontend_linted.rs");
408408
use crate::prudent::unsafe_mut;
409409
fn main() {
410410
let bs: &'static mut [bool] = Box::leak( Box::new([true, false]) );
@@ -418,7 +418,7 @@ fn main() {
418418

419419
## unsafe_mut - two args, typed dyn reference
420420
```rust
421-
::prudent::load!(any: "linted.rs");
421+
::prudent::load!(any: "frontend_linted.rs");
422422
use crate::prudent::unsafe_mut;
423423
# use core::fmt::Display;
424424
fn main() {
@@ -439,7 +439,7 @@ Only for types that implement/derive [core::marker::Copy].
439439

440440
## unsafe_val - one arg, basic
441441
```rust
442-
::prudent::load!(any: "linted.rs");
442+
::prudent::load!(any: "frontend_linted.rs");
443443
use crate::prudent::unsafe_val;
444444
fn main() {
445445
const B: bool = true;
@@ -452,7 +452,7 @@ fn main() {
452452

453453
## unsafe_val - two args, typed
454454
```rust
455-
::prudent::load!(any: "linted.rs");
455+
::prudent::load!(any: "frontend_linted.rs");
456456
use crate::prudent::unsafe_val;
457457
fn main() {
458458
const B: bool = true;
@@ -465,7 +465,7 @@ fn main() {
465465

466466
# unsafe_set
467467
```rust
468-
::prudent::load!(any: "linted.rs");
468+
::prudent::load!(any: "frontend_linted.rs");
469469
use crate::prudent::unsafe_set;
470470
fn main() {
471471
let mut b: bool = true;
@@ -477,7 +477,7 @@ fn main() {
477477
```
478478

479479
```rust
480-
::prudent::load!(any: "linted.rs");
480+
::prudent::load!(any: "frontend_linted.rs");
481481
use crate::prudent::unsafe_set;
482482
struct SNonCopy {}
483483
fn main() {
@@ -493,7 +493,7 @@ fn main() {
493493

494494
# unsafe_static_set
495495
```rust
496-
::prudent::load!(any: "linted.rs");
496+
::prudent::load!(any: "frontend_linted.rs");
497497
use crate::prudent::unsafe_static_set;
498498
static mut B: bool = true;
499499

src/linted.rs renamed to src/frontend_linted.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// A copy of prudent's linted.rs. Under Apache 2.0, MIT and BSD license.
1+
// A copy of prudent's frontend_linted.rs. Under Apache 2.0, MIT and BSD license.
22
//
33
// For the version of this file see PRUDENT_INTERNAL_LINTED_VERSION below. This may, or may not, be
44
// compatible with newer versions of prudent. For the most recent version available see
@@ -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 frontend_unlinted.rs, as that is internal."
22+
"Use ONLY frontend_linted.rs in your crate(s). Do not use frontend_unlinted.rs, as that is internal."
2323
);
2424
}
2525
};
@@ -60,13 +60,13 @@ macro_rules! internal_prudent_unsafe_fn {
6060
// include any unsafe code/calls/casts on their own without their own `unsafe{...}`
6161
// block(s).
6262
//
63-
// The rest of this comment block/lines exists the same in both linted.rs and
64-
// frontend_unlinted.rs, but it applies to linted.rs ONLY.
63+
// The rest of this comment block/lines exists the same in both frontend_linted.rs
64+
// and frontend_unlinted.rs, but it applies to frontend_linted.rs ONLY.
6565
//
6666
// (That minimizes the number of differences between those two files.)
6767
//
68-
// If this file is linted.rs (which then is passed to ::prudent::load!(...)), then
69-
// here we can *not* refer to
68+
// If this file is frontend_linted.rs (which then is passed to
69+
// ::prudent::load!(...)), then here we can *not* refer to
7070
// - $crate::unsafe_method, nor
7171
// - crate::unsafe_method
7272
//
@@ -81,7 +81,7 @@ macro_rules! internal_prudent_unsafe_fn {
8181
// `unsafe_method`). So we add prefix `internal_prudent_`, and we refer to
8282
// `internal_prudent_unsafe_method` instead.
8383
//
84-
// This applies to all other linted-to-linted macros calls in linted.rs.
84+
// This applies to all other linted-to-linted macros calls in frontend_linted.rs.
8585
let (tuple_tree, fun) = (internal_prudent_unsafe_fn_internal_build_tuple_tree!{ $($arg),+ }, $fn);
8686

8787
if false {

src/frontend_loader.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
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")
1+
// - "Frontend"_ macros can (and do) invoke "backend" macros, but not the other way. That's because
2+
// backend macros don't know the crate name where frontend macros were loaded.
3+
// - frontend 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 `backend`) from `prudent` crate under module `prudent`.
11+
// re-export all (both `frontend` 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 `backend`) from `prudent` crate, under given module name.
17+
// re-export all (both `frontend` and `backend`) from `prudent` crate, under given module name.
1818
( $module_name:ident ) => {
1919
/// prudent exported in a module
2020
mod $module_name {
21-
$crate::reexport_macros!( ::prudent::linted );
22-
$crate::reexport_non_macros!( ::prudent::linted );
21+
$crate::reexport_macros!( ::prudent::frontend);
22+
$crate::reexport_non_macros!( ::prudent::frontend );
2323
}
2424
};// -----------
2525

26-
// load `linted` from the given file; re-export `backend` from `prudent` crate; blend them
26+
// load `frontend` 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.
@@ -106,7 +106,7 @@ macro_rules! load {
106106
// Without #[macro_use] we can't refer to internal macro names without importing them, even
107107
// if the macros exist in the user's namespace, that is, loaded with
108108
// ```
109-
// ::prudent::load!(any: "path/to/linted.rs");
109+
// ::prudent::load!(any: "path/to/frontend_linted.rs");
110110
// ```
111111
// or similar.
112112
#[macro_use]
@@ -115,7 +115,7 @@ macro_rules! load {
115115

116116
#[cfg(not(any( $( $cfg_filter )* )))]
117117
#[allow(unused)]
118-
pub use ::prudent::linted as internal_prudent_linted_loaded_or_aliased;
118+
pub use ::prudent::frontend as internal_prudent_linted_loaded_or_aliased;
119119

120120
mod $module_name {
121121
$crate::reexport_macros!(super::internal_prudent_linted_loaded_or_aliased);
@@ -127,7 +127,7 @@ macro_rules! load {
127127
}
128128
}
129129

130-
/// Re-export macros from the given `linted`_module/path.
130+
/// Re-export macros from the given "frontend"_module/path.
131131
///
132132
/// NOT a part of public API - internal.
133133
#[doc(hidden)]
@@ -157,7 +157,7 @@ macro_rules! reexport_macros {
157157
}
158158

159159
/// Re-export
160-
/// 1. non-macros from the given `linted`_module/path. And
160+
/// 1. non-macros from the given "frontend"_module/path. And
161161
/// 2. anything needed from `backend`.
162162
///
163163
/// NOT a part of public API - internal.

src/frontend_unlinted.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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 frontend_unlinted.rs, as that is internal."
20+
"Use ONLY frontend_linted.rs in your crate(s). Do not use frontend_unlinted.rs, as that is internal."
2121
);
2222
}
2323
};
@@ -58,12 +58,12 @@ macro_rules! internal_prudent_unsafe_fn {
5858
// include any unsafe code/calls/casts on their own without their own `unsafe{...}`
5959
// block(s).
6060
//
61-
// The rest of this comment block/lines exists the same in both linted.rs and
62-
// frontend_unlinted.rs, but it applies to linted.rs ONLY.
61+
// The rest of this comment block/lines exists the same in both frontend_linted.rs and
62+
// frontend_unlinted.rs, but it applies to frontend_linted.rs ONLY.
6363
//
6464
// (That minimizes the number of differences between those two files.)
6565
//
66-
// If this file is linted.rs (which then is passed to ::prudent::load!(...)), then
66+
// If this file is frontend_linted.rs (which then is passed to ::prudent::load!(...)), then
6767
// here we can *not* refer to
6868
// - $crate::unsafe_method, nor
6969
// - crate::unsafe_method
@@ -79,7 +79,7 @@ macro_rules! internal_prudent_unsafe_fn {
7979
// `unsafe_method`). So we add prefix `internal_prudent_`, and we refer to
8080
// `internal_prudent_unsafe_method` instead.
8181
//
82-
// This applies to all other linted-to-linted macros calls in linted.rs.
82+
// This applies to all other linted-to-linted macros calls in frontend_linted.rs.
8383
let (tuple_tree, fun) = (::prudent::internal_prudent_unsafe_fn_internal_build_tuple_tree!{ $($arg),+ }, $fn);
8484

8585
if false {

0 commit comments

Comments
 (0)