Skip to content

Commit 786fbd6

Browse files
authored
Rustup (#13687)
r? @ghost changelog: none
2 parents b829d53 + 99ef369 commit 786fbd6

10 files changed

+37
-39
lines changed

clippy_lints/src/large_const_arrays.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
5656
&& !item.span.from_expansion()
5757
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
5858
&& let ty::Array(element_type, cst) = ty.kind()
59-
&& let Ok((_, ty::ValTree::Leaf(element_count))) = cst.eval_valtree(cx.tcx, ParamEnv::empty(), item.span)
59+
&& let Some((ty::ValTree::Leaf(element_count), _)) = cx.tcx
60+
.try_normalize_erasing_regions(ParamEnv::empty(), *cst).unwrap_or(*cst).try_to_valtree()
6061
&& let element_count = element_count.to_target_usize(cx.tcx)
6162
&& let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes())
6263
&& u128::from(self.maximum_allowed_size) < u128::from(element_count) * u128::from(element_size)

clippy_utils/src/diagnostics.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
//! Thank you!
99
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
1010
11-
use rustc_errors::{
12-
Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, SubdiagMessage, SubstitutionPart, Suggestions,
13-
};
11+
use rustc_errors::{Applicability, Diag, DiagMessage, MultiSpan, SubdiagMessage};
12+
#[cfg(debug_assertions)]
13+
use rustc_errors::{EmissionGuarantee, SubstitutionPart, Suggestions};
1414
use rustc_hir::HirId;
1515
use rustc_lint::{LateContext, Lint, LintContext};
1616
use rustc_span::Span;
@@ -38,6 +38,7 @@ fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) {
3838
/// only started triggered there.
3939
///
4040
/// This function makes sure we also validate them in debug clippy builds.
41+
#[cfg(debug_assertions)]
4142
fn validate_diag(diag: &Diag<'_, impl EmissionGuarantee>) {
4243
let suggestions = match &diag.suggestions {
4344
Suggestions::Enabled(suggs) => &**suggs,

clippy_utils/src/qualify_min_const_fn.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,8 @@ fn is_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool {
393393

394394
msrv.meets(const_stab_rust_version)
395395
} else {
396-
// Unstable const fn, check if the feature is enabled. We need both the regular stability
397-
// feature and (if set) the const stability feature to const-call this function.
398-
let stab = tcx.lookup_stability(def_id);
399-
let is_enabled = stab.is_some_and(|s| s.is_stable() || tcx.features().enabled(s.feature))
400-
&& const_stab.feature.is_none_or(|f| tcx.features().enabled(f));
401-
is_enabled && msrv.current().is_none()
396+
// Unstable const fn, check if the feature is enabled.
397+
tcx.features().enabled(const_stab.feature) && msrv.current().is_none()
402398
}
403399
})
404400
}

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2024-11-07"
2+
channel = "nightly-2024-11-14"
33
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
44
profile = "minimal"

tests/ui/empty_line_after/doc_comments.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: empty line after doc comment
33
|
44
LL | / /// for the crate
55
LL | |
6-
| |_
6+
| |_^
77
LL | fn first_in_crate() {}
88
| ------------------- the comment documents this function
99
|
@@ -22,7 +22,7 @@ error: empty line after doc comment
2222
|
2323
LL | / /// for the module
2424
LL | |
25-
| |_
25+
| |_^
2626
LL | fn first_in_module() {}
2727
| -------------------- the comment documents this function
2828
|
@@ -39,7 +39,7 @@ error: empty line after doc comment
3939
|
4040
LL | / /// # Indented
4141
LL | |
42-
| |_
42+
| |_^
4343
LL | /// Blank line
4444
LL | fn indented() {}
4545
| ------------- the comment documents this function
@@ -55,7 +55,7 @@ error: empty line after doc comment
5555
|
5656
LL | / /// This should produce a warning
5757
LL | |
58-
| |_
58+
| |_^
5959
LL | fn with_doc_and_newline() {}
6060
| ------------------------- the comment documents this function
6161
|
@@ -69,7 +69,7 @@ LL | |
6969
LL | | /** This is also a doc comment and is part of the warning
7070
LL | | */
7171
LL | |
72-
| |_
72+
| |_^
7373
...
7474
LL | fn three_attributes() {}
7575
| --------------------- the comment documents this function
@@ -82,7 +82,7 @@ error: empty line after doc comment
8282
LL | / /// docs for `old_code`
8383
LL | | // fn old_code() {}
8484
LL | |
85-
| |_
85+
| |_^
8686
LL | fn new_code() {}
8787
| ------------- the comment documents this function
8888
|
@@ -102,7 +102,7 @@ LL | | /// Docs
102102
LL | | /// for OldB
103103
LL | | // struct OldB;
104104
LL | |
105-
| |_
105+
| |_^
106106
...
107107
LL | struct Multiple;
108108
| --------------- the comment documents this struct
@@ -125,7 +125,7 @@ LL | / /**
125125
LL | | * Meant to be inner doc comment
126126
LL | | */
127127
LL | |
128-
| |_
128+
| |_^
129129
LL | fn first_in_module() {}
130130
| -------------------- the comment documents this function
131131
|
@@ -143,7 +143,7 @@ LL | | * Docs for `old_code`
143143
LL | | */
144144
LL | | /* fn old_code() {} */
145145
LL | |
146-
| |_
146+
| |_^
147147
...
148148
LL | fn new_code() {}
149149
| ------------- the comment documents this function
@@ -161,7 +161,7 @@ error: empty line after doc comment
161161
LL | / /// Docs for `old_code2`
162162
LL | | /* fn old_code2() {} */
163163
LL | |
164-
| |_
164+
| |_^
165165
LL | /// Docs for `new_code2`
166166
LL | fn new_code2() {}
167167
| -------------- the comment documents this function

