Skip to content

Commit 9e5941e

Browse files
authored
Revert "Add a lint for the Self tuple struct soundness hole" (#319)
1 parent bb275cc commit 9e5941e

10 files changed

+0
-141
lines changed

doc/src/config-lints.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -264,26 +264,3 @@ foo::<dyn SomeTrait>();
264264
// Trait object in type default (enum, union, trait, and so on are all also forbidden)
265265
struct SomeStruct<T = dyn SomeTrait>(...);
266266
```
267-
268-
### `plrust_tuple_struct_self_pattern`
269-
270-
This lint forbids use of a tuple struct named `Self` in pattern position. This
271-
can be used to bypass struct field privacy prior to Rust 1.71.0
272-
(<https://github.com/rust-lang/rust/issues/111220>). Once PL/Rust depends on
273-
1.71.0, this lint will be replaced by one that does nothing, as the offending
274-
pattern will not compile.
275-
276-
For example, this lint will prevent the following code:
277-
278-
```rs
279-
mod my {
280-
pub struct Foo(&'static str);
281-
}
282-
283-
impl AsRef<str> for my::Foo {
284-
fn as_ref(&self) -> &str {
285-
let Self(s) = self;
286-
s
287-
}
288-
}
289-
```

plrust/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ const DEFAULT_LINTS: &'static str = "\
9595
plrust_print_macros, \
9696
plrust_stdio, \
9797
plrust_suspicious_trait_object, \
98-
plrust_tuple_struct_self_pattern, \
9998
unsafe_code, \
10099
deprecated, \
101100
suspicious_auto_trait_impls, \

plrustc/plrustc/src/lints/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mod print_macros;
1919
mod static_impls;
2020
mod stdio;
2121
mod sus_trait_object;
22-
mod tuple_struct_self_pattern;
2322

2423
static INCLUDE_TEST_ONLY_LINTS: Lazy<bool> =
2524
Lazy::new(|| std::env::var("PLRUSTC_INCLUDE_TEST_ONLY_LINTS").is_ok());
@@ -39,7 +38,6 @@ static PLRUST_LINTS: Lazy<Vec<&'static Lint>> = Lazy::new(|| {
3938
print_macros::PLRUST_PRINT_MACROS,
4039
stdio::PLRUST_STDIO,
4140
sus_trait_object::PLRUST_SUSPICIOUS_TRAIT_OBJECT,
42-
tuple_struct_self_pattern::PLRUST_TUPLE_STRUCT_SELF_PATTERN,
4341
];
4442
if *INCLUDE_TEST_ONLY_LINTS {
4543
let test_only_lints = [force_ice::PLRUST_TEST_ONLY_FORCE_ICE];
@@ -85,7 +83,6 @@ pub fn register(store: &mut LintStore, _sess: &Session) {
8583
store.register_late_pass(move |_| Box::new(stdio::PlrustPrintFunctions));
8684
store.register_late_pass(move |_| Box::new(extern_blocks::NoExternBlockPass));
8785
store.register_late_pass(move |_| Box::new(lifetime_param_trait::LifetimeParamTraitPass));
88-
store.register_late_pass(move |_| Box::new(tuple_struct_self_pattern::TupleStructSelfPat));
8986

9087
if *INCLUDE_TEST_ONLY_LINTS {
9188
store.register_early_pass(move || Box::new(force_ice::PlrustcForceIce));

plrustc/plrustc/src/lints/tuple_struct_self_pattern.rs

Lines changed: 0 additions & 46 deletions
This file was deleted.

plrustc/plrustc/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ extern crate rustc_interface;
77

88
extern crate rustc_lint;
99
extern crate rustc_lint_defs;
10-
extern crate rustc_middle;
1110
extern crate rustc_session;
1211
extern crate rustc_span;
1312

plrustc/plrustc/uitests/tuple_struct_self_pat_box.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

plrustc/plrustc/uitests/tuple_struct_self_pat_box.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.

plrustc/plrustc/uitests/tuple_struct_self_pat_local_priv.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

plrustc/plrustc/uitests/tuple_struct_self_pat_local_priv.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.

plrustc/plrustc/uitests/tuple_struct_self_pat_should_pass.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)