Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5b9905b
Added CharIndices::offset function
TrolledWoods Feb 27, 2021
772543a
Removed trailing whitespace
TrolledWoods Feb 27, 2021
907eab8
Added feature flag to doc test
TrolledWoods Feb 27, 2021
30fc601
Tests for field is never read diagnostic
sunjay Mar 11, 2021
321aace
Added suggestion and note for when a field is never used
sunjay Mar 12, 2021
7faaf39
Updating test stderr files
sunjay Mar 12, 2021
789186d
Trying out a new message that works a little better for values *and* …
sunjay Mar 12, 2021
2acd8eb
New shorter diagnostic note that is different for items versus fields
sunjay Mar 13, 2021
3e34eb8
Putting help message only under the identifier that needs to be prefixed
sunjay Mar 25, 2021
539242a
Add a suggestion when using a type alias instead of trait alias
JohnTitor Mar 31, 2021
eea27b8
Mention trait alias on the E0404 note
JohnTitor Mar 31, 2021
53a1105
On stable, suggest removing `#![feature]` for features that have been…
jyn514 Mar 31, 2021
fa1624c
Added tracking issue number
TrolledWoods Apr 5, 2021
37a5b51
implement TrustedRandomAccess for Take iterator adapter
the8472 Apr 8, 2021
03900e4
move core::hint::black_box under its own feature gate
RalfJung Apr 15, 2021
4873271
bootstrap: use bash on illumos to run install scripts
jclulow Apr 16, 2021
e85f19b
:arrow_up: rust-analyzer
lnicola Apr 20, 2021
f505d61
Remove duplicated fn(Box<[T]>) -> Vec<T>
calebsander Apr 16, 2021
62226ee
Improve BinaryHeap::retain.
m-ou-se Nov 2, 2020
f5d72ab
Add better test for BinaryHeap::retain.
m-ou-se Nov 2, 2020
fc2a74c
RustWrapper: work around unification of diagnostic handlers
durin42 Mar 23, 2021
d6e5bba
Rollup merge of #78681 - m-ou-se:binary-heap-retain, r=Amanieu
Dylan-DPC Apr 22, 2021
9f7b36a
Rollup merge of #82585 - TrolledWoods:master, r=dtolnay
Dylan-DPC Apr 22, 2021
8903387
Rollup merge of #83004 - sunjay:field-never-read-issue-81658, r=pnkfelix
Dylan-DPC Apr 22, 2021
a714418
Rollup merge of #83425 - durin42:llvm-update, r=nagisa
Dylan-DPC Apr 22, 2021
9c15d9b
Rollup merge of #83722 - jyn514:stable-help, r=estebank
Dylan-DPC Apr 22, 2021
b6dbf13
Rollup merge of #83729 - JohnTitor:issue-43913, r=estebank
Dylan-DPC Apr 22, 2021
151c0ed
Rollup merge of #83990 - the8472:take-trusted-len, r=dtolnay
Dylan-DPC Apr 22, 2021
4413950
Rollup merge of #84216 - RalfJung:black-box, r=Mark-Simulacrum
Dylan-DPC Apr 22, 2021
46b7644
Rollup merge of #84248 - calebsander:refactor/vec-functions, r=Amanieu
Dylan-DPC Apr 22, 2021
8c7b58c
Rollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simul…
Dylan-DPC Apr 22, 2021
030f4a2
Rollup merge of #84359 - lnicola:rust-analyzer-2021-04-20, r=jonas-sc…
Dylan-DPC Apr 22, 2021
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
Prev Previous commit
Next Next commit
Trying out a new message that works a little better for values *and* …
…items
  • Loading branch information