tests/ui/empty_line_after/outer_attribute.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: empty line after outer attribute
33
|
44
LL | / #[crate_type = "lib"]
55
LL | |
6-
| |_
6+
| |_^
77
LL | fn first_in_crate() {}
88
| ------------------- the attribute applies to this function
99
|
@@ -20,7 +20,7 @@ error: empty line after outer attribute
2020
|
2121
LL | / #[inline]
2222
LL | |
23-
| |_
23+
| |_^
2424
LL | /// some comment
2525
LL | fn with_one_newline_and_comment() {}
2626
| --------------------------------- the attribute applies to this function
@@ -32,7 +32,7 @@ error: empty line after outer attribute
3232
|
3333
LL | / #[inline]
3434
LL | |
35-
| |_
35+
| |_^
3636
LL | fn with_one_newline() {}
3737
| --------------------- the attribute applies to this function
3838
|
@@ -44,7 +44,7 @@ error: empty lines after outer attribute
4444
LL | / #[crate_type = "lib"]
4545
LL | |
4646
LL | |
47-
| |_
47+
| |_^
4848
LL | fn with_two_newlines() {}
4949
| ---------------------- the attribute applies to this function
5050
|
@@ -59,7 +59,7 @@ error: empty line after outer attribute
5959
|
6060
LL | / #[doc = "doc attributes should be considered attributes"]
6161
LL | |
62-
| |_
62+
| |_^
6363
LL | enum Baz {
6464
| -------- the attribute applies to this enum
6565
|
@@ -70,7 +70,7 @@ error: empty line after outer attribute
7070
|
7171
LL | / #[repr(C)]
7272
LL | |
73-
| |_
73+
| |_^
7474
LL | struct Foo {
7575
| ---------- the attribute applies to this struct
7676
|
@@ -81,7 +81,7 @@ error: empty line after outer attribute
8181
|
8282
LL | / #[allow(dead_code)]
8383
LL | |
84-
| |_
84+
| |_^
8585
LL | mod foo {}
8686
| ------- the attribute applies to this module
8787
|
@@ -93,7 +93,7 @@ error: empty line after outer attribute
9393
LL | / #[inline]
9494
LL | | // Still lint cases where the empty line does not immediately follow the attribute
9595
LL | |
96-
| |_
96+
| |_^
9797
LL | fn comment_before_empty_line() {}
9898
| ------------------------------ the attribute applies to this function
9999
|
@@ -106,7 +106,7 @@ LL | / #[allow(unused)]
106106
LL | |
107107
LL | | // This comment is isolated
108108
LL | |
109-
| |_
109+
| |_^
110110
LL | pub fn isolated_comment() {}
111111
| ------------------------- the attribute applies to this function
112112
|

tests/ui/four_forward_slashes.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
33
|
44
LL | / //// whoops
55
LL | | fn a() {}
6-
| |_
6+
| |_^
77
|
88
= note: `-D clippy::four-forward-slashes` implied by `-D warnings`
99
= help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`
@@ -18,7 +18,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
1818
LL | / //// whoops
1919
LL | | #[allow(dead_code)]
2020
LL | | fn b() {}
21-
| |_
21+
| |_^
2222
|
2323
help: make this a doc comment by removing one `/`
2424
|
@@ -32,7 +32,7 @@ LL | / //// whoops
3232
LL | | //// two borked comments!
3333
LL | | #[track_caller]
3434
LL | | fn c() {}
35-
| |_
35+
| |_^
3636
|
3737
help: turn these into doc comments by removing one `/`
3838
|
@@ -46,7 +46,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
4646
LL | / //// between attributes
4747
LL | | #[allow(dead_code)]
4848
LL | | fn g() {}
49-
| |_
49+
| |_^
5050
|
5151
help: make this a doc comment by removing one `/`
5252
|
@@ -58,7 +58,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
5858
|
5959
LL | / //// not very start of contents
6060
LL | | fn h() {}
61-
| |_
61+
| |_^
6262
|
6363
help: make this a doc comment by removing one `/`
6464
|

tests/ui/four_forward_slashes_first_line.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
33
|
44
LL | / //// borked doc comment on the first line. doesn't combust!
55
LL | | fn a() {}
6-
| |_
6+
| |_^
77
|
88
= note: `-D clippy::four-forward-slashes` implied by `-D warnings`
99
= help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`

tests/ui/too_long_first_doc_paragraph-fix.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | | /// A much longer explanation that goes into a lot more detail about
66
LL | | /// how the thing works, possibly with doclinks and so one,
77
LL | | /// and probably spanning a many rows. Blablabla, it needs to be over
88
LL | | /// 200 characters so I needed to write something longeeeeeeer.
9-
| |_
9+
| |_^
1010
|
1111
= note: `-D clippy::too-long-first-doc-paragraph` implied by `-D warnings`
1212
= help: to override `-D warnings` add `#[allow(clippy::too_long_first_doc_paragraph)]`

tests/ui/too_long_first_doc_paragraph.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ error: first doc comment paragraph is too long
2323
LL | / /// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
2424
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
2525
LL | | /// gravida non lacinia at, rhoncus eu lacus.
26-
| |_
26+
| |_^
2727

2828
error: first doc comment paragraph is too long
2929
--> tests/ui/too_long_first_doc_paragraph.rs:36:1
@@ -32,7 +32,7 @@ LL | / /// Lorem
3232
LL | | /// ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
3333
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
3434
LL | | /// gravida non lacinia at, rhoncus eu lacus.
35-
| |_
35+
| |_^
3636

3737
error: aborting due to 3 previous errors
3838

0 commit comments

Comments
 (0)