Skip to content

Commit fb0353b

Browse files
committed
Update documentation and name for non_send_fields_in_send_ty lint
1 parent ef8df9d commit fb0353b

12 files changed

+45
-45
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2898,7 +2898,7 @@ Released 2018-09-13
28982898
[`no_effect`]: https://rust-lang.github.io/rust-clippy/master/index.html#no_effect
28992899
[`non_ascii_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_ascii_literal
29002900
[`non_octal_unix_permissions`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_octal_unix_permissions
2901-
[`non_send_field_in_send_ty`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_send_field_in_send_ty
2901+
[`non_send_fields_in_send_ty`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_send_fields_in_send_ty
29022902
[`nonminimal_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
29032903
[`nonsensical_open_options`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonsensical_open_options
29042904
[`nonstandard_macro_braces`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces

clippy_lints/src/lib.mods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ mod no_effect;
149149
mod non_copy_const;
150150
mod non_expressive_names;
151151
mod non_octal_unix_permissions;
152-
mod non_send_field_in_send_ty;
152+
mod non_send_fields_in_send_ty;
153153
mod nonstandard_macro_braces;
154154
mod open_options;
155155
mod option_env_unwrap;

clippy_lints/src/lib.register_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ store.register_lints(&[
366366
non_expressive_names::MANY_SINGLE_CHAR_NAMES,
367367
non_expressive_names::SIMILAR_NAMES,
368368
non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS,
369-
non_send_field_in_send_ty::NON_SEND_FIELD_IN_SEND_TY,
369+
non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY,
370370
nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES,
371371
open_options::NONSENSICAL_OPEN_OPTIONS,
372372
option_env_unwrap::OPTION_ENV_UNWRAP,

clippy_lints/src/lib.register_nursery.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
1616
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
1717
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
1818
LintId::of(mutex_atomic::MUTEX_INTEGER),
19-
LintId::of(non_send_field_in_send_ty::NON_SEND_FIELD_IN_SEND_TY),
19+
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
2020
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
2121
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),
2222
LintId::of(path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
536536
store.register_late_pass(move || Box::new(iter_not_returning_iterator::IterNotReturningIterator));
537537
store.register_late_pass(move || Box::new(if_then_panic::IfThenPanic));
538538
let enable_raw_pointer_heuristic_for_send = conf.enable_raw_pointer_heuristic_for_send;
539-
store.register_late_pass(move || Box::new(non_send_field_in_send_ty::NonSendFieldInSendTy::new(enable_raw_pointer_heuristic_for_send)));
539+
store.register_late_pass(move || Box::new(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(enable_raw_pointer_heuristic_for_send)));
540540
}
541541

542542
#[rustfmt::skip]

clippy_lints/src/non_send_field_in_send_ty.rs renamed to clippy_lints/src/non_send_fields_in_send_ty.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_span::sym;
1212

1313
declare_clippy_lint! {
1414
/// ### What it does
15-
/// Warns about a field in a `Send` struct that is neither `Send` nor `Copy`.
15+
/// Warns about fields in struct implementing `Send` that are neither `Send` nor `Copy`.
1616
///
1717
/// ### Why is this bad?
1818
/// Sending the struct to another thread will transfer the ownership to
@@ -43,7 +43,7 @@ declare_clippy_lint! {
4343
/// ```
4444
/// Use thread-safe types like [`std::sync::Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html)
4545
/// or specify correct bounds on generic type parameters (`T: Send`).
46-
pub NON_SEND_FIELD_IN_SEND_TY,
46+
pub NON_SEND_FIELDS_IN_SEND_TY,
4747
nursery,
4848
"there is field that does not implement `Send` in a `Send` struct"
4949
}
@@ -61,7 +61,7 @@ impl NonSendFieldInSendTy {
6161
}
6262
}
6363

64-
impl_lint_pass!(NonSendFieldInSendTy => [NON_SEND_FIELD_IN_SEND_TY]);
64+
impl_lint_pass!(NonSendFieldInSendTy => [NON_SEND_FIELDS_IN_SEND_TY]);
6565

6666
impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
6767
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
@@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
9696
.did
9797
.as_local()
9898
.map(|local_def_id| hir_map.local_def_id_to_hir_id(local_def_id));
99-
if !is_lint_allowed(cx, NON_SEND_FIELD_IN_SEND_TY, field_hir_id);
99+
if !is_lint_allowed(cx, NON_SEND_FIELDS_IN_SEND_TY, field_hir_id);
100100
if let field_ty = field.ty(cx.tcx, impl_trait_substs);
101101
if !ty_allowed_in_send(cx, field_ty, send_trait);
102102
if let Node::Field(field_def) = hir_map.get(field_hir_id);
@@ -114,7 +114,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
114114
if !non_send_fields.is_empty() {
115115
span_lint_and_then(
116116
cx,
117-
NON_SEND_FIELD_IN_SEND_TY,
117+
NON_SEND_FIELDS_IN_SEND_TY,
118118
item.span,
119119
&format!(
120120
"this implementation is unsound, as some fields in `{}` are `!Send`",

clippy_lints/src/utils/conf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ define_Conf! {
284284
///
285285
/// The list of unicode scripts allowed to be used in the scope.
286286
(allowed_scripts: Vec<String> = vec!["Latin".to_string()]),
287-
/// Lint: NON_SEND_FIELD_IN_SEND_TY.
287+
/// Lint: NON_SEND_FIELDS_IN_SEND_TY.
288288
///
289-
/// Whether to apply the raw pointer heuristic in `non_send_field_in_send_ty` lint.
289+
/// Whether to apply the raw pointer heuristic to determine if a type is `Send`.
290290
(enable_raw_pointer_heuristic_for_send: bool = true),
291291
}
292292

tests/ui-toml/strict_non_send_field_in_send_ty/test.rs renamed to tests/ui-toml/strict_non_send_fields_in_send_ty/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::non_send_field_in_send_ty)]
1+
#![warn(clippy::non_send_fields_in_send_ty)]
22
#![feature(extern_types)]
33

44
use std::rc::Rc;

tests/ui-toml/strict_non_send_field_in_send_ty/test.stderr renamed to tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this implementation is unsound, as some fields in `NoGeneric` are `!Send`
44
LL | unsafe impl Send for NoGeneric {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::non-send-field-in-send-ty` implied by `-D warnings`
7+
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
88
note: the type of field `rc_is_not_send` is `!Send`
99
--> $DIR/test.rs:8:5
1010
|

tests/ui/non_send_field_in_send_ty.rs renamed to tests/ui/non_send_fields_in_send_ty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::non_send_field_in_send_ty)]
1+
#![warn(clippy::non_send_fields_in_send_ty)]
22
#![feature(extern_types)]
33

44
use std::cell::UnsafeCell;
@@ -95,16 +95,16 @@ pub struct HeuristicTest {
9595
unsafe impl Send for HeuristicTest {}
9696

9797
// Test attributes
98-
#[allow(clippy::non_send_field_in_send_ty)]
98+
#[allow(clippy::non_send_fields_in_send_ty)]
9999
pub struct AttrTest1<T>(T);
100100

101101
pub struct AttrTest2<T> {
102-
#[allow(clippy::non_send_field_in_send_ty)]
102+
#[allow(clippy::non_send_fields_in_send_ty)]
103103
field: T,
104104
}
105105

106106
pub enum AttrTest3<T> {
107-
#[allow(clippy::non_send_field_in_send_ty)]
107+
#[allow(clippy::non_send_fields_in_send_ty)]
108108
Enum1(T),
109109
Enum2(T),
110110
}

tests/ui/non_send_field_in_send_ty.stderr renamed to tests/ui/non_send_fields_in_send_ty.stderr

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,167 +1,167 @@
11
error: this implementation is unsound, as some fields in `RingBuffer<T>` are `!Send`
2-
--> $DIR/non_send_field_in_send_ty.rs:16:1
2+
--> $DIR/non_send_fields_in_send_ty.rs:16:1
33
|
44
LL | unsafe impl<T> Send for RingBuffer<T> {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::non-send-field-in-send-ty` implied by `-D warnings`
7+
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
88
note: the type of field `data` is `!Send`
9-
--> $DIR/non_send_field_in_send_ty.rs:11:5
9+
--> $DIR/non_send_fields_in_send_ty.rs:11:5
1010
|
1111
LL | data: Vec<UnsafeCell<T>>,
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^
1313
= help: add bounds on type parameter `T` that satisfy `Vec<UnsafeCell<T>>: Send`
1414

1515
error: this implementation is unsound, as some fields in `MvccRwLock<T>` are `!Send`
16-
--> $DIR/non_send_field_in_send_ty.rs:24:1
16+
--> $DIR/non_send_fields_in_send_ty.rs:24:1
1717
|
1818
LL | unsafe impl<T> Send for MvccRwLock<T> {}
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
|
2121
note: the type of field `lock` is `!Send`
22-
--> $DIR/non_send_field_in_send_ty.rs:21:5
22+
--> $DIR/non_send_fields_in_send_ty.rs:21:5
2323
|
2424
LL | lock: Mutex<Box<T>>,
2525
| ^^^^^^^^^^^^^^^^^^^
2626
= help: add bounds on type parameter `T` that satisfy `Mutex<Box<T>>: Send`
2727

2828
error: this implementation is unsound, as some fields in `ArcGuard<RC, T>` are `!Send`
29-
--> $DIR/non_send_field_in_send_ty.rs:32:1
29+
--> $DIR/non_send_fields_in_send_ty.rs:32:1
3030
|
3131
LL | unsafe impl<RC, T: Send> Send for ArcGuard<RC, T> {}
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3333
|
3434
note: the type of field `head` is `!Send`
35-
--> $DIR/non_send_field_in_send_ty.rs:29:5
35+
--> $DIR/non_send_fields_in_send_ty.rs:29:5
3636
|
3737
LL | head: Arc<RC>,
3838
| ^^^^^^^^^^^^^
3939
= help: add bounds on type parameter `RC` that satisfy `Arc<RC>: Send`
4040

4141
error: this implementation is unsound, as some fields in `DeviceHandle<T>` are `!Send`
42-
--> $DIR/non_send_field_in_send_ty.rs:48:1
42+
--> $DIR/non_send_fields_in_send_ty.rs:48:1
4343
|
4444
LL | unsafe impl<T: UsbContext> Send for DeviceHandle<T> {}
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4646
|
4747
note: the type of field `context` is `!Send`
48-
--> $DIR/non_send_field_in_send_ty.rs:44:5
48+
--> $DIR/non_send_fields_in_send_ty.rs:44:5
4949
|
5050
LL | context: T,
5151
| ^^^^^^^^^^
5252
= help: add `T: Send` bound in `Send` impl
5353

5454
error: this implementation is unsound, as some fields in `NoGeneric` are `!Send`
55-
--> $DIR/non_send_field_in_send_ty.rs:55:1
55+
--> $DIR/non_send_fields_in_send_ty.rs:55:1
5656
|
5757
LL | unsafe impl Send for NoGeneric {}
5858
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5959
|
6060
note: the type of field `rc_is_not_send` is `!Send`
61-
--> $DIR/non_send_field_in_send_ty.rs:52:5
61+
--> $DIR/non_send_fields_in_send_ty.rs:52:5
6262
|
6363
LL | rc_is_not_send: Rc<String>,
6464
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6565
= help: use a thread-safe type that implements `Send`
6666

6767
error: this implementation is unsound, as some fields in `MultiField<T>` are `!Send`
68-
--> $DIR/non_send_field_in_send_ty.rs:63:1
68+
--> $DIR/non_send_fields_in_send_ty.rs:63:1
6969
|
7070
LL | unsafe impl<T> Send for MultiField<T> {}
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7272
|
7373
note: the type of field `field1` is `!Send`
74-
--> $DIR/non_send_field_in_send_ty.rs:58:5
74+
--> $DIR/non_send_fields_in_send_ty.rs:58:5
7575
|
7676
LL | field1: T,
7777
| ^^^^^^^^^
7878
= help: add `T: Send` bound in `Send` impl
7979
note: the type of field `field2` is `!Send`
80-
--> $DIR/non_send_field_in_send_ty.rs:59:5
80+
--> $DIR/non_send_fields_in_send_ty.rs:59:5
8181
|
8282
LL | field2: T,
8383
| ^^^^^^^^^
8484
= help: add `T: Send` bound in `Send` impl
8585
note: the type of field `field3` is `!Send`
86-
--> $DIR/non_send_field_in_send_ty.rs:60:5
86+
--> $DIR/non_send_fields_in_send_ty.rs:60:5
8787
|
8888
LL | field3: T,
8989
| ^^^^^^^^^
9090
= help: add `T: Send` bound in `Send` impl
9191

9292
error: this implementation is unsound, as some fields in `MyOption<T>` are `!Send`
93-
--> $DIR/non_send_field_in_send_ty.rs:70:1
93+
--> $DIR/non_send_fields_in_send_ty.rs:70:1
9494
|
9595
LL | unsafe impl<T> Send for MyOption<T> {}
9696
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9797
|
9898
note: the type of field `0` is `!Send`
99-
--> $DIR/non_send_field_in_send_ty.rs:66:12
99+
--> $DIR/non_send_fields_in_send_ty.rs:66:12
100100
|
101101
LL | MySome(T),
102102
| ^
103103
= help: add `T: Send` bound in `Send` impl
104104

105105
error: this implementation is unsound, as some fields in `MultiParam<A, B>` are `!Send`
106-
--> $DIR/non_send_field_in_send_ty.rs:77:1
106+
--> $DIR/non_send_fields_in_send_ty.rs:77:1
107107
|
108108
LL | unsafe impl<A, B> Send for MultiParam<A, B> {}
109109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110
|
111111
note: the type of field `vec` is `!Send`
112-
--> $DIR/non_send_field_in_send_ty.rs:74:5
112+
--> $DIR/non_send_fields_in_send_ty.rs:74:5
113113
|
114114
LL | vec: Vec<(A, B)>,
115115
| ^^^^^^^^^^^^^^^^
116116
= help: add bounds on type parameters `A, B` that satisfy `Vec<(A, B)>: Send`
117117

118118
error: this implementation is unsound, as some fields in `HeuristicTest` are `!Send`
119-
--> $DIR/non_send_field_in_send_ty.rs:95:1
119+
--> $DIR/non_send_fields_in_send_ty.rs:95:1
120120
|
121121
LL | unsafe impl Send for HeuristicTest {}
122122
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123123
|
124124
note: the type of field `field4` is `!Send`
125-
--> $DIR/non_send_field_in_send_ty.rs:90:5
125+
--> $DIR/non_send_fields_in_send_ty.rs:90:5
126126
|
127127
LL | field4: (*const NonSend, Rc<u8>),
128128
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129129
= help: use a thread-safe type that implements `Send`
130130

131131
error: this implementation is unsound, as some fields in `AttrTest3<T>` are `!Send`
132-
--> $DIR/non_send_field_in_send_ty.rs:114:1
132+
--> $DIR/non_send_fields_in_send_ty.rs:114:1
133133
|
134134
LL | unsafe impl<T> Send for AttrTest3<T> {}
135135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136136
|
137137
note: the type of field `0` is `!Send`
138-
--> $DIR/non_send_field_in_send_ty.rs:109:11
138+
--> $DIR/non_send_fields_in_send_ty.rs:109:11
139139
|
140140
LL | Enum2(T),
141141
| ^
142142
= help: add `T: Send` bound in `Send` impl
143143

144144
error: this implementation is unsound, as some fields in `Complex<P, u32>` are `!Send`
145-
--> $DIR/non_send_field_in_send_ty.rs:122:1
145+
--> $DIR/non_send_fields_in_send_ty.rs:122:1
146146
|
147147
LL | unsafe impl<P> Send for Complex<P, u32> {}
148148
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149149
|
150150
note: the type of field `field1` is `!Send`
151-
--> $DIR/non_send_field_in_send_ty.rs:118:5
151+
--> $DIR/non_send_fields_in_send_ty.rs:118:5
152152
|
153153
LL | field1: A,
154154
| ^^^^^^^^^
155155
= help: add `P: Send` bound in `Send` impl
156156

157157
error: this implementation is unsound, as some fields in `Complex<Q, MutexGuard<'static, bool>>` are `!Send`
158-
--> $DIR/non_send_field_in_send_ty.rs:125:1
158+
--> $DIR/non_send_fields_in_send_ty.rs:125:1
159159
|
160160
LL | unsafe impl<Q: Send> Send for Complex<Q, MutexGuard<'static, bool>> {}
161161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
162162
|
163163
note: the type of field `field2` is `!Send`
164-
--> $DIR/non_send_field_in_send_ty.rs:119:5
164+
--> $DIR/non_send_fields_in_send_ty.rs:119:5
165165
|
166166
LL | field2: B,
167167
| ^^^^^^^^^

0 commit comments

Comments
 (0)