sunjay committed Mar 25, 2021
commit 789186d8befacb9ea933dd80c02e7ca49e190df0
9 changes: 5 additions & 4 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,11 @@ impl DeadVisitor<'tcx> {
Applicability::MachineApplicable,
)
.note(&format!(
"the leading underscore helps signal to the reader that the {} may still serve\n\
a purpose even if it isn't used in a way that we can detect (e.g. the {}\nis \
only used through FFI or used only for its effect when dropped)",
descr, descr,
"The leading underscore signals to the reader that while the {} may not be {}\n\
by any Rust code, it still serves some other purpose that isn't detected by rustc.\n\
(e.g. some values are used for their effect when dropped or used in FFI code\n\
exclusively through raw pointers)",
descr, participle,
));
// Force the note we added to the front, before any other subdiagnostics
diag.children.rotate_right(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: associated constant is never used: `BAR`
LL | const BAR: u32 = 1;
| ^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_BAR`
|
= note: the leading underscore helps signal to the reader that the associated constant may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the associated constant
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the associated constant may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/associated-const-dead-code.rs:1:9
|
Expand Down
7 changes: 4 additions & 3 deletions src/test/ui/derive-uninhabited-enum-38885.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ warning: variant is never constructed: `Void`
LL | Void(Void),
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_Void`
|
= note: the leading underscore helps signal to the reader that the variant may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the variant
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the variant may not be constructed
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
= note: `-W dead-code` implied by `-W unused`

warning: 1 warning emitted
Expand Down
7 changes: 4 additions & 3 deletions src/test/ui/issues/issue-37515.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ warning: type alias is never used: `Z`
LL | type Z = dyn for<'x> Send;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_Z`
|
= note: the leading underscore helps signal to the reader that the type alias may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the type alias
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the type alias may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/issue-37515.rs:3:9
|
Expand Down
7 changes: 4 additions & 3 deletions src/test/ui/lint/dead-code/basic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: function is never used: `foo`
LL | fn foo() {
| ^^^ help: if this is intentional, prefix it with an underscore: `_foo`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/basic.rs:1:9
|
Expand Down
14 changes: 8 additions & 6 deletions src/test/ui/lint/dead-code/const-and-self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ warning: variant is never constructed: `B`
LL | B,
| ^ help: if this is intentional, prefix it with an underscore: `_B`
|
= note: the leading underscore helps signal to the reader that the variant may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the variant
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the variant may not be constructed
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/const-and-self.rs:3:9
|
Expand All @@ -19,9 +20,10 @@ warning: variant is never constructed: `C`
LL | C,
| ^ help: if this is intentional, prefix it with an underscore: `_C`
|
= note: the leading underscore helps signal to the reader that the variant may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the variant
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the variant may not be constructed
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

warning: 2 warnings emitted

7 changes: 4 additions & 3 deletions src/test/ui/lint/dead-code/drop-only-field-issue-81658.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: field is never read: `guard`
LL | guard: MutexGuard<'a, T>,
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_guard`
|
= note: the leading underscore helps signal to the reader that the field may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the field
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the field may not be read
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/drop-only-field-issue-81658.rs:8:9
|
Expand Down
7 changes: 4 additions & 3 deletions src/test/ui/lint/dead-code/empty-unused-enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: enum is never used: `E`
LL | enum E {}
| ^ help: if this is intentional, prefix it with an underscore: `_E`
|
= note: the leading underscore helps signal to the reader that the enum may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the enum
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the enum may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/empty-unused-enum.rs:1:9
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: field is never read: `items`
LL | items: Option<Vec<T>>,
| ^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_items`
|
= note: the leading underscore helps signal to the reader that the field may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the field
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the field may not be read
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/field-used-in-ffi-issue-81658.rs:7:9
|
Expand Down
7 changes: 4 additions & 3 deletions src/test/ui/lint/dead-code/impl-trait.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: type alias is never used: `Unused`
LL | type Unused = ();
| ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_Unused`
|
= note: the leading underscore helps signal to the reader that the type alias may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the type alias
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the type alias may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/impl-trait.rs:1:9
|
Expand Down
70 changes: 40 additions & 30 deletions src/test/ui/lint/dead-code/lint-dead-code-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: struct is never constructed: `Bar`
LL | pub struct Bar;
| ^^^ help: if this is intentional, prefix it with an underscore: `_Bar`
|
= note: the leading underscore helps signal to the reader that the struct may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the struct
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the struct may not be constructed
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/lint-dead-code-1.rs:5:9
|
Expand All @@ -19,89 +20,98 @@ error: static is never used: `priv_static`
LL | static priv_static: isize = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_priv_static`
|
= note: the leading underscore helps signal to the reader that the static may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the static
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the static may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: constant is never used: `priv_const`
--> $DIR/lint-dead-code-1.rs:27:1
|
LL | const priv_const: isize = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_priv_const`
|
= note: the leading underscore helps signal to the reader that the constant may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the constant
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the constant may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: struct is never constructed: `PrivStruct`
--> $DIR/lint-dead-code-1.rs:35:8
|
LL | struct PrivStruct;
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_PrivStruct`
|
= note: the leading underscore helps signal to the reader that the struct may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the struct
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the struct may not be constructed
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: enum is never used: `priv_enum`
--> $DIR/lint-dead-code-1.rs:64:6
|
LL | enum priv_enum { foo2, bar2 }
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_priv_enum`
|
= note: the leading underscore helps signal to the reader that the enum may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the enum
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the enum may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: variant is never constructed: `bar3`
--> $DIR/lint-dead-code-1.rs:67:5
|
LL | bar3
| ^^^^ help: if this is intentional, prefix it with an underscore: `_bar3`
|
= note: the leading underscore helps signal to the reader that the variant may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the variant
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the variant may not be constructed
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: function is never used: `priv_fn`
--> $DIR/lint-dead-code-1.rs:88:4
|
LL | fn priv_fn() {
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_priv_fn`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: function is never used: `foo`
--> $DIR/lint-dead-code-1.rs:93:4
|
LL | fn foo() {
| ^^^ help: if this is intentional, prefix it with an underscore: `_foo`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: function is never used: `bar`
--> $DIR/lint-dead-code-1.rs:98:4
|
LL | fn bar() {
| ^^^ help: if this is intentional, prefix it with an underscore: `_bar`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: function is never used: `baz`
--> $DIR/lint-dead-code-1.rs:102:4
|
LL | fn baz() -> impl Copy {
| ^^^ help: if this is intentional, prefix it with an underscore: `_baz`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: aborting due to 10 previous errors

21 changes: 12 additions & 9 deletions src/test/ui/lint/dead-code/lint-dead-code-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ error: function is never used: `dead_fn`
LL | fn dead_fn() {}
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_dead_fn`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)
note: the lint level is defined here
--> $DIR/lint-dead-code-2.rs:2:9
|
Expand All @@ -19,19 +20,21 @@ error: function is never used: `dead_fn2`
LL | fn dead_fn2() {}
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_dead_fn2`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: function is never used: `main`
--> $DIR/lint-dead-code-2.rs:38:4
|
LL | fn main() {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_main`
|
= note: the leading underscore helps signal to the reader that the function may still serve
a purpose even if it isn't used in a way that we can detect (e.g. the function
is only used through FFI or used only for its effect when dropped)
= note: The leading underscore signals to the reader that while the function may not be used
by any Rust code, it still serves some other purpose that isn't detected by rustc.
(e.g. some values are used for their effect when dropped or used in FFI code
exclusively through raw pointers)

error: aborting due to 3 previous errors

Loading