jfrick commited on
Commit
fd5a7e4
·
verified ·
1 Parent(s): e94cb49

Batched collector checkpoint

Browse files
Files changed (41) hide show
  1. changes/20261028T105419Z/rust-lang--rust-part011-00000.jsonl.gz +3 -0
  2. patches/20261028T105419Z/rust-lang--rust-part011/07d97873828a24fe06c6eae2feff45f10518f089.patch +94 -0
  3. patches/20261028T105419Z/rust-lang--rust-part011/09c7d6fab3648d715c3ae00cc37b96c8f3f9bb93.patch +43 -0
  4. patches/20261028T105419Z/rust-lang--rust-part011/0a7c6f478a73b06c3cdb8ce642b05189e0299f68.patch +28 -0
  5. patches/20261028T105419Z/rust-lang--rust-part011/2686c8c0128c0cd672f5b6df5603f7743f64b846.patch +158 -0
  6. patches/20261028T105419Z/rust-lang--rust-part011/26b5b02b77dcf30e1f20f657211afaab7eedbee8.patch +188 -0
  7. patches/20261028T105419Z/rust-lang--rust-part011/44ec893f6f4d0f528c5e5c131bb19d84995f2ebb.patch +30 -0
  8. patches/20261028T105419Z/rust-lang--rust-part011/47562f99ac1bdeab3ad8c0d92dc0619cf4adf820.patch +457 -0
  9. patches/20261028T105419Z/rust-lang--rust-part011/4bd9ab9e3c0feabc345454a07ecec1f5178d9740.patch +110 -0
  10. patches/20261028T105419Z/rust-lang--rust-part011/4f5002db4e071f169e670097913a63f16f305492.patch +185 -0
  11. patches/20261028T105419Z/rust-lang--rust-part011/5110c2445166de9b493483b52e374dbea2730afa.patch +33 -0
  12. patches/20261028T105419Z/rust-lang--rust-part011/530a4e554f21c8283db98277baea0761be84dd66.patch +12 -0
  13. patches/20261028T105419Z/rust-lang--rust-part011/536ac287713d9be8d8e8155cae8d4578e1704bf4.patch +1190 -0
  14. patches/20261028T105419Z/rust-lang--rust-part011/5fae19c02516f3b1dc3eb5e2e3532b19d9b9f390.patch +232 -0
  15. patches/20261028T105419Z/rust-lang--rust-part011/610f6ff258262a85cc1fe6fe5cd8ca300953ff04.patch +43 -0
  16. patches/20261028T105419Z/rust-lang--rust-part011/6423eed93f6662dee0d087dd3f237de0aaca69b0.patch +240 -0
  17. patches/20261028T105419Z/rust-lang--rust-part011/68c2ddf5d3d1f2bdb02a516625a4888f40a92a27.patch +41 -0
  18. patches/20261028T105419Z/rust-lang--rust-part011/6c8bd24ec61a7f9bf0bd1e30eb664dd96f932985.patch +15 -0
  19. patches/20261028T105419Z/rust-lang--rust-part011/6cabf9581df3b56951055bd63a250e2fda9f49ec.patch +27 -0
  20. patches/20261028T105419Z/rust-lang--rust-part011/70020cc60fdf32e67cbfc5818da8e3c7e34a1918.patch +48 -0
  21. patches/20261028T105419Z/rust-lang--rust-part011/787af2b8c80638c51a4fc8e44f84e6891f243ec7.patch +0 -0
  22. patches/20261028T105419Z/rust-lang--rust-part011/80f74433dbd201f6cf1eabf24820acf08993d110.patch +74 -0
  23. patches/20261028T105419Z/rust-lang--rust-part011/819099b56c2c69e5ed886b4b4f1c572beefa749d.patch +639 -0
  24. patches/20261028T105419Z/rust-lang--rust-part011/8432202b58569eb29b4ca2750eb7eefea94c0f04.patch +24 -0
  25. patches/20261028T105419Z/rust-lang--rust-part011/844b744a9962206de8c877d881a0a4edfe24b5bd.patch +1066 -0
  26. patches/20261028T105419Z/rust-lang--rust-part011/92fc352d158ed4bbd9879258d1a7898ae4bd991c.patch +0 -0
  27. patches/20261028T105419Z/rust-lang--rust-part011/96e2d460b640d06767d7f7d0251f4620a8bad123.patch +442 -0
  28. patches/20261028T105419Z/rust-lang--rust-part011/a725c3e72b72b1da3af04dd8bc265641bfe8cd45.patch +584 -0
  29. patches/20261028T105419Z/rust-lang--rust-part011/b8dca7f7daf2eb91b65b3e0eeacf4c0ef49959c1.patch +20 -0
  30. patches/20261028T105419Z/rust-lang--rust-part011/ba47895f5aee2ae4d79aa146ab7850948b743e33.patch +141 -0
  31. patches/20261028T105419Z/rust-lang--rust-part011/ba4efa6a5ab8987bff3a3a962cb45444050cbdec.patch +430 -0
  32. patches/20261028T105419Z/rust-lang--rust-part011/bceece16f135c3862071c51ebabf7d4e42114e35.patch +41 -0
  33. patches/20261028T105419Z/rust-lang--rust-part011/bedeb1e61284f000f0958bc3c04da7b68ef4abb3.patch +180 -0
  34. patches/20261028T105419Z/rust-lang--rust-part011/d02b65b54d71567d7cc1d668a4524aab9b5eb33c.patch +192 -0
  35. patches/20261028T105419Z/rust-lang--rust-part011/db59539ce6f8be0394f91699763b2c8256946983.patch +197 -0
  36. patches/20261028T105419Z/rust-lang--rust-part011/dda473214ee4569372af5f627a769b7413e15093.patch +0 -0
  37. patches/20261028T105419Z/rust-lang--rust-part011/deb81605189b7df985187428eb2ef9f934e2804d.patch +293 -0
  38. patches/20261028T105419Z/rust-lang--rust-part011/e845ed8cc9c0c18cd30c71f7f7b1e2918531e84a.patch +48 -0
  39. patches/20261028T105419Z/rust-lang--rust-part011/e99f23fec0b37494a9361b02fe509997896c5e37.patch +496 -0
  40. patches/20261028T105419Z/rust-lang--rust-part011/fddaffe8e045a15eee8127b22317fb95b1a10127.patch +697 -0
  41. progress/20261028T105419Z/rust-lang--rust-part011-patches.json +1 -0
changes/20261028T105419Z/rust-lang--rust-part011-00000.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02e0f11e994bc8d159150d2e5b1105b099000b062eceedc2971e12a3b985268f
3
+ size 6725081
patches/20261028T105419Z/rust-lang--rust-part011/07d97873828a24fe06c6eae2feff45f10518f089.patch ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
2
+ index 4e111d01b637bde062b991accae7c5d607228411..c482d05b1e463cebabc8902e016fbf10e4aaa069 100644
3
+ --- a/compiler/rustc_resolve/src/late.rs
4
+ +++ b/compiler/rustc_resolve/src/late.rs
5
+ @@ -287,7 +287,8 @@ impl RibKind<'_> {
6
+ #[derive(Debug)]
7
+ pub(crate) struct Rib<'ra, R = Res> {
8
+ pub bindings: FxIndexMap<Ident, R>,
9
+ - pub patterns_with_skipped_bindings: UnordMap<DefId, Vec<(Span, Result<(), ErrorGuaranteed>)>>,
10
+ + pub patterns_with_skipped_bindings:
11
+ + UnordMap<DefId, Vec<(Span, Option<Span>, Result<(), ErrorGuaranteed>)>>,
12
+ pub kind: RibKind<'ra>,
13
+ }
14
+
15
+ @@ -4363,6 +4364,10 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16
+ .or_default()
17
+ .push((
18
+ pat.span,
19
+ + match rest {
20
+ + ast::PatFieldsRest::Rest(span) => Some(*span),
21
+ + _ => None,
22
+ + },
23
+ match rest {
24
+ ast::PatFieldsRest::Recovered(guar) => Err(*guar),
25
+ _ => Ok(()),
26
+ diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs
27
+ index 3521419cc5de6954c026722244e75d713df113eb..0046ccdba6ec48a288595657f9d061e9aa8d382e 100644
28
+ --- a/compiler/rustc_resolve/src/late/diagnostics.rs
29
+ +++ b/compiler/rustc_resolve/src/late/diagnostics.rs
30
+ @@ -1602,11 +1602,11 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
31
+ {
32
+ for field in fields {
33
+ if field.name == segment.ident.name {
34
+ - if spans.iter().all(|(_, had_error)| had_error.is_err()) {
35
+ + if spans.iter().all(|(.., had_error)| had_error.is_err()) {
36
+ // This resolution error will likely be fixed by fixing a
37
+ // syntax error in a pattern, so it is irrelevant to the user.
38
+ let multispan: MultiSpan =
39
+ - spans.iter().map(|(s, _)| *s).collect::<Vec<_>>().into();
40
+ + spans.iter().map(|(s, ..)| *s).collect::<Vec<_>>().into();
41
+ err.span_note(
42
+ multispan,
43
+ "this pattern had a recovered parse error which likely lost \
44
+ @@ -1615,7 +1615,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
45
+ err.downgrade_to_delayed_bug();
46
+ }
47
+ let ty = self.r.tcx.item_name(*def_id);
48
+ - for (span, _) in spans {
49
+ + for (span, rest_span, _) in spans {
50
+ err.span_label(
51
+ *span,
52
+ format!(
53
+ @@ -1623,6 +1623,14 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
54
+ available in `{ty}`",
55
+ ),
56
+ );
57
+ + if let Some(rest_span) = rest_span {
58
+ + err.span_suggestion_verbose(
59
+ + *rest_span,
60
+ + format!("include `{field}` in the pattern"),
61
+ + format!("{field}, .."),
62
+ + Applicability::MaybeIncorrect,
63
+ + );
64
+ + }
65
+ }
66
+ }
67
+ }
68
+ diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr
69
+ index e588ffd388690808e307fd0be3802571d50ab355..d2047c4102d156e2785490ae3d2ea28cc8dc8b06 100644
70
+ --- a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr
71
+ +++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr
72
+ @@ -13,6 +13,11 @@ LL | if let Website { url, .. } = website {
73
+ | ------------------- this pattern doesn't include `title`, which is available in `Website`
74
+ LL | println!("[{}]({})", title, url);
75
+ | ^^^^^ not found in this scope
76
+ + |
77
+ +help: include `title` in the pattern
78
+ + |
79
+ +LL | if let Website { url, title, .. } = website {
80
+ + | ++++++
81
+
82
+ error[E0425]: cannot find value `a` in this scope
83
+ --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:28:20
84
+ @@ -22,6 +27,10 @@ LL | if let Foo::Bar { .. } = x {
85
+ LL | println!("{a}");
86
+ | ^ not found in this scope
87
+ |
88
+ +help: include `a` in the pattern
89
+ + |
90
+ +LL | if let Foo::Bar { a, .. } = x {
91
+ + | ++
92
+ help: a local variable with a similar name exists
93
+ |
94
+ LL - println!("{a}");
patches/20261028T105419Z/rust-lang--rust-part011/09c7d6fab3648d715c3ae00cc37b96c8f3f9bb93.patch ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/.github/workflows/clippy_mq.yml b/.github/workflows/clippy_mq.yml
2
+ index 43cab49d8ece60f6829b0a8167992571dacce8f4..3dd4a5abe8f3a7a40d28b8862a920c902f1ebfb6 100644
3
+ --- a/.github/workflows/clippy_mq.yml
4
+ +++ b/.github/workflows/clippy_mq.yml
5
+ @@ -147,7 +147,6 @@ jobs:
6
+ max-parallel: 6
7
+ matrix:
8
+ integration:
9
+ - - 'matthiaskrgr/clippy_ci_panic_test'
10
+ - 'rust-lang/cargo'
11
+ - 'rust-lang/chalk'
12
+ - 'rust-lang/rustfmt'
13
+ diff --git a/tests/integration.rs b/tests/integration.rs
14
+ index 4275292fd86e616c31cef1eaab5b48e80eb63e0b..06e87c17d283a3288ac5bba242cc3403ad6d1aa9 100644
15
+ --- a/tests/integration.rs
16
+ +++ b/tests/integration.rs
17
+ @@ -61,26 +61,6 @@ fn integration_test() {
18
+ // debug:
19
+ eprintln!("{stderr}");
20
+
21
+ - // this is an internal test to make sure we would correctly panic on a span_delayed_bug
22
+ - if repo_name == "matthiaskrgr/clippy_ci_panic_test" {
23
+ - // we need to kind of switch around our logic here:
24
+ - // if we find a panic, everything is fine, if we don't panic, SOMETHING is broken about our testing
25
+ -
26
+ - // the repo basically just contains a span_delayed_bug that forces rustc/clippy to panic:
27
+ - /*
28
+ - #![feature(rustc_attrs)]
29
+ - #[rustc_error(delayed_bug_from_inside_query)]
30
+ - fn main() {}
31
+ - */
32
+ -
33
+ - if stderr.find("error: internal compiler error").is_some() {
34
+ - eprintln!("we saw that we intentionally panicked, yay");
35
+ - return;
36
+ - }
37
+ -
38
+ - panic!("panic caused by span_delayed_bug was NOT detected! Something is broken!");
39
+ - }
40
+ -
41
+ if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
42
+ static BACKTRACE_END_MSG: &str = "end of query stack";
43
+ let backtrace_end = stderr[backtrace_start..]
patches/20261028T105419Z/rust-lang--rust-part011/0a7c6f478a73b06c3cdb8ce642b05189e0299f68.patch ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs
2
+ index 549dcc24cfa9a74c4c5f18052179bb010c645b5b..f7eb76bbe72b5cc2c56e6ec7ea67e6c20c2d6d08 100644
3
+ --- a/compiler/rustc_trait_selection/src/solve/fulfill.rs
4
+ +++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs
5
+ @@ -21,7 +21,11 @@ use crate::traits::{FulfillmentError, ScrubbedTraitError};
6
+
7
+ mod derive_errors;
8
+
9
+ -// FIXME: Do we need to use a `ThinVec` here?
10
+ +// `ThinVec` is important for performance, but not for the usual memory layout reasons.
11
+ +// `try_evaluate_obligations` is extremely hot and uses `retain_mut`. `ThinVec::retain_mut` is
12
+ +// simple and sub-optimal in terms of how it moves elements, but it can be inlined.
13
+ +// `Vec::retain_mut` is more sophisticated and minimizes element moves, but also contains more code
14
+ +// and doesn't get inlined in `try_evaluate_obligations`, giving worse performance overall.
15
+ type PendingObligations<'tcx> =
16
+ ThinVec<(PredicateObligation<'tcx>, Option<GoalStalledOn<TyCtxt<'tcx>>>)>;
17
+
18
+ @@ -453,7 +457,9 @@ mod size_asserts {
19
+ use super::*;
20
+ // tidy-alphabetical-start
21
+ // Before #160005 this pair was greater than 128 bytes, which triggered the use of (slow)
22
+ - // `memcpy` for moving elements of `PendingObligations`.
23
+ + // `memcpy` for moving elements of `PendingObligations`. Then #160479 greatly reduced the
24
+ + // number of `memcpy` operations in `try_evaluate_obligations`. So the size of this pair is
25
+ + // much less important than it was, but still shouldn't be changed without some thought.
26
+ static_assert_size!((PredicateObligation<'_>, Option<GoalStalledOn<TyCtxt<'_>>>), 104);
27
+ // tidy-alphabetical-end
28
+ }
patches/20261028T105419Z/rust-lang--rust-part011/2686c8c0128c0cd672f5b6df5603f7743f64b846.patch ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
2
+ index 03d13e6a81a6e88b3a496a7448003b926000e226..ee8d8659e66e1e507bc4dabb05734377fba7661b 100644
3
+ --- a/compiler/rustc_middle/src/ty/print/pretty.rs
4
+ +++ b/compiler/rustc_middle/src/ty/print/pretty.rs
5
+ @@ -2692,15 +2692,10 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
6
+ struct RegionFolder<'a, 'tcx> {
7
+ tcx: TyCtxt<'tcx>,
8
+ current_index: ty::DebruijnIndex,
9
+ + /// Regions bound by the binder being named (and placeholders) that have
10
+ + /// already been named.
11
+ region_map: UnordMap<ty::BoundRegion<'tcx>, ty::Region<'tcx>>,
12
+ - name: &'a mut (
13
+ - dyn FnMut(
14
+ - Option<ty::DebruijnIndex>, // Debruijn index of the folded late-bound region
15
+ - ty::DebruijnIndex, // Index corresponding to binder level
16
+ - ty::BoundRegion<'tcx>,
17
+ - ) -> ty::Region<'tcx>
18
+ - + 'a
19
+ - ),
20
+ + name: &'a mut (dyn FnMut(ty::BoundRegion<'tcx>) -> ty::Region<'tcx> + 'a),
21
+ }
22
+
23
+ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
24
+ @@ -2731,8 +2726,13 @@ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
25
+ fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
26
+ let name = &mut self.name;
27
+ let region = match r.kind() {
28
+ - ty::ReBound(ty::BoundVarIndexKind::Bound(db), br) if db >= self.current_index => {
29
+ - *self.region_map.entry(br).or_insert_with(|| name(Some(db), self.current_index, br))
30
+ + // Only name regions bound by the binder being named. Regions bound by an
31
+ + // enclosing binder that merely escape through this one keep their name
32
+ + // (they were named when that binder was folded) and their index, and must
33
+ + // not end up in `region_map`, which callers use to build `for<...>` lists
34
+ + // (#102392, #134410).
35
+ + ty::ReBound(ty::BoundVarIndexKind::Bound(db), br) if db == self.current_index => {
36
+ + *self.region_map.entry(br).or_insert_with(|| name(br))
37
+ }
38
+ ty::RePlaceholder(ty::PlaceholderRegion {
39
+ bound: ty::BoundRegion { kind, .. },
40
+ @@ -2745,10 +2745,7 @@ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
41
+ _ => {
42
+ // Index doesn't matter, since this is just for naming and these never get bound
43
+ let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind };
44
+ - *self
45
+ - .region_map
46
+ - .entry(br)
47
+ - .or_insert_with(|| name(None, self.current_index, br))
48
+ + *self.region_map.entry(br).or_insert_with(|| name(br))
49
+ }
50
+ }
51
+ }
52
+ @@ -2857,13 +2854,8 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
53
+
54
+ let trim_path = with_forced_trimmed_paths();
55
+ // Closure used in `RegionFolder` to create names for anonymous late-bound
56
+ - // regions. We use two `DebruijnIndex`es (one for the currently folded
57
+ - // late-bound region and the other for the binder level) to determine
58
+ - // whether a name has already been created for the currently folded region,
59
+ - // see issue #102392.
60
+ - let mut name = |lifetime_idx: Option<ty::DebruijnIndex>,
61
+ - binder_level_idx: ty::DebruijnIndex,
62
+ - br: ty::BoundRegion<'tcx>| {
63
+ + // regions.
64
+ + let mut name = |br: ty::BoundRegion<'tcx>| {
65
+ let (name, kind) = if let Some(name) = br.kind.get_name(tcx) {
66
+ (name, br.kind)
67
+ } else {
68
+ @@ -2871,16 +2863,6 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
69
+ (name, ty::BoundRegionKind::NamedForPrinting(name))
70
+ };
71
+
72
+ - if let Some(lt_idx) = lifetime_idx {
73
+ - if lt_idx > binder_level_idx {
74
+ - return ty::Region::new_bound(
75
+ - tcx,
76
+ - ty::INNERMOST,
77
+ - ty::BoundRegion { var: br.var, kind },
78
+ - );
79
+ - }
80
+ - }
81
+ -
82
+ // Unconditionally render `unsafe<>`.
83
+ if !trim_path || mode == WrapBinderMode::Unsafe {
84
+ start_or_continue(self, mode.start_str(), ", ");
85
+ diff --git a/tests/ui/higher-ranked/nested-binder-cmp-fn-sig-print.rs b/tests/ui/higher-ranked/nested-binder-cmp-fn-sig-print.rs
86
+ new file mode 100644
87
+ index 0000000000000000000000000000000000000000..65620812e3f8a742e117584935574a17564d2154
88
+ --- /dev/null
89
+ +++ b/tests/ui/higher-ranked/nested-binder-cmp-fn-sig-print.rs
90
+ @@ -0,0 +1,26 @@
91
+ +//! Regression test for <https://github.com/rust-lang/rust/issues/134410> and
92
+ +//! <https://github.com/rust-lang/rust/issues/111365>.
93
+ +//!
94
+ +//! The expected/found notes of "one type is more general than the other" errors
95
+ +//! used to leak lifetimes bound by outer binders into nested `for<...>` lists,
96
+ +//! printing invalid types such as `&mut for<'a> fn(for<'a> fn(&'a ()))` or
97
+ +//! `for<'o> fn(for<'a, 'o> fn(&'a (), &'o ()))`.
98
+ +
99
+ +type F1 = fn(fn(&'static ()));
100
+ +type F2 = for<'a> fn(fn(&'a ()));
101
+ +
102
+ +fn issue_134410(a: &mut F1) {
103
+ + let _: &mut F2 = a; //~ ERROR mismatched types
104
+ +}
105
+ +
106
+ +type One = fn(HelperOne);
107
+ +type HelperOne = for<'a> fn(&'a (), &'a ());
108
+ +
109
+ +type Two = for<'o> fn(HelperTwo<'o>);
110
+ +type HelperTwo<'x> = for<'a> fn(&'a (), &'x ());
111
+ +
112
+ +fn issue_111365(x: One) -> Two {
113
+ + x //~ ERROR mismatched types
114
+ +}
115
+ +
116
+ +fn main() {}
117
+ diff --git a/tests/ui/higher-ranked/nested-binder-cmp-fn-sig-print.stderr b/tests/ui/higher-ranked/nested-binder-cmp-fn-sig-print.stderr
118
+ new file mode 100644
119
+ index 0000000000000000000000000000000000000000..c26b39ec5a567ed29e4129975df1febe00644829
120
+ --- /dev/null
121
+ +++ b/tests/ui/higher-ranked/nested-binder-cmp-fn-sig-print.stderr
122
+ @@ -0,0 +1,23 @@
123
+ +error[E0308]: mismatched types
124
+ + --> $DIR/nested-binder-cmp-fn-sig-print.rs:23:5
125
+ + |
126
+ +LL | fn issue_111365(x: One) -> Two {
127
+ + | --- expected `for<'o> fn(for<'a> fn(&'a (), &'o ()))` because of return type
128
+ +LL | x
129
+ + | ^ one type is more general than the other
130
+ + |
131
+ + = note: expected fn pointer `for<'o> fn(for<'a> fn(&'a (), &'o ()))`
132
+ + found fn pointer `fn(for<'a> fn(&'a (), &'a ()))`
133
+ +
134
+ +error[E0308]: mismatched types
135
+ + --> $DIR/nested-binder-cmp-fn-sig-print.rs:13:22
136
+ + |
137
+ +LL | let _: &mut F2 = a;
138
+ + | ^ one type is more general than the other
139
+ + |
140
+ + = note: expected mutable reference `&mut for<'a> fn(fn(&'a ()))`
141
+ + found mutable reference `&mut fn(fn(&()))`
142
+ +
143
+ +error: aborting due to 2 previous errors
144
+ +
145
+ +For more information about this error, try `rustc --explain E0308`.
146
+ diff --git a/tests/ui/nll/relate_tys/placeholder-outlives-existential.stderr b/tests/ui/nll/relate_tys/placeholder-outlives-existential.stderr
147
+ index 80ab5c8d6e9d8b28a47ad57a78e7d5c6d388e0c2..05950c4d4f48aeb8154bc6d37a2ef1d573d2e115 100644
148
+ --- a/tests/ui/nll/relate_tys/placeholder-outlives-existential.stderr
149
+ +++ b/tests/ui/nll/relate_tys/placeholder-outlives-existential.stderr
150
+ @@ -5,7 +5,7 @@ LL | x
151
+ | ^ one type is more general than the other
152
+ |
153
+ = note: expected fn pointer `fn(fn(fn(for<'unify> fn(Contra<'unify>, Co<'unify>))))`
154
+ - found fn pointer `for<'e> fn(for<'e, 'p> fn(for<'e, 'p> fn(for<'e, 'p> fn(Contra<'e>, Co<'p>))))`
155
+ + found fn pointer `for<'e> fn(for<'p> fn(fn(fn(Contra<'e>, Co<'p>))))`
156
+
157
+ error: lifetime may not live long enough
158
+ --> $DIR/placeholder-outlives-existential.rs:28:5
patches/20261028T105419Z/rust-lang--rust-part011/26b5b02b77dcf30e1f20f657211afaab7eedbee8.patch ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/src/edit_lints.rs b/clippy_dev/src/edit_lints.rs
2
+ index 2ea3a84bdc7109dd76f187d0464bd30f9745092c..59013ca820d9c2b95454ed58c7b6dc8a0a1c9708 100644
3
+ --- a/clippy_dev/src/edit_lints.rs
4
+ +++ b/clippy_dev/src/edit_lints.rs
5
+ @@ -333,7 +333,7 @@ fn uplift_update_fn<'a>(
6
+ while let Some(ident) = cursor.find_any_ident() {
7
+ match cursor.get_text(ident) {
8
+ "mod"
9
+ - if remove_mod && cursor.match_all(&[cursor::Pat::Ident(old_name), cursor::Pat::Semi], &mut []) =>
10
+ + if remove_mod && cursor.match_ident(old_name).is_some() && cursor.match_pat(cursor::Pat::Semi) =>
11
+ {
12
+ dst.push_str(&src[copy_pos as usize..ident.pos as usize]);
13
+ dst.push_str(new_name);
14
+ @@ -343,7 +343,7 @@ fn uplift_update_fn<'a>(
15
+ }
16
+ changed = true;
17
+ },
18
+ - "clippy" if cursor.match_all(&[cursor::Pat::DoubleColon, cursor::Pat::Ident(old_name)], &mut []) => {
19
+ + "clippy" if cursor.match_pat(cursor::Pat::DoubleColon) && cursor.match_ident(old_name).is_some() => {
20
+ dst.push_str(&src[copy_pos as usize..ident.pos as usize]);
21
+ dst.push_str(new_name);
22
+ copy_pos = cursor.pos();
23
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
24
+ index ff6c63f61d8665701bc617f9fc820ab2a4fb8d42..d4e7fdfdba52175945e3961f44d2aa59dd07946b 100644
25
+ --- a/clippy_dev/src/parse.rs
26
+ +++ b/clippy_dev/src/parse.rs
27
+ @@ -1,6 +1,6 @@
28
+ pub mod cursor;
29
+
30
+ -use self::cursor::{Capture, Cursor};
31
+ +use self::cursor::{Capture, Cursor, IdentPat};
32
+ use crate::utils::{ErrAction, File, Scoped, expect_action, slice_groups_mut, walk_dir_no_dot_or_target};
33
+ use core::cell::Cell;
34
+ use core::fmt::{self, Display, Write as _};
35
+ @@ -352,16 +352,17 @@ impl<'cx> ParseCxImpl<'cx> {
36
+ #[allow(clippy::enum_glob_use)]
37
+ use cursor::Pat::*;
38
+ #[rustfmt::skip]
39
+ - static LINT_DECL_TOKENS: &[cursor::Pat<'_>] = &[
40
+ + static LINT_DECL_TOKENS: &[cursor::Pat] = &[
41
+ // !{ /// docs
42
+ Bang, OpenBrace, AnyComment,
43
+ // #[clippy::version = "version"]
44
+ - Pound, OpenBracket, Ident("clippy"), DoubleColon, Ident("version"), Eq, LitStr, CloseBracket,
45
+ + Pound, OpenBracket, Ident(IdentPat::clippy), DoubleColon,
46
+ + Ident(IdentPat::version), Eq, LitStr, CloseBracket,
47
+ // pub NAME, GROUP,
48
+ - Ident("pub"), CaptureIdent, Comma, AnyComment, CaptureIdent, Comma,
49
+ + Ident(IdentPat::r#pub), CaptureIdent, Comma, AnyComment, CaptureIdent, Comma,
50
+ ];
51
+ #[rustfmt::skip]
52
+ - static PASS_DECL_TOKENS: &[cursor::Pat<'_>] = &[
53
+ + static PASS_DECL_TOKENS: &[cursor::Pat] = &[
54
+ // !( NAME <'lt> => [
55
+ Bang, OpenParen, CaptureDocLines, CaptureIdent, CaptureOptLifetimeArg, FatArrow, OpenBracket,
56
+ ];
57
+ @@ -453,22 +454,26 @@ impl<'cx> ParseCxImpl<'cx> {
58
+ fn parse_deprecated_lints(&mut self, data: &mut LintData<'cx>) {
59
+ #[allow(clippy::enum_glob_use)]
60
+ use cursor::Pat::*;
61
+ +
62
+ #[rustfmt::skip]
63
+ - static DECL_TOKENS: &[cursor::Pat<'_>] = &[
64
+ + static DECL_TOKENS: &[cursor::Pat] = &[
65
+ // #[clippy::version = "version"]
66
+ - Pound, OpenBracket, Ident("clippy"), DoubleColon, Ident("version"), Eq, CaptureLitStr, CloseBracket,
67
+ + Pound, OpenBracket, Ident(IdentPat::clippy), DoubleColon,
68
+ + Ident(IdentPat::version), Eq, CaptureLitStr, CloseBracket,
69
+ // ("first", "second"),
70
+ OpenParen, CaptureLitStr, Comma, CaptureLitStr, CloseParen, Comma,
71
+ ];
72
+ #[rustfmt::skip]
73
+ - static DEPRECATED_TOKENS: &[cursor::Pat<'_>] = &[
74
+ + static DEPRECATED_TOKENS: &[cursor::Pat] = &[
75
+ // !{ DEPRECATED(DEPRECATED_VERSION) = [
76
+ - Bang, OpenBrace, Ident("DEPRECATED"), OpenParen, Ident("DEPRECATED_VERSION"), CloseParen, Eq, OpenBracket,
77
+ + Bang, OpenBrace, Ident(IdentPat::DEPRECATED), OpenParen,
78
+ + Ident(IdentPat::DEPRECATED_VERSION), CloseParen, Eq, OpenBracket,
79
+ ];
80
+ #[rustfmt::skip]
81
+ - static RENAMED_TOKENS: &[cursor::Pat<'_>] = &[
82
+ + static RENAMED_TOKENS: &[cursor::Pat] = &[
83
+ // !{ RENAMED(RENAMED_VERSION) = [
84
+ - Bang, OpenBrace, Ident("RENAMED"), OpenParen, Ident("RENAMED_VERSION"), CloseParen, Eq, OpenBracket,
85
+ + Bang, OpenBrace, Ident(IdentPat::RENAMED), OpenParen,
86
+ + Ident(IdentPat::RENAMED_VERSION), CloseParen, Eq, OpenBracket,
87
+ ];
88
+
89
+ let file = data.deprecated_file;
90
+ diff --git a/clippy_dev/src/parse/cursor.rs b/clippy_dev/src/parse/cursor.rs
91
+ index af840532c27bd0e9472c6eaa0438ba97841561db..5a30931040a323383ecca651979c70934ca49d3c 100644
92
+ --- a/clippy_dev/src/parse/cursor.rs
93
+ +++ b/clippy_dev/src/parse/cursor.rs
94
+ @@ -8,10 +8,10 @@ use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind};
95
+ /// `DoubleColon` will consume the first `:` and then fail to match, leaving the cursor at
96
+ /// the `*`.
97
+ #[derive(Clone, Copy)]
98
+ -pub enum Pat<'a> {
99
+ +pub enum Pat {
100
+ + Ident(IdentPat),
101
+ /// Matches any number of comments and doc comments.
102
+ AnyComment,
103
+ - Ident(&'a str),
104
+ CaptureDocLines,
105
+ CaptureIdent,
106
+ LitStr,
107
+ @@ -35,6 +35,36 @@ pub enum Pat<'a> {
108
+ Semi,
109
+ }
110
+
111
+ +macro_rules! ident_or_lit {
112
+ + ($ident:ident) => {
113
+ + stringify!($ident)
114
+ + };
115
+ + ($_ident:ident $lit:literal) => {
116
+ + $lit
117
+ + };
118
+ +}
119
+ +macro_rules! decl_ident_pats {
120
+ + ($($ident:ident $(= $s:literal)?,)*) => {
121
+ + #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
122
+ + #[derive(Clone, Copy)]
123
+ + pub enum IdentPat { $($ident),* }
124
+ + impl IdentPat {
125
+ + pub fn as_str(self) -> &'static str {
126
+ + match self { $(Self::$ident => ident_or_lit!($ident $($s)?)),* }
127
+ + }
128
+ + }
129
+ + }
130
+ +}
131
+ +decl_ident_pats! {
132
+ + DEPRECATED,
133
+ + DEPRECATED_VERSION,
134
+ + RENAMED,
135
+ + RENAMED_VERSION,
136
+ + clippy,
137
+ + r#pub = "pub",
138
+ + version,
139
+ +}
140
+ +
141
+ #[derive(Clone, Copy)]
142
+ pub struct Capture {
143
+ pub pos: u32,
144
+ @@ -116,7 +146,7 @@ impl<'txt> Cursor<'txt> {
145
+ /// For each capture made by the pattern one item will be taken from the capture
146
+ /// sequence with the result placed inside.
147
+ #[expect(clippy::too_many_lines)]
148
+ - fn match_impl(&mut self, pat: Pat<'_>, captures: &mut slice::IterMut<'_, Capture>) -> bool {
149
+ + fn match_impl(&mut self, pat: Pat, captures: &mut slice::IterMut<'_, Capture>) -> bool {
150
+ loop {
151
+ match (pat, self.next_token.kind) {
152
+ #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/6697
153
+ @@ -149,7 +179,7 @@ impl<'txt> Cursor<'txt> {
154
+ self.step();
155
+ return true;
156
+ },
157
+ - (Pat::Ident(x), TokenKind::Ident) if x == self.peek_text() => {
158
+ + (Pat::Ident(x), TokenKind::Ident) if x.as_str() == self.peek_text() => {
159
+ self.step();
160
+ return true;
161
+ },
162
+ @@ -319,7 +349,7 @@ impl<'txt> Cursor<'txt> {
163
+ /// Not generally suitable for multi-token patterns or patterns that can match
164
+ /// nothing.
165
+ #[must_use]
166
+ - pub fn find_pat(&mut self, pat: Pat<'_>) -> bool {
167
+ + pub fn find_pat(&mut self, pat: Pat) -> bool {
168
+ let mut capture = [].iter_mut();
169
+ while !self.match_impl(pat, &mut capture) {
170
+ self.step();
171
+ @@ -340,7 +370,7 @@ impl<'txt> Cursor<'txt> {
172
+ ///
173
+ /// If the match fails the cursor will be positioned at the first failing token.
174
+ #[must_use]
175
+ - pub fn match_all(&mut self, pats: &[Pat<'_>], captures: &mut [Capture]) -> bool {
176
+ + pub fn match_all(&mut self, pats: &[Pat], captures: &mut [Capture]) -> bool {
177
+ let mut captures = captures.iter_mut();
178
+ pats.iter().all(|&p| self.match_impl(p, &mut captures))
179
+ }
180
+ @@ -351,7 +381,7 @@ impl<'txt> Cursor<'txt> {
181
+ /// If the pattern attempts to capture anything this will panic. If the match fails
182
+ /// the cursor will be positioned at the first failing token.
183
+ #[must_use]
184
+ - pub fn match_pat(&mut self, pat: Pat<'_>) -> bool {
185
+ + pub fn match_pat(&mut self, pat: Pat) -> bool {
186
+ self.match_impl(pat, &mut [].iter_mut())
187
+ }
188
+ }
patches/20261028T105419Z/rust-lang--rust-part011/44ec893f6f4d0f528c5e5c131bb19d84995f2ebb.patch ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/codegen-llvm/issues/static-table-search-loop-44041.rs b/tests/codegen-llvm/issues/static-table-search-loop-44041.rs
2
+ new file mode 100644
3
+ index 0000000000000000000000000000000000000000..cbdfcd088aa1180792305b4fdec624ff5880367f
4
+ --- /dev/null
5
+ +++ b/tests/codegen-llvm/issues/static-table-search-loop-44041.rs
6
+ @@ -0,0 +1,24 @@
7
+ +// Tests that a loop searching a small static array is unrolled and simplified
8
+ +// down to a single comparison, with none of the unrolled branches left behind.
9
+ +// See <https://github.com/rust-lang/rust/issues/44041>.
10
+ +
11
+ +//@ compile-flags: -Copt-level=3
12
+ +
13
+ +#![crate_type = "lib"]
14
+ +
15
+ +static TABLE: [i32; 4] = [0; 4];
16
+ +
17
+ +// CHECK-LABEL: @exists_in_table(
18
+ +// CHECK-NOT: br {{.*}}
19
+ +// CHECK: icmp eq i32
20
+ +// CHECK-NOT: br {{.*}}
21
+ +// CHECK: ret i1
22
+ +#[no_mangle]
23
+ +pub fn exists_in_table(v: i32) -> bool {
24
+ + for &x in TABLE.iter() {
25
+ + if x == v {
26
+ + return true;
27
+ + }
28
+ + }
29
+ + false
30
+ +}
patches/20261028T105419Z/rust-lang--rust-part011/47562f99ac1bdeab3ad8c0d92dc0619cf4adf820.patch ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/src/edit_lints.rs b/clippy_dev/src/edit_lints.rs
2
+ index 9307fb41b6ea5a57aab7fba604d6ca78189c0db0..4ced81f5b1d3dc85f2cd26758ee7678cb282d131 100644
3
+ --- a/clippy_dev/src/edit_lints.rs
4
+ +++ b/clippy_dev/src/edit_lints.rs
5
+ @@ -1,5 +1,7 @@
6
+ use crate::parse::cursor::{self, Capture, Cursor};
7
+ -use crate::parse::{ActiveLint, DeprecatedLint, Lint, LintData, LintName, ParseCx, RenamedLint};
8
+ +use crate::parse::{
9
+ + ActiveLint, DeprecatedLint, Lint, LintData, LintName, ParseCx, ParsedLints, RenamedLint, SourceFile, Span,
10
+ +};
11
+ use crate::utils::{
12
+ ErrAction, FileUpdater, UpdateMode, UpdateStatus, Version, delete_dir_if_exists, delete_file_if_exists,
13
+ expect_action, try_rename_dir, try_rename_file, walk_dir_no_dot_or_target,
14
+ @@ -27,18 +29,28 @@ pub fn deprecate<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, name
15
+ eprintln!("error: failed to find lint `{name}`");
16
+ return;
17
+ };
18
+ - let Lint::Active(prev_lint) = mem::replace(
19
+ + let prev_lint = mem::replace(
20
+ lint.get_mut(),
21
+ - Lint::Deprecated(DeprecatedLint {
22
+ - reason,
23
+ - version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
24
+ - }),
25
+ - ) else {
26
+ + Lint {
27
+ + name_sp: Span::new(data.deprecated_file, 0..0),
28
+ + data: LintData::Deprecated(DeprecatedLint {
29
+ + reason,
30
+ + version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
31
+ + }),
32
+ + },
33
+ + );
34
+ + let LintData::Active(prev_lint_data) = prev_lint.data else {
35
+ eprintln!("error: `{name}` is already deprecated");
36
+ return;
37
+ };
38
+
39
+ - remove_lint_declaration(name, &prev_lint, &data, &mut FileUpdater::default());
40
+ + remove_lint_declaration(
41
+ + name,
42
+ + prev_lint.name_sp.file,
43
+ + &prev_lint_data,
44
+ + &data,
45
+ + &mut FileUpdater::default(),
46
+ + );
47
+ data.gen_decls(UpdateMode::Change);
48
+ println!("info: `{name}` has successfully been deprecated");
49
+ println!("note: you must run `cargo uitest` to update the test results");
50
+ @@ -53,19 +65,24 @@ pub fn uplift<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
51
+ eprintln!("error: failed to find lint `{old_name}`");
52
+ return;
53
+ };
54
+ - let Lint::Active(prev_lint) = mem::replace(
55
+ +
56
+ + let prev_lint = mem::replace(
57
+ lint.get_mut(),
58
+ - Lint::Renamed(RenamedLint {
59
+ - new_name: LintName::new_rustc(new_name),
60
+ - version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
61
+ - }),
62
+ - ) else {
63
+ + Lint {
64
+ + name_sp: Span::new(data.deprecated_file, 0..0),
65
+ + data: LintData::Renamed(RenamedLint {
66
+ + new_name: LintName::new_rustc(new_name),
67
+ + version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
68
+ + }),
69
+ + },
70
+ + );
71
+ + let LintData::Active(prev_lint_data) = prev_lint.data else {
72
+ eprintln!("error: `{old_name}` is already deprecated");
73
+ return;
74
+ };
75
+
76
+ let mut updater = FileUpdater::default();
77
+ - let remove_mod = remove_lint_declaration(old_name, &prev_lint, &data, &mut updater);
78
+ + let remove_mod = remove_lint_declaration(old_name, prev_lint.name_sp.file, &prev_lint_data, &data, &mut updater);
79
+ let mut update_fn = uplift_update_fn(old_name, new_name, remove_mod);
80
+ for e in walk_dir_no_dot_or_target(".") {
81
+ let e = expect_action(e, ErrAction::Read, ".");
82
+ @@ -103,32 +120,38 @@ pub fn rename<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
83
+ eprintln!("error: failed to find lint `{old_name}`");
84
+ return;
85
+ };
86
+ - let Lint::Active(prev_lint) = mem::replace(
87
+ +
88
+ + let prev_lint = mem::replace(
89
+ lint.get_mut(),
90
+ - Lint::Renamed(RenamedLint {
91
+ - new_name: LintName::new_clippy(new_name),
92
+ - version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
93
+ - }),
94
+ - ) else {
95
+ + Lint {
96
+ + name_sp: Span::new(data.deprecated_file, 0..0),
97
+ + data: LintData::Renamed(RenamedLint {
98
+ + new_name: LintName::new_clippy(new_name),
99
+ + version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
100
+ + }),
101
+ + },
102
+ + );
103
+ + if !matches!(prev_lint.data, LintData::Active(_)) {
104
+ eprintln!("error: `{old_name}` is already deprecated");
105
+ return;
106
+ };
107
+
108
+ + let prev_file = prev_lint.name_sp.file;
109
+ let mut rename_mod = false;
110
+ if let Entry::Vacant(e) = data.lints.entry(new_name) {
111
+ - if let Some((path, file)) = prev_lint.file.path.get().rsplit_once(path::MAIN_SEPARATOR)
112
+ + if let Some((path, file)) = prev_file.path.get().rsplit_once(path::MAIN_SEPARATOR)
113
+ && let Some(file) = file.strip_suffix(".rs")
114
+ && file == old_name
115
+ {
116
+ let new_path = cx
117
+ .str_buf
118
+ .alloc_display(cx.arena, format_args!("{path}{}{new_name}.rs", path::MAIN_SEPARATOR));
119
+ - if try_rename_file(prev_lint.file.path.get(), new_path) {
120
+ + if try_rename_file(prev_file.path.get(), new_path) {
121
+ rename_mod = true;
122
+ - prev_lint.file.path.set(new_path);
123
+ + prev_file.path.set(new_path);
124
+ }
125
+ }
126
+ - e.insert(Lint::Active(prev_lint));
127
+ + e.insert(prev_lint);
128
+ rename_test_files(old_name, new_name, &create_ignored_prefixes(old_name, &data));
129
+ } else {
130
+ println!("Renamed `{old_name}` to `{new_name}`");
131
+ @@ -153,22 +176,22 @@ pub fn rename<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
132
+
133
+ /// Removes a lint's declaration and test files. Returns whether the module containing the
134
+ /// lint was deleted.
135
+ -fn remove_lint_declaration(name: &str, lint: &ActiveLint<'_>, data: &LintData<'_>, updater: &mut FileUpdater) -> bool {
136
+ - let delete_mod = if data.lints.iter().all(|(_, l)| {
137
+ - if let Lint::Active(l) = l {
138
+ - l.file != lint.file
139
+ - } else {
140
+ - true
141
+ - }
142
+ - }) {
143
+ - delete_file_if_exists(lint.file.path.get())
144
+ +fn remove_lint_declaration(
145
+ + name: &str,
146
+ + lint_file: &SourceFile<'_>,
147
+ + lint_data: &ActiveLint<'_>,
148
+ + data: &ParsedLints<'_>,
149
+ + updater: &mut FileUpdater,
150
+ +) -> bool {
151
+ + let delete_mod = if data.lints.iter().all(|(_, l)| l.name_sp.file != lint_file) {
152
+ + delete_file_if_exists(lint_file.path.get())
153
+ } else {
154
+ - updater.update_file(lint.file.path.get(), &mut |_, src, dst| -> UpdateStatus {
155
+ - let mut start = &src[..lint.declaration_range.start as usize];
156
+ + updater.update_file(lint_file.path.get(), &mut |_, src, dst| -> UpdateStatus {
157
+ + let mut start = &src[..lint_data.decl_range.start as usize];
158
+ if start.ends_with("\n\n") {
159
+ start = &start[..start.len() - 1];
160
+ }
161
+ - let mut end = &src[lint.declaration_range.end as usize..];
162
+ + let mut end = &src[lint_data.decl_range.end as usize..];
163
+ if end.starts_with("\n\n") {
164
+ end = &end[1..];
165
+ }
166
+ @@ -187,10 +210,10 @@ fn remove_lint_declaration(name: &str, lint: &ActiveLint<'_>, data: &LintData<'_
167
+ ///
168
+ /// This is needed because rustc doesn't allow a lint to be renamed to a lint that has
169
+ /// also been renamed.
170
+ -fn update_rename_targets<'cx>(data: &mut LintData<'cx>, old_name: &str, new_name: LintName<'cx>) {
171
+ +fn update_rename_targets<'cx>(data: &mut ParsedLints<'cx>, old_name: &str, new_name: LintName<'cx>) {
172
+ let old_name = LintName::new_clippy(old_name);
173
+ for lint in data.lints.values_mut() {
174
+ - if let Lint::Renamed(lint) = lint
175
+ + if let LintData::Renamed(lint) = &mut lint.data
176
+ && lint.new_name == old_name
177
+ {
178
+ lint.new_name = new_name;
179
+ @@ -199,7 +222,7 @@ fn update_rename_targets<'cx>(data: &mut LintData<'cx>, old_name: &str, new_name
180
+ }
181
+
182
+ /// Creates a list of prefixes to ignore when
183
+ -fn create_ignored_prefixes<'cx>(name: &str, data: &LintData<'cx>) -> Vec<&'cx str> {
184
+ +fn create_ignored_prefixes<'cx>(name: &str, data: &ParsedLints<'cx>) -> Vec<&'cx str> {
185
+ data.lints
186
+ .keys()
187
+ .copied()
188
+ diff --git a/clippy_dev/src/fmt.rs b/clippy_dev/src/fmt.rs
189
+ index ba09dca6abd78e04c2aaf72cb23deff92c6f140a..ea136417425ba3ec9aebac0d44044de648ab99cc 100644
190
+ --- a/clippy_dev/src/fmt.rs
191
+ +++ b/clippy_dev/src/fmt.rs
192
+ @@ -344,7 +344,7 @@ pub fn run(update_mode: UpdateMode) {
193
+ let mut lints = data.mk_file_to_lint_decl_map();
194
+ let mut ranges = VecBuf::with_capacity(256);
195
+ for passes in data.iter_passes_by_file_mut() {
196
+ - let file = passes[0].file;
197
+ + let file = passes[0].decl_sp.file;
198
+ let mut lints = lints.remove(file);
199
+ let lints = lints.as_deref_mut().unwrap_or_default();
200
+ updater.update_loaded_file_checked("cargo dev fmt", update_mode, file, &mut |_, src, dst| {
201
+ diff --git a/clippy_dev/src/generate.rs b/clippy_dev/src/generate.rs
202
+ index 2159900d580c81c869600035554ffb0ff0c94e54..fe11d87bf06553bdceb33402aa495c542bee4bb1 100644
203
+ --- a/clippy_dev/src/generate.rs
204
+ +++ b/clippy_dev/src/generate.rs
205
+ @@ -1,5 +1,5 @@
206
+ use crate::parse::cursor::Cursor;
207
+ -use crate::parse::{Lint, LintData, LintPass, VecBuf};
208
+ +use crate::parse::{LintData, LintPass, ParsedLints, VecBuf};
209
+ use crate::utils::{FileUpdater, UpdateMode, UpdateStatus, slice_groups, update_text_region_fn};
210
+ use core::range::Range;
211
+ use itertools::Itertools as _;
212
+ @@ -13,7 +13,7 @@ const GENERATED_FILE_COMMENT: &str = "// This file was generated by `cargo dev u
213
+
214
+ const DOCS_LINK: &str = "https://rust-lang.github.io/rust-clippy/main/index.html";
215
+
216
+ -impl LintData<'_> {
217
+ +impl ParsedLints<'_> {
218
+ #[expect(clippy::too_many_lines)]
219
+ pub fn gen_decls(&self, update_mode: UpdateMode) {
220
+ let mut updater = FileUpdater::default();
221
+ @@ -39,10 +39,10 @@ impl LintData<'_> {
222
+ let mut deprecated = Vec::with_capacity(lints.len() / 8);
223
+ let mut renamed = Vec::with_capacity(lints.len() / 8);
224
+ for &(name, lint) in &lints {
225
+ - match lint {
226
+ - Lint::Active(lint) => active.push((name, lint.file.path_as_krate_mod())),
227
+ - Lint::Deprecated(lint) => deprecated.push((name, lint)),
228
+ - Lint::Renamed(lint) => renamed.push((name, lint)),
229
+ + match &lint.data {
230
+ + LintData::Active(_) => active.push((name, lint.name_sp.file.path_as_krate_mod())),
231
+ + LintData::Deprecated(lint) => deprecated.push((name, lint)),
232
+ + LintData::Renamed(lint) => renamed.push((name, lint)),
233
+ }
234
+ }
235
+ active.sort_by_key(|&(_, path)| path);
236
+ @@ -265,7 +265,7 @@ pub fn gen_sorted_lints_file(
237
+ ) {
238
+ ranges.with(|ranges| {
239
+ ranges.extend(lints.iter().map(|&(_, x)| x));
240
+ - ranges.extend(passes.iter().map(|x| x.decl_range));
241
+ + ranges.extend(passes.iter().map(|x| x.decl_sp.range));
242
+ ranges.sort_unstable_by_key(|x| x.start);
243
+
244
+ lints.sort_unstable_by_key(|&(x, _)| x);
245
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
246
+ index 609b12e4f1f0ea0e3b8bc43fb57f12c05cf71056..92edee2b37922b8fe7778c23783700ea76213969 100644
247
+ --- a/clippy_dev/src/parse.rs
248
+ +++ b/clippy_dev/src/parse.rs
249
+ @@ -69,6 +69,17 @@ impl Hash for SourceFile<'_> {
250
+ }
251
+ }
252
+
253
+ +#[derive(Clone, Copy)]
254
+ +pub struct Span<'cx> {
255
+ + pub file: &'cx SourceFile<'cx>,
256
+ + pub range: Range<u32>,
257
+ +}
258
+ +impl<'cx> Span<'cx> {
259
+ + pub fn new(file: &'cx SourceFile<'cx>, range: Range<u32>) -> Self {
260
+ + Self { file, range }
261
+ + }
262
+ +}
263
+ +
264
+ pub struct ParseCxImpl<'cx> {
265
+ pub arena: &'cx DroplessArena,
266
+ pub source_files: &'cx TypedArena<SourceFile<'cx>>,
267
+ @@ -218,9 +229,8 @@ impl Display for LintName<'_> {
268
+ }
269
+
270
+ pub struct ActiveLint<'cx> {
271
+ - pub file: &'cx SourceFile<'cx>,
272
+ pub group: &'cx str,
273
+ - pub declaration_range: Range<u32>,
274
+ + pub decl_range: Range<u32>,
275
+ }
276
+
277
+ pub struct DeprecatedLint<'cx> {
278
+ @@ -233,12 +243,17 @@ pub struct RenamedLint<'cx> {
279
+ pub version: &'cx str,
280
+ }
281
+
282
+ -pub enum Lint<'cx> {
283
+ +pub enum LintData<'cx> {
284
+ Active(ActiveLint<'cx>),
285
+ Deprecated(DeprecatedLint<'cx>),
286
+ Renamed(RenamedLint<'cx>),
287
+ }
288
+
289
+ +pub struct Lint<'cx> {
290
+ + pub name_sp: Span<'cx>,
291
+ + pub data: LintData<'cx>,
292
+ +}
293
+ +
294
+ #[derive(Clone, Copy)]
295
+ pub enum LintPassMac {
296
+ Declare,
297
+ @@ -260,27 +275,26 @@ pub struct LintPass<'cx> {
298
+ pub name: &'cx str,
299
+ pub lt: Option<&'cx str>,
300
+ pub mac: LintPassMac,
301
+ - pub file: &'cx SourceFile<'cx>,
302
+ - pub decl_range: Range<u32>,
303
+ + pub decl_sp: Span<'cx>,
304
+ pub lints: &'cx mut [&'cx str],
305
+ }
306
+
307
+ -pub struct LintData<'cx> {
308
+ +pub struct ParsedLints<'cx> {
309
+ pub lints: FxHashMap<&'cx str, Lint<'cx>>,
310
+ pub lint_passes: Vec<LintPass<'cx>>,
311
+ pub deprecated_file: &'cx SourceFile<'cx>,
312
+ }
313
+ -impl<'cx> LintData<'cx> {
314
+ +impl<'cx> ParsedLints<'cx> {
315
+ #[expect(clippy::mutable_key_type)]
316
+ pub fn mk_file_to_lint_decl_map(&self) -> FxHashMap<&'cx SourceFile<'cx>, Vec<(&'cx str, Range<u32>)>> {
317
+ #[expect(clippy::default_trait_access)]
318
+ let mut lints = FxHashMap::with_capacity_and_hasher(500, Default::default());
319
+ for (&name, lint) in &self.lints {
320
+ - if let Lint::Active(lint) = lint {
321
+ + if let LintData::Active(lint_data) = &lint.data {
322
+ lints
323
+ - .entry(lint.file)
324
+ + .entry(lint.name_sp.file)
325
+ .or_insert_with(|| Vec::with_capacity(8))
326
+ - .push((name, lint.declaration_range));
327
+ + .push((name, lint_data.decl_range));
328
+ }
329
+ }
330
+ lints
331
+ @@ -288,7 +302,7 @@ impl<'cx> LintData<'cx> {
332
+
333
+ pub fn iter_passes_by_file_mut<'s>(&'s mut self) -> impl Iterator<Item = &'s mut [LintPass<'cx>]> {
334
+ slice_groups_mut(&mut self.lint_passes, |head, tail| {
335
+ - tail.iter().take_while(|&x| x.file == head.file).count()
336
+ + tail.iter().take_while(|&x| x.decl_sp.file == head.decl_sp.file).count()
337
+ })
338
+ }
339
+ }
340
+ @@ -296,8 +310,8 @@ impl<'cx> LintData<'cx> {
341
+ impl<'cx> ParseCxImpl<'cx> {
342
+ /// Finds and parses all lint declarations.
343
+ #[must_use]
344
+ - pub fn parse_lint_decls(&mut self) -> LintData<'cx> {
345
+ - let mut data = LintData {
346
+ + pub fn parse_lint_decls(&mut self) -> ParsedLints<'cx> {
347
+ + let mut data = ParsedLints {
348
+ #[expect(clippy::default_trait_access)]
349
+ lints: FxHashMap::with_capacity_and_hasher(1000, Default::default()),
350
+ lint_passes: Vec::with_capacity(400),
351
+ @@ -348,7 +362,7 @@ impl<'cx> ParseCxImpl<'cx> {
352
+ }
353
+
354
+ /// Parse a source file looking for `declare_clippy_lint` macro invocations.
355
+ - fn parse_lint_src_file(&mut self, data: &mut LintData<'cx>, file: &'cx SourceFile<'cx>) {
356
+ + fn parse_lint_src_file(&mut self, data: &mut ParsedLints<'cx>, file: &'cx SourceFile<'cx>) {
357
+ #[allow(clippy::enum_glob_use)]
358
+ use cursor::Pat::*;
359
+ #[rustfmt::skip]
360
+ @@ -374,11 +388,13 @@ impl<'cx> ParseCxImpl<'cx> {
361
+ data.lints
362
+ .insert(
363
+ self.str_buf.alloc_ascii_lower(self.arena, cursor.get_text(captures[0])),
364
+ - Lint::Active(ActiveLint {
365
+ - file,
366
+ - group: cursor.get_text(captures[1]),
367
+ - declaration_range: mac_name.pos..cursor.pos(),
368
+ - }),
369
+ + Lint {
370
+ + name_sp: captures[0].mk_sp(file),
371
+ + data: LintData::Active(ActiveLint {
372
+ + group: cursor.get_text(captures[1]),
373
+ + decl_range: mac_name.pos..cursor.pos(),
374
+ + }),
375
+ + },
376
+ )
377
+ .is_none()
378
+ );
379
+ @@ -426,8 +442,7 @@ impl<'cx> ParseCxImpl<'cx> {
380
+ name,
381
+ lt,
382
+ mac,
383
+ - file,
384
+ - decl_range: mac_name.pos..cursor.pos(),
385
+ + decl_sp: Span::new(file, mac_name.pos..cursor.pos()),
386
+ lints,
387
+ });
388
+ }
389
+ @@ -437,7 +452,7 @@ impl<'cx> ParseCxImpl<'cx> {
390
+ }
391
+ }
392
+
393
+ - fn parse_deprecated_lints(&mut self, data: &mut LintData<'cx>) {
394
+ + fn parse_deprecated_lints(&mut self, data: &mut ParsedLints<'cx>) {
395
+ #[allow(clippy::enum_glob_use)]
396
+ use cursor::Pat::*;
397
+
398
+ @@ -478,10 +493,13 @@ impl<'cx> ParseCxImpl<'cx> {
399
+ data.lints
400
+ .insert(
401
+ self.parse_clippy_lint_name(file, cursor.get_text(captures[1])),
402
+ - Lint::Deprecated(DeprecatedLint {
403
+ - reason: self.parse_str_single_line(file, cursor.get_text(captures[2])),
404
+ - version: self.parse_str_single_line(file, cursor.get_text(captures[0])),
405
+ - }),
406
+ + Lint {
407
+ + name_sp: captures[1].mk_sp(file),
408
+ + data: LintData::Deprecated(DeprecatedLint {
409
+ + reason: self.parse_str_single_line(file, cursor.get_text(captures[2])),
410
+ + version: self.parse_str_single_line(file, cursor.get_text(captures[0])),
411
+ + }),
412
+ + },
413
+ )
414
+ .is_none()
415
+ );
416
+ @@ -496,10 +514,13 @@ impl<'cx> ParseCxImpl<'cx> {
417
+ data.lints
418
+ .insert(
419
+ self.parse_clippy_lint_name(file, cursor.get_text(captures[1])),
420
+ - Lint::Renamed(RenamedLint {
421
+ - new_name: self.parse_lint_name(file, cursor.get_text(captures[2])),
422
+ - version: self.parse_str_single_line(file, cursor.get_text(captures[0])),
423
+ - }),
424
+ + Lint {
425
+ + name_sp: captures[1].mk_sp(file),
426
+ + data: LintData::Renamed(RenamedLint {
427
+ + new_name: self.parse_lint_name(file, cursor.get_text(captures[2])),
428
+ + version: self.parse_str_single_line(file, cursor.get_text(captures[0])),
429
+ + }),
430
+ + },
431
+ )
432
+ .is_none()
433
+ );
434
+ diff --git a/clippy_dev/src/parse/cursor.rs b/clippy_dev/src/parse/cursor.rs
435
+ index 5ce595d0ec1bae3ef37c8ad27c755acef0690185..76cbb070883e2800190184e12c30e522859e76b6 100644
436
+ --- a/clippy_dev/src/parse/cursor.rs
437
+ +++ b/clippy_dev/src/parse/cursor.rs
438
+ @@ -1,4 +1,4 @@
439
+ -use super::StrBuf;
440
+ +use super::{SourceFile, Span, StrBuf};
441
+ use core::{ptr, slice};
442
+ use rustc_arena::DroplessArena;
443
+ use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind};
444
+ @@ -73,6 +73,13 @@ pub struct Capture {
445
+ }
446
+ impl Capture {
447
+ pub const EMPTY: Self = Self { pos: 0, len: 0 };
448
+ +
449
+ + pub fn mk_sp<'cx>(self, file: &'cx SourceFile<'cx>) -> Span<'cx> {
450
+ + Span {
451
+ + file,
452
+ + range: self.pos..self.pos + self.len,
453
+ + }
454
+ + }
455
+ }
456
+
457
+ /// A unidirectional cursor over a token stream that is lexed on demand.
patches/20261028T105419Z/rust-lang--rust-part011/4bd9ab9e3c0feabc345454a07ecec1f5178d9740.patch ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
2
+ index 6010da42c19bb90964f21d3f99d4be9556d0c868..609b12e4f1f0ea0e3b8bc43fb57f12c05cf71056 100644
3
+ --- a/clippy_dev/src/parse.rs
4
+ +++ b/clippy_dev/src/parse.rs
5
+ @@ -399,27 +399,13 @@ impl<'cx> ParseCxImpl<'cx> {
6
+ let lt = if lt.is_empty() { None } else { Some(lt) };
7
+
8
+ let lints = self.str_list_buf.with(|buf| {
9
+ - // Parses a comma separated list of paths and converts each path
10
+ - // to a string with whitespace removed.
11
+ - while !cursor.eat_close_bracket() {
12
+ - buf.push(self.str_buf.with(|buf| {
13
+ - if cursor.eat_double_colon() {
14
+ - buf.push_str("::");
15
+ - }
16
+ - let capture = cursor.capture_ident()?;
17
+ - buf.push_str(cursor.get_text(capture));
18
+ - while cursor.eat_double_colon() {
19
+ - buf.push_str("::");
20
+ - let capture = cursor.capture_ident()?;
21
+ - buf.push_str(cursor.get_text(capture));
22
+ - }
23
+ - Some(self.arena.alloc_str(buf))
24
+ - })?);
25
+ -
26
+ + loop {
27
+ + match cursor.capture_opt_path(&mut self.str_buf, self.arena) {
28
+ + Ok(None) => break,
29
+ + Ok(Some(p)) => buf.push(p),
30
+ + Err(()) => panic!("error parsing path"),
31
+ + }
32
+ if !cursor.eat_comma() {
33
+ - if !cursor.eat_close_bracket() {
34
+ - return None;
35
+ - }
36
+ break;
37
+ }
38
+ }
39
+ @@ -433,7 +419,7 @@ impl<'cx> ParseCxImpl<'cx> {
40
+ });
41
+
42
+ if let Some(lints) = lints
43
+ - && cursor.match_all(&[CloseParen, Semi], &mut [])
44
+ + && cursor.match_all(&[CloseBracket, CloseParen, Semi], &mut [])
45
+ {
46
+ data.lint_passes.push(LintPass {
47
+ docs,
48
+ diff --git a/clippy_dev/src/parse/cursor.rs b/clippy_dev/src/parse/cursor.rs
49
+ index 2fffaa201582a192b55ffe8e833cf348a254f99c..5ce595d0ec1bae3ef37c8ad27c755acef0690185 100644
50
+ --- a/clippy_dev/src/parse/cursor.rs
51
+ +++ b/clippy_dev/src/parse/cursor.rs
52
+ @@ -1,4 +1,6 @@
53
+ +use super::StrBuf;
54
+ use core::{ptr, slice};
55
+ +use rustc_arena::DroplessArena;
56
+ use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind};
57
+
58
+ /// A token pattern used for searching and matching by the [`Cursor`].
59
+ @@ -267,6 +269,51 @@ impl<'txt> Cursor<'txt> {
60
+ }
61
+ }
62
+
63
+ + /// Consumes and captures the text of a path without any internal whitespace. Returns
64
+ + /// `Err` if the path ends with `::`, and `None` if no path component exists at the
65
+ + /// current position.
66
+ + ///
67
+ + /// Only paths containing identifiers separated by `::` with a possible leading `::`.
68
+ + /// Generic arguments and qualified paths are not considered.
69
+ + pub fn capture_opt_path(&mut self, buf: &mut StrBuf, arena: &'txt DroplessArena) -> Result<Option<&'txt str>, ()> {
70
+ + #[derive(Clone, Copy)]
71
+ + enum State {
72
+ + Start,
73
+ + Sep,
74
+ + Ident,
75
+ + }
76
+ +
77
+ + buf.with(|buf| {
78
+ + let start = self.pos;
79
+ + let mut state = State::Start;
80
+ + loop {
81
+ + match (state, self.next_token.kind) {
82
+ + (_, TokenKind::Whitespace) => self.step(),
83
+ + (State::Start | State::Ident, TokenKind::Colon) if self.inner.first() == ':' => {
84
+ + state = State::Sep;
85
+ + buf.push_str("::");
86
+ + self.step();
87
+ + self.step();
88
+ + },
89
+ + (State::Start | State::Sep, TokenKind::Ident) => {
90
+ + state = State::Ident;
91
+ + buf.push_str(self.peek_text());
92
+ + self.step();
93
+ + },
94
+ + (State::Ident, _) => break,
95
+ + (State::Start, _) => return Ok(None),
96
+ + (State::Sep, _) => return Err(()),
97
+ + }
98
+ + }
99
+ + let text = self.text[start as usize..self.pos as usize].trim();
100
+ + Ok(Some(if text.len() == buf.len() {
101
+ + text
102
+ + } else {
103
+ + arena.alloc_str(buf)
104
+ + }))
105
+ + })
106
+ + }
107
+ +
108
+ /// Attempts to match a sequence of patterns at the current position. Returns whether
109
+ /// all patterns were successfully matched.
110
+ ///
patches/20261028T105419Z/rust-lang--rust-part011/4f5002db4e071f169e670097913a63f16f305492.patch ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
2
+ index ea045ac6465f308dfe222b1803ad26d9610ab8b9..b196ae1e5a82edb2552c84e4529bc44ba6d5b1d7 100644
3
+ --- a/compiler/rustc_passes/src/check_attr.rs
4
+ +++ b/compiler/rustc_passes/src/check_attr.rs
5
+ @@ -1216,6 +1216,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
6
+ let mut is_align = false;
7
+ let mut is_packed = false;
8
+ let mut repeated_repr = false;
9
+ + let mut maybe_last_int_type = None;
10
+
11
+ for (repr, _repr_span) in reprs {
12
+ match repr {
13
+ @@ -1254,7 +1255,17 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
14
+ // when checking for any other attribute together with transparent.
15
+ is_transparent = true;
16
+ }
17
+ - ReprAttr::ReprInt(_) => {
18
+ + ReprAttr::ReprInt(int_type) => {
19
+ + if let Some(last_int_type) = maybe_last_int_type
20
+ + && last_int_type == int_type
21
+ + {
22
+ + // We'll "miss" detecting repeated int reprs if the user specifies
23
+ + // #[repr(u8, u64, u8)] for example. But that's okay because we've got
24
+ + // conflicting reprs anyway so it's not worth the effort to do more precise
25
+ + // tracking.
26
+ + repeated_repr = true;
27
+ + }
28
+ + maybe_last_int_type = Some(int_type);
29
+ int_reprs += 1;
30
+ }
31
+ };
32
+ diff --git a/tests/ui/repr/repr-repeated-attrs.rs b/tests/ui/repr/repr-repeated-attrs.rs
33
+ index a6dd3fb6e8b15776c7e8862666cd614b38b2b6e8..61e3ba05625d8dad51b0856ef0d66890e23026bb 100644
34
+ --- a/tests/ui/repr/repr-repeated-attrs.rs
35
+ +++ b/tests/ui/repr/repr-repeated-attrs.rs
36
+ @@ -19,7 +19,7 @@ struct SeveralRustReprs(u8);
37
+ #[repr(C, C, C)]
38
+ struct SeveralC(u8);
39
+
40
+ -#[repr(u8, u8)]
41
+ +#[repr(u8, u8)] //~ WARN representation attribute is specified more than once
42
+ //~^ ERROR conflicting representation hints
43
+ //~| WARN this was previously accepted
44
+ enum SeveralPrimitiveRerprs {
45
+ @@ -34,7 +34,7 @@ enum SeveralCAndPrims {
46
+ Variant(u8),
47
+ }
48
+
49
+ -#[repr(Rust, u8, u8)]
50
+ +#[repr(Rust, u8, u8)] //~ WARN representation attribute is specified more than once
51
+ //~^ ERROR conflicting representation hints
52
+ //~^^ ERROR conflicting representation hints
53
+ //~| WARN this was previously accepted
54
+ @@ -42,8 +42,9 @@ enum RustAndPrimDisallowed {
55
+ Variant(u8),
56
+ }
57
+
58
+ -#[repr(u8, u8)] //~ ERROR conflicting representation hints
59
+ -//~^ WARN this was previously accepted
60
+ +#[repr(u8, u8)] //~ WARN representation attribute is specified more than once
61
+ +//~^ ERROR conflicting representation hints
62
+ +//~| WARN this was previously accepted
63
+ #[repr(u16)]
64
+ enum ConflictingPrimReprs {
65
+ Variant,
66
+ diff --git a/tests/ui/repr/repr-repeated-attrs.stderr b/tests/ui/repr/repr-repeated-attrs.stderr
67
+ index 72c312a13ea11adf3b3d21f1898c7299be0cf66a..57af8ec804d76d672cb87f068efef3c13ec7f68a 100644
68
+ --- a/tests/ui/repr/repr-repeated-attrs.stderr
69
+ +++ b/tests/ui/repr/repr-repeated-attrs.stderr
70
+ @@ -46,6 +46,14 @@ LL | #[repr(u8, u8)]
71
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
72
+ = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
73
+
74
+ +warning: representation attribute is specified more than once
75
+ + --> $DIR/repr-repeated-attrs.rs:22:8
76
+ + |
77
+ +LL | #[repr(u8, u8)]
78
+ + | ^^ ^^
79
+ + |
80
+ + = note: for consistency, only specify the representation once
81
+ +
82
+ error[E0566]: conflicting representation hints
83
+ --> $DIR/repr-repeated-attrs.rs:29:8
84
+ |
85
+ @@ -84,20 +92,39 @@ LL | #[repr(Rust, u8, u8)]
86
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
87
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
88
+
89
+ +warning: representation attribute is specified more than once
90
+ + --> $DIR/repr-repeated-attrs.rs:37:8
91
+ + |
92
+ +LL | #[repr(Rust, u8, u8)]
93
+ + | ^^^^ ^^ ^^
94
+ + |
95
+ + = note: for consistency, only specify the representation once
96
+ +
97
+ error[E0566]: conflicting representation hints
98
+ - --> $DIR/repr-repeated-attrs.rs:44:8
99
+ + --> $DIR/repr-repeated-attrs.rs:45:8
100
+ |
101
+ LL | #[repr(u8, u8)]
102
+ | ^^ ^^
103
+ -LL |
104
+ +...
105
+ LL | #[repr(u16)]
106
+ | ^^^
107
+ |
108
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
109
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
110
+
111
+ +warning: representation attribute is specified more than once
112
+ + --> $DIR/repr-repeated-attrs.rs:45:8
113
+ + |
114
+ +LL | #[repr(u8, u8)]
115
+ + | ^^ ^^
116
+ +...
117
+ +LL | #[repr(u16)]
118
+ + | ^^^
119
+ + |
120
+ + = note: for consistency, only specify the representation once
121
+ +
122
+ error[E0566]: conflicting representation hints
123
+ - --> $DIR/repr-repeated-attrs.rs:51:8
124
+ + --> $DIR/repr-repeated-attrs.rs:53:8
125
+ |
126
+ LL | #[repr(C, u8)]
127
+ | ^ ^^
128
+ @@ -106,7 +133,7 @@ LL | #[repr(C, u8)]
129
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
130
+
131
+ error[E0566]: conflicting representation hints
132
+ - --> $DIR/repr-repeated-attrs.rs:59:8
133
+ + --> $DIR/repr-repeated-attrs.rs:61:8
134
+ |
135
+ LL | #[repr(C, C, u8, u8, u8)]
136
+ | ^ ^ ^^ ^^ ^^
137
+ @@ -115,14 +142,14 @@ LL | #[repr(C, C, u8, u8, u8)]
138
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
139
+
140
+ warning: representation attribute is specified more than once
141
+ - --> $DIR/repr-repeated-attrs.rs:59:8
142
+ + --> $DIR/repr-repeated-attrs.rs:61:8
143
+ |
144
+ LL | #[repr(C, C, u8, u8, u8)]
145
+ | ^ ^ ^^ ^^ ^^
146
+ |
147
+ = note: for consistency, only specify the representation once
148
+
149
+ -error: aborting due to 9 previous errors; 4 warnings emitted
150
+ +error: aborting due to 9 previous errors; 7 warnings emitted
151
+
152
+ Some errors have detailed explanations: E0566, E0692.
153
+ For more information about an error, try `rustc --explain E0566`.
154
+ @@ -164,11 +191,11 @@ LL | #[repr(Rust, u8, u8)]
155
+
156
+ Future breakage diagnostic:
157
+ error[E0566]: conflicting representation hints
158
+ - --> $DIR/repr-repeated-attrs.rs:44:8
159
+ + --> $DIR/repr-repeated-attrs.rs:45:8
160
+ |
161
+ LL | #[repr(u8, u8)]
162
+ | ^^ ^^
163
+ -LL |
164
+ +...
165
+ LL | #[repr(u16)]
166
+ | ^^^
167
+ |
168
+ @@ -178,7 +205,7 @@ LL | #[repr(u16)]
169
+
170
+ Future breakage diagnostic:
171
+ error[E0566]: conflicting representation hints
172
+ - --> $DIR/repr-repeated-attrs.rs:51:8
173
+ + --> $DIR/repr-repeated-attrs.rs:53:8
174
+ |
175
+ LL | #[repr(C, u8)]
176
+ | ^ ^^
177
+ @@ -189,7 +216,7 @@ LL | #[repr(C, u8)]
178
+
179
+ Future breakage diagnostic:
180
+ error[E0566]: conflicting representation hints
181
+ - --> $DIR/repr-repeated-attrs.rs:59:8
182
+ + --> $DIR/repr-repeated-attrs.rs:61:8
183
+ |
184
+ LL | #[repr(C, C, u8, u8, u8)]
185
+ | ^ ^ ^^ ^^ ^^
patches/20261028T105419Z/rust-lang--rust-part011/5110c2445166de9b493483b52e374dbea2730afa.patch ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs
2
+ index ba5119ee228adb60dc339aea738517db66585dd3..7cfb93ca1b86d05393395b98aef7b825fefd844f 100644
3
+ --- a/compiler/rustc_abi/src/lib.rs
4
+ +++ b/compiler/rustc_abi/src/lib.rs
5
+ @@ -184,6 +184,14 @@ impl ReprOptions {
6
+ self.flags.contains(ReprFlags::IS_C)
7
+ }
8
+
9
+ + /// Returns whether this is (implicitly or explicitly) `repr(Rust)`, i.e., its layout
10
+ + /// is defined by Rust and we make no stable commitments.
11
+ + #[inline]
12
+ + pub fn rust(&self) -> bool {
13
+ + // `linear` is currently just an internal flag we set on Box; that's still `repr(Rust)`.
14
+ + !self.c() & !self.simd() & !self.scalable() & !self.transparent()
15
+ + }
16
+ +
17
+ #[inline]
18
+ pub fn packed(&self) -> bool {
19
+ self.pack.is_some()
20
+ diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs
21
+ index c378a70da4b2b7ed6f425ad524ab703b16f51921..d10b844bf3500b5bac7b2d3aa4c69eb955fda0b1 100644
22
+ --- a/compiler/rustc_const_eval/src/interpret/call.rs
23
+ +++ b/compiler/rustc_const_eval/src/interpret/call.rs
24
+ @@ -97,7 +97,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
25
+ } else if adt_def.repr().c() {
26
+ interp_ok(false)
27
+ } else {
28
+ - // Must be repr(Rust).
29
+ + // Can't be SIMD or Scalable (since this is a 1-ZST); only Rust is left.
30
+ + assert!(adt_def.repr().rust());
31
+ interp_ok(true)
32
+ }
33
+ }
patches/20261028T105419Z/rust-lang--rust-part011/530a4e554f21c8283db98277baea0761be84dd66.patch ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/visitor.rs b/src/visitor.rs
2
+ index 55f9a4d8c8b26f18ed8844cf3e50e292bb6b9bbc..b3ba0f2df2cdb214ea7ab873838e8d6d53ab9c52 100644
3
+ --- a/src/visitor.rs
4
+ +++ b/src/visitor.rs
5
+ @@ -631,6 +631,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
6
+ // For now, leave the contents of the Span unformatted.
7
+ self.push_rewrite(item.span, None)
8
+ }
9
+ + ast::ItemKind::TestBinderConstraints(..) => self.push_rewrite(item.span, None),
10
+ };
11
+ }
12
+ self.skip_context = skip_context_saved;
patches/20261028T105419Z/rust-lang--rust-part011/536ac287713d9be8d8e8155cae8d4578e1704bf4.patch ADDED
@@ -0,0 +1,1190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/Cargo.toml b/clippy_dev/Cargo.toml
2
+ index c4e06d8d6c4b99fe3cb1898b3854fa71fe243d6e..2b41201e5afb042f12053a4dd59f470c31ee5589 100644
3
+ --- a/clippy_dev/Cargo.toml
4
+ +++ b/clippy_dev/Cargo.toml
5
+ @@ -5,10 +5,13 @@ version = "0.0.1"
6
+ edition = "2024"
7
+
8
+ [dependencies]
9
+ +annotate-snippets = { version = "0.12.10", features = ["simd"] }
10
+ +anstream = "0.6.20"
11
+ chrono = { version = "0.4.38", default-features = false, features = ["clock"] }
12
+ clap = { version = "4.4", features = ["derive"] }
13
+ indoc = "1.0"
14
+ itertools = "0.15"
15
+ +memchr = "2.7.6"
16
+ opener = "0.8"
17
+ rustc-literal-escaper = "0.0.8"
18
+ walkdir = "2.3"
19
+ diff --git a/clippy_dev/src/diag.rs b/clippy_dev/src/diag.rs
20
+ new file mode 100644
21
+ index 0000000000000000000000000000000000000000..49abd7dad68abae5339be7b3499f3b7fbfa29d37
22
+ --- /dev/null
23
+ +++ b/clippy_dev/src/diag.rs
24
+ @@ -0,0 +1,153 @@
25
+ +use crate::Span;
26
+ +use annotate_snippets::renderer::{DEFAULT_TERM_WIDTH, Renderer};
27
+ +use annotate_snippets::{Annotation, AnnotationKind, Group, Level, Origin, Snippet};
28
+ +use core::panic::Location;
29
+ +use std::borrow::Cow;
30
+ +use std::io::Write as _;
31
+ +use std::process;
32
+ +
33
+ +pub struct DiagCx {
34
+ + out: anstream::Stderr,
35
+ + renderer: Renderer,
36
+ + has_err: bool,
37
+ +}
38
+ +impl Default for DiagCx {
39
+ + fn default() -> Self {
40
+ + let width = termize::dimensions().map_or(DEFAULT_TERM_WIDTH, |(w, _)| w);
41
+ + Self {
42
+ + out: anstream::stderr(),
43
+ + renderer: Renderer::styled().term_width(width),
44
+ + has_err: false,
45
+ + }
46
+ + }
47
+ +}
48
+ +impl Drop for DiagCx {
49
+ + fn drop(&mut self) {
50
+ + if self.has_err {
51
+ + self.emit_err(&[
52
+ + Group::with_title(
53
+ + Level::ERROR
54
+ + .with_name("internal error")
55
+ + .primary_title("errors were found, but it was assumed none occurred"),
56
+ + ),
57
+ + Group::with_title(Level::NOTE.secondary_title("any produced results may be incorrect")),
58
+ + ]);
59
+ + process::exit(1);
60
+ + }
61
+ + }
62
+ +}
63
+ +impl DiagCx {
64
+ + pub fn exit_on_err(&self) {
65
+ + if self.has_err {
66
+ + process::exit(1);
67
+ + }
68
+ + }
69
+ +
70
+ + #[track_caller]
71
+ + pub fn exit_assume_err(&mut self) -> ! {
72
+ + if !self.has_err {
73
+ + self.emit_err(&[
74
+ + Group::with_title(
75
+ + Level::ERROR
76
+ + .with_name("internal error")
77
+ + .primary_title("errors were expected, but failed to occur"),
78
+ + ),
79
+ + mk_loc_group(),
80
+ + ]);
81
+ + }
82
+ + process::exit(1);
83
+ + }
84
+ +}
85
+ +
86
+ +fn sp_to_snip(kind: AnnotationKind, sp: Span<'_>) -> Snippet<'_, Annotation<'_>> {
87
+ + let line_starts = sp.file.line_starts();
88
+ + let first_line = match line_starts.binary_search(&sp.range.start) {
89
+ + Ok(x) => x,
90
+ + // Note: `Err(0)` isn't possible since `0` is always the first start.
91
+ + Err(x) => x - 1,
92
+ + };
93
+ + let start = line_starts[first_line] as usize;
94
+ + let last_line = match line_starts.binary_search(&sp.range.end) {
95
+ + Ok(x) => x,
96
+ + Err(x) => x - 1,
97
+ + };
98
+ + let end = line_starts
99
+ + .get(last_line + 1)
100
+ + .map_or(sp.file.contents.len(), |&x| x as usize);
101
+ + Snippet::source(&sp.file.contents[start..end])
102
+ + .line_start(first_line + 1)
103
+ + .path(sp.file.path.get())
104
+ + .annotation(kind.span((sp.range.start as usize - start..sp.range.end as usize - start).into()))
105
+ +}
106
+ +
107
+ +fn mk_spanned_primary<'a>(level: Level<'a>, sp: Span<'a>, msg: impl Into<Cow<'a, str>>) -> Group<'a> {
108
+ + level
109
+ + .primary_title(msg.into())
110
+ + .element(sp_to_snip(AnnotationKind::Primary, sp))
111
+ +}
112
+ +
113
+ +fn mk_spanned_secondary<'a>(level: Level<'a>, sp: Span<'a>, msg: impl Into<Cow<'a, str>>) -> Group<'a> {
114
+ + level
115
+ + .secondary_title(msg.into())
116
+ + .element(sp_to_snip(AnnotationKind::Context, sp))
117
+ +}
118
+ +
119
+ +#[track_caller]
120
+ +fn mk_loc_group() -> Group<'static> {
121
+ + let loc = Location::caller();
122
+ + Level::INFO.secondary_title("error created here").element(
123
+ + Origin::path(loc.file())
124
+ + .line(loc.line() as usize)
125
+ + .char_column(loc.column() as usize),
126
+ + )
127
+ +}
128
+ +
129
+ +impl DiagCx {
130
+ + fn emit_err(&mut self, groups: &[Group<'_>]) {
131
+ + let mut s = self.renderer.render(groups);
132
+ + s.push('\n');
133
+ + self.out.write_all(s.as_bytes()).unwrap();
134
+ + self.has_err = true;
135
+ + }
136
+ +
137
+ + #[track_caller]
138
+ + pub fn emit_spanned_err<'a>(&mut self, sp: Span<'a>, msg: impl Into<Cow<'a, str>>) {
139
+ + self.emit_err(&[mk_spanned_primary(Level::ERROR, sp, msg.into()), mk_loc_group()]);
140
+ + }
141
+ +
142
+ + #[track_caller]
143
+ + pub fn emit_spanless_err<'a>(&mut self, msg: impl Into<Cow<'a, str>>) {
144
+ + self.emit_err(&[
145
+ + Group::with_title(Level::ERROR.primary_title(msg.into())),
146
+ + mk_loc_group(),
147
+ + ]);
148
+ + }
149
+ +
150
+ + #[track_caller]
151
+ + pub fn emit_already_deprecated(&mut self, name: &str) {
152
+ + self.emit_spanless_err(format!("lint `{name}` is already deprecated"));
153
+ + }
154
+ +
155
+ + #[track_caller]
156
+ + pub fn emit_duplicate_lint(&mut self, sp: Span<'_>, first_sp: Span<'_>) {
157
+ + self.emit_err(&[
158
+ + mk_spanned_primary(Level::ERROR, sp, "duplicate lint name declared"),
159
+ + mk_spanned_secondary(Level::NOTE, first_sp, "previous declaration here"),
160
+ + mk_loc_group(),
161
+ + ]);
162
+ + }
163
+ +
164
+ + #[track_caller]
165
+ + pub fn emit_not_clippy_lint_name(&mut self, sp: Span<'_>) {
166
+ + self.emit_err(&[
167
+ + mk_spanned_primary(Level::ERROR, sp, "not a clippy lint name"),
168
+ + Group::with_title(Level::HELP.secondary_title("add the `clippy::` tool prefix")),
169
+ + mk_loc_group(),
170
+ + ]);
171
+ + }
172
+ +
173
+ + #[track_caller]
174
+ + pub fn emit_unknown_lint(&mut self, name: &str) {
175
+ + self.emit_spanless_err(format!("unknown lint `{name}`"));
176
+ + }
177
+ +}
178
+ diff --git a/clippy_dev/src/edit_lints.rs b/clippy_dev/src/edit_lints.rs
179
+ index 078e0f2c6cd867d76ef211596fbc969183a79c39..cd1ae61f88e5e55f504e7e6c6d73c701db50e42e 100644
180
+ --- a/clippy_dev/src/edit_lints.rs
181
+ +++ b/clippy_dev/src/edit_lints.rs
182
+ @@ -1,9 +1,10 @@
183
+ use crate::parse::cursor::{self, Capture, Cursor};
184
+ use crate::parse::{ActiveLint, DeprecatedLint, Lint, LintData, LintName, ParseCx, ParsedLints, RenamedLint};
185
+ use crate::utils::{
186
+ - ErrAction, FileUpdater, SourceFile, Span, UpdateMode, UpdateStatus, Version, delete_dir_if_exists,
187
+ - delete_file_if_exists, expect_action, try_rename_dir, try_rename_file, walk_dir_no_dot_or_target,
188
+ + ErrAction, FileUpdater, UpdateMode, UpdateStatus, Version, delete_dir_if_exists, delete_file_if_exists,
189
+ + expect_action, try_rename_dir, try_rename_file, walk_dir_no_dot_or_target,
190
+ };
191
+ +use crate::{SourceFile, Span};
192
+ use core::mem;
193
+ use rustc_lexer::TokenKind;
194
+ use std::collections::hash_map::Entry;
195
+ @@ -22,10 +23,9 @@ use std::{fs, path};
196
+ /// If a file path could not read from or written to
197
+ pub fn deprecate<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, name: &'env str, reason: &'env str) {
198
+ let mut data = cx.parse_lint_decls();
199
+ -
200
+ let Entry::Occupied(mut lint) = data.lints.entry(name) else {
201
+ - eprintln!("error: failed to find lint `{name}`");
202
+ - return;
203
+ + cx.dcx.emit_unknown_lint(name);
204
+ + cx.dcx.exit_assume_err();
205
+ };
206
+ let prev_lint = mem::replace(
207
+ lint.get_mut(),
208
+ @@ -38,9 +38,10 @@ pub fn deprecate<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, name
209
+ },
210
+ );
211
+ let LintData::Active(prev_lint_data) = prev_lint.data else {
212
+ - eprintln!("error: `{name}` is already deprecated");
213
+ - return;
214
+ + cx.dcx.emit_already_deprecated(name);
215
+ + cx.dcx.exit_assume_err();
216
+ };
217
+ + cx.dcx.exit_on_err();
218
+
219
+ remove_lint_declaration(
220
+ name,
221
+ @@ -56,14 +57,10 @@ pub fn deprecate<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, name
222
+
223
+ pub fn uplift<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_name: &'env str, new_name: &'env str) {
224
+ let mut data = cx.parse_lint_decls();
225
+ -
226
+ - update_rename_targets(&mut data, old_name, LintName::new_rustc(new_name));
227
+ -
228
+ let Entry::Occupied(mut lint) = data.lints.entry(old_name) else {
229
+ - eprintln!("error: failed to find lint `{old_name}`");
230
+ - return;
231
+ + cx.dcx.emit_unknown_lint(old_name);
232
+ + cx.dcx.exit_assume_err();
233
+ };
234
+ -
235
+ let prev_lint = mem::replace(
236
+ lint.get_mut(),
237
+ Lint {
238
+ @@ -75,10 +72,12 @@ pub fn uplift<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
239
+ },
240
+ );
241
+ let LintData::Active(prev_lint_data) = prev_lint.data else {
242
+ - eprintln!("error: `{old_name}` is already deprecated");
243
+ - return;
244
+ + cx.dcx.emit_already_deprecated(old_name);
245
+ + cx.dcx.exit_assume_err();
246
+ };
247
+ + cx.dcx.exit_on_err();
248
+
249
+ + update_rename_targets(&mut data, old_name, LintName::new_rustc(new_name));
250
+ let mut updater = FileUpdater::default();
251
+ let remove_mod = remove_lint_declaration(old_name, prev_lint.name_sp.file, &prev_lint_data, &data, &mut updater);
252
+ let mut update_fn = uplift_update_fn(old_name, new_name, remove_mod);
253
+ @@ -109,16 +108,11 @@ pub fn uplift<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
254
+ /// * If `old_name` doesn't name an existing lint.
255
+ /// * If `old_name` names a deprecated or renamed lint.
256
+ pub fn rename<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_name: &'env str, new_name: &'env str) {
257
+ - let mut updater = FileUpdater::default();
258
+ let mut data = cx.parse_lint_decls();
259
+ -
260
+ - update_rename_targets(&mut data, old_name, LintName::new_clippy(new_name));
261
+ -
262
+ let Entry::Occupied(mut lint) = data.lints.entry(old_name) else {
263
+ - eprintln!("error: failed to find lint `{old_name}`");
264
+ - return;
265
+ + cx.dcx.emit_unknown_lint(old_name);
266
+ + cx.dcx.exit_assume_err();
267
+ };
268
+ -
269
+ let prev_lint = mem::replace(
270
+ lint.get_mut(),
271
+ Lint {
272
+ @@ -130,10 +124,12 @@ pub fn rename<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
273
+ },
274
+ );
275
+ if !matches!(prev_lint.data, LintData::Active(_)) {
276
+ - eprintln!("error: `{old_name}` is already deprecated");
277
+ - return;
278
+ - };
279
+ + cx.dcx.emit_already_deprecated(old_name);
280
+ + }
281
+ + cx.dcx.exit_on_err();
282
+
283
+ + update_rename_targets(&mut data, old_name, LintName::new_clippy(new_name));
284
+ + let mut updater = FileUpdater::default();
285
+ let prev_file = prev_lint.name_sp.file;
286
+ let mut rename_mod = false;
287
+ if let Entry::Vacant(e) = data.lints.entry(new_name) {
288
+ @@ -401,7 +397,9 @@ fn rename_update_fn<'a>(
289
+ match text {
290
+ // clippy::line_name or clippy::lint-name
291
+ "clippy" => {
292
+ - if cursor.match_all(&[cursor::Pat::DoubleColon, cursor::Pat::CaptureIdent], &mut captures)
293
+ + if cursor
294
+ + .match_all(&[cursor::Pat::DoubleColon, cursor::Pat::CaptureIdent], &mut captures)
295
+ + .is_ok()
296
+ && cursor.get_text(captures[0]) == old_name
297
+ {
298
+ dst.push_str(&src[copy_pos as usize..captures[0].pos as usize]);
299
+ @@ -464,7 +462,9 @@ fn rename_update_fn<'a>(
300
+ },
301
+ // ::lint_name
302
+ TokenKind::Colon
303
+ - if cursor.match_all(&[cursor::Pat::DoubleColon, cursor::Pat::CaptureIdent], &mut captures)
304
+ + if cursor
305
+ + .match_all(&[cursor::Pat::DoubleColon, cursor::Pat::CaptureIdent], &mut captures)
306
+ + .is_ok()
307
+ && cursor.get_text(captures[0]) == old_name =>
308
+ {
309
+ dst.push_str(&src[copy_pos as usize..captures[0].pos as usize]);
310
+ diff --git a/clippy_dev/src/fmt.rs b/clippy_dev/src/fmt.rs
311
+ index b479c4d70c9580c22aabf7ba67e837eae94dcf2c..992eb049e7410f7fd62b74e1002095e73fd731c7 100644
312
+ --- a/clippy_dev/src/fmt.rs
313
+ +++ b/clippy_dev/src/fmt.rs
314
+ @@ -336,6 +336,7 @@ pub fn run(update_mode: UpdateMode) {
315
+
316
+ new_parse_cx(|cx| {
317
+ let mut data = cx.parse_lint_decls();
318
+ + cx.dcx.exit_on_err();
319
+
320
+ let mut updater = FileUpdater::default();
321
+
322
+ diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
323
+ index 5c15839cd3ddf9f6687699bb8e58621b5baab3c6..0e1f985a8ef389bff3bcac2d17f7d4a7ae76bc92 100644
324
+ --- a/clippy_dev/src/lib.rs
325
+ +++ b/clippy_dev/src/lib.rs
326
+ @@ -21,6 +21,7 @@ extern crate rustc_data_structures;
327
+ #[expect(unused_extern_crates, reason = "required to link to rustc crates")]
328
+ extern crate rustc_driver;
329
+ extern crate rustc_lexer;
330
+ +extern crate termize;
331
+
332
+ pub mod dogfood;
333
+ pub mod edit_lints;
334
+ @@ -32,9 +33,11 @@ pub mod serve;
335
+ pub mod setup;
336
+ pub mod sync;
337
+
338
+ +mod diag;
339
+ mod generate;
340
+ mod parse;
341
+ mod utils;
342
+
343
+ +pub use self::diag::DiagCx;
344
+ pub use self::parse::{ParseCx, new_parse_cx};
345
+ -pub use self::utils::{ClippyInfo, UpdateMode};
346
+ +pub use self::utils::{ClippyInfo, SourceFile, Span, UpdateMode};
347
+ diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs
348
+ index 5fe2295a1e21dfb50572f7d9fc989f8dce57d229..9e0f2fa14cb0ae8df8c412be9af4a56a4cf1b111 100644
349
+ --- a/clippy_dev/src/main.rs
350
+ +++ b/clippy_dev/src/main.rs
351
+ @@ -26,9 +26,11 @@ fn main() {
352
+ allow_no_vcs,
353
+ } => dogfood::dogfood(fix, allow_dirty, allow_staged, allow_no_vcs),
354
+ DevCommand::Fmt { check } => fmt::run(UpdateMode::from_check(check)),
355
+ - DevCommand::UpdateLints { check } => {
356
+ - new_parse_cx(|cx| cx.parse_lint_decls().gen_decls(UpdateMode::from_check(check)));
357
+ - },
358
+ + DevCommand::UpdateLints { check } => new_parse_cx(|cx| {
359
+ + let data = cx.parse_lint_decls();
360
+ + cx.dcx.exit_on_err();
361
+ + data.gen_decls(UpdateMode::from_check(check));
362
+ + }),
363
+ DevCommand::NewLint {
364
+ pass,
365
+ name,
366
+ @@ -36,7 +38,11 @@ fn main() {
367
+ r#type,
368
+ msrv,
369
+ } => match new_lint::create(clippy.version, pass, &name, &category, r#type.as_deref(), msrv) {
370
+ - Ok(()) => new_parse_cx(|cx| cx.parse_lint_decls().gen_decls(UpdateMode::Change)),
371
+ + Ok(()) => new_parse_cx(|cx| {
372
+ + let data = cx.parse_lint_decls();
373
+ + cx.dcx.exit_on_err();
374
+ + data.gen_decls(UpdateMode::Change);
375
+ + }),
376
+ Err(e) => eprintln!("Unable to create lint: {e}"),
377
+ },
378
+ DevCommand::Setup(SetupCommand { subcommand }) => match subcommand {
379
+ diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs
380
+ index 78eaabbb794e877510be7210cb98078234515d65..3c797fb2247eb290ead694ecee751656543b61f3 100644
381
+ --- a/clippy_dev/src/new_lint.rs
382
+ +++ b/clippy_dev/src/new_lint.rs
383
+ @@ -531,10 +531,16 @@ fn parse_mod_file(path: &Path, contents: &str) -> (&'static str, usize) {
384
+ let mut captures = [Capture::EMPTY];
385
+ while let Some(name) = cursor.find_capture_ident() {
386
+ match cursor.get_text(name) {
387
+ - "declare_clippy_lint" if cursor.match_all(&[Bang, OpenBrace], &mut []) && cursor.find_close_brace() => {
388
+ + "declare_clippy_lint"
389
+ + if cursor.match_all(&[Bang, OpenBrace], &mut []).is_ok() && cursor.find_close_brace() =>
390
+ + {
391
+ decl_end = Some(cursor.pos());
392
+ },
393
+ - "impl" if cursor.match_all(&[Lt, Lifetime, Gt, CaptureIdent], &mut captures) => {
394
+ + "impl"
395
+ + if cursor
396
+ + .match_all(&[Lt, Lifetime, Gt, CaptureIdent], &mut captures)
397
+ + .is_ok() =>
398
+ + {
399
+ match cursor.get_text(captures[0]) {
400
+ "LateLintPass" => context = Some("LateContext"),
401
+ "EarlyLintPass" => context = Some("EarlyContext"),
402
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
403
+ index 95fb22accc079f46fc8b1b66425340cd99ba4939..e589485dc8f4dfcb1dce2690178fef3d4ce2b3c9 100644
404
+ --- a/clippy_dev/src/parse.rs
405
+ +++ b/clippy_dev/src/parse.rs
406
+ @@ -1,13 +1,13 @@
407
+ pub mod cursor;
408
+
409
+ use self::cursor::{Capture, Cursor, IdentPat};
410
+ -use crate::utils::{
411
+ - ErrAction, Scoped, SourceFile, Span, StrBuf, VecBuf, expect_action, slice_groups_mut, walk_dir_no_dot_or_target,
412
+ -};
413
+ +use crate::utils::{ErrAction, Scoped, StrBuf, VecBuf, expect_action, slice_groups_mut, walk_dir_no_dot_or_target};
414
+ +use crate::{DiagCx, SourceFile, Span};
415
+ use core::fmt::{self, Display};
416
+ use core::range::Range;
417
+ use rustc_arena::{DroplessArena, TypedArena};
418
+ use rustc_data_structures::fx::FxHashMap;
419
+ +use std::collections::hash_map::{Entry, VacantEntry};
420
+ use std::{fs, path};
421
+
422
+ pub struct ParseCxImpl<'cx> {
423
+ @@ -15,6 +15,7 @@ pub struct ParseCxImpl<'cx> {
424
+ pub source_files: &'cx TypedArena<SourceFile<'cx>>,
425
+ pub str_buf: StrBuf,
426
+ pub str_list_buf: VecBuf<&'cx str>,
427
+ + pub dcx: DiagCx,
428
+ }
429
+ pub type ParseCx<'cx> = &'cx mut ParseCxImpl<'cx>;
430
+
431
+ @@ -27,6 +28,7 @@ pub fn new_parse_cx<'env, T>(f: impl for<'cx> FnOnce(&'cx mut Scoped<'cx, 'env,
432
+ source_files: &source_files,
433
+ str_buf: StrBuf::with_capacity(128),
434
+ str_list_buf: VecBuf::with_capacity(128),
435
+ + dcx: DiagCx::default(),
436
+ }))
437
+ }
438
+
439
+ @@ -43,25 +45,29 @@ impl LintTool {
440
+ Self::Clippy => "clippy::",
441
+ }
442
+ }
443
+ +
444
+ + pub fn from_prefix(s: &str) -> Option<Self> {
445
+ + (s == "clippy").then_some(Self::Clippy)
446
+ + }
447
+ }
448
+
449
+ #[derive(Clone, Copy, PartialEq, Eq, Hash)]
450
+ pub struct LintName<'cx> {
451
+ - pub name: &'cx str,
452
+ pub tool: LintTool,
453
+ + pub name: &'cx str,
454
+ }
455
+ impl<'cx> LintName<'cx> {
456
+ pub fn new_rustc(name: &'cx str) -> Self {
457
+ Self {
458
+ - name,
459
+ tool: LintTool::Rustc,
460
+ + name,
461
+ }
462
+ }
463
+
464
+ pub fn new_clippy(name: &'cx str) -> Self {
465
+ Self {
466
+ - name,
467
+ tool: LintTool::Clippy,
468
+ + name,
469
+ }
470
+ }
471
+ }
472
+ @@ -149,11 +155,26 @@ impl<'cx> ParsedLints<'cx> {
473
+ tail.iter().take_while(|&x| x.decl_sp.file == head.decl_sp.file).count()
474
+ })
475
+ }
476
+ +
477
+ + #[track_caller]
478
+ + fn get_vacant_lint<'a>(
479
+ + &'a mut self,
480
+ + dcx: &mut DiagCx,
481
+ + name: &'cx str,
482
+ + name_sp: Span<'cx>,
483
+ + ) -> Option<VacantEntry<'a, &'cx str, Lint<'cx>>> {
484
+ + match self.lints.entry(name) {
485
+ + Entry::Vacant(e) => Some(e),
486
+ + Entry::Occupied(e) => {
487
+ + dcx.emit_duplicate_lint(name_sp, e.get().name_sp);
488
+ + None
489
+ + },
490
+ + }
491
+ + }
492
+ }
493
+
494
+ impl<'cx> ParseCxImpl<'cx> {
495
+ /// Finds and parses all lint declarations.
496
+ - #[must_use]
497
+ pub fn parse_lint_decls(&mut self) -> ParsedLints<'cx> {
498
+ let mut data = ParsedLints {
499
+ #[expect(clippy::default_trait_access)]
500
+ @@ -209,83 +230,87 @@ impl<'cx> ParseCxImpl<'cx> {
501
+ fn parse_lint_src_file(&mut self, data: &mut ParsedLints<'cx>, file: &'cx SourceFile<'cx>) {
502
+ #[allow(clippy::enum_glob_use)]
503
+ use cursor::Pat::*;
504
+ - #[rustfmt::skip]
505
+ - static LINT_DECL_TOKENS: &[cursor::Pat] = &[
506
+ - // !{ /// docs
507
+ - Bang, OpenBrace, AnyComments,
508
+ - // #[clippy::version = "version"]
509
+ - Pound, OpenBracket, Ident(IdentPat::clippy), DoubleColon,
510
+ - Ident(IdentPat::version), Eq, LitStr, CloseBracket,
511
+ - // pub NAME, GROUP,
512
+ - Ident(IdentPat::r#pub), CaptureIdent, Comma, AnyComments, CaptureIdent, Comma,
513
+ - ];
514
+
515
+ let mut cursor = Cursor::new(&file.contents);
516
+ let mut captures = [Capture::EMPTY; 3];
517
+ while let Some(mac_name) = cursor.find_capture_ident() {
518
+ - captures[1] = Capture::EMPTY;
519
+ + if !cursor.eat_bang() {
520
+ + continue;
521
+ + }
522
+ match cursor.get_text(mac_name) {
523
+ - "declare_clippy_lint"
524
+ - if cursor.match_all(LINT_DECL_TOKENS, &mut captures) && cursor.find_close_brace() =>
525
+ - {
526
+ - assert!(
527
+ - data.lints
528
+ - .insert(
529
+ - self.str_buf.alloc_ascii_lower(self.arena, cursor.get_text(captures[0])),
530
+ - Lint {
531
+ - name_sp: captures[0].mk_sp(file),
532
+ - data: LintData::Active(ActiveLint {
533
+ - group: cursor.get_text(captures[1]),
534
+ - decl_range: mac_name.pos..cursor.pos(),
535
+ - }),
536
+ - },
537
+ - )
538
+ - .is_none()
539
+ - );
540
+ + "declare_clippy_lint" => {
541
+ + #[rustfmt::skip]
542
+ + static DECL_START: &[cursor::Pat] = &[
543
+ + // { /// docs
544
+ + OpenBrace, AnyComments,
545
+ + // #[clippy::version = "version"]
546
+ + Pound, OpenBracket, Ident(IdentPat::clippy), DoubleColon,
547
+ + Ident(IdentPat::version), Eq, CaptureLitStr, CloseBracket,
548
+ + // pub NAME, GROUP, "desc",
549
+ + Ident(IdentPat::r#pub), CaptureIdent, Comma,
550
+ + AnyComments, CaptureIdent, Comma, AnyComments, LitStr,
551
+ + ];
552
+ + #[rustfmt::skip]
553
+ + static OPTION: &[cursor::Pat] = &[
554
+ + // @option = value
555
+ + AnyComments, At, AnyIdent, Eq, Lit,
556
+ + ];
557
+ +
558
+ + if let Err(expected) = cursor
559
+ + .match_all(DECL_START, &mut captures)
560
+ + .and_then(|()| {
561
+ + (!cursor.eat_comma()).ok_or(()).or_else(|()| {
562
+ + cursor.eat_list(|cursor| cursor.match_all(OPTION, &mut []).map(|()| true))
563
+ + })
564
+ + })
565
+ + .and_then(|()| cursor.eat_close_brace().ok_or("`}`"))
566
+ + {
567
+ + cursor.emit_unexpected(&mut self.dcx, file, expected);
568
+ + } else if let name = self.str_buf.alloc_ascii_lower(self.arena, cursor.get_text(captures[1]))
569
+ + && let name_sp = captures[1].mk_sp(file)
570
+ + && let Some(e) = data.get_vacant_lint(&mut self.dcx, name, name_sp)
571
+ + {
572
+ + let _ = self.parse_version(cursor.get_text(captures[0]), captures[0].mk_sp(file));
573
+ + e.insert(Lint {
574
+ + name_sp,
575
+ + data: LintData::Active(ActiveLint {
576
+ + group: cursor.get_text(captures[2]),
577
+ + decl_range: mac_name.pos..cursor.pos(),
578
+ + }),
579
+ + });
580
+ + }
581
+ },
582
+ - mac @ ("declare_lint_pass" | "impl_lint_pass")
583
+ - if cursor.match_all(&[Bang, OpenParen, CaptureDocLines, CaptureIdent], &mut captures)
584
+ - && cursor.opt_match_all(&[Lt, CaptureLifetime, Gt], &mut captures[2..])
585
+ - && cursor.match_all(&[FatArrow, OpenBracket], &mut captures) =>
586
+ - {
587
+ - let mac = if matches!(mac, "declare_lint_pass") {
588
+ - LintPassMac::Declare
589
+ - } else {
590
+ - LintPassMac::Impl
591
+ - };
592
+ - let docs = cursor.get_text(captures[0]);
593
+ - let name = cursor.get_text(captures[1]);
594
+ - let lt = cursor.get_text(captures[2]);
595
+ - let lt = if lt.is_empty() { None } else { Some(lt) };
596
+ -
597
+ - let lints = self.str_list_buf.with(|buf| {
598
+ - loop {
599
+ - match cursor.capture_opt_path(&mut self.str_buf, self.arena) {
600
+ - Ok(None) => break,
601
+ - Ok(Some(p)) => buf.push(p),
602
+ - Err(()) => panic!("error parsing path"),
603
+ - }
604
+ - if !cursor.eat_comma() {
605
+ - break;
606
+ - }
607
+ - }
608
+ -
609
+ - // The arena panics when allocating a size of zero.
610
+ - Some(if buf.is_empty() {
611
+ - &mut []
612
+ - } else {
613
+ - self.arena.alloc_slice(buf)
614
+ + mac @ ("declare_lint_pass" | "impl_lint_pass") => {
615
+ + let mut has_lt = false;
616
+ + let mut lints: &mut [_] = &mut [];
617
+ + if let Err(expected) = cursor
618
+ + .match_all(&[OpenParen, CaptureDocLines, CaptureIdent], &mut captures)
619
+ + .and_then(|()| cursor.opt_match_all(&[Lt, CaptureLifetime, Gt], &mut captures[2..]))
620
+ + .and_then(|res| {
621
+ + has_lt = res;
622
+ + cursor.match_all(&[FatArrow, OpenBracket], &mut [])
623
+ + })
624
+ + .and_then(|()| {
625
+ + cursor.capture_list(&mut self.str_list_buf, self.arena, |cursor| {
626
+ + cursor.capture_opt_path(&mut self.str_buf, self.arena)
627
+ + })
628
+ + })
629
+ + .and_then(|res| {
630
+ + lints = res;
631
+ + cursor.match_all(&[CloseBracket, CloseParen, Semi], &mut [])
632
+ })
633
+ - });
634
+ -
635
+ - if let Some(lints) = lints
636
+ - && cursor.match_all(&[CloseBracket, CloseParen, Semi], &mut [])
637
+ {
638
+ + cursor.emit_unexpected(&mut self.dcx, file, expected);
639
+ + } else {
640
+ data.lint_passes.push(LintPass {
641
+ - docs,
642
+ - name,
643
+ - lt,
644
+ - mac,
645
+ + docs: cursor.get_text(captures[0]),
646
+ + name: cursor.get_text(captures[1]),
647
+ + lt: has_lt.then(|| cursor.get_text(captures[2])),
648
+ + mac: if matches!(mac, "declare_lint_pass") {
649
+ + LintPassMac::Declare
650
+ + } else {
651
+ + LintPassMac::Impl
652
+ + },
653
+ decl_sp: Span::new(file, mac_name.pos..cursor.pos()),
654
+ lints,
655
+ });
656
+ @@ -305,8 +330,8 @@ impl<'cx> ParseCxImpl<'cx> {
657
+ // #[clippy::version = "version"]
658
+ Pound, OpenBracket, Ident(IdentPat::clippy), DoubleColon,
659
+ Ident(IdentPat::version), Eq, CaptureLitStr, CloseBracket,
660
+ - // ("first", "second"),
661
+ - OpenParen, CaptureLitStr, Comma, CaptureLitStr, CloseParen, Comma,
662
+ + // ("first", "second")
663
+ + OpenParen, CaptureLitStr, Comma, CaptureLitStr, CloseParen,
664
+ ];
665
+ #[rustfmt::skip]
666
+ static DEPRECATED_TOKENS: &[cursor::Pat] = &[
667
+ @@ -325,113 +350,163 @@ impl<'cx> ParseCxImpl<'cx> {
668
+ let mut cursor = Cursor::new(&file.contents);
669
+ let mut captures = [Capture::EMPTY; 3];
670
+
671
+ - // First instance is the macro definition.
672
+ - assert!(
673
+ - cursor.find_ident("declare_with_version"),
674
+ - "error reading deprecated lints"
675
+ - );
676
+ -
677
+ - if cursor.find_ident("declare_with_version") && cursor.match_all(DEPRECATED_TOKENS, &mut []) {
678
+ - while cursor.match_all(DECL_TOKENS, &mut captures) {
679
+ - assert!(
680
+ - data.lints
681
+ - .insert(
682
+ - self.parse_clippy_lint_name(file, cursor.get_text(captures[1])),
683
+ - Lint {
684
+ - name_sp: captures[1].mk_sp(file),
685
+ - data: LintData::Deprecated(DeprecatedLint {
686
+ - reason: self.parse_str_single_line(file, cursor.get_text(captures[2])),
687
+ - version: self.parse_str_single_line(file, cursor.get_text(captures[0])),
688
+ - }),
689
+ - },
690
+ + if let Err(expected) = cursor
691
+ + .find_ident("declare_with_version")
692
+ + .ok_or("`declare_with_version`")
693
+ + .and_then(|()| {
694
+ + cursor
695
+ + .find_ident("declare_with_version")
696
+ + .ok_or("`declare_with_version`")
697
+ + })
698
+ + .and_then(|()| cursor.match_all(DEPRECATED_TOKENS, &mut []))
699
+ + .and_then(|()| {
700
+ + cursor.eat_list(|cursor| {
701
+ + let parsed = cursor.opt_match_all(DECL_TOKENS, &mut captures)?;
702
+ + if parsed
703
+ + && let [version, name, reason] = captures
704
+ + && let name_sp = name.mk_sp(file)
705
+ + && let (Some(version), Some(name), Some(reason)) = (
706
+ + self.parse_version(cursor.get_text(version), version.mk_sp(file)),
707
+ + self.parse_clippy_lint_name(cursor.get_text(name), name_sp),
708
+ + self.parse_str_lit(cursor.get_text(reason), reason.mk_sp(file)),
709
+ )
710
+ - .is_none()
711
+ - );
712
+ - }
713
+ - } else {
714
+ - panic!("error reading deprecated lints");
715
+ - }
716
+ -
717
+ - if cursor.find_ident("declare_with_version") && cursor.match_all(RENAMED_TOKENS, &mut []) {
718
+ - while cursor.match_all(DECL_TOKENS, &mut captures) {
719
+ - assert!(
720
+ - data.lints
721
+ - .insert(
722
+ - self.parse_clippy_lint_name(file, cursor.get_text(captures[1])),
723
+ - Lint {
724
+ - name_sp: captures[1].mk_sp(file),
725
+ - data: LintData::Renamed(RenamedLint {
726
+ - new_name: self.parse_lint_name(file, cursor.get_text(captures[2])),
727
+ - version: self.parse_str_single_line(file, cursor.get_text(captures[0])),
728
+ - }),
729
+ - },
730
+ + && let Some(e) = data.get_vacant_lint(&mut self.dcx, name, name_sp)
731
+ + {
732
+ + e.insert(Lint {
733
+ + name_sp,
734
+ + data: LintData::Deprecated(DeprecatedLint { reason, version }),
735
+ + });
736
+ + }
737
+ + Ok(parsed)
738
+ + })
739
+ + })
740
+ + .and_then(|()| {
741
+ + cursor
742
+ + .find_ident("declare_with_version")
743
+ + .ok_or("`declare_with_version`")
744
+ + })
745
+ + .and_then(|()| cursor.match_all(RENAMED_TOKENS, &mut []))
746
+ + .and_then(|()| {
747
+ + cursor.eat_list(|cursor| {
748
+ + let parsed = cursor.opt_match_all(DECL_TOKENS, &mut captures)?;
749
+ + if parsed
750
+ + && let [version, name, new_name] = captures
751
+ + && let name_sp = name.mk_sp(file)
752
+ + && let (Some(version), Some(name), Some(new_name)) = (
753
+ + self.parse_version(cursor.get_text(version), version.mk_sp(file)),
754
+ + self.parse_clippy_lint_name(cursor.get_text(name), name_sp),
755
+ + self.parse_lint_name(cursor.get_text(new_name), new_name.mk_sp(file)),
756
+ )
757
+ - .is_none()
758
+ - );
759
+ - }
760
+ - } else {
761
+ - panic!("error reading renamed lints");
762
+ + && let Some(e) = data.get_vacant_lint(&mut self.dcx, name, name_sp)
763
+ + {
764
+ + e.insert(Lint {
765
+ + name_sp,
766
+ + data: LintData::Renamed(RenamedLint { new_name, version }),
767
+ + });
768
+ + }
769
+ + Ok(parsed)
770
+ + })
771
+ + })
772
+ + {
773
+ + cursor.emit_unexpected(&mut self.dcx, file, expected);
774
+ }
775
+ }
776
+
777
+ - /// Removes the line splices and surrounding quotes from a string literal
778
+ - fn parse_str_lit(&mut self, s: &'cx str) -> &'cx str {
779
+ - let (s, is_raw) = if let Some(s) = s.strip_prefix("r") {
780
+ - (s.trim_matches('#'), true)
781
+ + /// Removes the line splices and surrounding quotes from a string literal.
782
+ + fn parse_str_lit(&mut self, s: &'cx str, sp: Span<'cx>) -> Option<&'cx str> {
783
+ + let (s, is_raw, sp_base) = if let Some(trimmed) = s.strip_prefix("r") {
784
+ + let trimmed = trimmed.trim_start_matches('#');
785
+ + #[expect(clippy::cast_possible_truncation)]
786
+ + let sp_base = (s.len() - trimmed.len() + 1) as u32;
787
+ + (trimmed.trim_end_matches('#'), true, sp_base)
788
+ } else {
789
+ - (s, false)
790
+ + (s, false, 1)
791
+ };
792
+ + let sp_base = sp.range.start + sp_base;
793
+ let s = s
794
+ .strip_prefix('"')
795
+ .and_then(|s| s.strip_suffix('"'))
796
+ .unwrap_or_else(|| panic!("expected quoted string, found `{s}`"));
797
+
798
+ + let mut is_ok = true;
799
+ if is_raw {
800
+ - s
801
+ + rustc_literal_escaper::check_raw_str(s, |range, c| {
802
+ + if c.is_err_and(|e| e.is_fatal()) {
803
+ + #[expect(clippy::cast_possible_truncation)]
804
+ + let range = range.start as u32 + sp_base..range.end as u32 + sp_base;
805
+ + self.dcx
806
+ + .emit_spanned_err(Span::new(sp.file, range), "invalid string escape sequence");
807
+ + is_ok = false;
808
+ + }
809
+ + });
810
+ + is_ok.then_some(s)
811
+ } else {
812
+ self.str_buf.with(|buf| {
813
+ - rustc_literal_escaper::unescape_str(s, &mut |_, ch| {
814
+ - if let Ok(ch) = ch {
815
+ - buf.push(ch);
816
+ - }
817
+ + rustc_literal_escaper::unescape_str(s, |range, c| match c {
818
+ + Ok(c) => buf.push(c),
819
+ + Err(e) if e.is_fatal() => {
820
+ + #[expect(clippy::cast_possible_truncation)]
821
+ + let range = range.start as u32 + sp_base..range.end as u32 + sp_base;
822
+ + self.dcx
823
+ + .emit_spanned_err(Span::new(sp.file, range), "invalid string escape sequence");
824
+ + is_ok = false;
825
+ + },
826
+ + Err(_) => {},
827
+ });
828
+ - if buf == s {
829
+ - s
830
+ - } else if buf.is_empty() {
831
+ - ""
832
+ - } else {
833
+ - self.arena.alloc_str(buf)
834
+ - }
835
+ + is_ok.then(|| {
836
+ + if buf == s {
837
+ + s
838
+ + } else if buf.is_empty() {
839
+ + ""
840
+ + } else {
841
+ + self.arena.alloc_str(buf)
842
+ + }
843
+ + })
844
+ })
845
+ }
846
+ }
847
+
848
+ - fn parse_str_single_line(&mut self, file: &SourceFile<'_>, s: &'cx str) -> &'cx str {
849
+ - let value = self.parse_str_lit(s);
850
+ - assert!(
851
+ - !value.contains('\n'),
852
+ - "error parsing `{}`: `{s}` should be a single line string",
853
+ - file.path.get(),
854
+ - );
855
+ - value
856
+ + #[track_caller]
857
+ + fn parse_lint_name(&mut self, s: &'cx str, sp: Span<'cx>) -> Option<LintName<'cx>> {
858
+ + let s = self.parse_str_lit(s, sp)?;
859
+ + let (tool, name) = match s.split_once("::") {
860
+ + Some((tool, name)) if let Some(tool) = LintTool::from_prefix(tool) => (tool, name),
861
+ + Some(..) => {
862
+ + self.dcx.emit_spanned_err(sp, "unknown lint tool");
863
+ + return None;
864
+ + },
865
+ + None => (LintTool::Rustc, s),
866
+ + };
867
+ + if name
868
+ + .bytes()
869
+ + .all(|c| matches!(c, b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'_'))
870
+ + {
871
+ + Some(LintName { tool, name })
872
+ + } else {
873
+ + self.dcx.emit_spanned_err(sp, "unparsable lint name");
874
+ + None
875
+ + }
876
+ }
877
+
878
+ - fn parse_clippy_lint_name(&mut self, file: &SourceFile<'_>, s: &'cx str) -> &'cx str {
879
+ - match self.parse_str_single_line(file, s).strip_prefix("clippy::") {
880
+ - Some(x) => x,
881
+ - None => panic!(
882
+ - "error parsing `{}`: `{s}` should be a string starting with `clippy::`",
883
+ - file.path.get(),
884
+ - ),
885
+ + #[track_caller]
886
+ + fn parse_clippy_lint_name(&mut self, s: &'cx str, sp: Span<'cx>) -> Option<&'cx str> {
887
+ + let name = self.parse_lint_name(s, sp)?;
888
+ + if name.tool == LintTool::Clippy {
889
+ + Some(name.name)
890
+ + } else {
891
+ + self.dcx.emit_not_clippy_lint_name(sp);
892
+ + None
893
+ }
894
+ }
895
+
896
+ - fn parse_lint_name(&mut self, file: &SourceFile<'_>, s: &'cx str) -> LintName<'cx> {
897
+ - let s = self.parse_str_single_line(file, s);
898
+ - let (name, tool) = match s.strip_prefix("clippy::") {
899
+ - Some(s) => (s, LintTool::Clippy),
900
+ - None => (s, LintTool::Rustc),
901
+ - };
902
+ - LintName { name, tool }
903
+ + #[track_caller]
904
+ + fn parse_version(&mut self, s: &'cx str, sp: Span<'cx>) -> Option<&'cx str> {
905
+ + let s = self.parse_str_lit(s, sp)?;
906
+ + if s.bytes().all(|c| matches!(c, b'0'..=b'9' | b'.')) || matches!(s, "pre 1.29.0" | "CURRENT_RUSTC_VERSION") {
907
+ + Some(s)
908
+ + } else {
909
+ + self.dcx.emit_spanned_err(sp, "unparsable version number");
910
+ + None
911
+ + }
912
+ }
913
+ }
914
+ diff --git a/clippy_dev/src/parse/cursor.rs b/clippy_dev/src/parse/cursor.rs
915
+ index 76cbb070883e2800190184e12c30e522859e76b6..2ee007615a67e5820e5153dcc6c12e46626652cf 100644
916
+ --- a/clippy_dev/src/parse/cursor.rs
917
+ +++ b/clippy_dev/src/parse/cursor.rs
918
+ @@ -1,4 +1,5 @@
919
+ -use super::{SourceFile, Span, StrBuf};
920
+ +use crate::utils::{StrBuf, VecBuf};
921
+ +use crate::{DiagCx, SourceFile, Span};
922
+ use core::{ptr, slice};
923
+ use rustc_arena::DroplessArena;
924
+ use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind};
925
+ @@ -17,6 +18,8 @@ pub enum Pat {
926
+ CaptureIdent,
927
+ CaptureLifetime,
928
+ CaptureLitStr,
929
+ + AnyIdent,
930
+ + At,
931
+ Bang,
932
+ CloseBracket,
933
+ CloseParen,
934
+ @@ -27,6 +30,7 @@ pub enum Pat {
935
+ Gt,
936
+ Ident(IdentPat),
937
+ Lifetime,
938
+ + Lit,
939
+ LitStr,
940
+ Lt,
941
+ OpenBrace,
942
+ @@ -35,6 +39,34 @@ pub enum Pat {
943
+ Pound,
944
+ Semi,
945
+ }
946
+ +impl Pat {
947
+ + pub fn desc(self) -> &'static str {
948
+ + match self {
949
+ + Self::AnyComments => "comments",
950
+ + Self::CaptureDocLines => "doc line comments",
951
+ + Self::AnyIdent | Self::CaptureIdent => "an identifier",
952
+ + Self::At => "`@`",
953
+ + Self::Bang => "`!`",
954
+ + Self::CloseBracket => "`]`",
955
+ + Self::CloseParen => "`)`",
956
+ + Self::Comma => "`,`",
957
+ + Self::DoubleColon => "`::`",
958
+ + Self::Eq => "`=`",
959
+ + Self::FatArrow => "`=>`",
960
+ + Self::Gt => "`>`",
961
+ + Self::Ident(x) => x.desc(),
962
+ + Self::Lifetime | Self::CaptureLifetime => "a lifetime",
963
+ + Self::Lit => "a literal",
964
+ + Self::LitStr | Self::CaptureLitStr => "a string literal",
965
+ + Self::Lt => "`<`",
966
+ + Self::OpenBrace => "`{`",
967
+ + Self::OpenBracket => "`[`",
968
+ + Self::OpenParen => "`(`",
969
+ + Self::Pound => "`#`",
970
+ + Self::Semi => "`;`",
971
+ + }
972
+ + }
973
+ +}
974
+
975
+ macro_rules! ident_or_lit {
976
+ ($ident:ident) => {
977
+ @@ -53,6 +85,10 @@ macro_rules! decl_ident_pats {
978
+ pub fn as_str(self) -> &'static str {
979
+ match self { $(Self::$ident => ident_or_lit!($ident $($s)?)),* }
980
+ }
981
+ +
982
+ + pub fn desc(self) -> &'static str {
983
+ + match self { $(Self::$ident => concat!("`", ident_or_lit!($ident $($s)?), "`")),* }
984
+ + }
985
+ }
986
+ }
987
+ }
988
+ @@ -142,6 +178,17 @@ impl<'txt> Cursor<'txt> {
989
+ self.next_token = self.inner.advance_token();
990
+ }
991
+
992
+ + #[track_caller]
993
+ + pub fn emit_unexpected<'cx>(&self, dcx: &mut DiagCx, file: &'cx SourceFile<'cx>, expected: &'static str) {
994
+ + let sp = Span::new(file, self.pos..self.pos + self.next_token.len);
995
+ + let msg = if matches!(self.next_token.kind, TokenKind::Eof) {
996
+ + "end of file"
997
+ + } else {
998
+ + "token"
999
+ + };
1000
+ + dcx.emit_spanned_err(sp, format!("unexpected {msg}, expected {expected}"));
1001
+ + }
1002
+ +
1003
+ /// Consumes tokens until the given pattern is either fully matched of fails to match.
1004
+ /// Returns whether the pattern was fully matched.
1005
+ ///
1006
+ @@ -159,12 +206,16 @@ impl<'txt> Cursor<'txt> {
1007
+ (Pat::AnyComments, _) => return true,
1008
+
1009
+ (Pat::Ident(x), TokenKind::Ident) if x.as_str() == self.peek_text() => break,
1010
+ - (Pat::Bang, TokenKind::Bang)
1011
+ + (Pat::Lit, TokenKind::Ident) if matches!(self.peek_text(), "true" | "false") => break,
1012
+ + (Pat::At, TokenKind::At)
1013
+ + | (Pat::AnyIdent, TokenKind::Ident | TokenKind::RawIdent)
1014
+ + | (Pat::Bang, TokenKind::Bang)
1015
+ | (Pat::CloseBracket, TokenKind::CloseBracket)
1016
+ | (Pat::CloseParen, TokenKind::CloseParen)
1017
+ | (Pat::Comma, TokenKind::Comma)
1018
+ | (Pat::Eq, TokenKind::Eq)
1019
+ | (Pat::Lifetime, TokenKind::Lifetime { .. })
1020
+ + | (Pat::Lit, TokenKind::Literal { .. })
1021
+ | (Pat::Lt, TokenKind::Lt)
1022
+ | (Pat::Gt, TokenKind::Gt)
1023
+ | (Pat::OpenBrace, TokenKind::OpenBrace)
1024
+ @@ -223,11 +274,11 @@ impl<'txt> Cursor<'txt> {
1025
+ };
1026
+ return true;
1027
+ },
1028
+ -
1029
+ (Pat::CaptureDocLines, _) => {
1030
+ *captures.next().unwrap() = Capture::EMPTY;
1031
+ return true;
1032
+ },
1033
+ +
1034
+ _ => return false,
1035
+ }
1036
+ }
1037
+ @@ -282,7 +333,11 @@ impl<'txt> Cursor<'txt> {
1038
+ ///
1039
+ /// Only paths containing identifiers separated by `::` with a possible leading `::`.
1040
+ /// Generic arguments and qualified paths are not considered.
1041
+ - pub fn capture_opt_path(&mut self, buf: &mut StrBuf, arena: &'txt DroplessArena) -> Result<Option<&'txt str>, ()> {
1042
+ + pub fn capture_opt_path(
1043
+ + &mut self,
1044
+ + buf: &mut StrBuf,
1045
+ + arena: &'txt DroplessArena,
1046
+ + ) -> Result<Option<&'txt str>, &'static str> {
1047
+ #[derive(Clone, Copy)]
1048
+ enum State {
1049
+ Start,
1050
+ @@ -309,7 +364,7 @@ impl<'txt> Cursor<'txt> {
1051
+ },
1052
+ (State::Ident, _) => break,
1053
+ (State::Start, _) => return Ok(None),
1054
+ - (State::Sep, _) => return Err(()),
1055
+ + (State::Sep, _) => return Err(Pat::AnyIdent.desc()),
1056
+ }
1057
+ }
1058
+ let text = self.text[start as usize..self.pos as usize].trim();
1059
+ @@ -321,6 +376,36 @@ impl<'txt> Cursor<'txt> {
1060
+ })
1061
+ }
1062
+
1063
+ + pub fn eat_list(&mut self, mut f: impl FnMut(&mut Self) -> Result<bool, &'static str>) -> Result<(), &'static str> {
1064
+ + while f(self)? {
1065
+ + if !self.eat_comma() {
1066
+ + break;
1067
+ + }
1068
+ + }
1069
+ + Ok(())
1070
+ + }
1071
+ +
1072
+ + pub fn capture_list<'cx, T: Copy>(
1073
+ + &mut self,
1074
+ + buf: &mut VecBuf<T>,
1075
+ + arena: &'cx DroplessArena,
1076
+ + mut f: impl FnMut(&mut Self) -> Result<Option<T>, &'static str>,
1077
+ + ) -> Result<&'cx mut [T], &'static str> {
1078
+ + buf.with(|buf| {
1079
+ + while let Some(x) = f(self)? {
1080
+ + buf.push(x);
1081
+ + if !self.eat_comma() {
1082
+ + break;
1083
+ + }
1084
+ + }
1085
+ + Ok(if buf.is_empty() {
1086
+ + &mut []
1087
+ + } else {
1088
+ + arena.alloc_slice(buf)
1089
+ + })
1090
+ + })
1091
+ + }
1092
+ +
1093
+ /// Attempts to match a sequence of patterns at the current position. Returns whether
1094
+ /// all patterns were successfully matched.
1095
+ ///
1096
+ @@ -330,10 +415,10 @@ impl<'txt> Cursor<'txt> {
1097
+ /// unmodified.
1098
+ ///
1099
+ /// If the match fails the cursor will be positioned at the first failing token.
1100
+ - #[must_use]
1101
+ - pub fn match_all(&mut self, pats: &[Pat], captures: &mut [Capture]) -> bool {
1102
+ + pub fn match_all(&mut self, pats: &[Pat], captures: &mut [Capture]) -> Result<(), &'static str> {
1103
+ let mut captures = captures.iter_mut();
1104
+ - pats.iter().all(|&p| self.match_impl(p, &mut captures))
1105
+ + pats.iter()
1106
+ + .try_for_each(|&pat| self.match_impl(pat, &mut captures).ok_or(pat.desc()))
1107
+ }
1108
+
1109
+ /// Attempts to match a sequence of patterns at the current position. Returns whether
1110
+ @@ -345,13 +430,16 @@ impl<'txt> Cursor<'txt> {
1111
+ /// unmodified.
1112
+ ///
1113
+ /// If the match fails the cursor will be positioned at the first failing token.
1114
+ - #[must_use]
1115
+ - pub fn opt_match_all(&mut self, pats: &[Pat], captures: &mut [Capture]) -> bool {
1116
+ + pub fn opt_match_all(&mut self, pats: &[Pat], captures: &mut [Capture]) -> Result<bool, &'static str> {
1117
+ let mut captures = captures.iter_mut();
1118
+ - pats.iter()
1119
+ + match pats
1120
+ + .iter()
1121
+ .try_for_each(|p| self.match_impl(*p, &mut captures).ok_or(p))
1122
+ - .err()
1123
+ - .is_none_or(|p| ptr::addr_eq(pats.as_ptr(), p))
1124
+ + {
1125
+ + Ok(()) => Ok(true),
1126
+ + Err(p) if ptr::addr_eq(pats.as_ptr(), p) => Ok(false),
1127
+ + Err(p) => Err(p.desc()),
1128
+ + }
1129
+ }
1130
+ }
1131
+
1132
+ @@ -400,6 +488,8 @@ macro_rules! mk_tk_methods {
1133
+ }
1134
+ }
1135
+ mk_tk_methods! {
1136
+ + ["`!`"]
1137
+ + bang(&mut self) { TokenKind::Bang }
1138
+ ["`}`"]
1139
+ close_brace(&mut self) { TokenKind::CloseBrace }
1140
+ ["`]`"]
1141
+ diff --git a/clippy_dev/src/utils.rs b/clippy_dev/src/utils.rs
1142
+ index d3e95ffb87b40c4148a2ccbf85906a85bb4574d9..3680f167bc749fbdc341a479bcf0f4016ec64db2 100644
1143
+ --- a/clippy_dev/src/utils.rs
1144
+ +++ b/clippy_dev/src/utils.rs
1145
+ @@ -1,4 +1,4 @@
1146
+ -use core::cell::Cell;
1147
+ +use core::cell::{Cell, OnceCell};
1148
+ use core::fmt::{self, Display, Write as _};
1149
+ use core::hash::{Hash, Hasher};
1150
+ use core::marker::PhantomData;
1151
+ @@ -8,6 +8,7 @@ use core::range::Range;
1152
+ use core::str::FromStr;
1153
+ use core::str::pattern::Pattern;
1154
+ use core::{mem, ptr};
1155
+ +use memchr::memchr_iter;
1156
+ use rustc_arena::DroplessArena;
1157
+ use std::ffi::OsStr;
1158
+ use std::fs::{self, OpenOptions};
1159
+ @@ -799,18 +800,31 @@ impl<T> VecBuf<T> {
1160
+ pub struct SourceFile<'cx> {
1161
+ // `cargo dev rename_lint` needs to be able to rename files.
1162
+ pub path: Cell<&'cx str>,
1163
+ + pub line_starts: OnceCell<Vec<u32>>,
1164
+ pub contents: String,
1165
+ }
1166
+ impl<'cx> SourceFile<'cx> {
1167
+ + #[must_use]
1168
+ pub fn load(path: &'cx str) -> Self {
1169
+ let mut contents = String::new();
1170
+ File::open_read(path).read_append_to_string(&mut contents);
1171
+ SourceFile {
1172
+ path: Cell::new(path),
1173
+ + line_starts: OnceCell::new(),
1174
+ contents,
1175
+ }
1176
+ }
1177
+
1178
+ + pub fn line_starts(&self) -> &[u32] {
1179
+ + self.line_starts.get_or_init(|| {
1180
+ + let mut line_starts = Vec::with_capacity(self.contents.len() / 32 + 4);
1181
+ + line_starts.push(0);
1182
+ + #[expect(clippy::cast_possible_truncation)]
1183
+ + line_starts.extend(memchr_iter(b'\n', self.contents.as_bytes()).map(|x| x as u32 + 1));
1184
+ + line_starts
1185
+ + })
1186
+ + }
1187
+ +
1188
+ /// Splits the file's path into the crate it's a part of and the module it implements.
1189
+ ///
1190
+ /// Only supports paths in the form `CRATE_NAME/src/PATH/TO/FILE.rs` using the current
patches/20261028T105419Z/rust-lang--rust-part011/5fae19c02516f3b1dc3eb5e2e3532b19d9b9f390.patch ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
2
+ index 9799208efdb2a41cba705c9bb78971a6ccb0fe9d..41f98e2fb40c0a367d32bac14b13cbd1fa9178c6 100644
3
+ --- a/compiler/rustc_hir_analysis/src/lib.rs
4
+ +++ b/compiler/rustc_hir_analysis/src/lib.rs
5
+ @@ -194,6 +194,16 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
6
+ {
7
+ tcx.ensure_ok().typeck(item_def_id);
8
+ }
9
+ + });
10
+ +
11
+ + // This has to be a second pass over the body owners, after every body has been
12
+ + // type-checked above. `needs_coroutine_by_move_body_def_id` asks for `type_of`, and for a
13
+ + // body owner nested inside a const argument's anon const that goes through `typeck` of the
14
+ + // anon const, which needs the anon const's own type. That type is never computed, only fed
15
+ + // while the enclosing body is type-checked. Doing this in the pass above lets the parallel
16
+ + // front end reach the nested body owner first, computing (and caching) an error type for
17
+ + // the anon const that then conflicts with the type fed later on.
18
+ + tcx.par_hir_body_owners(|item_def_id| {
19
+ // Ensure we generate the new `DefId` before finishing `check_crate`.
20
+ // Afterwards we freeze the list of `DefId`s.
21
+ if tcx.needs_coroutine_by_move_body_def_id(item_def_id.to_def_id()) {
22
+ diff --git a/tests/ui/const-generics/anon-const-type-of-defaulted-param-issue-158818.rs b/tests/ui/const-generics/anon-const-type-of-defaulted-param-issue-158818.rs
23
+ new file mode 100644
24
+ index 0000000000000000000000000000000000000000..e10f46176ebb3d5e789ade3a39765c00698ebdca
25
+ --- /dev/null
26
+ +++ b/tests/ui/const-generics/anon-const-type-of-defaulted-param-issue-158818.rs
27
+ @@ -0,0 +1,12 @@
28
+ +//@ edition: 2024
29
+ +//@ compile-flags: -Zthreads=0 --crate-type lib
30
+ +
31
+ +#![allow(dead_code)]
32
+ +#![allow(invalid_type_param_default)]
33
+ +
34
+ +fn f<const N: u8, T = ()>() {
35
+ + f::<{ async || {} }>();
36
+ + //~^ ERROR mismatched types
37
+ +}
38
+ +
39
+ +//@ normalize-stderr: "found `\{async closure@[^`]*\}`" -> "found `{async closure@...}`"
40
+ diff --git a/tests/ui/const-generics/anon-const-type-of-defaulted-param-issue-158818.stderr b/tests/ui/const-generics/anon-const-type-of-defaulted-param-issue-158818.stderr
41
+ new file mode 100644
42
+ index 0000000000000000000000000000000000000000..33071f2a3a8df28de9437263c925a0445b521045
43
+ --- /dev/null
44
+ +++ b/tests/ui/const-generics/anon-const-type-of-defaulted-param-issue-158818.stderr
45
+ @@ -0,0 +1,22 @@
46
+ +error[E0308]: mismatched types
47
+ + --> $DIR/anon-const-type-of-defaulted-param-issue-158818.rs:8:11
48
+ + |
49
+ +LL | f::<{ async || {} }>();
50
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
51
+ + |
52
+ + = note: expected type `u8`
53
+ + found closure `{async closure@$DIR/anon-const-type-of-defaulted-param-issue-158818.rs:8:11: 8:19}`
54
+ +
55
+ +error: aborting due to 1 previous error
56
+ +
57
+ +For more information about this error, try `rustc --explain E0308`.
58
+ +Future incompatibility report: Future breakage diagnostic:
59
+ +warning: defaults for generic parameters are not allowed here
60
+ + --> $DIR/anon-const-type-of-defaulted-param-issue-158818.rs:7:19
61
+ + |
62
+ +LL | fn f<const N: u8, T = ()>() {
63
+ + | ^^^^^^
64
+ + |
65
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
66
+ + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
67
+ +
68
+ diff --git a/tests/ui/const-generics/anon-const-type-of-issue-158818.rs b/tests/ui/const-generics/anon-const-type-of-issue-158818.rs
69
+ new file mode 100644
70
+ index 0000000000000000000000000000000000000000..3052ceefa4759a33bb25db836c72c80de7aec5b2
71
+ --- /dev/null
72
+ +++ b/tests/ui/const-generics/anon-const-type-of-issue-158818.rs
73
+ @@ -0,0 +1,69 @@
74
+ +// The type of a const argument's anon const is never computed, only fed while the enclosing body
75
+ +// is type-checked. Under the parallel front end, `check_crate` used to ask for the `type_of` of a
76
+ +// body owner nested inside such an anon const before that had happened, computing and caching an
77
+ +// error type that then conflicted with the type fed later on.
78
+ +//
79
+ +// Each case below reaches the anon const through a different kind of path or position, none of
80
+ +// which is resolved before the enclosing body is type-checked. They all live in one body so that
81
+ +// the parallel front end cannot interleave their diagnostics.
82
+ +
83
+ +//@ edition: 2024
84
+ +//@ compile-flags: -Zthreads=0 --crate-type lib
85
+ +
86
+ +#![allow(dead_code)]
87
+ +
88
+ +struct Foo<const N: u8>;
89
+ +struct Tuple<const N: u8>(u8);
90
+ +
91
+ +trait Trait {
92
+ + fn assoc<const N: u8>();
93
+ +}
94
+ +
95
+ +impl Trait for Foo<0> {
96
+ + fn assoc<const N: u8>() {}
97
+ +}
98
+ +
99
+ +impl<const N: u8> Foo<N> {
100
+ + fn inherent<const M: u8>() {}
101
+ +}
102
+ +
103
+ +mod submodule {
104
+ + pub fn free<const N: u8>() {}
105
+ +}
106
+ +
107
+ +fn free<const N: u8>() {}
108
+ +
109
+ +fn preceded<T, const N: u8>() {}
110
+ +
111
+ +// The late-bound `'a` is not a generic parameter, leaving this function with fewer parameters
112
+ +// than it declares. Elided late-bound lifetimes in the signature do the same.
113
+ +fn late_bound<'a, const N: u8>(_: &'a ()) {}
114
+ +
115
+ +// `impl Sized` is a synthetic parameter, with no argument of its own.
116
+ +fn synthetic<const N: u8>(_: impl Sized) {}
117
+ +
118
+ +fn cases() {
119
+ + free::<{ async || {} }>();
120
+ + //~^ ERROR mismatched types
121
+ + submodule::free::<{ async || {} }>();
122
+ + //~^ ERROR mismatched types
123
+ + preceded::<u8, { async || {} }>();
124
+ + //~^ ERROR mismatched types
125
+ + late_bound::<{ async || {} }>(&());
126
+ + //~^ ERROR mismatched types
127
+ + synthetic::<{ async || {} }>(());
128
+ + //~^ ERROR mismatched types
129
+ + <Foo<0> as Trait>::assoc::<{ async || {} }>();
130
+ + //~^ ERROR mismatched types
131
+ + Foo::<0>::inherent::<{ async || {} }>();
132
+ + //~^ ERROR mismatched types
133
+ + let _ = Tuple::<{ async || {} }>(0);
134
+ + //~^ ERROR mismatched types
135
+ +
136
+ + // Not a path expression at all: the const argument sits in a type annotation, and is only
137
+ + // lowered once typeck reaches this statement.
138
+ + let _: Foo<{ async || {} }>;
139
+ + //~^ ERROR mismatched types
140
+ +}
141
+ +
142
+ +//@ normalize-stderr: "\{async closure@[^`]*\}" -> "{async closure@...}"
143
+ diff --git a/tests/ui/const-generics/anon-const-type-of-issue-158818.stderr b/tests/ui/const-generics/anon-const-type-of-issue-158818.stderr
144
+ new file mode 100644
145
+ index 0000000000000000000000000000000000000000..d0ee9786e294cc96784f3f56f3ca22bb25ca73da
146
+ --- /dev/null
147
+ +++ b/tests/ui/const-generics/anon-const-type-of-issue-158818.stderr
148
+ @@ -0,0 +1,84 @@
149
+ +error[E0308]: mismatched types
150
+ + --> $DIR/anon-const-type-of-issue-158818.rs:46:14
151
+ + |
152
+ +LL | free::<{ async || {} }>();
153
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
154
+ + |
155
+ + = note: expected type `u8`
156
+ + found closure `{async closure@...}`
157
+ +
158
+ +error[E0308]: mismatched types
159
+ + --> $DIR/anon-const-type-of-issue-158818.rs:48:25
160
+ + |
161
+ +LL | submodule::free::<{ async || {} }>();
162
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
163
+ + |
164
+ + = note: expected type `u8`
165
+ + found closure `{async closure@...}`
166
+ +
167
+ +error[E0308]: mismatched types
168
+ + --> $DIR/anon-const-type-of-issue-158818.rs:50:22
169
+ + |
170
+ +LL | preceded::<u8, { async || {} }>();
171
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
172
+ + |
173
+ + = note: expected type `u8`
174
+ + found closure `{async closure@...}`
175
+ +
176
+ +error[E0308]: mismatched types
177
+ + --> $DIR/anon-const-type-of-issue-158818.rs:52:20
178
+ + |
179
+ +LL | late_bound::<{ async || {} }>(&());
180
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
181
+ + |
182
+ + = note: expected type `u8`
183
+ + found closure `{async closure@...}`
184
+ +
185
+ +error[E0308]: mismatched types
186
+ + --> $DIR/anon-const-type-of-issue-158818.rs:54:19
187
+ + |
188
+ +LL | synthetic::<{ async || {} }>(());
189
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
190
+ + |
191
+ + = note: expected type `u8`
192
+ + found closure `{async closure@...}`
193
+ +
194
+ +error[E0308]: mismatched types
195
+ + --> $DIR/anon-const-type-of-issue-158818.rs:56:34
196
+ + |
197
+ +LL | <Foo<0> as Trait>::assoc::<{ async || {} }>();
198
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
199
+ + |
200
+ + = note: expected type `u8`
201
+ + found closure `{async closure@...}`
202
+ +
203
+ +error[E0308]: mismatched types
204
+ + --> $DIR/anon-const-type-of-issue-158818.rs:58:28
205
+ + |
206
+ +LL | Foo::<0>::inherent::<{ async || {} }>();
207
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
208
+ + |
209
+ + = note: expected type `u8`
210
+ + found closure `{async closure@...}`
211
+ +
212
+ +error[E0308]: mismatched types
213
+ + --> $DIR/anon-const-type-of-issue-158818.rs:60:23
214
+ + |
215
+ +LL | let _ = Tuple::<{ async || {} }>(0);
216
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
217
+ + |
218
+ + = note: expected type `u8`
219
+ + found closure `{async closure@...}`
220
+ +
221
+ +error[E0308]: mismatched types
222
+ + --> $DIR/anon-const-type-of-issue-158818.rs:65:18
223
+ + |
224
+ +LL | let _: Foo<{ async || {} }>;
225
+ + | ^^^^^^^^^^^ expected `u8`, found `{async closure@...}`
226
+ + |
227
+ + = note: expected type `u8`
228
+ + found closure `{async closure@...}`
229
+ +
230
+ +error: aborting due to 9 previous errors
231
+ +
232
+ +For more information about this error, try `rustc --explain E0308`.
patches/20261028T105419Z/rust-lang--rust-part011/610f6ff258262a85cc1fe6fe5cd8ca300953ff04.patch ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
2
+ index f247b517c541f01265bf0ef22d8996647a584d2e..fc53d64a2f984b7ead7cc479dfc4b652ecb5accd 100644
3
+ --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
4
+ +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
5
+ @@ -1329,7 +1329,11 @@ impl<'db> InferenceContext<'db> {
6
+ }
7
+ None => {
8
+ let ty = self.table.next_ty_var(element.into());
9
+ - self.infer_expr(element, &Expectation::has_type(ty), ExprIsRead::Yes);
10
+ + self.infer_expr_suptype_coerce_never(
11
+ + element,
12
+ + &Expectation::has_type(ty),
13
+ + ExprIsRead::Yes,
14
+ + );
15
+ ty
16
+ }
17
+ };
18
+ diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs
19
+ index 1c5f8aa110463cefa4b5a755eb01edfb4594da70..e53f7503dac6b6c7ae207df54a7a73aefabcfefb 100644
20
+ --- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs
21
+ +++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs
22
+ @@ -114,6 +114,21 @@ fn test() {
23
+ );
24
+ }
25
+
26
+ +#[test]
27
+ +fn array_repeat_never_can_be_reinferred() {
28
+ + check_no_mismatches(
29
+ + r#"
30
+ +fn test() {
31
+ + let y = [return; 2];
32
+ + match y {
33
+ + [(1, _), (_, false)] => {}
34
+ + [_, _] => {}
35
+ + }
36
+ +}
37
+ +"#,
38
+ + );
39
+ +}
40
+ +
41
+ #[test]
42
+ fn match_no_arm() {
43
+ check_types(
patches/20261028T105419Z/rust-lang--rust-part011/6423eed93f6662dee0d087dd3f237de0aaca69b0.patch ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
2
+ index af517fbd8f4d095cb077ccaa1dac3de088cb0e2e..811536a5f221e6c0b227b6b4fd3cc5b11cc4987a 100644
3
+ --- a/compiler/rustc_lint_defs/src/builtin.rs
4
+ +++ b/compiler/rustc_lint_defs/src/builtin.rs
5
+ @@ -278,18 +278,25 @@ declare_lint! {
6
+ }
7
+
8
+ declare_lint! {
9
+ - /// Todo: explain this.
10
+ + /// The `repeated_reprs` lint detects when the same representation is
11
+ + /// specified more than once in a `#[repr(..)]` attribute.
12
+ ///
13
+ /// ### Example
14
+ ///
15
+ - /// TODO
16
+ + /// ```rust
17
+ + /// #[repr(C)]
18
+ + /// #[repr(C)]
19
+ + /// enum Foo { A }
20
+ + /// ```
21
+ ///
22
+ /// ### Explanation
23
+ ///
24
+ - /// TODO
25
+ + /// While some representations may be specified more than once, the compiler
26
+ + /// will reject repeated uses of some others. For consistency, prefer to
27
+ + /// only specify the representation once.
28
+ pub REPEATED_REPRS,
29
+ Warn,
30
+ - "repeated `#[repr(..)]` attributes were inconsistently rejected before",
31
+ + "detects repeated representations in `#[repr(..)]` attributes",
32
+ }
33
+
34
+ declare_lint! {
35
+ diff --git a/compiler/rustc_passes/src/diagnostics.rs b/compiler/rustc_passes/src/diagnostics.rs
36
+ index deae750ca26881053af44285b9953a2bbb57a4e1..2f4900a6b47a7f9fab09272d1f00e63c83aea784 100644
37
+ --- a/compiler/rustc_passes/src/diagnostics.rs
38
+ +++ b/compiler/rustc_passes/src/diagnostics.rs
39
+ @@ -608,8 +608,8 @@ pub(crate) struct TransparentIncompatible {
40
+ }
41
+
42
+ #[derive(Diagnostic)]
43
+ -#[diag("attribute is specified more than once")]
44
+ -#[note("will become a hard error soon. todo: wording")]
45
+ +#[diag("representation attribute is specified more than once")]
46
+ +#[note("for consistency, only specify the representation once")]
47
+ pub(crate) struct RepeatedRepr;
48
+
49
+ #[derive(Diagnostic)]
50
+ diff --git a/tests/ui/attributes/issue-100631.rs b/tests/ui/attributes/issue-100631.rs
51
+ index 0f0eb235aae7840ee6cc5b4422c45e11586024da..d496231c730263d049edd9f92427c9fba9b9270b 100644
52
+ --- a/tests/ui/attributes/issue-100631.rs
53
+ +++ b/tests/ui/attributes/issue-100631.rs
54
+ @@ -2,7 +2,7 @@
55
+ // can reasonably deal with multiple attributes.
56
+ // `repr` will use `TyCtxt::get_attrs` since it's `DuplicatesOk`.
57
+ #[repr(C)] //~ ERROR: unsupported representation for zero-variant enum [E0084]
58
+ -//~^ WARN attribute is specified more than once
59
+ +//~^ WARN representation attribute is specified more than once
60
+ #[repr(C)]
61
+ enum Foo {}
62
+
63
+ diff --git a/tests/ui/attributes/issue-100631.stderr b/tests/ui/attributes/issue-100631.stderr
64
+ index 8f9cc9defcde0684b42081d32305a1bfe1204ab2..66e08738eb02c24dca94beab59ba9114006dedd9 100644
65
+ --- a/tests/ui/attributes/issue-100631.stderr
66
+ +++ b/tests/ui/attributes/issue-100631.stderr
67
+ @@ -1,4 +1,4 @@
68
+ -warning: attribute is specified more than once
69
+ +warning: representation attribute is specified more than once
70
+ --> $DIR/issue-100631.rs:4:8
71
+ |
72
+ LL | #[repr(C)]
73
+ @@ -7,7 +7,7 @@ LL |
74
+ LL | #[repr(C)]
75
+ | ^
76
+ |
77
+ - = note: will become a hard error soon. todo: wording
78
+ + = note: for consistency, only specify the representation once
79
+ = note: `#[warn(repeated_reprs)]` on by default
80
+
81
+ error[E0084]: unsupported representation for zero-variant enum
82
+ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs
83
+ index 6a1dfd702cf06bd113d61a8f754c182fde53f7a6..348c9590e8b27be1ab5e99cb24d90b724e4371d6 100644
84
+ --- a/tests/ui/lint/unused/unused-attr-duplicate.rs
85
+ +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs
86
+ @@ -64,7 +64,7 @@ fn t1() {}
87
+ #[must_use = "some message"]
88
+ //~^ ERROR unused attribute
89
+ //~| WARN this was previously accepted
90
+ -#[repr(C)] //~ WARN attribute is specified more than once
91
+ +#[repr(C)] //~ WARN representation attribute is specified more than once
92
+ #[repr(C)]
93
+ #[non_exhaustive]
94
+ #[non_exhaustive] //~ ERROR unused attribute
95
+ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr
96
+ index 10a674cc0332578f45c7a70faa45acf77c31d083..93f7a4791188f2c9138f737b8a58e7e6d4a3471d 100644
97
+ --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr
98
+ +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr
99
+ @@ -16,7 +16,7 @@ note: the lint level is defined here
100
+ LL | #![deny(unused_attributes)]
101
+ | ^^^^^^^^^^^^^^^^^
102
+
103
+ -warning: attribute is specified more than once
104
+ +warning: representation attribute is specified more than once
105
+ --> $DIR/unused-attr-duplicate.rs:67:8
106
+ |
107
+ LL | #[repr(C)]
108
+ @@ -24,7 +24,7 @@ LL | #[repr(C)]
109
+ LL | #[repr(C)]
110
+ | ^
111
+ |
112
+ - = note: will become a hard error soon. todo: wording
113
+ + = note: for consistency, only specify the representation once
114
+ = note: `#[warn(repeated_reprs)]` on by default
115
+
116
+ error: unused attribute
117
+ diff --git a/tests/ui/repr/conflicting-repr-hints.rs b/tests/ui/repr/conflicting-repr-hints.rs
118
+ index 0ddcabef67972c41d84ccd44b338df56016c191a..032f2b2e6c6083abe234780cd8a434f8e6e0cb75 100644
119
+ --- a/tests/ui/repr/conflicting-repr-hints.rs
120
+ +++ b/tests/ui/repr/conflicting-repr-hints.rs
121
+ @@ -36,10 +36,10 @@ struct G(i32); //~ ERROR type has conflicting packed and align representation hi
122
+ #[repr(packed)]
123
+ struct H(i32); //~ ERROR type has conflicting packed and align representation hints
124
+
125
+ -#[repr(packed, packed(2))] //~ WARN attribute is specified more than once
126
+ +#[repr(packed, packed(2))] //~ WARN representation attribute is specified more than once
127
+ struct I(i32); //~ ERROR type has conflicting packed representation hints
128
+
129
+ -#[repr(packed(2))] //~ WARN attribute is specified more than once
130
+ +#[repr(packed(2))] //~ WARN representation attribute is specified more than once
131
+ #[repr(packed)]
132
+ struct J(i32); //~ ERROR type has conflicting packed representation hints
133
+
134
+ diff --git a/tests/ui/repr/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr
135
+ index 77ff01a22caa5469a84587809533864fef2c1272..a99546b75478578638f4b83418858cf8ae6abca5 100644
136
+ --- a/tests/ui/repr/conflicting-repr-hints.stderr
137
+ +++ b/tests/ui/repr/conflicting-repr-hints.stderr
138
+ @@ -17,16 +17,16 @@ LL | #[repr(u32, u64)]
139
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
140
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
141
+
142
+ -warning: attribute is specified more than once
143
+ +warning: representation attribute is specified more than once
144
+ --> $DIR/conflicting-repr-hints.rs:39:8
145
+ |
146
+ LL | #[repr(packed, packed(2))]
147
+ | ^^^^^^ ^^^^^^^^^
148
+ |
149
+ - = note: will become a hard error soon. todo: wording
150
+ + = note: for consistency, only specify the representation once
151
+ = note: `#[warn(repeated_reprs)]` on by default
152
+
153
+ -warning: attribute is specified more than once
154
+ +warning: representation attribute is specified more than once
155
+ --> $DIR/conflicting-repr-hints.rs:42:8
156
+ |
157
+ LL | #[repr(packed(2))]
158
+ @@ -34,15 +34,15 @@ LL | #[repr(packed(2))]
159
+ LL | #[repr(packed)]
160
+ | ^^^^^^
161
+ |
162
+ - = note: will become a hard error soon. todo: wording
163
+ + = note: for consistency, only specify the representation once
164
+
165
+ -warning: attribute is specified more than once
166
+ +warning: representation attribute is specified more than once
167
+ --> $DIR/conflicting-repr-hints.rs:46:8
168
+ |
169
+ LL | #[repr(packed, packed(1))]
170
+ | ^^^^^^ ^^^^^^^^^
171
+ |
172
+ - = note: will become a hard error soon. todo: wording
173
+ + = note: for consistency, only specify the representation once
174
+
175
+ error[E0587]: type has conflicting packed and align representation hints
176
+ --> $DIR/conflicting-repr-hints.rs:29:1
177
+ diff --git a/tests/ui/structs-enums/align-enum.rs b/tests/ui/structs-enums/align-enum.rs
178
+ index c9652ac84db47814b2ea2a1934e46012feaebafa..a635af7352afef14867f6dee2991d1e7e433da37 100644
179
+ --- a/tests/ui/structs-enums/align-enum.rs
180
+ +++ b/tests/ui/structs-enums/align-enum.rs
181
+ @@ -11,7 +11,7 @@ enum Align16 {
182
+ }
183
+
184
+ // Raise alignment by maximum
185
+ -#[repr(align(1), align(16))] //~ WARN attribute is specified more than once
186
+ +#[repr(align(1), align(16))] //~ WARN representation attribute is specified more than once
187
+ #[repr(align(32))]
188
+ #[repr(align(4))]
189
+ enum Align32 {
190
+ diff --git a/tests/ui/structs-enums/align-enum.stderr b/tests/ui/structs-enums/align-enum.stderr
191
+ index 25fec15cf2a1209cf5618c6a40dcc500ab7bb188..9b8c9842f81dfcee9e39c1adf163705a38f6cba9 100644
192
+ --- a/tests/ui/structs-enums/align-enum.stderr
193
+ +++ b/tests/ui/structs-enums/align-enum.stderr
194
+ @@ -1,4 +1,4 @@
195
+ -warning: attribute is specified more than once
196
+ +warning: representation attribute is specified more than once
197
+ --> $DIR/align-enum.rs:14:8
198
+ |
199
+ LL | #[repr(align(1), align(16))]
200
+ @@ -8,7 +8,7 @@ LL | #[repr(align(32))]
201
+ LL | #[repr(align(4))]
202
+ | ^^^^^^^^
203
+ |
204
+ - = note: will become a hard error soon. todo: wording
205
+ + = note: for consistency, only specify the representation once
206
+ = note: `#[warn(repeated_reprs)]` on by default
207
+
208
+ warning: 1 warning emitted
209
+ diff --git a/tests/ui/structs-enums/align-struct.rs b/tests/ui/structs-enums/align-struct.rs
210
+ index 1b6d4dfa49755da16cacb7fc1d0abea70ee613fa..2d1ebf6731a626209afbe0cc30632e41c0e9d84a 100644
211
+ --- a/tests/ui/structs-enums/align-struct.rs
212
+ +++ b/tests/ui/structs-enums/align-struct.rs
213
+ @@ -13,7 +13,7 @@ struct Align16(i32);
214
+ struct Align1(i32);
215
+
216
+ // Multiple attributes take the max
217
+ -#[repr(align(4))] //~ WARN attribute is specified more than once
218
+ +#[repr(align(4))] //~ WARN representation attribute is specified more than once
219
+ #[repr(align(16))]
220
+ #[repr(align(8))]
221
+ struct AlignMany(i32);
222
+ diff --git a/tests/ui/structs-enums/align-struct.stderr b/tests/ui/structs-enums/align-struct.stderr
223
+ index 6aaafc8c7753d6e34467106a42821f273b17a946..f54e9cd14cd8bd22de5600fa23ccf02a94153c41 100644
224
+ --- a/tests/ui/structs-enums/align-struct.stderr
225
+ +++ b/tests/ui/structs-enums/align-struct.stderr
226
+ @@ -1,4 +1,4 @@
227
+ -warning: attribute is specified more than once
228
+ +warning: representation attribute is specified more than once
229
+ --> $DIR/align-struct.rs:16:8
230
+ |
231
+ LL | #[repr(align(4))]
232
+ @@ -8,7 +8,7 @@ LL | #[repr(align(16))]
233
+ LL | #[repr(align(8))]
234
+ | ^^^^^^^^
235
+ |
236
+ - = note: will become a hard error soon. todo: wording
237
+ + = note: for consistency, only specify the representation once
238
+ = note: `#[warn(repeated_reprs)]` on by default
239
+
240
+ warning: 1 warning emitted
patches/20261028T105419Z/rust-lang--rust-part011/68c2ddf5d3d1f2bdb02a516625a4888f40a92a27.patch ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
2
+ index bd1ad70fe6a1426882505480e825f479593916b6..44f410408a40a22aeee96517233852be11e31204 100644
3
+ --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
4
+ +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
5
+ @@ -491,6 +491,12 @@ impl<'db> MirLowerCtx<'_, 'db> {
6
+ )?
7
+ }
8
+ Pat::Ref { pat, mutability: _ } => {
9
+ + let ty = cond_place.ty(&self.result, &self.infcx, self.env).ty;
10
+ + if !ty.is_ref() {
11
+ + return Err(MirLowerError::TypeError(
12
+ + "non reference type matched with reference pattern",
13
+ + ));
14
+ + }
15
+ let cond_place = cond_place.project(ProjectionElem::Deref);
16
+ self.pattern_match_inner(current, current_else, cond_place, *pat, mode)?
17
+ }
18
+ diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs
19
+ index 1f6aa5c926b152448c2a1e737864e93f0cccdde1..e4f3b61be4556412eea887d5db2e7953fc6acbab 100644
20
+ --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs
21
+ +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs
22
+ @@ -49,3 +49,19 @@ fn foo() {
23
+ "#,
24
+ );
25
+ }
26
+ +
27
+ +#[test]
28
+ +fn ref_pattern_on_unresolved_alias() {
29
+ + lower_mir(
30
+ + r#"
31
+ +//- minicore: sized
32
+ +trait Tr {
33
+ + type A;
34
+ +}
35
+ +
36
+ +fn f<T: Tr>(x: T::A) {
37
+ + let &() = x;
38
+ +}
39
+ +"#,
40
+ + );
41
+ +}
patches/20261028T105419Z/rust-lang--rust-part011/6c8bd24ec61a7f9bf0bd1e30eb664dd96f932985.patch ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
2
+ index 39292b5d04309601a893fdaccb6e318af2d9cdfb..121f3c0a818504a71a47ca62dda8b343bb70b740 100644
3
+ --- a/src/bootstrap/src/core/builder/cargo.rs
4
+ +++ b/src/bootstrap/src/core/builder/cargo.rs
5
+ @@ -399,7 +399,9 @@ impl Cargo {
6
+ // Do not enable Zlib compression on:
7
+ // - Windows, because MSVC/PDB doesn't support it
8
+ // - macOS, because its linker doesn't know the flag
9
+ - if !self.target.is_windows() && !self.target.is_apple() {
10
+ + // - Cygwin, because its linker may not support the flag
11
+ + if !self.target.is_windows() && !self.target.is_apple() && !self.target.is_cygwin()
12
+ + {
13
+ // If we link through cc, we need the -Wl prefix.
14
+ // If we don't, then we must not add it, because the linker wouldn't
15
+ // understand it.
patches/20261028T105419Z/rust-lang--rust-part011/6cabf9581df3b56951055bd63a250e2fda9f49ec.patch ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/ui-internal/custom_ice_message.rs b/tests/ui/custom_ice_message.rs
2
+ similarity index 100%
3
+ rename from tests/ui-internal/custom_ice_message.rs
4
+ rename to tests/ui/custom_ice_message.rs
5
+ diff --git a/tests/ui-internal/custom_ice_message.stderr b/tests/ui/custom_ice_message.stderr
6
+ similarity index 89%
7
+ rename from tests/ui-internal/custom_ice_message.stderr
8
+ rename to tests/ui/custom_ice_message.stderr
9
+ index 2e4d53104fba182e60364203463556ff8d3a4cf7..c21963007c89e95219a74dabfb37dfe69edf00aa 100644
10
+ --- a/tests/ui-internal/custom_ice_message.stderr
11
+ +++ b/tests/ui/custom_ice_message.stderr
12
+ @@ -3,13 +3,13 @@ note: no errors encountered even though delayed bugs were created
13
+ note: those delayed bugs will now be shown as internal compiler errors
14
+
15
+ error: internal compiler error: Would you like some help with that?
16
+ - --> tests/ui-internal/custom_ice_message.rs:12:1
17
+ + --> tests/ui/custom_ice_message.rs:12:1
18
+ |
19
+ LL | fn it_looks_like_you_are_trying_to_kill_clippy() {}
20
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21
+ |
22
+ note: delayed at clippy_lints_internal/src/produce_ice.rs - disabled backtrace
23
+ - --> tests/ui-internal/custom_ice_message.rs:12:1
24
+ + --> tests/ui/custom_ice_message.rs:12:1
25
+ |
26
+ LL | fn it_looks_like_you_are_trying_to_kill_clippy() {}
27
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
patches/20261028T105419Z/rust-lang--rust-part011/70020cc60fdf32e67cbfc5818da8e3c7e34a1918.patch ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
2
+ index c5117c4c83f7c2b70274ba3bf697b3784aeccc1f..f251fdb29ace275e8868e30bf0d930d56232bf16 100644
3
+ --- a/src/etc/lldb_providers.py
4
+ +++ b/src/etc/lldb_providers.py
5
+ @@ -1029,19 +1029,14 @@ class TupleSyntheticProvider:
6
+
7
+ def get_child_index(self, name: str) -> int:
8
+ if name.isdigit():
9
+ - return int(name)
10
+ + return self.valobj.GetIndexOfChildWithName(f"__{name}")
11
+ else:
12
+ return -1
13
+
14
+ def get_child_at_index(self, index: int) -> Optional[SBValue]:
15
+ - if self.is_variant:
16
+ - field = self.type.GetFieldAtIndex(index + 1)
17
+ - else:
18
+ - field = self.type.GetFieldAtIndex(index)
19
+ - element = self.valobj.GetChildMemberWithName(field.name)
20
+ - return self.valobj.CreateValueFromData(
21
+ - str(index), element.GetData(), element.GetType()
22
+ - )
23
+ + return self.valobj.GetChildAtIndex(
24
+ + self.valobj.GetIndexOfChildWithName(f"__{index}")
25
+ + ).Clone(str(index))
26
+
27
+ def update(self):
28
+ pass
29
+ @@ -1060,12 +1055,15 @@ class MSVCTupleSyntheticProvider:
30
+ return self.valobj.GetNumChildren()
31
+
32
+ def get_child_index(self, name: str) -> int:
33
+ - return self.valobj.GetIndexOfChildWithName(name)
34
+ + if name.isdigit():
35
+ + return self.valobj.GetIndexOfChildWithName(f"__{name}")
36
+ + else:
37
+ + return -1
38
+
39
+ def get_child_at_index(self, index: int) -> Optional[SBValue]:
40
+ - child: SBValue = self.valobj.GetChildAtIndex(index)
41
+ - offset = self.valobj.GetType().GetFieldAtIndex(index).byte_offset
42
+ - return self.valobj.CreateChildAtOffset(str(index), offset, child.GetType())
43
+ + return self.valobj.GetChildAtIndex(
44
+ + self.valobj.GetIndexOfChildWithName(f"__{index}")
45
+ + ).Clone(str(index))
46
+
47
+ def update(self):
48
+ pass
patches/20261028T105419Z/rust-lang--rust-part011/787af2b8c80638c51a4fc8e44f84e6891f243ec7.patch ADDED
The diff for this file is too large to render. See raw diff
 
patches/20261028T105419Z/rust-lang--rust-part011/80f74433dbd201f6cf1eabf24820acf08993d110.patch ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs
2
+ index 09ad3254e57146071d8b628b1a797ef5939c6953..b3b1bea68e0b42b3fc9a0089bb4c6ae59ca0c4da 100644
3
+ --- a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs
4
+ +++ b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs
5
+ @@ -171,7 +171,6 @@ fn f16_builtin<'gcc, 'tcx>(
6
+ sym::exp2f16 => "exp2f",
7
+ sym::fabs => "fabsf",
8
+ sym::floorf16 => "__builtin_floorf",
9
+ - sym::fmaf16 => "fmaf",
10
+ sym::logf16 => "logf",
11
+ sym::log2f16 => "log2f",
12
+ sym::log10f16 => "log10f",
13
+ @@ -249,7 +248,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
14
+ | sym::expf16
15
+ | sym::exp2f16
16
+ | sym::floorf16
17
+ - | sym::fmaf16
18
+ | sym::logf16
19
+ | sym::log2f16
20
+ | sym::log10f16
21
+ diff --git a/library/coretests/tests/num/floats.rs b/library/coretests/tests/num/floats.rs
22
+ index cc1d1a0b673dc0f2bb582cb0211aeaac14f021d4..8c3bc2f61b4fe9a65ddb3b5d0aa6c95630e0bb29 100644
23
+ --- a/library/coretests/tests/num/floats.rs
24
+ +++ b/library/coretests/tests/num/floats.rs
25
+ @@ -58,6 +58,9 @@ pub(crate) trait TestableFloat: Sized {
26
+ const RAW_MINUS_14_DOT_25: Self;
27
+ /// The result of 12.3.mul_add(4.5, 6.7)
28
+ const MUL_ADD_RESULT: Self;
29
+ + /// The result of 48.34375.mul_add(0.000013887882, 0.12438965), which checks that f16::mul_add
30
+ + /// is correctly rounded. A naive implementation via f32::mul_add has insufficient precision.
31
+ + const F16_NO_DOUBLE_ROUNDING_MUL_ADD_RESULT: Self;
32
+ /// The result of (-12.3).mul_add(-4.5, -6.7)
33
+ const NEG_MUL_ADD_RESULT: Self;
34
+ /// Reciprocal of the maximum val
35
+ @@ -109,6 +112,7 @@ impl TestableFloat for f16 {
36
+ const RAW_1337: Self = Self::from_bits(0x6539);
37
+ const RAW_MINUS_14_DOT_25: Self = Self::from_bits(0xcb20);
38
+ const MUL_ADD_RESULT: Self = 62.031;
39
+ + const F16_NO_DOUBLE_ROUNDING_MUL_ADD_RESULT: Self = 0.1251;
40
+ const NEG_MUL_ADD_RESULT: Self = 48.625;
41
+ const MAX_RECIP: Self = 1.526624e-5;
42
+ const ASINH_ACOSH_MAX: Self = 11.781;
43
+ @@ -168,6 +172,7 @@ impl TestableFloat for f32 {
44
+ const RAW_1337: Self = Self::from_bits(0x44a72000);
45
+ const RAW_MINUS_14_DOT_25: Self = Self::from_bits(0xc1640000);
46
+ const MUL_ADD_RESULT: Self = 62.05;
47
+ + const F16_NO_DOUBLE_ROUNDING_MUL_ADD_RESULT: Self = 0.12506104;
48
+ const NEG_MUL_ADD_RESULT: Self = 48.65;
49
+ const MAX_RECIP: Self = 2.938736e-39;
50
+ const ASINH_ACOSH_MAX: Self = 89.4159851;
51
+ @@ -200,6 +205,7 @@ impl TestableFloat for f64 {
52
+ const RAW_1337: Self = Self::from_bits(0x4094e40000000000);
53
+ const RAW_MINUS_14_DOT_25: Self = Self::from_bits(0xc02c800000000000);
54
+ const MUL_ADD_RESULT: Self = 62.050000000000004;
55
+ + const F16_NO_DOUBLE_ROUNDING_MUL_ADD_RESULT: Self = 0.1250610422954375;
56
+ const NEG_MUL_ADD_RESULT: Self = 48.650000000000006;
57
+ const MAX_RECIP: Self = 5.562684646268003e-309;
58
+ const ASINH_ACOSH_MAX: Self = 710.47586007394398;
59
+ @@ -242,6 +248,7 @@ impl TestableFloat for f128 {
60
+ const RAW_1337: Self = Self::from_bits(0x40094e40000000000000000000000000);
61
+ const RAW_MINUS_14_DOT_25: Self = Self::from_bits(0xc002c800000000000000000000000000);
62
+ const MUL_ADD_RESULT: Self = 62.0500000000000000000000000000000037;
63
+ + const F16_NO_DOUBLE_ROUNDING_MUL_ADD_RESULT: Self = 0.1250610422954375;
64
+ const NEG_MUL_ADD_RESULT: Self = 48.6500000000000000000000000000000049;
65
+ const MAX_RECIP: Self = 8.40525785778023376565669454330438228902076605e-4933;
66
+ const ASINH_ACOSH_MAX: Self = 11357.216553474703894801348310092223;
67
+ @@ -1978,6 +1985,7 @@ float_test! {
68
+ let inf: Float = Float::INFINITY;
69
+ let neg_inf: Float = Float::NEG_INFINITY;
70
+ assert_biteq!(flt(12.3).mul_add(flt(4.5), flt(6.7)), Float::MUL_ADD_RESULT);
71
+ + assert_biteq!(flt( 48.34375).mul_add(flt(0.000013887882), flt(0.12438965)), Float::F16_NO_DOUBLE_ROUNDING_MUL_ADD_RESULT);
72
+ assert_biteq!((flt(-12.3)).mul_add(flt(-4.5), flt(-6.7)), Float::NEG_MUL_ADD_RESULT);
73
+ assert_biteq!(flt(0.0).mul_add(8.9, 1.2), 1.2);
74
+ assert_biteq!(flt(3.4).mul_add(-0.0, 5.6), 5.6);
patches/20261028T105419Z/rust-lang--rust-part011/819099b56c2c69e5ed886b4b4f1c572beefa749d.patch ADDED
@@ -0,0 +1,639 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_attr_ir/src/data_structures.rs b/compiler/rustc_attr_ir/src/data_structures.rs
2
+ index 195712559782ddd3686569b16f64493272da80cb..28e90ea4f52b4d28cd590b796cfe925584646bfd 100644
3
+ --- a/compiler/rustc_attr_ir/src/data_structures.rs
4
+ +++ b/compiler/rustc_attr_ir/src/data_structures.rs
5
+ @@ -172,7 +172,19 @@ impl OptimizeAttr {
6
+ }
7
+ }
8
+
9
+ -#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, StableHash, PrintAttribute)]
10
+ +#[derive(
11
+ + PartialEq,
12
+ + Eq,
13
+ + Debug,
14
+ + PartialOrd,
15
+ + Ord,
16
+ + Encodable,
17
+ + Decodable,
18
+ + Copy,
19
+ + Clone,
20
+ + StableHash,
21
+ + PrintAttribute
22
+ +)]
23
+ pub enum ReprAttr {
24
+ ReprInt(IntType),
25
+ ReprRust,
26
+ @@ -188,7 +200,7 @@ pub enum TransparencyError {
27
+ MultipleTransparencyAttrs(Span, Span),
28
+ }
29
+
30
+ -#[derive(Eq, PartialEq, Debug, Copy, Clone)]
31
+ +#[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)]
32
+ #[derive(Encodable, Decodable, StableHash, PrintAttribute)]
33
+ pub enum IntType {
34
+ SignedInt(ast::IntTy),
35
+ diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
36
+ index b196ae1e5a82edb2552c84e4529bc44ba6d5b1d7..e4ee552d5bd0ebeb1c59e2f0f49625bcd67c3eb0 100644
37
+ --- a/compiler/rustc_passes/src/check_attr.rs
38
+ +++ b/compiler/rustc_passes/src/check_attr.rs
39
+ @@ -1213,64 +1213,58 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
40
+ let mut is_c = false;
41
+ let mut is_simd = false;
42
+ let mut is_transparent = false;
43
+ - let mut is_align = false;
44
+ - let mut is_packed = false;
45
+ - let mut repeated_repr = false;
46
+ - let mut maybe_last_int_type = None;
47
+
48
+ for (repr, _repr_span) in reprs {
49
+ match repr {
50
+ ReprAttr::ReprRust => {
51
+ - if is_explicit_rust {
52
+ - repeated_repr = true;
53
+ - }
54
+ is_explicit_rust = true;
55
+ }
56
+ ReprAttr::ReprC => {
57
+ - if is_c {
58
+ - repeated_repr = true;
59
+ - }
60
+ is_c = true;
61
+ }
62
+ - ReprAttr::ReprAlign(..) => {
63
+ - if is_align {
64
+ - repeated_repr = true;
65
+ - }
66
+ - is_align = true;
67
+ - }
68
+ - ReprAttr::ReprPacked(..) => {
69
+ - if is_packed {
70
+ - repeated_repr = true;
71
+ - }
72
+ - is_packed = true;
73
+ - }
74
+ + ReprAttr::ReprAlign(..) => (),
75
+ + ReprAttr::ReprPacked(..) => (),
76
+ ReprAttr::ReprSimd => {
77
+ - if is_simd {
78
+ - repeated_repr = true;
79
+ - }
80
+ is_simd = true;
81
+ }
82
+ ReprAttr::ReprTransparent => {
83
+ - // No need to check for repeated transparent because that is already checked
84
+ - // when checking for any other attribute together with transparent.
85
+ is_transparent = true;
86
+ }
87
+ - ReprAttr::ReprInt(int_type) => {
88
+ - if let Some(last_int_type) = maybe_last_int_type
89
+ - && last_int_type == int_type
90
+ - {
91
+ - // We'll "miss" detecting repeated int reprs if the user specifies
92
+ - // #[repr(u8, u64, u8)] for example. But that's okay because we've got
93
+ - // conflicting reprs anyway so it's not worth the effort to do more precise
94
+ - // tracking.
95
+ - repeated_repr = true;
96
+ - }
97
+ - maybe_last_int_type = Some(int_type);
98
+ + ReprAttr::ReprInt(..) => {
99
+ int_reprs += 1;
100
+ }
101
+ };
102
+ }
103
+
104
+ + if !reprs.is_empty() {
105
+ + let sorted_reprs = {
106
+ + let mut to_sort = reprs.to_owned();
107
+ + to_sort.sort_unstable();
108
+ + to_sort
109
+ + };
110
+ +
111
+ + // To collect all duplicates, get subslices where all of the elements of the subslice
112
+ + // are equal, then filter out all those whose length is not 1. We could return warnings
113
+ + // for each of them, but that's annoyingly excessive. So we instead collect all spans in
114
+ + // one big Vec.
115
+ + let spans: Vec<Span> = sorted_reprs
116
+ + .chunk_by(|(a, _), (b, _)| a == b)
117
+ + .map(ToOwned::to_owned)
118
+ + .filter(|slice| slice.len() != 1)
119
+ + .flatten()
120
+ + .map(|(_, span)| span)
121
+ + .collect();
122
+ +
123
+ + if !spans.is_empty() {
124
+ + self.tcx.emit_node_span_lint(
125
+ + REPEATED_REPRS,
126
+ + hir_id,
127
+ + spans,
128
+ + diagnostics::RepeatedRepr,
129
+ + );
130
+ + }
131
+ + }
132
+ +
133
+ // Just point at all repr hints if there are any incompatibilities.
134
+ // This is not ideal, but tracking precisely which ones are at fault is a huge hassle.
135
+ let hint_spans = reprs.iter().map(|(_, span)| *span);
136
+ @@ -1306,17 +1300,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
137
+ self.tcx.emit_node_span_lint(
138
+ CONFLICTING_REPR_HINTS,
139
+ hir_id,
140
+ - hint_spans.clone().collect::<Vec<Span>>(),
141
+ - diagnostics::ReprConflictingLint,
142
+ - );
143
+ - }
144
+ -
145
+ - if repeated_repr {
146
+ - self.tcx.emit_node_span_lint(
147
+ - REPEATED_REPRS,
148
+ - hir_id,
149
+ hint_spans.collect::<Vec<Span>>(),
150
+ - diagnostics::RepeatedRepr,
151
+ + diagnostics::ReprConflictingLint,
152
+ );
153
+ }
154
+ }
155
+ diff --git a/compiler/rustc_passes/src/diagnostics.rs b/compiler/rustc_passes/src/diagnostics.rs
156
+ index 2f4900a6b47a7f9fab09272d1f00e63c83aea784..c343d9c7078e7f9dd4f05e16200c587e67e519ba 100644
157
+ --- a/compiler/rustc_passes/src/diagnostics.rs
158
+ +++ b/compiler/rustc_passes/src/diagnostics.rs
159
+ @@ -608,7 +608,7 @@ pub(crate) struct TransparentIncompatible {
160
+ }
161
+
162
+ #[derive(Diagnostic)]
163
+ -#[diag("representation attribute is specified more than once")]
164
+ +#[diag("`#[repr(..)]` attribute is specified more than once")]
165
+ #[note("for consistency, only specify the representation once")]
166
+ pub(crate) struct RepeatedRepr;
167
+
168
+ diff --git a/tests/ui/attributes/issue-100631.rs b/tests/ui/attributes/issue-100631.rs
169
+ index d496231c730263d049edd9f92427c9fba9b9270b..9a30691a39ec38723ec803c8dcfe4dff4fb0e043 100644
170
+ --- a/tests/ui/attributes/issue-100631.rs
171
+ +++ b/tests/ui/attributes/issue-100631.rs
172
+ @@ -2,7 +2,7 @@
173
+ // can reasonably deal with multiple attributes.
174
+ // `repr` will use `TyCtxt::get_attrs` since it's `DuplicatesOk`.
175
+ #[repr(C)] //~ ERROR: unsupported representation for zero-variant enum [E0084]
176
+ -//~^ WARN representation attribute is specified more than once
177
+ +//~^ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
178
+ #[repr(C)]
179
+ enum Foo {}
180
+
181
+ diff --git a/tests/ui/attributes/issue-100631.stderr b/tests/ui/attributes/issue-100631.stderr
182
+ index 66e08738eb02c24dca94beab59ba9114006dedd9..0ecc19ae85b3d9d8851ddef81a0ec6da492983e4 100644
183
+ --- a/tests/ui/attributes/issue-100631.stderr
184
+ +++ b/tests/ui/attributes/issue-100631.stderr
185
+ @@ -1,4 +1,4 @@
186
+ -warning: representation attribute is specified more than once
187
+ +warning: `#[repr(..)]` attribute is specified more than once
188
+ --> $DIR/issue-100631.rs:4:8
189
+ |
190
+ LL | #[repr(C)]
191
+ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs
192
+ index 348c9590e8b27be1ab5e99cb24d90b724e4371d6..c013041ed4159192965aee2df1ce33862ba01b26 100644
193
+ --- a/tests/ui/lint/unused/unused-attr-duplicate.rs
194
+ +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs
195
+ @@ -64,7 +64,7 @@ fn t1() {}
196
+ #[must_use = "some message"]
197
+ //~^ ERROR unused attribute
198
+ //~| WARN this was previously accepted
199
+ -#[repr(C)] //~ WARN representation attribute is specified more than once
200
+ +#[repr(C)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
201
+ #[repr(C)]
202
+ #[non_exhaustive]
203
+ #[non_exhaustive] //~ ERROR unused attribute
204
+ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr
205
+ index 93f7a4791188f2c9138f737b8a58e7e6d4a3471d..6e4f7d23604c29224329ba678d8a5ffb514e2d01 100644
206
+ --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr
207
+ +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr
208
+ @@ -16,7 +16,7 @@ note: the lint level is defined here
209
+ LL | #![deny(unused_attributes)]
210
+ | ^^^^^^^^^^^^^^^^^
211
+
212
+ -warning: representation attribute is specified more than once
213
+ +warning: `#[repr(..)]` attribute is specified more than once
214
+ --> $DIR/unused-attr-duplicate.rs:67:8
215
+ |
216
+ LL | #[repr(C)]
217
+ @@ -264,19 +264,6 @@ note: attribute also specified here
218
+ LL | #[track_caller]
219
+ | ^^^^^^^^^^^^^^^
220
+
221
+ -error: unused attribute
222
+ - --> $DIR/unused-attr-duplicate.rs:93:5
223
+ - |
224
+ -LL | #[link_name = "rust_dbg_extern_identity_u32"]
225
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
226
+ - |
227
+ -note: attribute also specified here
228
+ - --> $DIR/unused-attr-duplicate.rs:92:5
229
+ - |
230
+ -LL | #[link_name = "this_does_not_exist"]
231
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
232
+ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
233
+ -
234
+ error: unused attribute
235
+ --> $DIR/unused-attr-duplicate.rs:99:1
236
+ |
237
+ @@ -328,13 +315,13 @@ LL | #[link_section = "__TEXT,__text"]
238
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
239
+
240
+ error: unused attribute
241
+ - --> $DIR/unused-attr-duplicate.rs:94:5
242
+ + --> $DIR/unused-attr-duplicate.rs:93:5
243
+ |
244
+ LL | #[link_name = "rust_dbg_extern_identity_u32"]
245
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
246
+ |
247
+ note: attribute also specified here
248
+ - --> $DIR/unused-attr-duplicate.rs:93:5
249
+ + --> $DIR/unused-attr-duplicate.rs:92:5
250
+ |
251
+ LL | #[link_name = "this_does_not_exist"]
252
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
253
+ diff --git a/tests/ui/repr/conflicting-repr-hints.rs b/tests/ui/repr/conflicting-repr-hints.rs
254
+ index 032f2b2e6c6083abe234780cd8a434f8e6e0cb75..81a94aad78ff664db86444b89d0ce97815494c0a 100644
255
+ --- a/tests/ui/repr/conflicting-repr-hints.rs
256
+ +++ b/tests/ui/repr/conflicting-repr-hints.rs
257
+ @@ -36,10 +36,10 @@ struct G(i32); //~ ERROR type has conflicting packed and align representation hi
258
+ #[repr(packed)]
259
+ struct H(i32); //~ ERROR type has conflicting packed and align representation hints
260
+
261
+ -#[repr(packed, packed(2))] //~ WARN representation attribute is specified more than once
262
+ +#[repr(packed, packed(2))]
263
+ struct I(i32); //~ ERROR type has conflicting packed representation hints
264
+
265
+ -#[repr(packed(2))] //~ WARN representation attribute is specified more than once
266
+ +#[repr(packed(2))]
267
+ #[repr(packed)]
268
+ struct J(i32); //~ ERROR type has conflicting packed representation hints
269
+
270
+ diff --git a/tests/ui/repr/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr
271
+ index a99546b75478578638f4b83418858cf8ae6abca5..8f2655fd716f186b5918e9d8e19250d2e4ac27fd 100644
272
+ --- a/tests/ui/repr/conflicting-repr-hints.stderr
273
+ +++ b/tests/ui/repr/conflicting-repr-hints.stderr
274
+ @@ -17,32 +17,14 @@ LL | #[repr(u32, u64)]
275
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
276
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
277
+
278
+ -warning: representation attribute is specified more than once
279
+ - --> $DIR/conflicting-repr-hints.rs:39:8
280
+ - |
281
+ -LL | #[repr(packed, packed(2))]
282
+ - | ^^^^^^ ^^^^^^^^^
283
+ - |
284
+ - = note: for consistency, only specify the representation once
285
+ - = note: `#[warn(repeated_reprs)]` on by default
286
+ -
287
+ -warning: representation attribute is specified more than once
288
+ - --> $DIR/conflicting-repr-hints.rs:42:8
289
+ - |
290
+ -LL | #[repr(packed(2))]
291
+ - | ^^^^^^^^^
292
+ -LL | #[repr(packed)]
293
+ - | ^^^^^^
294
+ - |
295
+ - = note: for consistency, only specify the representation once
296
+ -
297
+ -warning: representation attribute is specified more than once
298
+ +warning: `#[repr(..)]` attribute is specified more than once
299
+ --> $DIR/conflicting-repr-hints.rs:46:8
300
+ |
301
+ LL | #[repr(packed, packed(1))]
302
+ | ^^^^^^ ^^^^^^^^^
303
+ |
304
+ = note: for consistency, only specify the representation once
305
+ + = note: `#[warn(repeated_reprs)]` on by default
306
+
307
+ error[E0587]: type has conflicting packed and align representation hints
308
+ --> $DIR/conflicting-repr-hints.rs:29:1
309
+ @@ -104,7 +86,7 @@ error[E0587]: type has conflicting packed and align representation hints
310
+ LL | pub union U {
311
+ | ^^^^^^^^^^^
312
+
313
+ -error: aborting due to 12 previous errors; 3 warnings emitted
314
+ +error: aborting due to 12 previous errors; 1 warning emitted
315
+
316
+ Some errors have detailed explanations: E0566, E0587, E0634.
317
+ For more information about an error, try `rustc --explain E0566`.
318
+ diff --git a/tests/ui/repr/repr-repeated-attrs.rs b/tests/ui/repr/repr-repeated-attrs.rs
319
+ index 61e3ba05625d8dad51b0856ef0d66890e23026bb..7306b9192f09eb79deb39a8a9c4bc6b886591106 100644
320
+ --- a/tests/ui/repr/repr-repeated-attrs.rs
321
+ +++ b/tests/ui/repr/repr-repeated-attrs.rs
322
+ @@ -1,32 +1,32 @@
323
+ // Tests to ensure we warn on repeated `#[repr(..)]` attributes.
324
+
325
+ -#[repr(transparent, transparent)]
326
+ +#[repr(transparent, transparent)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
327
+ //~^ ERROR transparent struct cannot have other repr hints
328
+ #[repr(transparent)]
329
+ struct SeveralTransparentReprs(*mut u8);
330
+
331
+ -#[repr(transparent)]
332
+ +#[repr(transparent)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
333
+ //~^ ERROR transparent struct cannot have other repr hints
334
+ #[repr(transparent)]
335
+ struct MultilineOnly(*mut u8);
336
+
337
+ #[repr(Rust, Rust)]
338
+ -//~^ WARN representation attribute is specified more than once
339
+ +//~^ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
340
+ struct SeveralRustReprs(u8);
341
+
342
+ #[repr(C, C)]
343
+ -//~^ WARN representation attribute is specified more than once
344
+ +//~^ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
345
+ #[repr(C, C, C)]
346
+ struct SeveralC(u8);
347
+
348
+ -#[repr(u8, u8)] //~ WARN representation attribute is specified more than once
349
+ +#[repr(u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
350
+ //~^ ERROR conflicting representation hints
351
+ //~| WARN this was previously accepted
352
+ enum SeveralPrimitiveRerprs {
353
+ Variant,
354
+ }
355
+
356
+ -#[repr(C, C, u8)] //~ WARN representation attribute is specified more than once
357
+ +#[repr(C, C, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
358
+ //~^ ERROR conflicting representation hints
359
+ //~| WARN this was previously accepted
360
+ #[repr(C, u8, u8)]
361
+ @@ -34,7 +34,7 @@ enum SeveralCAndPrims {
362
+ Variant(u8),
363
+ }
364
+
365
+ -#[repr(Rust, u8, u8)] //~ WARN representation attribute is specified more than once
366
+ +#[repr(Rust, u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
367
+ //~^ ERROR conflicting representation hints
368
+ //~^^ ERROR conflicting representation hints
369
+ //~| WARN this was previously accepted
370
+ @@ -42,7 +42,7 @@ enum RustAndPrimDisallowed {
371
+ Variant(u8),
372
+ }
373
+
374
+ -#[repr(u8, u8)] //~ WARN representation attribute is specified more than once
375
+ +#[repr(u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
376
+ //~^ ERROR conflicting representation hints
377
+ //~| WARN this was previously accepted
378
+ #[repr(u16)]
379
+ @@ -58,7 +58,7 @@ enum CWithIntsCausesFCW1 {
380
+ B,
381
+ }
382
+
383
+ -#[repr(C, C, u8, u8, u8)] //~ WARN representation attribute is specified more than once
384
+ +#[repr(C, C, u8, u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
385
+ //~^ ERROR conflicting representation hints
386
+ //~| WARN this was previously accepted
387
+ enum CWithIntsCausesFCW2 {
388
+ diff --git a/tests/ui/repr/repr-repeated-attrs.stderr b/tests/ui/repr/repr-repeated-attrs.stderr
389
+ index 57af8ec804d76d672cb87f068efef3c13ec7f68a..a0b8b1d7da3cc58d1eae30809f115711a2b65948 100644
390
+ --- a/tests/ui/repr/repr-repeated-attrs.stderr
391
+ +++ b/tests/ui/repr/repr-repeated-attrs.stderr
392
+ @@ -1,3 +1,15 @@
393
+ +warning: `#[repr(..)]` attribute is specified more than once
394
+ + --> $DIR/repr-repeated-attrs.rs:3:8
395
+ + |
396
+ +LL | #[repr(transparent, transparent)]
397
+ + | ^^^^^^^^^^^ ^^^^^^^^^^^
398
+ +LL |
399
+ +LL | #[repr(transparent)]
400
+ + | ^^^^^^^^^^^
401
+ + |
402
+ + = note: for consistency, only specify the representation once
403
+ + = note: `#[warn(repeated_reprs)]` on by default
404
+ +
405
+ error[E0692]: transparent struct cannot have other repr hints
406
+ --> $DIR/repr-repeated-attrs.rs:3:8
407
+ |
408
+ @@ -7,6 +19,17 @@ LL |
409
+ LL | #[repr(transparent)]
410
+ | ^^^^^^^^^^^
411
+
412
+ +warning: `#[repr(..)]` attribute is specified more than once
413
+ + --> $DIR/repr-repeated-attrs.rs:8:8
414
+ + |
415
+ +LL | #[repr(transparent)]
416
+ + | ^^^^^^^^^^^
417
+ +LL |
418
+ +LL | #[repr(transparent)]
419
+ + | ^^^^^^^^^^^
420
+ + |
421
+ + = note: for consistency, only specify the representation once
422
+ +
423
+ error[E0692]: transparent struct cannot have other repr hints
424
+ --> $DIR/repr-repeated-attrs.rs:8:8
425
+ |
426
+ @@ -16,16 +39,15 @@ LL |
427
+ LL | #[repr(transparent)]
428
+ | ^^^^^^^^^^^
429
+
430
+ -warning: representation attribute is specified more than once
431
+ +warning: `#[repr(..)]` attribute is specified more than once
432
+ --> $DIR/repr-repeated-attrs.rs:13:8
433
+ |
434
+ LL | #[repr(Rust, Rust)]
435
+ | ^^^^ ^^^^
436
+ |
437
+ = note: for consistency, only specify the representation once
438
+ - = note: `#[warn(repeated_reprs)]` on by default
439
+
440
+ -warning: representation attribute is specified more than once
441
+ +warning: `#[repr(..)]` attribute is specified more than once
442
+ --> $DIR/repr-repeated-attrs.rs:17:8
443
+ |
444
+ LL | #[repr(C, C)]
445
+ @@ -36,25 +58,25 @@ LL | #[repr(C, C, C)]
446
+ |
447
+ = note: for consistency, only specify the representation once
448
+
449
+ -error[E0566]: conflicting representation hints
450
+ +warning: `#[repr(..)]` attribute is specified more than once
451
+ --> $DIR/repr-repeated-attrs.rs:22:8
452
+ |
453
+ LL | #[repr(u8, u8)]
454
+ | ^^ ^^
455
+ |
456
+ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
457
+ - = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
458
+ - = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
459
+ + = note: for consistency, only specify the representation once
460
+
461
+ -warning: representation attribute is specified more than once
462
+ +error[E0566]: conflicting representation hints
463
+ --> $DIR/repr-repeated-attrs.rs:22:8
464
+ |
465
+ LL | #[repr(u8, u8)]
466
+ | ^^ ^^
467
+ |
468
+ - = note: for consistency, only specify the representation once
469
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
470
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
471
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
472
+
473
+ -error[E0566]: conflicting representation hints
474
+ +warning: `#[repr(..)]` attribute is specified more than once
475
+ --> $DIR/repr-repeated-attrs.rs:29:8
476
+ |
477
+ LL | #[repr(C, C, u8)]
478
+ @@ -63,10 +85,9 @@ LL | #[repr(C, C, u8)]
479
+ LL | #[repr(C, u8, u8)]
480
+ | ^ ^^ ^^
481
+ |
482
+ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
483
+ - = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
484
+ + = note: for consistency, only specify the representation once
485
+
486
+ -warning: representation attribute is specified more than once
487
+ +error[E0566]: conflicting representation hints
488
+ --> $DIR/repr-repeated-attrs.rs:29:8
489
+ |
490
+ LL | #[repr(C, C, u8)]
491
+ @@ -75,6 +96,15 @@ LL | #[repr(C, C, u8)]
492
+ LL | #[repr(C, u8, u8)]
493
+ | ^ ^^ ^^
494
+ |
495
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
496
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
497
+ +
498
+ +warning: `#[repr(..)]` attribute is specified more than once
499
+ + --> $DIR/repr-repeated-attrs.rs:37:14
500
+ + |
501
+ +LL | #[repr(Rust, u8, u8)]
502
+ + | ^^ ^^
503
+ + |
504
+ = note: for consistency, only specify the representation once
505
+
506
+ error[E0566]: conflicting representation hints
507
+ @@ -92,11 +122,11 @@ LL | #[repr(Rust, u8, u8)]
508
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
509
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
510
+
511
+ -warning: representation attribute is specified more than once
512
+ - --> $DIR/repr-repeated-attrs.rs:37:8
513
+ +warning: `#[repr(..)]` attribute is specified more than once
514
+ + --> $DIR/repr-repeated-attrs.rs:45:8
515
+ |
516
+ -LL | #[repr(Rust, u8, u8)]
517
+ - | ^^^^ ^^ ^^
518
+ +LL | #[repr(u8, u8)]
519
+ + | ^^ ^^
520
+ |
521
+ = note: for consistency, only specify the representation once
522
+
523
+ @@ -112,17 +142,6 @@ LL | #[repr(u16)]
524
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
525
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
526
+
527
+ -warning: representation attribute is specified more than once
528
+ - --> $DIR/repr-repeated-attrs.rs:45:8
529
+ - |
530
+ -LL | #[repr(u8, u8)]
531
+ - | ^^ ^^
532
+ -...
533
+ -LL | #[repr(u16)]
534
+ - | ^^^
535
+ - |
536
+ - = note: for consistency, only specify the representation once
537
+ -
538
+ error[E0566]: conflicting representation hints
539
+ --> $DIR/repr-repeated-attrs.rs:53:8
540
+ |
541
+ @@ -132,24 +151,24 @@ LL | #[repr(C, u8)]
542
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
543
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
544
+
545
+ -error[E0566]: conflicting representation hints
546
+ +warning: `#[repr(..)]` attribute is specified more than once
547
+ --> $DIR/repr-repeated-attrs.rs:61:8
548
+ |
549
+ LL | #[repr(C, C, u8, u8, u8)]
550
+ | ^ ^ ^^ ^^ ^^
551
+ |
552
+ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
553
+ - = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
554
+ + = note: for consistency, only specify the representation once
555
+
556
+ -warning: representation attribute is specified more than once
557
+ +error[E0566]: conflicting representation hints
558
+ --> $DIR/repr-repeated-attrs.rs:61:8
559
+ |
560
+ LL | #[repr(C, C, u8, u8, u8)]
561
+ | ^ ^ ^^ ^^ ^^
562
+ |
563
+ - = note: for consistency, only specify the representation once
564
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
565
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
566
+
567
+ -error: aborting due to 9 previous errors; 7 warnings emitted
568
+ +error: aborting due to 9 previous errors; 9 warnings emitted
569
+
570
+ Some errors have detailed explanations: E0566, E0692.
571
+ For more information about an error, try `rustc --explain E0566`.
572
+ diff --git a/tests/ui/structs-enums/align-enum.rs b/tests/ui/structs-enums/align-enum.rs
573
+ index a635af7352afef14867f6dee2991d1e7e433da37..ff80a19211cdaf69b7c6b179ec9aaeb01faa7da6 100644
574
+ --- a/tests/ui/structs-enums/align-enum.rs
575
+ +++ b/tests/ui/structs-enums/align-enum.rs
576
+ @@ -11,7 +11,7 @@ enum Align16 {
577
+ }
578
+
579
+ // Raise alignment by maximum
580
+ -#[repr(align(1), align(16))] //~ WARN representation attribute is specified more than once
581
+ +#[repr(align(1), align(16))]
582
+ #[repr(align(32))]
583
+ #[repr(align(4))]
584
+ enum Align32 {
585
+ diff --git a/tests/ui/structs-enums/align-enum.stderr b/tests/ui/structs-enums/align-enum.stderr
586
+ deleted file mode 100644
587
+ index 9b8c9842f81dfcee9e39c1adf163705a38f6cba9..0000000000000000000000000000000000000000
588
+ --- a/tests/ui/structs-enums/align-enum.stderr
589
+ +++ /dev/null
590
+ @@ -1,15 +0,0 @@
591
+ -warning: representation attribute is specified more than once
592
+ - --> $DIR/align-enum.rs:14:8
593
+ - |
594
+ -LL | #[repr(align(1), align(16))]
595
+ - | ^^^^^^^^ ^^^^^^^^^
596
+ -LL | #[repr(align(32))]
597
+ - | ^^^^^^^^^
598
+ -LL | #[repr(align(4))]
599
+ - | ^^^^^^^^
600
+ - |
601
+ - = note: for consistency, only specify the representation once
602
+ - = note: `#[warn(repeated_reprs)]` on by default
603
+ -
604
+ -warning: 1 warning emitted
605
+ -
606
+ diff --git a/tests/ui/structs-enums/align-struct.rs b/tests/ui/structs-enums/align-struct.rs
607
+ index 2d1ebf6731a626209afbe0cc30632e41c0e9d84a..3d8dad6e324e31113587297ef09f5a50050e918d 100644
608
+ --- a/tests/ui/structs-enums/align-struct.rs
609
+ +++ b/tests/ui/structs-enums/align-struct.rs
610
+ @@ -13,7 +13,7 @@ struct Align16(i32);
611
+ struct Align1(i32);
612
+
613
+ // Multiple attributes take the max
614
+ -#[repr(align(4))] //~ WARN representation attribute is specified more than once
615
+ +#[repr(align(4))]
616
+ #[repr(align(16))]
617
+ #[repr(align(8))]
618
+ struct AlignMany(i32);
619
+ diff --git a/tests/ui/structs-enums/align-struct.stderr b/tests/ui/structs-enums/align-struct.stderr
620
+ deleted file mode 100644
621
+ index f54e9cd14cd8bd22de5600fa23ccf02a94153c41..0000000000000000000000000000000000000000
622
+ --- a/tests/ui/structs-enums/align-struct.stderr
623
+ +++ /dev/null
624
+ @@ -1,15 +0,0 @@
625
+ -warning: representation attribute is specified more than once
626
+ - --> $DIR/align-struct.rs:16:8
627
+ - |
628
+ -LL | #[repr(align(4))]
629
+ - | ^^^^^^^^
630
+ -LL | #[repr(align(16))]
631
+ - | ^^^^^^^^^
632
+ -LL | #[repr(align(8))]
633
+ - | ^^^^^^^^
634
+ - |
635
+ - = note: for consistency, only specify the representation once
636
+ - = note: `#[warn(repeated_reprs)]` on by default
637
+ -
638
+ -warning: 1 warning emitted
639
+ -
patches/20261028T105419Z/rust-lang--rust-part011/8432202b58569eb29b4ca2750eb7eefea94c0f04.patch ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs
2
+ index f6930e0a60d429f37c5c63583ecd5a85397eeb2a..f59219c09dc286e952fc4f360d17fe73f847e3fc 100644
3
+ --- a/library/core/src/char/methods.rs
4
+ +++ b/library/core/src/char/methods.rs
5
+ @@ -1,5 +1,7 @@
6
+ //! impl char {}
7
+
8
+ +#![expect(clippy::manual_is_ascii_check, reason = "this module implements various is_ascii checks")]
9
+ +
10
+ use super::*;
11
+ use crate::panic::const_panic;
12
+ use crate::slice;
13
+ diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
14
+ index 3fe7b95283446b0ae82db3f7eb6f22d694d18d91..59e470800dbd39e89ec91414addc9d7ab9e91612 100644
15
+ --- a/library/core/src/num/mod.rs
16
+ +++ b/library/core/src/num/mod.rs
17
+ @@ -1,6 +1,7 @@
18
+ //! Numeric traits and functions for the built-in numeric types.
19
+
20
+ #![stable(feature = "rust1", since = "1.0.0")]
21
+ +#![expect(clippy::manual_is_ascii_check, reason = "this module implements various is_ascii checks")]
22
+
23
+ use crate::convert::{BoundedCastFromInt, CheckedCastFromInt};
24
+ use crate::panic::const_panic;
patches/20261028T105419Z/rust-lang--rust-part011/844b744a9962206de8c877d881a0a4edfe24b5bd.patch ADDED
@@ -0,0 +1,1066 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_attr_ir/src/data_structures.rs b/compiler/rustc_attr_ir/src/data_structures.rs
2
+ index 195712559782ddd3686569b16f64493272da80cb..e6baaf28fbc6dd12029b72ffea82e8dc4ea58057 100644
3
+ --- a/compiler/rustc_attr_ir/src/data_structures.rs
4
+ +++ b/compiler/rustc_attr_ir/src/data_structures.rs
5
+ @@ -1422,9 +1422,6 @@ pub enum AttributeKind {
6
+ /// Represents `#[rustc_regions]`
7
+ RustcRegions,
8
+
9
+ - /// Represents `#[rustc_reservation_impl]`
10
+ - RustcReservationImpl(Symbol),
11
+ -
12
+ /// Represents `#[rustc_scalable_vector(N)]`
13
+ RustcScalableVector {
14
+ /// The base multiple of lanes that are in a scalable vector, if provided. `element_count`
15
+ diff --git a/compiler/rustc_attr_ir/src/encode_cross_crate.rs b/compiler/rustc_attr_ir/src/encode_cross_crate.rs
16
+ index 637fbaeabdc669011b47e9e43e23cda1266828c0..164ab3c5822d058e265ccbba6746d280aea65597 100644
17
+ --- a/compiler/rustc_attr_ir/src/encode_cross_crate.rs
18
+ +++ b/compiler/rustc_attr_ir/src/encode_cross_crate.rs
19
+ @@ -185,7 +185,6 @@ impl AttributeKind {
20
+ RustcPubTransparent(..) => Yes,
21
+ RustcReallocator => No,
22
+ RustcRegions => No,
23
+ - RustcReservationImpl(..) => Yes,
24
+ RustcScalableVector { .. } => Yes,
25
+ RustcShouldNotBeCalledOnConstItems => Yes,
26
+ RustcSimdMonomorphizeLaneLimit(..) => Yes, // Affects layout computation, which needs to work cross-crate
27
+ diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
28
+ index f1860acc4c05a626776544bfe3d2040746147cf2..3620847a19301fdf6a71d6659cf2dba22ce1977a 100644
29
+ --- a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
30
+ +++ b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
31
+ @@ -1122,23 +1122,6 @@ impl NoArgsAttributeParser for RustcStrictCoherenceParser {
32
+ const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcStrictCoherence;
33
+ }
34
+
35
+ -pub(crate) struct RustcReservationImplParser;
36
+ -
37
+ -impl SingleAttributeParser for RustcReservationImplParser {
38
+ - const PATH: &[Symbol] = &[sym::rustc_reservation_impl];
39
+ - const ALLOWED_TARGETS: AllowedTargets<'_> =
40
+ - AllowedTargets::AllowList(&[Allow(Target::Impl { of_trait: true })]);
41
+ - const TEMPLATE: AttributeTemplate = template!(NameValueStr: "reservation message");
42
+ - const STABILITY: AttributeStability = unstable!(rustc_attrs);
43
+ -
44
+ - fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
45
+ - let nv = cx.expect_name_value(args, cx.attr_span, None)?;
46
+ - let value_str = cx.expect_string_literal(nv)?;
47
+ -
48
+ - Some(AttributeKind::RustcReservationImpl(value_str))
49
+ - }
50
+ -}
51
+ -
52
+ pub(crate) struct PreludeImportParser;
53
+
54
+ impl NoArgsAttributeParser for PreludeImportParser {
55
+ diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs
56
+ index 5783f17028029b2610db04429c373bdac3a3bda4..7fe799a027c542db51a06eecde99fea204502924 100644
57
+ --- a/compiler/rustc_attr_parsing/src/context.rs
58
+ +++ b/compiler/rustc_attr_parsing/src/context.rs
59
+ @@ -249,7 +249,6 @@ attribute_parsers!(
60
+ Single<RustcNeverTypeOptionsParser>,
61
+ Single<RustcObjcClassParser>,
62
+ Single<RustcObjcSelectorParser>,
63
+ - Single<RustcReservationImplParser>,
64
+ Single<RustcScalableVectorParser>,
65
+ Single<RustcSimdMonomorphizeLaneLimitParser>,
66
+ Single<RustcSkipDuringMethodDispatchParser>,
67
+ diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
68
+ index fd68af02de6105ffae992a5215f2f2fb6ad36fbf..85a7c5aca0970ff80b3567c7e5a6ae7e9e49cf51 100644
69
+ --- a/compiler/rustc_feature/src/builtin_attrs.rs
70
+ +++ b/compiler/rustc_feature/src/builtin_attrs.rs
71
+ @@ -364,7 +364,6 @@ pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[
72
+ sym::prelude_import,
73
+ sym::rustc_paren_sugar,
74
+ sym::rustc_inherit_overflow_checks,
75
+ - sym::rustc_reservation_impl,
76
+ sym::rustc_test_entrypoint_marker,
77
+ sym::rustc_test_marker,
78
+ sym::rustc_allow_lifetime_dependent_specialization,
79
+ diff --git a/compiler/rustc_hir_analysis/src/check/always_applicable.rs b/compiler/rustc_hir_analysis/src/check/always_applicable.rs
80
+ index 6a30ff40eedc697214d30bad35dbbd1e4344b84d..60636a11649268dceaf712ea10dbf08b428a7a5a 100644
81
+ --- a/compiler/rustc_hir_analysis/src/check/always_applicable.rs
82
+ +++ b/compiler/rustc_hir_analysis/src/check/always_applicable.rs
83
+ @@ -43,12 +43,7 @@ pub(crate) fn check_drop_impl(
84
+ match tcx.impl_polarity(drop_impl_did) {
85
+ ty::ImplPolarity::Positive => {}
86
+ ty::ImplPolarity::Negative => {
87
+ - return Err(tcx.dcx().emit_err(diagnostics::DropImplPolarity::Negative {
88
+ - span: tcx.def_span(drop_impl_did),
89
+ - }));
90
+ - }
91
+ - ty::ImplPolarity::Reservation => {
92
+ - return Err(tcx.dcx().emit_err(diagnostics::DropImplPolarity::Reservation {
93
+ + return Err(tcx.dcx().emit_err(diagnostics::NegativeDropImplPolarity {
94
+ span: tcx.def_span(drop_impl_did),
95
+ }));
96
+ }
97
+ @@ -153,7 +148,7 @@ fn ensure_impl_params_and_item_params_correspond<'tcx>(
98
+ let item_span = tcx.def_span(adt_def_id);
99
+ let self_descr = tcx.def_descr(adt_def_id);
100
+ let polarity = match tcx.impl_polarity(impl_def_id) {
101
+ - ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => "",
102
+ + ty::ImplPolarity::Positive => "",
103
+ ty::ImplPolarity::Negative => "!",
104
+ };
105
+ let trait_name = tcx.item_name(tcx.impl_trait_id(impl_def_id.to_def_id()));
106
+ @@ -265,7 +260,7 @@ fn ensure_impl_predicates_are_implied_by_item_defn<'tcx>(
107
+ let impl_span = tcx.def_span(impl_def_id.to_def_id());
108
+ let trait_name = tcx.item_name(tcx.impl_trait_id(impl_def_id.to_def_id()));
109
+ let polarity = match tcx.impl_polarity(impl_def_id) {
110
+ - ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => "",
111
+ + ty::ImplPolarity::Positive => "",
112
+ ty::ImplPolarity::Negative => "!",
113
+ };
114
+ // Take the param-env of the adt and instantiate the args that show up in
115
+ diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
116
+ index 614d5517ba1f69c93ae767e99fb62ca90422f673..1895f586df2f09118deec451e645d9b6d518fa0d 100644
117
+ --- a/compiler/rustc_hir_analysis/src/check/check.rs
118
+ +++ b/compiler/rustc_hir_analysis/src/check/check.rs
119
+ @@ -1296,7 +1296,7 @@ fn check_impl_items_against_trait<'tcx>(
120
+
121
+ // Negative impls are not expected to have any items
122
+ match impl_trait_header.polarity {
123
+ - ty::ImplPolarity::Reservation | ty::ImplPolarity::Positive => {}
124
+ + ty::ImplPolarity::Positive => {}
125
+ ty::ImplPolarity::Negative => {
126
+ if let [first_item_ref, ..] = *impl_item_refs {
127
+ let first_item_span = tcx.def_span(first_item_ref);
128
+ diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
129
+ index c9324858543988f0d6b3c4ac9c36eed8e9569b16..f2dec4c7db89f8ee45dc6a7908388786c9b45acc 100644
130
+ --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
131
+ +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
132
+ @@ -317,9 +317,6 @@ pub(super) fn check_item<'tcx>(
133
+ .emit());
134
+ }
135
+ }
136
+ - ty::ImplPolarity::Reservation => {
137
+ - // FIXME: what amount of WF checking do we need for reservation impls?
138
+ - }
139
+ }
140
+ } else {
141
+ res = res.and(check_impl(tcx, item, impl_));
142
+ @@ -1310,9 +1307,6 @@ fn check_impl<'tcx>(
143
+ enter_wf_checking_ctxt(tcx, item.owner_id.def_id, |wfcx| {
144
+ match impl_.of_trait {
145
+ Some(of_trait) => {
146
+ - // `#[rustc_reservation_impl]` impls are not real impls and
147
+ - // therefore don't need to be WF (the trait's `Self: Trait` predicate
148
+ - // won't hold).
149
+ let trait_ref = tcx.impl_trait_ref(item.owner_id).instantiate_identity();
150
+ // Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in
151
+ // case other `Foo` impls are incoherent.
152
+ diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
153
+ index 06d336298a42c31d153290e1ba027042bdd2e206..34a3f155baf43b8ce1ea417932ee6b7a164c9299 100644
154
+ --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs
155
+ +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
156
+ @@ -170,7 +170,7 @@ fn visit_implementation_of_const_param_ty(checker: &Checker<'_>) -> Result<(), E
157
+
158
+ let param_env = tcx.param_env(impl_did);
159
+
160
+ - if let ty::ImplPolarity::Negative | ty::ImplPolarity::Reservation = header.polarity {
161
+ + if let ty::ImplPolarity::Negative = header.polarity {
162
+ return Ok(());
163
+ }
164
+
165
+ diff --git a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs
166
+ index 7fcf8ddceea5cd43b817cb584c1dc50b90de93c5..ce0171a4d2d7dd54e55dc168a89f5aa4752b104b 100644
167
+ --- a/compiler/rustc_hir_analysis/src/coherence/unsafety.rs
168
+ +++ b/compiler/rustc_hir_analysis/src/coherence/unsafety.rs
169
+ @@ -34,7 +34,7 @@ pub(super) fn check_item(
170
+ };
171
+
172
+ match (trait_def_safety, unsafe_attr, trait_header.safety, trait_header.polarity) {
173
+ - (Safety::Safe, None, Safety::Unsafe, Positive | Reservation) => {
174
+ + (Safety::Safe, None, Safety::Unsafe, Positive) => {
175
+ let span = tcx.def_span(def_id);
176
+ return Err(struct_span_code_err!(
177
+ tcx.dcx(),
178
+ @@ -52,7 +52,7 @@ pub(super) fn check_item(
179
+ .emit());
180
+ }
181
+
182
+ - (Safety::Unsafe, _, Safety::Safe, Positive | Reservation) => {
183
+ + (Safety::Unsafe, _, Safety::Safe, Positive) => {
184
+ let span = tcx.def_span(def_id);
185
+ return Err(struct_span_code_err!(
186
+ tcx.dcx(),
187
+ @@ -86,7 +86,7 @@ pub(super) fn check_item(
188
+ .emit());
189
+ }
190
+
191
+ - (Safety::Safe, Some(attr_name), Safety::Safe, Positive | Reservation) => {
192
+ + (Safety::Safe, Some(attr_name), Safety::Safe, Positive) => {
193
+ let span = tcx.def_span(def_id);
194
+ return Err(struct_span_code_err!(
195
+ tcx.dcx(),
196
+ @@ -116,8 +116,8 @@ pub(super) fn check_item(
197
+ Ok(())
198
+ }
199
+ (_, _, Safety::Safe, Negative)
200
+ - | (Safety::Unsafe, _, Safety::Unsafe, Positive | Reservation)
201
+ - | (Safety::Safe, Some(_), Safety::Unsafe, Positive | Reservation)
202
+ + | (Safety::Unsafe, _, Safety::Unsafe, Positive)
203
+ + | (Safety::Safe, Some(_), Safety::Unsafe, Positive)
204
+ | (Safety::Safe, None, Safety::Safe, _) => Ok(()),
205
+ }
206
+ }
207
+ diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
208
+ index 0b58b42461319a030fe6143e10d5ca3a0d1c354d..65fd562a4ebf6d7d0397b4d14a0960f2888189bd 100644
209
+ --- a/compiler/rustc_hir_analysis/src/collect.rs
210
+ +++ b/compiler/rustc_hir_analysis/src/collect.rs
211
+ @@ -1549,7 +1549,6 @@ fn impl_trait_header(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::ImplTraitHeader
212
+ .of_trait
213
+ .unwrap_or_else(|| panic!("expected impl trait, found inherent impl on {def_id:?}"));
214
+ let selfty = tcx.type_of(def_id).instantiate_identity().skip_norm_wip();
215
+ - let is_rustc_reservation = find_attr!(tcx, def_id, RustcReservationImpl(..));
216
+
217
+ check_impl_constness(tcx, impl_.constness, &of_trait.trait_ref);
218
+
219
+ @@ -1558,7 +1557,7 @@ fn impl_trait_header(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::ImplTraitHeader
220
+ ty::ImplTraitHeader {
221
+ trait_ref: ty::EarlyBinder::bind(tcx, trait_ref),
222
+ safety: of_trait.safety,
223
+ - polarity: polarity_of_impl(tcx, of_trait, is_rustc_reservation),
224
+ + polarity: polarity_of_impl(of_trait),
225
+ constness: impl_.constness,
226
+ }
227
+ }
228
+ @@ -1605,26 +1604,10 @@ fn check_impl_constness(
229
+ });
230
+ }
231
+
232
+ -fn polarity_of_impl(
233
+ - tcx: TyCtxt<'_>,
234
+ - of_trait: &hir::TraitImplHeader<'_>,
235
+ - is_rustc_reservation: bool,
236
+ -) -> ty::ImplPolarity {
237
+ +fn polarity_of_impl(of_trait: &hir::TraitImplHeader<'_>) -> ty::ImplPolarity {
238
+ match of_trait.polarity {
239
+ - hir::ImplPolarity::Negative(span) => {
240
+ - if is_rustc_reservation {
241
+ - let span = span.to(of_trait.trait_ref.path.span);
242
+ - tcx.dcx().span_err(span, "reservation impls can't be negative");
243
+ - }
244
+ - ty::ImplPolarity::Negative
245
+ - }
246
+ - hir::ImplPolarity::Positive => {
247
+ - if is_rustc_reservation {
248
+ - ty::ImplPolarity::Reservation
249
+ - } else {
250
+ - ty::ImplPolarity::Positive
251
+ - }
252
+ - }
253
+ + hir::ImplPolarity::Negative(_) => ty::ImplPolarity::Negative,
254
+ + hir::ImplPolarity::Positive => ty::ImplPolarity::Positive,
255
+ }
256
+ }
257
+
258
+ diff --git a/compiler/rustc_hir_analysis/src/diagnostics.rs b/compiler/rustc_hir_analysis/src/diagnostics.rs
259
+ index ef287b737851f6d513882d77f5967f6a07d274b4..a50aefd0160590155f28bdd28fd43e52360dd9d4 100644
260
+ --- a/compiler/rustc_hir_analysis/src/diagnostics.rs
261
+ +++ b/compiler/rustc_hir_analysis/src/diagnostics.rs
262
+ @@ -1081,17 +1081,10 @@ pub(crate) struct StaticSpecialize {
263
+ }
264
+
265
+ #[derive(Diagnostic)]
266
+ -pub(crate) enum DropImplPolarity {
267
+ - #[diag("negative `Drop` impls are not supported")]
268
+ - Negative {
269
+ - #[primary_span]
270
+ - span: Span,
271
+ - },
272
+ - #[diag("reservation `Drop` impls are not supported")]
273
+ - Reservation {
274
+ - #[primary_span]
275
+ - span: Span,
276
+ - },
277
+ +#[diag("negative `Drop` impls are not supported")]
278
+ +pub(crate) struct NegativeDropImplPolarity {
279
+ + #[primary_span]
280
+ + pub span: Span,
281
+ }
282
+
283
+ #[derive(Diagnostic)]
284
+ diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
285
+ index c4b886110595b44e11bf1993ebe20d0d187d812d..19d86ebe7cced86e73a0c9084c8e3e77b52ca3d8 100644
286
+ --- a/compiler/rustc_middle/src/ty/mod.rs
287
+ +++ b/compiler/rustc_middle/src/ty/mod.rs
288
+ @@ -1905,10 +1905,6 @@ impl<'tcx> TyCtxt<'tcx> {
289
+ }
290
+
291
+ match (impl1.polarity, impl2.polarity) {
292
+ - (ImplPolarity::Reservation, _) | (_, ImplPolarity::Reservation) => {
293
+ - // `#[rustc_reservation_impl]` impls don't overlap with anything
294
+ - return Some(ImplOverlapKind::Permitted { marker: false });
295
+ - }
296
+ (ImplPolarity::Positive, ImplPolarity::Negative)
297
+ | (ImplPolarity::Negative, ImplPolarity::Positive) => {
298
+ // `impl AutoTrait for Type` + `impl !AutoTrait for Type`
299
+ diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
300
+ index a93fd853b6216ed22f1be2ed6ff10b8efddf4b6e..6980946f8fbc819fb27a87d6d3db59bf7b01784a 100644
301
+ --- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
302
+ +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
303
+ @@ -219,7 +219,7 @@ where
304
+ goal: Goal<I, Self>,
305
+ goal_trait_ref: ty::TraitRef<I>,
306
+ impl_def_id: I::ImplId,
307
+ - then: impl FnOnce(&mut EvalCtxt<'_, D>, Certainty) -> QueryResultOrRerunNonErased<I>,
308
+ + then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResultOrRerunNonErased<I>,
309
+ ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased>;
310
+
311
+ /// If the predicate contained an error, we want to avoid emitting unnecessary trait
312
+ @@ -553,13 +553,9 @@ where
313
+ let cx = self.cx();
314
+ let goal_trait_ref = goal.predicate.trait_ref(cx);
315
+ cx.for_each_relevant_impl(goal_trait_ref, |impl_def_id| -> Result<_, _> {
316
+ - match G::consider_impl_candidate(
317
+ - self,
318
+ - goal,
319
+ - goal_trait_ref,
320
+ - impl_def_id,
321
+ - |ecx, certainty| ecx.evaluate_added_goals_and_make_canonical_response(certainty),
322
+ - )
323
+ + match G::consider_impl_candidate(self, goal, goal_trait_ref, impl_def_id, |ecx| {
324
+ + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
325
+ + })
326
+ .map_err_to_rerun()?
327
+ {
328
+ Ok(candidate) => candidates.push(candidate),
329
+ @@ -1171,27 +1167,21 @@ where
330
+ if assemble_from.should_assemble_impl_candidates() {
331
+ let cx = self.cx();
332
+ let goal_trait_ref = goal.predicate.trait_ref(cx);
333
+ +
334
+ cx.for_each_blanket_impl(goal.predicate.trait_def_id(cx), |impl_def_id| {
335
+ - match G::consider_impl_candidate(
336
+ - self,
337
+ - goal,
338
+ - goal_trait_ref,
339
+ - impl_def_id,
340
+ - |ecx, certainty| {
341
+ - if ecx.shallow_resolve(self_ty).is_ty_var() {
342
+ - // We force the certainty of impl candidates to be `Maybe`.
343
+ - let certainty = certainty.and(Certainty::AMBIGUOUS);
344
+ - ecx.evaluate_added_goals_and_make_canonical_response(certainty)
345
+ - } else {
346
+ - // We don't want to use impls if they constrain the opaque.
347
+ - //
348
+ - // FIXME(trait-system-refactor-initiative#229): This isn't
349
+ - // perfect yet as it still allows us to incorrectly constrain
350
+ - // other inference variables.
351
+ - Err(NoSolution.into())
352
+ - }
353
+ - },
354
+ - )
355
+ + match G::consider_impl_candidate(self, goal, goal_trait_ref, impl_def_id, |ecx| {
356
+ + if ecx.shallow_resolve(self_ty).is_ty_var() {
357
+ + // We force the certainty of impl candidates to be `Maybe`.
358
+ + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
359
+ + } else {
360
+ + // We don't want to use impls if they constrain the opaque.
361
+ + //
362
+ + // FIXME(trait-system-refactor-initiative#229): This isn't
363
+ + // perfect yet as it still allows us to incorrectly constrain
364
+ + // other inference variables.
365
+ + Err(NoSolution.into())
366
+ + }
367
+ + })
368
+ .map_err_to_rerun()?
369
+ {
370
+ Ok(candidate) => candidates.push(candidate),
371
+ diff --git a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
372
+ index 993ce05330a29243fe21f92a1db48e249c0cbac8..04d1376d20b9f31c6f9b1ebdeb7e3f39967e1d28 100644
373
+ --- a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
374
+ +++ b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
375
+ @@ -138,7 +138,7 @@ where
376
+ goal: Goal<I, Self>,
377
+ goal_trait_ref: ty::TraitRef<I>,
378
+ impl_def_id: I::ImplId,
379
+ - then: impl FnOnce(&mut EvalCtxt<'_, D>, Certainty) -> QueryResultOrRerunNonErased<I>,
380
+ + then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResultOrRerunNonErased<I>,
381
+ ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
382
+ let cx = ecx.cx();
383
+
384
+ @@ -156,17 +156,9 @@ where
385
+ return Err(NoSolution.into());
386
+ }
387
+
388
+ - let impl_polarity = cx.impl_polarity(impl_def_id);
389
+ - let certainty = match impl_polarity {
390
+ + match cx.impl_polarity(impl_def_id) {
391
+ ty::ImplPolarity::Negative => return Err(NoSolution.into()),
392
+ - ty::ImplPolarity::Reservation => {
393
+ - if ecx.typing_mode().is_coherence() {
394
+ - Certainty::AMBIGUOUS
395
+ - } else {
396
+ - return Err(NoSolution.into());
397
+ - }
398
+ - }
399
+ - ty::ImplPolarity::Positive => Certainty::Yes,
400
+ + ty::ImplPolarity::Positive => (),
401
+ };
402
+
403
+ if !cx.impl_is_const(impl_def_id) {
404
+ @@ -200,7 +192,7 @@ where
405
+ });
406
+ ecx.add_goals(GoalSource::ImplWhereBound, const_conditions)?;
407
+
408
+ - then(ecx, certainty)
409
+ + then(ecx)
410
+ })
411
+ }
412
+
413
+ diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs
414
+ index 1d8617812937ffdb2075e345f6844e32811fe044..f5b1df1be3eff72061543781046557d1177aaf1d 100644
415
+ --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs
416
+ +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to.rs
417
+ @@ -255,7 +255,7 @@ where
418
+ goal: Goal<I, NormalizesTo<I>>,
419
+ goal_trait_ref: ty::TraitRef<I>,
420
+ impl_def_id: I::ImplId,
421
+ - then: impl FnOnce(&mut EvalCtxt<'_, D>, Certainty) -> QueryResultOrRerunNonErased<I>,
422
+ + then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResultOrRerunNonErased<I>,
423
+ ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
424
+ let cx = ecx.cx();
425
+
426
+ @@ -278,9 +278,6 @@ where
427
+ let impl_polarity = cx.impl_polarity(impl_def_id);
428
+ match impl_polarity {
429
+ ty::ImplPolarity::Negative => return Err(NoSolution.into()),
430
+ - ty::ImplPolarity::Reservation => {
431
+ - unimplemented!("reservation impl for trait with assoc item: {:?}", goal)
432
+ - }
433
+ ty::ImplPolarity::Positive => {}
434
+ };
435
+
436
+ @@ -390,10 +387,10 @@ where
437
+ // This is not the case here and we only prefer adding an ambiguous
438
+ // nested goal for consistency.
439
+ ecx.add_goal(GoalSource::Misc, goal.with(cx, PredicateKind::Ambiguous))?;
440
+ - return then(ecx, Certainty::Yes);
441
+ + return then(ecx);
442
+ } else {
443
+ ecx.instantiate_normalizes_to_as_rigid(goal)?;
444
+ - return then(ecx, Certainty::Yes);
445
+ + return then(ecx);
446
+ }
447
+ } else {
448
+ return error_response(ecx, cx.delay_bug("missing item"));
449
+ diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
450
+ index 14cb3acad68e0a2ce2425d689c74dda2506c1592..902ad882f212324f72e5d73acad9d352d9829ee9 100644
451
+ --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
452
+ +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
453
+ @@ -62,7 +62,7 @@ where
454
+ goal: Goal<I, TraitClause<I>>,
455
+ goal_trait_ref: TraitRef<I>,
456
+ impl_def_id: I::ImplId,
457
+ - then: impl FnOnce(&mut EvalCtxt<'_, D>, Certainty) -> QueryResultOrRerunNonErased<I>,
458
+ + then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResultOrRerunNonErased<I>,
459
+ ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
460
+ let cx = ecx.cx();
461
+
462
+ @@ -80,37 +80,21 @@ where
463
+ return Err(NoSolution.into());
464
+ }
465
+
466
+ - // An upper bound of the certainty of this goal, used to lower the certainty
467
+ - // of reservation impl to ambiguous during coherence.
468
+ - let impl_polarity = cx.impl_polarity(impl_def_id);
469
+ - let maximal_certainty = match (impl_polarity, goal.predicate.polarity) {
470
+ - // In coherence mode, this is ambiguous. But outside of coherence, it's not a real impl.
471
+ - (ty::ImplPolarity::Reservation, _) => {
472
+ - if ecx.typing_mode().is_coherence() {
473
+ - Certainty::AMBIGUOUS
474
+ - } else {
475
+ - return Err(NoSolution.into());
476
+ - }
477
+ - }
478
+ -
479
+ + match (cx.impl_polarity(impl_def_id), goal.predicate.polarity) {
480
+ // Impl matches polarity
481
+ (ty::ImplPolarity::Positive, ty::ClausePolarity::Positive)
482
+ - | (ty::ImplPolarity::Negative, ty::ClausePolarity::Negative) => {
483
+ - if ecx.typing_mode().is_reflection()
484
+ - && !cx.is_fully_generic_for_reflection(impl_def_id)
485
+ - {
486
+ - return Err(NoSolution.into());
487
+ - } else {
488
+ - Certainty::Yes
489
+ - }
490
+ - }
491
+ + | (ty::ImplPolarity::Negative, ty::ClausePolarity::Negative) => {}
492
+
493
+ // Impl doesn't match polarity
494
+ (ty::ImplPolarity::Positive, ty::ClausePolarity::Negative)
495
+ | (ty::ImplPolarity::Negative, ty::ClausePolarity::Positive) => {
496
+ return Err(NoSolution.into());
497
+ }
498
+ - };
499
+ + }
500
+ +
501
+ + if ecx.typing_mode().is_reflection() && !cx.is_fully_generic_for_reflection(impl_def_id) {
502
+ + return Err(NoSolution.into());
503
+ + }
504
+
505
+ ecx.probe_trait_candidate(CandidateSource::Impl(impl_def_id)).enter(|ecx| {
506
+ let impl_args = ecx.fresh_args_for_item(impl_def_id.into());
507
+ @@ -136,7 +120,7 @@ where
508
+ .map(|pred| goal.with(cx, pred)),
509
+ )?;
510
+
511
+ - then(ecx, maximal_certainty)
512
+ + then(ecx)
513
+ })
514
+ }
515
+
516
+ diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
517
+ index 7f9e4fc553455cffaa4d4a1aecfed8916a4aa90e..a483e3f0fe8c112640b2b665aac6c986e6371050 100644
518
+ --- a/compiler/rustc_passes/src/check_attr.rs
519
+ +++ b/compiler/rustc_passes/src/check_attr.rs
520
+ @@ -391,7 +391,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
521
+ AttributeKind::RustcPubTransparent(..) => (),
522
+ AttributeKind::RustcReallocator => (),
523
+ AttributeKind::RustcRegions => (),
524
+ - AttributeKind::RustcReservationImpl(..) => (),
525
+ AttributeKind::RustcScalableVector { .. } => (),
526
+ AttributeKind::RustcShouldNotBeCalledOnConstItems => (),
527
+ AttributeKind::RustcSimdMonomorphizeLaneLimit(..) => (),
528
+ diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs
529
+ index 9eed22dc15d05f7fb223e6a1140050477a37046f..da5766fba87db4cf11a064b1a8131f1ca2340210 100644
530
+ --- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs
531
+ +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs
532
+ @@ -896,7 +896,6 @@ impl<'tcx> Stable<'tcx> for ty::ImplPolarity {
533
+ match self {
534
+ Positive => crate::ty::ImplPolarity::Positive,
535
+ Negative => crate::ty::ImplPolarity::Negative,
536
+ - Reservation => crate::ty::ImplPolarity::Reservation,
537
+ }
538
+ }
539
+ }
540
+ diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
541
+ index e8333751d1df81851e3fe7aad354756c6247b6f8..6376fe032c64e0212b3c3b8fffd0356683ca284b 100644
542
+ --- a/compiler/rustc_span/src/symbol.rs
543
+ +++ b/compiler/rustc_span/src/symbol.rs
544
+ @@ -1871,7 +1871,6 @@ symbols! {
545
+ rustc_pub_transparent,
546
+ rustc_reallocator,
547
+ rustc_regions,
548
+ - rustc_reservation_impl,
549
+ rustc_scalable_vector,
550
+ rustc_should_not_be_called_on_const_items,
551
+ rustc_simd_monomorphize_lane_limit,
552
+ diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
553
+ index ec854e25a6aa2fa41c1182618c916485beb410ca..24217aaf75fe7b817b0f140505ad8563d1bf3bef 100644
554
+ --- a/compiler/rustc_trait_selection/src/traits/coherence.rs
555
+ +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
556
+ @@ -9,7 +9,6 @@ use std::fmt::Debug;
557
+ use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
558
+ use rustc_errors::{Diag, EmissionGuarantee};
559
+ use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
560
+ -use rustc_hir::find_attr;
561
+ use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, TyCtxtInferExt};
562
+ use rustc_infer::traits::{PredicateObligations, TraitErrors};
563
+ use rustc_macros::{TypeFoldable, TypeVisitable};
564
+ @@ -767,20 +766,6 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> {
565
+ }
566
+
567
+ let mut candidates = goal.candidates();
568
+ - for cand in goal.candidates() {
569
+ - if let inspect::ProbeKind::TraitCandidate {
570
+ - source: CandidateSource::Impl(def_id),
571
+ - result: Ok(_),
572
+ - } = cand.kind()
573
+ - && let ty::ImplPolarity::Reservation = infcx.tcx.impl_polarity(def_id)
574
+ - {
575
+ - if let Some(message) =
576
+ - find_attr!(infcx.tcx, def_id, RustcReservationImpl(message) => *message)
577
+ - {
578
+ - self.causes.insert(IntercrateAmbiguityCause::ReservationImpl { message });
579
+ - }
580
+ - }
581
+ - }
582
+
583
+ // We also look for unknowable candidates. In case a goal is unknowable, there's
584
+ // always exactly 1 candidate.
585
+ diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
586
+ index f936e0bf072798eb3c153de44bcf58704c87366c..118616570661ecc3c9aee695c20601ed45df8d7a 100644
587
+ --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
588
+ +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
589
+ @@ -10,9 +10,9 @@ use std::ops::ControlFlow;
590
+ use hir::def::DefKind;
591
+ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
592
+ use rustc_errors::{Diag, EmissionGuarantee};
593
+ +use rustc_hir as hir;
594
+ use rustc_hir::attrs::lang_items::LangItem;
595
+ use rustc_hir::def_id::DefId;
596
+ -use rustc_hir::{self as hir, find_attr};
597
+ use rustc_infer::infer::BoundRegionConversionTime::{self, HigherRankedType};
598
+ use rustc_infer::infer::DefineOpaqueTypes;
599
+ use rustc_infer::infer::at::ToTrace;
600
+ @@ -31,7 +31,6 @@ use rustc_middle::ty::{
601
+ Unnormalized, Upcast, elaborate, may_use_unstable_feature,
602
+ };
603
+ use rustc_next_trait_solver::solve::AliasBoundKind;
604
+ -use rustc_span::Symbol;
605
+ use tracing::{debug, instrument, trace};
606
+
607
+ use self::EvaluationResult::*;
608
+ @@ -59,7 +58,6 @@ mod confirmation;
609
+ pub enum IntercrateAmbiguityCause<'tcx> {
610
+ DownstreamCrate { trait_ref: ty::TraitRef<'tcx>, self_ty: Option<Ty<'tcx>> },
611
+ UpstreamCrateUpdate { trait_ref: ty::TraitRef<'tcx>, self_ty: Option<Ty<'tcx>> },
612
+ - ReservationImpl { message: Symbol },
613
+ }
614
+
615
+ impl<'tcx> IntercrateAmbiguityCause<'tcx> {
616
+ @@ -94,7 +92,6 @@ impl<'tcx> IntercrateAmbiguityCause<'tcx> {
617
+ }
618
+ )
619
+ }
620
+ - IntercrateAmbiguityCause::ReservationImpl { message } => message.to_string(),
621
+ })
622
+ }
623
+ }
624
+ @@ -441,7 +438,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
625
+ // Instead, we select the right impl now but report "`Bar` does
626
+ // not implement `Clone`".
627
+ if candidates.len() == 1 {
628
+ - return self.filter_reservation_impls(candidates.pop().unwrap());
629
+ + return Ok(candidates.pop());
630
+ }
631
+
632
+ // Winnow, but record the exact outcome of evaluation, which
633
+ @@ -488,13 +485,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
634
+ let has_non_region_infer = stack.obligation.predicate.has_non_region_infer();
635
+ let candidate_preference_mode =
636
+ CandidatePreferenceMode::compute(self.tcx(), stack.obligation.predicate.def_id());
637
+ - if let Some(candidate) =
638
+ - self.winnow_candidates(has_non_region_infer, candidate_preference_mode, candidates)
639
+ - {
640
+ - self.filter_reservation_impls(candidate)
641
+ - } else {
642
+ - Ok(None)
643
+ - }
644
+ + Ok(self.winnow_candidates(has_non_region_infer, candidate_preference_mode, candidates))
645
+ }
646
+ }
647
+
648
+ @@ -1417,58 +1408,28 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
649
+ #[instrument(level = "debug", skip(self, candidates))]
650
+ fn filter_impls(
651
+ &mut self,
652
+ - candidates: Vec<SelectionCandidate<'tcx>>,
653
+ + mut candidates: Vec<SelectionCandidate<'tcx>>,
654
+ obligation: &PolyTraitObligation<'tcx>,
655
+ ) -> Vec<SelectionCandidate<'tcx>> {
656
+ trace!("{candidates:#?}");
657
+ let tcx = self.tcx();
658
+ - let mut result = Vec::with_capacity(candidates.len());
659
+
660
+ - for candidate in candidates {
661
+ - if let ImplCandidate(def_id) = candidate {
662
+ + candidates.retain(|candidate| {
663
+ + if let &ImplCandidate(def_id) = candidate {
664
+ match (tcx.impl_polarity(def_id), obligation.polarity()) {
665
+ - (ty::ImplPolarity::Reservation, _)
666
+ - | (ty::ImplPolarity::Positive, ty::ClausePolarity::Positive)
667
+ - | (ty::ImplPolarity::Negative, ty::ClausePolarity::Negative) => {
668
+ - result.push(candidate);
669
+ - }
670
+ - _ => {}
671
+ + (ty::ImplPolarity::Positive, ty::ClausePolarity::Positive)
672
+ + | (ty::ImplPolarity::Negative, ty::ClausePolarity::Negative) => true,
673
+ +
674
+ + // remove impl candidates with mismatched polarity to the obligation
675
+ + _ => false,
676
+ }
677
+ } else {
678
+ - result.push(candidate);
679
+ + true
680
+ }
681
+ - }
682
+ -
683
+ - trace!("{result:#?}");
684
+ - result
685
+ - }
686
+ + });
687
+
688
+ - /// filter_reservation_impls filter reservation impl for any goal as ambiguous
689
+ - #[instrument(level = "debug", skip(self))]
690
+ - fn filter_reservation_impls(
691
+ - &mut self,
692
+ - candidate: SelectionCandidate<'tcx>,
693
+ - ) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
694
+ - let tcx = self.tcx();
695
+ - // Treat reservation impls as ambiguity.
696
+ - if let ImplCandidate(def_id) = candidate
697
+ - && let ty::ImplPolarity::Reservation = tcx.impl_polarity(def_id)
698
+ - {
699
+ - if let Some(intercrate_ambiguity_clauses) = &mut self.intercrate_ambiguity_causes {
700
+ - let message = find_attr!(tcx, def_id, RustcReservationImpl(message) => *message);
701
+ - if let Some(message) = message {
702
+ - debug!(
703
+ - "filter_reservation_impls: \
704
+ - reservation impl ambiguity on {:?}",
705
+ - def_id
706
+ - );
707
+ - intercrate_ambiguity_clauses
708
+ - .insert(IntercrateAmbiguityCause::ReservationImpl { message });
709
+ - }
710
+ - }
711
+ - return Ok(None);
712
+ - }
713
+ - Ok(Some(candidate))
714
+ + trace!("{candidates:#?}");
715
+ + candidates
716
+ }
717
+
718
+ fn is_knowable<'o>(&mut self, stack: &TraitObligationStack<'o, 'tcx>) -> Result<(), Conflict> {
719
+ @@ -2560,7 +2521,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
720
+ nested_obligations.extend(obligations);
721
+
722
+ match self.typing_mode() {
723
+ - TypingMode::Coherence => {}
724
+ TypingMode::Reflection
725
+ if !self.tcx().impl_is_fully_generic_for_reflection(impl_def_id) =>
726
+ {
727
+ @@ -2568,18 +2528,14 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
728
+ return Err(());
729
+ }
730
+
731
+ - TypingMode::Typeck { .. }
732
+ + TypingMode::Coherence
733
+ + | TypingMode::Typeck { .. }
734
+ | TypingMode::PostTypeckUntilBorrowck { .. }
735
+ | TypingMode::PostBorrowck { .. }
736
+ | TypingMode::Codegen
737
+ | TypingMode::ErasedNotCoherence(_)
738
+ | TypingMode::Reflection
739
+ - | TypingMode::PostAnalysis => {
740
+ - if impl_trait_header.polarity == ty::ImplPolarity::Reservation {
741
+ - debug!("reservation impls only apply in intercrate mode");
742
+ - return Err(());
743
+ - }
744
+ - }
745
+ + | TypingMode::PostAnalysis => {}
746
+ }
747
+
748
+ Ok(Normalized { value: impl_args, obligations: nested_obligations })
749
+ diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs
750
+ index a819530485ccd196aca3da8a0cc12aeb196295a1..7d281663d50338cad4b6d807a2b107c28a61254c 100644
751
+ --- a/compiler/rustc_type_ir/src/predicate.rs
752
+ +++ b/compiler/rustc_type_ir/src/predicate.rs
753
+ @@ -265,11 +265,6 @@ pub enum ImplPolarity {
754
+ Positive,
755
+ /// `impl !Trait for Type`
756
+ Negative,
757
+ - /// `#[rustc_reservation_impl] impl Trait for Type`
758
+ - ///
759
+ - /// This is a "stability hack", not a real Rust feature.
760
+ - /// See #64631 for details.
761
+ - Reservation,
762
+ }
763
+
764
+ impl fmt::Display for ImplPolarity {
765
+ @@ -277,7 +272,6 @@ impl fmt::Display for ImplPolarity {
766
+ match self {
767
+ Self::Positive => f.write_str("positive"),
768
+ Self::Negative => f.write_str("negative"),
769
+ - Self::Reservation => f.write_str("reservation"),
770
+ }
771
+ }
772
+ }
773
+ @@ -288,7 +282,6 @@ impl ImplPolarity {
774
+ match self {
775
+ Self::Positive => "",
776
+ Self::Negative => "!",
777
+ - Self::Reservation => "",
778
+ }
779
+ }
780
+ }
781
+ diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
782
+ index eddf3e4873039ae41c994e2979ddf83e044fde31..a9ecf6d66d001bc1a987983cfd3ca14a61cee07f 100644
783
+ --- a/src/librustdoc/html/render/mod.rs
784
+ +++ b/src/librustdoc/html/render/mod.rs
785
+ @@ -948,7 +948,7 @@ fn short_item_info(
786
+ fn impl_trait_key(cx: &Context<'_>, i: &Impl) -> Option<String> {
787
+ let trait_ = i.inner_impl().trait_.as_ref()?;
788
+ let prefix = match i.inner_impl().polarity {
789
+ - ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => "",
790
+ + ty::ImplPolarity::Positive => "",
791
+ ty::ImplPolarity::Negative => "!",
792
+ };
793
+ Some(format!("{prefix}{:#}", print_path(trait_, cx)))
794
+ @@ -964,7 +964,7 @@ fn render_impls<'a, 'cx>(
795
+ ) -> impl fmt::Display + use<'a, 'cx> {
796
+ impls.sort_by_cached_key(|imp| {
797
+ let prefix = match imp.inner_impl().polarity {
798
+ - ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => Ordering::Greater,
799
+ + ty::ImplPolarity::Positive => Ordering::Greater,
800
+ ty::ImplPolarity::Negative => Ordering::Less,
801
+ };
802
+ (prefix, ImplString::new_path(imp, cx))
803
+ diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs
804
+ index b19ed533d49531a21c450618fae00e519ce800df..5a0e9d9e810e7cce7b4a99abcc4b929943fa5f2b 100644
805
+ --- a/src/librustdoc/json/conversions.rs
806
+ +++ b/src/librustdoc/json/conversions.rs
807
+ @@ -829,7 +829,7 @@ impl FromClean<clean::Impl> for Impl {
808
+ clean::ImplKind::Blanket(ty) => (false, Some(ty)),
809
+ };
810
+ let is_negative = match polarity {
811
+ - ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => false,
812
+ + ty::ImplPolarity::Positive => false,
813
+ ty::ImplPolarity::Negative => true,
814
+ };
815
+ Impl {
816
+ diff --git a/tests/ui/dropck/reservation.rs b/tests/ui/dropck/reservation.rs
817
+ deleted file mode 100644
818
+ index f7199d4ec44074d63c02aaf3e228e9f31f2746ea..0000000000000000000000000000000000000000
819
+ --- a/tests/ui/dropck/reservation.rs
820
+ +++ /dev/null
821
+ @@ -1,10 +0,0 @@
822
+ -#![feature(rustc_attrs)]
823
+ -
824
+ -struct ReservedDrop;
825
+ -#[rustc_reservation_impl = "message"]
826
+ -impl Drop for ReservedDrop {
827
+ -//~^ ERROR reservation `Drop` impls are not supported
828
+ - fn drop(&mut self) {}
829
+ -}
830
+ -
831
+ -fn main() {}
832
+ diff --git a/tests/ui/dropck/reservation.stderr b/tests/ui/dropck/reservation.stderr
833
+ deleted file mode 100644
834
+ index a6ebf158a075d49ea8a289c1940e87fb1e0acb48..0000000000000000000000000000000000000000
835
+ --- a/tests/ui/dropck/reservation.stderr
836
+ +++ /dev/null
837
+ @@ -1,8 +0,0 @@
838
+ -error: reservation `Drop` impls are not supported
839
+ - --> $DIR/reservation.rs:5:1
840
+ - |
841
+ -LL | impl Drop for ReservedDrop {
842
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^
843
+ -
844
+ -error: aborting due to 1 previous error
845
+ -
846
+ diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.next.stderr b/tests/ui/traits/reservation-impl/coherence-conflict.next.stderr
847
+ deleted file mode 100644
848
+ index 2b5277f93328955f080294b0fa20028c0b8f8f9e..0000000000000000000000000000000000000000
849
+ --- a/tests/ui/traits/reservation-impl/coherence-conflict.next.stderr
850
+ +++ /dev/null
851
+ @@ -1,13 +0,0 @@
852
+ -error[E0119]: conflicting implementations of trait `OtherTrait` for type `()`
853
+ - --> $DIR/coherence-conflict.rs:12:1
854
+ - |
855
+ -LL | impl OtherTrait for () {}
856
+ - | ---------------------- first implementation here
857
+ -LL | impl<T: MyTrait> OtherTrait for T {}
858
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
859
+ - |
860
+ - = note: this impl is reserved
861
+ -
862
+ -error: aborting due to 1 previous error
863
+ -
864
+ -For more information about this error, try `rustc --explain E0119`.
865
+ diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.old.stderr b/tests/ui/traits/reservation-impl/coherence-conflict.old.stderr
866
+ deleted file mode 100644
867
+ index 2b5277f93328955f080294b0fa20028c0b8f8f9e..0000000000000000000000000000000000000000
868
+ --- a/tests/ui/traits/reservation-impl/coherence-conflict.old.stderr
869
+ +++ /dev/null
870
+ @@ -1,13 +0,0 @@
871
+ -error[E0119]: conflicting implementations of trait `OtherTrait` for type `()`
872
+ - --> $DIR/coherence-conflict.rs:12:1
873
+ - |
874
+ -LL | impl OtherTrait for () {}
875
+ - | ---------------------- first implementation here
876
+ -LL | impl<T: MyTrait> OtherTrait for T {}
877
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
878
+ - |
879
+ - = note: this impl is reserved
880
+ -
881
+ -error: aborting due to 1 previous error
882
+ -
883
+ -For more information about this error, try `rustc --explain E0119`.
884
+ diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.rs b/tests/ui/traits/reservation-impl/coherence-conflict.rs
885
+ deleted file mode 100644
886
+ index 558793c25f3c44788863088989e6451640609875..0000000000000000000000000000000000000000
887
+ --- a/tests/ui/traits/reservation-impl/coherence-conflict.rs
888
+ +++ /dev/null
889
+ @@ -1,15 +0,0 @@
890
+ -// check that reservation impls are accounted for in negative reasoning.
891
+ -//@ revisions: old next
892
+ -//@[next] compile-flags: -Znext-solver
893
+ -#![feature(rustc_attrs)]
894
+ -
895
+ -trait MyTrait {}
896
+ -#[rustc_reservation_impl="this impl is reserved"]
897
+ -impl MyTrait for () {}
898
+ -
899
+ -trait OtherTrait {}
900
+ -impl OtherTrait for () {}
901
+ -impl<T: MyTrait> OtherTrait for T {}
902
+ -//~^ ERROR conflicting implementations
903
+ -
904
+ -fn main() {}
905
+ diff --git a/tests/ui/traits/reservation-impl/no-use.next.stderr b/tests/ui/traits/reservation-impl/no-use.next.stderr
906
+ deleted file mode 100644
907
+ index 772e360eade443a010488aa90f3535b20989fd2d..0000000000000000000000000000000000000000
908
+ --- a/tests/ui/traits/reservation-impl/no-use.next.stderr
909
+ +++ /dev/null
910
+ @@ -1,9 +0,0 @@
911
+ -error[E0277]: the trait bound `(): MyTrait` is not satisfied
912
+ - --> $DIR/no-use.rs:11:6
913
+ - |
914
+ -LL | <() as MyTrait>::foo(&());
915
+ - | ^^ the trait `MyTrait` is not implemented for `()`
916
+ -
917
+ -error: aborting due to 1 previous error
918
+ -
919
+ -For more information about this error, try `rustc --explain E0277`.
920
+ diff --git a/tests/ui/traits/reservation-impl/no-use.old.stderr b/tests/ui/traits/reservation-impl/no-use.old.stderr
921
+ deleted file mode 100644
922
+ index 772e360eade443a010488aa90f3535b20989fd2d..0000000000000000000000000000000000000000
923
+ --- a/tests/ui/traits/reservation-impl/no-use.old.stderr
924
+ +++ /dev/null
925
+ @@ -1,9 +0,0 @@
926
+ -error[E0277]: the trait bound `(): MyTrait` is not satisfied
927
+ - --> $DIR/no-use.rs:11:6
928
+ - |
929
+ -LL | <() as MyTrait>::foo(&());
930
+ - | ^^ the trait `MyTrait` is not implemented for `()`
931
+ -
932
+ -error: aborting due to 1 previous error
933
+ -
934
+ -For more information about this error, try `rustc --explain E0277`.
935
+ diff --git a/tests/ui/traits/reservation-impl/no-use.rs b/tests/ui/traits/reservation-impl/no-use.rs
936
+ deleted file mode 100644
937
+ index b470a2815c0c7b77668cbc695dd019f7199ccd15..0000000000000000000000000000000000000000
938
+ --- a/tests/ui/traits/reservation-impl/no-use.rs
939
+ +++ /dev/null
940
+ @@ -1,13 +0,0 @@
941
+ -// check that reservation impls can't be used as normal impls in positive reasoning.
942
+ -//@ revisions: old next
943
+ -//@[next] compile-flags: -Znext-solver
944
+ -#![feature(rustc_attrs)]
945
+ -
946
+ -trait MyTrait { fn foo(&self); }
947
+ -#[rustc_reservation_impl = "foo"]
948
+ -impl MyTrait for () { fn foo(&self) {} }
949
+ -
950
+ -fn main() {
951
+ - <() as MyTrait>::foo(&());
952
+ - //~^ ERROR the trait bound `(): MyTrait` is not satisfied
953
+ -}
954
+ diff --git a/tests/ui/traits/reservation-impl/non-lattice-ok.rs b/tests/ui/traits/reservation-impl/non-lattice-ok.rs
955
+ deleted file mode 100644
956
+ index 93dab111891c079f589cfc174f0fea642ceba75a..0000000000000000000000000000000000000000
957
+ --- a/tests/ui/traits/reservation-impl/non-lattice-ok.rs
958
+ +++ /dev/null
959
+ @@ -1,70 +0,0 @@
960
+ -//@ build-pass
961
+ -
962
+ -// Check that a reservation impl does not force other impls to follow
963
+ -// a lattice discipline.
964
+ -
965
+ -// Why did we ever want to do this?
966
+ -//
967
+ -// We want to eventually add an `impl<T> From<!> for T` impl. That impl conflicts
968
+ -// with existing impls - at least the `impl<T> From<T> for T` impl. There are
969
+ -// 2 ways we thought of for dealing with that conflict:
970
+ -//
971
+ -// 1. Using specialization and doing some handling for the
972
+ -// overlap. The current thought is to require ["intersection
973
+ -// impls"][ii], specialization", which means providing an
974
+ -// (higher-priority) impl for the intersection of every 2 conflicting
975
+ -// impls that determines what happens in the intersection case. That's
976
+ -// the first thing we thought about - see e.g.
977
+ -// https://github.com/rust-lang/rust/issues/57012#issuecomment-452150775
978
+ -//
979
+ -// 2. The other way is to notice that `impl From<!> for T` is basically a
980
+ -// marker trait since its only method is uninhabited, and allow for "marker
981
+ -// trait overlap", where the conflict "doesn't matter" because it can't
982
+ -// actually cause any ambiguity.
983
+ -//
984
+ -// Now it turned out lattice specialization doesn't work it, because an
985
+ -// `impl<T> From<T> for Smaht<T>` would require an `impl From<!> for Smaht<!>`,
986
+ -// breaking backwards-compatibility in a fairly painful way. So if we want to
987
+ -// go with a known approach, we should go with a "marker trait overlap"-style
988
+ -// approach.
989
+ -//
990
+ -// [ii]: https://smallcultfollowing.com/babysteps/blog/2016/09/24/intersection-impls/
991
+ -
992
+ -// check that reservation impls can't be used as normal impls in positive reasoning.
993
+ -
994
+ -//@ revisions: old next
995
+ -//@[next] compile-flags: -Znext-solver
996
+ -
997
+ -#![feature(rustc_attrs)]
998
+ -
999
+ -trait MyTrait {}
1000
+ -
1001
+ -impl MyTrait for ! {}
1002
+ -
1003
+ -trait MyFrom<T> {
1004
+ - fn my_from(x: T) -> Self;
1005
+ -}
1006
+ -
1007
+ -// Given the "normal" impls for From
1008
+ -#[rustc_reservation_impl = "this impl is reserved"]
1009
+ -impl<T> MyFrom<!> for T {
1010
+ - fn my_from(x: !) -> Self {
1011
+ - match x {}
1012
+ - }
1013
+ -}
1014
+ -
1015
+ -impl<T> MyFrom<T> for T {
1016
+ - fn my_from(x: T) -> Self {
1017
+ - x
1018
+ - }
1019
+ -}
1020
+ -
1021
+ -// ... we *do* want to allow this common pattern, of `From<!> for MySmaht<T>`
1022
+ -struct MySmaht<T>(T);
1023
+ -impl<T> MyFrom<T> for MySmaht<T> {
1024
+ - fn my_from(x: T) -> Self {
1025
+ - MySmaht(x)
1026
+ - }
1027
+ -}
1028
+ -
1029
+ -fn main() {}
1030
+ diff --git a/tests/ui/traits/reservation-impl/ok.rs b/tests/ui/traits/reservation-impl/ok.rs
1031
+ deleted file mode 100644
1032
+ index cf68c1b2e96dcca904e73306ad332700a9cdc850..0000000000000000000000000000000000000000
1033
+ --- a/tests/ui/traits/reservation-impl/ok.rs
1034
+ +++ /dev/null
1035
+ @@ -1,31 +0,0 @@
1036
+ -//@ run-pass
1037
+ -
1038
+ -// rpass test for reservation impls. Not 100% required because `From` uses them,
1039
+ -// but still.
1040
+ -
1041
+ -//@ revisions: old next
1042
+ -//@[next] compile-flags: -Znext-solver
1043
+ -
1044
+ -#![feature(rustc_attrs)]
1045
+ -
1046
+ -use std::mem;
1047
+ -
1048
+ -trait MyTrait<S> {
1049
+ - fn foo(&self, s: S) -> usize;
1050
+ -}
1051
+ -
1052
+ -#[rustc_reservation_impl = "foo"]
1053
+ -impl<T> MyTrait<u64> for T {
1054
+ - fn foo(&self, _x: u64) -> usize { 0 }
1055
+ -}
1056
+ -
1057
+ -// reservation impls don't create coherence conflicts, even with
1058
+ -// non-chain overlap.
1059
+ -impl<S> MyTrait<S> for u32 {
1060
+ - fn foo(&self, _x: S) -> usize { mem::size_of::<S>() }
1061
+ -}
1062
+ -
1063
+ -fn main() {
1064
+ - // ...and the non-reservation impl gets picked.XS
1065
+ - assert_eq!(0u32.foo(0u64), mem::size_of::<u64>());
1066
+ -}
patches/20261028T105419Z/rust-lang--rust-part011/92fc352d158ed4bbd9879258d1a7898ae4bd991c.patch ADDED
The diff for this file is too large to render. See raw diff
 
patches/20261028T105419Z/rust-lang--rust-part011/96e2d460b640d06767d7f7d0251f4620a8bad123.patch ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/src/edit_lints.rs b/clippy_dev/src/edit_lints.rs
2
+ index 59013ca820d9c2b95454ed58c7b6dc8a0a1c9708..9307fb41b6ea5a57aab7fba604d6ca78189c0db0 100644
3
+ --- a/clippy_dev/src/edit_lints.rs
4
+ +++ b/clippy_dev/src/edit_lints.rs
5
+ @@ -330,11 +330,9 @@ fn uplift_update_fn<'a>(
6
+ let mut copy_pos = 0u32;
7
+ let mut changed = false;
8
+ let mut cursor = Cursor::new(src);
9
+ - while let Some(ident) = cursor.find_any_ident() {
10
+ + while let Some(ident) = cursor.find_capture_ident() {
11
+ match cursor.get_text(ident) {
12
+ - "mod"
13
+ - if remove_mod && cursor.match_ident(old_name).is_some() && cursor.match_pat(cursor::Pat::Semi) =>
14
+ - {
15
+ + "mod" if remove_mod && cursor.eat_ident(old_name) && cursor.eat_semi() => {
16
+ dst.push_str(&src[copy_pos as usize..ident.pos as usize]);
17
+ dst.push_str(new_name);
18
+ copy_pos = cursor.pos();
19
+ @@ -343,7 +341,7 @@ fn uplift_update_fn<'a>(
20
+ }
21
+ changed = true;
22
+ },
23
+ - "clippy" if cursor.match_pat(cursor::Pat::DoubleColon) && cursor.match_ident(old_name).is_some() => {
24
+ + "clippy" if cursor.eat_double_colon() && cursor.eat_ident(old_name) => {
25
+ dst.push_str(&src[copy_pos as usize..ident.pos as usize]);
26
+ dst.push_str(new_name);
27
+ copy_pos = cursor.pos();
28
+ @@ -393,8 +391,11 @@ fn rename_update_fn<'a>(
29
+ },
30
+ // mod lint_name
31
+ "mod" => {
32
+ - if rename_mod && let Some(pos) = cursor.match_ident(old_name) {
33
+ - dst.push_str(&src[copy_pos as usize..pos as usize]);
34
+ + if rename_mod
35
+ + && let Some(mod_name) = cursor.capture_ident()
36
+ + && cursor.get_text(mod_name) == old_name
37
+ + {
38
+ + dst.push_str(&src[copy_pos as usize..mod_name.pos as usize]);
39
+ dst.push_str(new_name);
40
+ copy_pos = cursor.pos();
41
+ changed = true;
42
+ @@ -403,7 +404,7 @@ fn rename_update_fn<'a>(
43
+ // lint_name::
44
+ name if rename_mod && name == old_name => {
45
+ let name_end = cursor.pos();
46
+ - if cursor.match_pat(cursor::Pat::DoubleColon) {
47
+ + if cursor.eat_double_colon() {
48
+ dst.push_str(&src[copy_pos as usize..match_start as usize]);
49
+ dst.push_str(new_name);
50
+ copy_pos = name_end;
51
+ diff --git a/clippy_dev/src/generate.rs b/clippy_dev/src/generate.rs
52
+ index 4d86da4ada58065cb461dd1f886771daf056da86..2159900d580c81c869600035554ffb0ff0c94e54 100644
53
+ --- a/clippy_dev/src/generate.rs
54
+ +++ b/clippy_dev/src/generate.rs
55
+ @@ -73,8 +73,7 @@ impl LintData<'_> {
56
+ &mut |_, src, dst| {
57
+ let mut cursor = Cursor::new(src);
58
+ assert!(
59
+ - cursor.find_ident("declare_with_version").is_some()
60
+ - && cursor.find_ident("declare_with_version").is_some(),
61
+ + cursor.find_ident("declare_with_version") && cursor.find_ident("declare_with_version"),
62
+ "error reading deprecated lints"
63
+ );
64
+ dst.push_str(&src[..cursor.pos() as usize]);
65
+ diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
66
+ index 70783118efedf4a9d4a09156c74b9f7c32dc1aa5..5c15839cd3ddf9f6687699bb8e58621b5baab3c6 100644
67
+ --- a/clippy_dev/src/lib.rs
68
+ +++ b/clippy_dev/src/lib.rs
69
+ @@ -1,5 +1,6 @@
70
+ #![feature(
71
+ exit_status_error,
72
+ + macro_metavar_expr_concat,
73
+ new_range,
74
+ os_str_slice,
75
+ os_string_truncate,
76
+ diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs
77
+ index 6c9594072c9b433c6156439761a772f4e173980a..78eaabbb794e877510be7210cb98078234515d65 100644
78
+ --- a/clippy_dev/src/new_lint.rs
79
+ +++ b/clippy_dev/src/new_lint.rs
80
+ @@ -529,9 +529,9 @@ fn parse_mod_file(path: &Path, contents: &str) -> (&'static str, usize) {
81
+ let mut decl_end = None;
82
+ let mut cursor = Cursor::new(contents);
83
+ let mut captures = [Capture::EMPTY];
84
+ - while let Some(name) = cursor.find_any_ident() {
85
+ + while let Some(name) = cursor.find_capture_ident() {
86
+ match cursor.get_text(name) {
87
+ - "declare_clippy_lint" if cursor.match_all(&[Bang, OpenBrace], &mut []) && cursor.find_pat(CloseBrace) => {
88
+ + "declare_clippy_lint" if cursor.match_all(&[Bang, OpenBrace], &mut []) && cursor.find_close_brace() => {
89
+ decl_end = Some(cursor.pos());
90
+ },
91
+ "impl" if cursor.match_all(&[Lt, Lifetime, Gt, CaptureIdent], &mut captures) => {
92
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
93
+ index 2bc30b61d346a0d5237e710cc99b1bb265266635..6010da42c19bb90964f21d3f99d4be9556d0c868 100644
94
+ --- a/clippy_dev/src/parse.rs
95
+ +++ b/clippy_dev/src/parse.rs
96
+ @@ -364,11 +364,11 @@ impl<'cx> ParseCxImpl<'cx> {
97
+
98
+ let mut cursor = Cursor::new(&file.contents);
99
+ let mut captures = [Capture::EMPTY; 3];
100
+ - while let Some(mac_name) = cursor.find_any_ident() {
101
+ + while let Some(mac_name) = cursor.find_capture_ident() {
102
+ captures[1] = Capture::EMPTY;
103
+ match cursor.get_text(mac_name) {
104
+ "declare_clippy_lint"
105
+ - if cursor.match_all(LINT_DECL_TOKENS, &mut captures) && cursor.find_pat(CloseBrace) =>
106
+ + if cursor.match_all(LINT_DECL_TOKENS, &mut captures) && cursor.find_close_brace() =>
107
+ {
108
+ assert!(
109
+ data.lints
110
+ @@ -401,14 +401,14 @@ impl<'cx> ParseCxImpl<'cx> {
111
+ let lints = self.str_list_buf.with(|buf| {
112
+ // Parses a comma separated list of paths and converts each path
113
+ // to a string with whitespace removed.
114
+ - while !cursor.match_pat(CloseBracket) {
115
+ + while !cursor.eat_close_bracket() {
116
+ buf.push(self.str_buf.with(|buf| {
117
+ - if cursor.match_pat(DoubleColon) {
118
+ + if cursor.eat_double_colon() {
119
+ buf.push_str("::");
120
+ }
121
+ let capture = cursor.capture_ident()?;
122
+ buf.push_str(cursor.get_text(capture));
123
+ - while cursor.match_pat(DoubleColon) {
124
+ + while cursor.eat_double_colon() {
125
+ buf.push_str("::");
126
+ let capture = cursor.capture_ident()?;
127
+ buf.push_str(cursor.get_text(capture));
128
+ @@ -416,8 +416,8 @@ impl<'cx> ParseCxImpl<'cx> {
129
+ Some(self.arena.alloc_str(buf))
130
+ })?);
131
+
132
+ - if !cursor.match_pat(Comma) {
133
+ - if !cursor.match_pat(CloseBracket) {
134
+ + if !cursor.eat_comma() {
135
+ + if !cursor.eat_close_bracket() {
136
+ return None;
137
+ }
138
+ break;
139
+ @@ -482,11 +482,11 @@ impl<'cx> ParseCxImpl<'cx> {
140
+
141
+ // First instance is the macro definition.
142
+ assert!(
143
+ - cursor.find_ident("declare_with_version").is_some(),
144
+ + cursor.find_ident("declare_with_version"),
145
+ "error reading deprecated lints"
146
+ );
147
+
148
+ - if cursor.find_ident("declare_with_version").is_some() && cursor.match_all(DEPRECATED_TOKENS, &mut []) {
149
+ + if cursor.find_ident("declare_with_version") && cursor.match_all(DEPRECATED_TOKENS, &mut []) {
150
+ while cursor.match_all(DECL_TOKENS, &mut captures) {
151
+ assert!(
152
+ data.lints
153
+ @@ -504,7 +504,7 @@ impl<'cx> ParseCxImpl<'cx> {
154
+ panic!("error reading deprecated lints");
155
+ }
156
+
157
+ - if cursor.find_ident("declare_with_version").is_some() && cursor.match_all(RENAMED_TOKENS, &mut []) {
158
+ + if cursor.find_ident("declare_with_version") && cursor.match_all(RENAMED_TOKENS, &mut []) {
159
+ while cursor.match_all(DECL_TOKENS, &mut captures) {
160
+ assert!(
161
+ data.lints
162
+ diff --git a/clippy_dev/src/parse/cursor.rs b/clippy_dev/src/parse/cursor.rs
163
+ index c7ad710f8d20987f68877db73ad9b10796c698ae..2fffaa201582a192b55ffe8e833cf348a254f99c 100644
164
+ --- a/clippy_dev/src/parse/cursor.rs
165
+ +++ b/clippy_dev/src/parse/cursor.rs
166
+ @@ -16,7 +16,6 @@ pub enum Pat {
167
+ CaptureLifetime,
168
+ CaptureLitStr,
169
+ Bang,
170
+ - CloseBrace,
171
+ CloseBracket,
172
+ CloseParen,
173
+ Comma,
174
+ @@ -126,12 +125,6 @@ impl<'txt> Cursor<'txt> {
175
+ self.pos
176
+ }
177
+
178
+ - /// Gets whether the cursor has exhausted its input.
179
+ - #[must_use]
180
+ - pub fn at_end(&self) -> bool {
181
+ - self.next_token.kind == TokenKind::Eof
182
+ - }
183
+ -
184
+ /// Advances the cursor to the next token. If the stream is exhausted this will set
185
+ /// the next token to [`TokenKind::Eof`].
186
+ pub fn step(&mut self) {
187
+ @@ -154,8 +147,10 @@ impl<'txt> Cursor<'txt> {
188
+ Pat::AnyComments,
189
+ TokenKind::BlockComment { terminated: true, .. } | TokenKind::LineComment { .. },
190
+ ) => self.step(),
191
+ + (Pat::AnyComments, _) => return true,
192
+ +
193
+ + (Pat::Ident(x), TokenKind::Ident) if x.as_str() == self.peek_text() => break,
194
+ (Pat::Bang, TokenKind::Bang)
195
+ - | (Pat::CloseBrace, TokenKind::CloseBrace)
196
+ | (Pat::CloseBracket, TokenKind::CloseBracket)
197
+ | (Pat::CloseParen, TokenKind::CloseParen)
198
+ | (Pat::Comma, TokenKind::Comma)
199
+ @@ -174,30 +169,17 @@ impl<'txt> Cursor<'txt> {
200
+ kind: LiteralKind::Str { terminated: true } | LiteralKind::RawStr { .. },
201
+ ..
202
+ },
203
+ - ) => {
204
+ - self.step();
205
+ - return true;
206
+ - },
207
+ - (Pat::Ident(x), TokenKind::Ident) if x.as_str() == self.peek_text() => {
208
+ - self.step();
209
+ - return true;
210
+ - },
211
+ - (Pat::DoubleColon, TokenKind::Colon) => {
212
+ + ) => break,
213
+ +
214
+ + (Pat::DoubleColon, TokenKind::Colon) if self.inner.as_str().starts_with(':') => {
215
+ self.step();
216
+ - if matches!(self.next_token.kind, TokenKind::Colon) {
217
+ - self.step();
218
+ - return true;
219
+ - }
220
+ - return false;
221
+ + break;
222
+ },
223
+ - (Pat::FatArrow, TokenKind::Eq) => {
224
+ + (Pat::FatArrow, TokenKind::Eq) if self.inner.as_str().starts_with('>') => {
225
+ self.step();
226
+ - if matches!(self.next_token.kind, TokenKind::Gt) {
227
+ - self.step();
228
+ - return true;
229
+ - }
230
+ - return false;
231
+ + break;
232
+ },
233
+ +
234
+ #[rustfmt::skip]
235
+ (
236
+ Pat::CaptureLitStr,
237
+ @@ -214,6 +196,7 @@ impl<'txt> Cursor<'txt> {
238
+ self.step();
239
+ return true;
240
+ },
241
+ +
242
+ (Pat::CaptureDocLines, TokenKind::LineComment { doc_style: Some(_) }) => {
243
+ let pos = self.pos;
244
+ loop {
245
+ @@ -231,43 +214,26 @@ impl<'txt> Cursor<'txt> {
246
+ };
247
+ return true;
248
+ },
249
+ +
250
+ (Pat::CaptureDocLines, _) => {
251
+ *captures.next().unwrap() = Capture::EMPTY;
252
+ return true;
253
+ },
254
+ - (Pat::AnyComments, _) => return true,
255
+ _ => return false,
256
+ }
257
+ }
258
+ - }
259
+
260
+ - /// Consumes all tokens until the specified identifier is found and returns its
261
+ - /// position. Returns `None` if the identifier could not be found.
262
+ - ///
263
+ - /// The cursor will be positioned immediately after the identifier, or at the end if
264
+ - /// it is not.
265
+ - pub fn find_ident(&mut self, ident: &str) -> Option<u32> {
266
+ - loop {
267
+ - match self.next_token.kind {
268
+ - TokenKind::Ident if self.peek_text() == ident => {
269
+ - let pos = self.pos;
270
+ - self.step();
271
+ - return Some(pos);
272
+ - },
273
+ - TokenKind::Eof => return None,
274
+ - _ => self.step(),
275
+ - }
276
+ - }
277
+ + self.step();
278
+ + true
279
+ }
280
+
281
+ - /// Consumes all tokens until the next identifier is found and captures it. Returns
282
+ - /// `None` if no identifier could be found.
283
+ - ///
284
+ - /// The cursor will be positioned immediately after the identifier, or at the end if
285
+ - /// it is not.
286
+ - pub fn find_any_ident(&mut self) -> Option<Capture> {
287
+ + /// Consumes and captures the next non-whitespace token if it's an identifier. Returns
288
+ + /// `None` otherwise.
289
+ + #[must_use]
290
+ + pub fn capture_ident(&mut self) -> Option<Capture> {
291
+ loop {
292
+ match self.next_token.kind {
293
+ + TokenKind::Whitespace => self.step(),
294
+ TokenKind::Ident => {
295
+ let res = Capture {
296
+ pos: self.pos,
297
+ @@ -276,60 +242,29 @@ impl<'txt> Cursor<'txt> {
298
+ self.step();
299
+ return Some(res);
300
+ },
301
+ - TokenKind::Eof => return None,
302
+ - _ => self.step(),
303
+ - }
304
+ - }
305
+ - }
306
+ -
307
+ - /// Consume the returns the position of the next non-whitespace token if it's the
308
+ - /// specified identifier. Returns `None` otherwise.
309
+ - pub fn match_ident(&mut self, s: &str) -> Option<u32> {
310
+ - loop {
311
+ - match self.next_token.kind {
312
+ - TokenKind::Ident if s == self.peek_text() => {
313
+ - let pos = self.pos;
314
+ - self.step();
315
+ - return Some(pos);
316
+ - },
317
+ - TokenKind::Whitespace => self.step(),
318
+ _ => return None,
319
+ }
320
+ }
321
+ }
322
+
323
+ - /// Consumes and captures the next non-whitespace token if it's an identifier. Returns
324
+ - /// `None` otherwise.
325
+ - pub fn capture_ident(&mut self) -> Option<Capture> {
326
+ + /// Consumes all tokens up to and including the next identifier. Returns either the
327
+ + /// captured identifier or `None` if one was not found.
328
+ + #[must_use]
329
+ + pub fn find_capture_ident(&mut self) -> Option<Capture> {
330
+ loop {
331
+ match self.next_token.kind {
332
+ + TokenKind::Eof => return None,
333
+ TokenKind::Ident => {
334
+ - let pos = self.pos;
335
+ - let len = self.next_token.len;
336
+ + let res = Capture {
337
+ + pos: self.pos,
338
+ + len: self.next_token.len,
339
+ + };
340
+ self.step();
341
+ - return Some(Capture { pos, len });
342
+ + return Some(res);
343
+ },
344
+ - TokenKind::Whitespace => self.step(),
345
+ - _ => return None,
346
+ - }
347
+ - }
348
+ - }
349
+ -
350
+ - /// Continually attempt to match the pattern on subsequent tokens until a match is
351
+ - /// found. Returns whether the pattern was successfully matched.
352
+ - ///
353
+ - /// Not generally suitable for multi-token patterns or patterns that can match
354
+ - /// nothing.
355
+ - #[must_use]
356
+ - pub fn find_pat(&mut self, pat: Pat) -> bool {
357
+ - let mut capture = [].iter_mut();
358
+ - while !self.match_impl(pat, &mut capture) {
359
+ - self.step();
360
+ - if self.at_end() {
361
+ - return false;
362
+ + _ => self.step(),
363
+ }
364
+ }
365
+ - true
366
+ }
367
+
368
+ /// Attempts to match a sequence of patterns at the current position. Returns whether
369
+ @@ -364,14 +299,65 @@ impl<'txt> Cursor<'txt> {
370
+ .err()
371
+ .is_none_or(|p| ptr::addr_eq(pats.as_ptr(), p))
372
+ }
373
+ +}
374
+
375
+ - /// Attempts to match a single pattern at the current position. Returns whether the
376
+ - /// pattern was successfully matched.
377
+ - ///
378
+ - /// If the pattern attempts to capture anything this will panic. If the match fails
379
+ - /// the cursor will be positioned at the first failing token.
380
+ - #[must_use]
381
+ - pub fn match_pat(&mut self, pat: Pat) -> bool {
382
+ - self.match_impl(pat, &mut [].iter_mut())
383
+ +macro_rules! mk_tk_methods {
384
+ + ($(
385
+ + [$desc:literal]
386
+ + $name:ident(&mut $self:tt $($params:tt)*)
387
+ + { $pat:pat $(if $guard:expr)? $(=> $extra:block)? }
388
+ + )*) => {
389
+ + #[allow(dead_code)]
390
+ + impl Cursor<'_> {$(
391
+ + #[doc = "Consumes the next non-whitespace token if it's "]
392
+ + #[doc = $desc]
393
+ + #[doc = " and returns whether the token was found."]
394
+ + #[must_use]
395
+ + pub fn ${concat(eat_, $name)}(&mut $self $($params)*) -> bool {
396
+ + loop {
397
+ + match $self.next_token.kind {
398
+ + TokenKind::Whitespace => $self.step(),
399
+ + $pat $(if $guard)? => {
400
+ + $self.step();
401
+ + return true;
402
+ + },
403
+ + _ => return false,
404
+ + }
405
+ + }
406
+ + }
407
+ +
408
+ + #[doc = "Consumes all tokens up to and including "]
409
+ + #[doc = $desc]
410
+ + #[doc = " and returns whether the token was found."]
411
+ + #[must_use]
412
+ + pub fn ${concat(find_, $name)}(&mut $self $($params)*) -> bool {
413
+ + loop {
414
+ + match $self.next_token.kind {
415
+ + TokenKind::Eof => return false,
416
+ + $pat $(if $guard)? => {
417
+ + $self.step();
418
+ + return true;
419
+ + },
420
+ + _ => $self.step(),
421
+ + }
422
+ + }
423
+ + }
424
+ + )*}
425
+ + }
426
+ +}
427
+ +mk_tk_methods! {
428
+ + ["`}`"]
429
+ + close_brace(&mut self) { TokenKind::CloseBrace }
430
+ + ["`]`"]
431
+ + close_bracket(&mut self) { TokenKind::CloseBracket }
432
+ + ["`,`"]
433
+ + comma(&mut self) { TokenKind::Comma }
434
+ + ["`::`"]
435
+ + double_colon(&mut self) {
436
+ + TokenKind::Colon if self.inner.as_str().starts_with(':') => { self.step(); }
437
+ }
438
+ + ["the specified identifier"]
439
+ + ident(&mut self, s: &str) { TokenKind::Ident if self.peek_text() == s }
440
+ + ["`;`"]
441
+ + semi(&mut self) { TokenKind::Semi }
442
+ }
patches/20261028T105419Z/rust-lang--rust-part011/a725c3e72b72b1da3af04dd8bc265641bfe8cd45.patch ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
2
+ index 019749c77ae66aa98597606dd477fb03cb50f092..58be46690b78882bc0bcfbcf3d7c30750988bc7d 100644
3
+ --- a/library/alloc/src/boxed.rs
4
+ +++ b/library/alloc/src/boxed.rs
5
+ @@ -426,82 +426,6 @@ impl<T> Box<T> {
6
+ pub fn try_new_zeroed() -> Result<Box<mem::MaybeUninit<T>>, AllocError> {
7
+ Box::try_new_zeroed_in(Global)
8
+ }
9
+ -
10
+ - /// Maps the value in a box, reusing the allocation if possible.
11
+ - ///
12
+ - /// `f` is called on the value in the box, and the result is returned, also boxed.
13
+ - ///
14
+ - /// Note: this is an associated function, which means that you have
15
+ - /// to call it as `Box::map(b, f)` instead of `b.map(f)`. This
16
+ - /// is so that there is no conflict with a method on the inner type.
17
+ - ///
18
+ - /// # Examples
19
+ - ///
20
+ - /// ```
21
+ - /// #![feature(smart_pointer_try_map)]
22
+ - ///
23
+ - /// let b = Box::new(7);
24
+ - /// let new = Box::map(b, |i| i + 7);
25
+ - /// assert_eq!(*new, 14);
26
+ - /// ```
27
+ - #[cfg(not(no_global_oom_handling))]
28
+ - #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
29
+ - pub fn map<U>(this: Self, f: impl FnOnce(T) -> U) -> Box<U> {
30
+ - if size_of::<T>() == size_of::<U>() && align_of::<T>() == align_of::<U>() {
31
+ - let (value, allocation) = Box::take(this);
32
+ - Box::write(
33
+ - unsafe { mem::transmute::<Box<MaybeUninit<T>>, Box<MaybeUninit<U>>>(allocation) },
34
+ - f(value),
35
+ - )
36
+ - } else {
37
+ - Box::new(f(*this))
38
+ - }
39
+ - }
40
+ -
41
+ - /// Attempts to map the value in a box, reusing the allocation if possible.
42
+ - ///
43
+ - /// `f` is called on the value in the box, and if the operation succeeds, the result is
44
+ - /// returned, also boxed.
45
+ - ///
46
+ - /// Note: this is an associated function, which means that you have
47
+ - /// to call it as `Box::try_map(b, f)` instead of `b.try_map(f)`. This
48
+ - /// is so that there is no conflict with a method on the inner type.
49
+ - ///
50
+ - /// # Examples
51
+ - ///
52
+ - /// ```
53
+ - /// #![feature(smart_pointer_try_map)]
54
+ - ///
55
+ - /// let b = Box::new(7);
56
+ - /// let new = Box::try_map(b, u32::try_from).unwrap();
57
+ - /// assert_eq!(*new, 7);
58
+ - /// ```
59
+ - #[cfg(not(no_global_oom_handling))]
60
+ - #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
61
+ - pub fn try_map<R>(
62
+ - this: Self,
63
+ - f: impl FnOnce(T) -> R,
64
+ - ) -> <R::Residual as Residual<Box<R::Output>>>::TryType
65
+ - where
66
+ - R: Try,
67
+ - R::Residual: Residual<Box<R::Output>>,
68
+ - {
69
+ - if size_of::<T>() == size_of::<R::Output>() && align_of::<T>() == align_of::<R::Output>() {
70
+ - let (value, allocation) = Box::take(this);
71
+ - try {
72
+ - Box::write(
73
+ - unsafe {
74
+ - mem::transmute::<Box<MaybeUninit<T>>, Box<MaybeUninit<R::Output>>>(
75
+ - allocation,
76
+ - )
77
+ - },
78
+ - f(value)?,
79
+ - )
80
+ - }
81
+ - } else {
82
+ - try { Box::new(f(*this)?) }
83
+ - }
84
+ - }
85
+ }
86
+
87
+ impl<T, A: Allocator> Box<T, A> {
88
+ @@ -776,6 +700,77 @@ impl<T, A: Allocator> Box<T, A> {
89
+ (value, uninit)
90
+ }
91
+ }
92
+ +
93
+ + /// Maps the value in a box, reusing the allocation if possible.
94
+ + ///
95
+ + /// `f` is called on the value in the box, and the result is returned, also boxed.
96
+ + ///
97
+ + /// Note: this is an associated function, which means that you have
98
+ + /// to call it as `Box::map(b, f)` instead of `b.map(f)`. This
99
+ + /// is so that there is no conflict with a method on the inner type.
100
+ + ///
101
+ + /// # Examples
102
+ + ///
103
+ + /// ```
104
+ + /// #![feature(smart_pointer_try_map)]
105
+ + ///
106
+ + /// let b = Box::new(7);
107
+ + /// let new = Box::map(b, |i| i + 7);
108
+ + /// assert_eq!(*new, 14);
109
+ + /// ```
110
+ + #[cfg(not(no_global_oom_handling))]
111
+ + #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
112
+ + pub fn map<U>(this: Self, f: impl FnOnce(T) -> U) -> Box<U, A> {
113
+ + let (value, allocation) = Box::take(this);
114
+ + let (raw, alloc) = Box::into_non_null_with_allocator(allocation);
115
+ + if size_of::<T>() == size_of::<U>() && align_of::<T>() == align_of::<U>() {
116
+ + let allocation = unsafe { Box::from_non_null_in(raw.cast::<MaybeUninit<U>>(), alloc) };
117
+ + Box::write(allocation, f(value))
118
+ + } else {
119
+ + unsafe { alloc.deallocate(raw.cast(), Layout::for_value(&value)) }
120
+ + Box::new_in(f(value), alloc)
121
+ + }
122
+ + }
123
+ +
124
+ + /// Attempts to map the value in a box, reusing the allocation if possible.
125
+ + ///
126
+ + /// `f` is called on the value in the box, and if the operation succeeds, the result is
127
+ + /// returned, also boxed.
128
+ + ///
129
+ + /// Note: this is an associated function, which means that you have
130
+ + /// to call it as `Box::try_map(b, f)` instead of `b.try_map(f)`. This
131
+ + /// is so that there is no conflict with a method on the inner type.
132
+ + ///
133
+ + /// # Examples
134
+ + ///
135
+ + /// ```
136
+ + /// #![feature(smart_pointer_try_map)]
137
+ + ///
138
+ + /// let b = Box::new(7);
139
+ + /// let new = Box::try_map(b, u32::try_from).unwrap();
140
+ + /// assert_eq!(*new, 7);
141
+ + /// ```
142
+ + #[cfg(not(no_global_oom_handling))]
143
+ + #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
144
+ + pub fn try_map<R>(
145
+ + this: Self,
146
+ + f: impl FnOnce(T) -> R,
147
+ + ) -> <R::Residual as Residual<Box<R::Output, A>>>::TryType
148
+ + where
149
+ + R: Try,
150
+ + R::Residual: Residual<Box<R::Output, A>>,
151
+ + {
152
+ + let (value, allocation) = Box::take(this);
153
+ + let (raw, alloc) = Box::into_non_null_with_allocator(allocation);
154
+ + if size_of::<T>() == size_of::<R::Output>() && align_of::<T>() == align_of::<R::Output>() {
155
+ + let allocation =
156
+ + unsafe { Box::from_non_null_in(raw.cast::<MaybeUninit<R::Output>>(), alloc) };
157
+ + try { Box::write(allocation, f(value)?) }
158
+ + } else {
159
+ + unsafe { alloc.deallocate(raw.cast(), Layout::for_value(&value)) }
160
+ + try { Box::new_in(f(value)?, alloc) }
161
+ + }
162
+ + }
163
+ }
164
+
165
+ impl<T: ?Sized + CloneToUninit> Box<T> {
166
+ diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
167
+ index e4a803f28e1211e109e0450112e68eab13c91e1e..8d954d90c615de7911d7cc164da18c8fb01e482d 100644
168
+ --- a/library/alloc/src/rc.rs
169
+ +++ b/library/alloc/src/rc.rs
170
+ @@ -651,93 +651,6 @@ impl<T> Rc<T> {
171
+ pub fn pin(value: T) -> Pin<Rc<T>> {
172
+ unsafe { Pin::new_unchecked(Rc::new(value)) }
173
+ }
174
+ -
175
+ - /// Maps the value in an `Rc`, reusing the allocation if possible.
176
+ - ///
177
+ - /// `f` is called on a reference to the value in the `Rc`, and the result is returned, also in
178
+ - /// an `Rc`.
179
+ - ///
180
+ - /// Note: this is an associated function, which means that you have
181
+ - /// to call it as `Rc::map(r, f)` instead of `r.map(f)`. This
182
+ - /// is so that there is no conflict with a method on the inner type.
183
+ - ///
184
+ - /// # Examples
185
+ - ///
186
+ - /// ```
187
+ - /// #![feature(smart_pointer_try_map)]
188
+ - ///
189
+ - /// use std::rc::Rc;
190
+ - ///
191
+ - /// let r = Rc::new(7);
192
+ - /// let new = Rc::map(r, |i| i + 7);
193
+ - /// assert_eq!(*new, 14);
194
+ - /// ```
195
+ - #[cfg(not(no_global_oom_handling))]
196
+ - #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
197
+ - pub fn map<U>(this: Self, f: impl FnOnce(&T) -> U) -> Rc<U> {
198
+ - if size_of::<T>() == size_of::<U>()
199
+ - && align_of::<T>() == align_of::<U>()
200
+ - && Rc::is_unique(&this)
201
+ - {
202
+ - unsafe {
203
+ - let ptr = Rc::into_raw(this);
204
+ - let value = ptr.read();
205
+ - let mut allocation = Rc::from_raw(ptr.cast::<mem::MaybeUninit<U>>());
206
+ -
207
+ - Rc::get_mut_unchecked(&mut allocation).write(f(&value));
208
+ - allocation.assume_init()
209
+ - }
210
+ - } else {
211
+ - Rc::new(f(&*this))
212
+ - }
213
+ - }
214
+ -
215
+ - /// Attempts to map the value in an `Rc`, reusing the allocation if possible.
216
+ - ///
217
+ - /// `f` is called on a reference to the value in the `Rc`, and if the operation succeeds, the
218
+ - /// result is returned, also in an `Rc`.
219
+ - ///
220
+ - /// Note: this is an associated function, which means that you have
221
+ - /// to call it as `Rc::try_map(r, f)` instead of `r.try_map(f)`. This
222
+ - /// is so that there is no conflict with a method on the inner type.
223
+ - ///
224
+ - /// # Examples
225
+ - ///
226
+ - /// ```
227
+ - /// #![feature(smart_pointer_try_map)]
228
+ - ///
229
+ - /// use std::rc::Rc;
230
+ - ///
231
+ - /// let b = Rc::new(7);
232
+ - /// let new = Rc::try_map(b, |&i| u32::try_from(i)).unwrap();
233
+ - /// assert_eq!(*new, 7);
234
+ - /// ```
235
+ - #[cfg(not(no_global_oom_handling))]
236
+ - #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
237
+ - pub fn try_map<R>(
238
+ - this: Self,
239
+ - f: impl FnOnce(&T) -> R,
240
+ - ) -> <R::Residual as Residual<Rc<R::Output>>>::TryType
241
+ - where
242
+ - R: Try,
243
+ - R::Residual: Residual<Rc<R::Output>>,
244
+ - {
245
+ - if size_of::<T>() == size_of::<R::Output>()
246
+ - && align_of::<T>() == align_of::<R::Output>()
247
+ - && Rc::is_unique(&this)
248
+ - {
249
+ - unsafe {
250
+ - let ptr = Rc::into_raw(this);
251
+ - let value = ptr.read();
252
+ - let mut allocation = Rc::from_raw(ptr.cast::<mem::MaybeUninit<R::Output>>());
253
+ -
254
+ - Rc::get_mut_unchecked(&mut allocation).write(f(&value)?);
255
+ - try { allocation.assume_init() }
256
+ - }
257
+ - } else {
258
+ - try { Rc::new(f(&*this)?) }
259
+ - }
260
+ - }
261
+ }
262
+
263
+ impl<T, A: Allocator> Rc<T, A> {
264
+ @@ -1107,6 +1020,102 @@ impl<T, A: Allocator> Rc<T, A> {
265
+ pub fn into_inner(this: Self) -> Option<T> {
266
+ Rc::try_unwrap(this).ok()
267
+ }
268
+ +
269
+ + /// Maps the value in an `Rc`, reusing the allocation if possible.
270
+ + ///
271
+ + /// `f` is called on a reference to the value in the `Rc`, and the result is returned, also in
272
+ + /// an `Rc`.
273
+ + ///
274
+ + /// Note: this is an associated function, which means that you have
275
+ + /// to call it as `Rc::map(r, f)` instead of `r.map(f)`. This
276
+ + /// is so that there is no conflict with a method on the inner type.
277
+ + ///
278
+ + /// # Examples
279
+ + ///
280
+ + /// ```
281
+ + /// #![feature(smart_pointer_try_map)]
282
+ + ///
283
+ + /// use std::rc::Rc;
284
+ + ///
285
+ + /// let r = Rc::new(7);
286
+ + /// let new = Rc::map(r, |i| i + 7);
287
+ + /// assert_eq!(*new, 14);
288
+ + /// ```
289
+ + #[cfg(not(no_global_oom_handling))]
290
+ + #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
291
+ + pub fn map<U>(this: Self, f: impl FnOnce(&T) -> U) -> Rc<U, A> {
292
+ + if size_of::<T>() == size_of::<U>()
293
+ + && align_of::<T>() == align_of::<U>()
294
+ + && Rc::is_unique(&this)
295
+ + {
296
+ + unsafe {
297
+ + let (ptr, alloc) = Rc::into_raw_with_allocator(this);
298
+ + let value = ptr.read();
299
+ + let mut allocation = Rc::from_raw_in(ptr.cast::<mem::MaybeUninit<U>>(), alloc);
300
+ +
301
+ + Rc::get_mut_unchecked(&mut allocation).write(f(&value));
302
+ + allocation.assume_init()
303
+ + }
304
+ + } else {
305
+ + let output = f(&*this);
306
+ + let (ptr, alloc) = Rc::into_raw_with_allocator(this);
307
+ + unsafe { Rc::decrement_strong_count_in(ptr, &alloc) }
308
+ +
309
+ + Rc::new_in(output, alloc)
310
+ + }
311
+ + }
312
+ +
313
+ + /// Attempts to map the value in an `Rc`, reusing the allocation if possible.
314
+ + ///
315
+ + /// `f` is called on a reference to the value in the `Rc`, and if the operation succeeds, the
316
+ + /// result is returned, also in an `Rc`.
317
+ + ///
318
+ + /// Note: this is an associated function, which means that you have
319
+ + /// to call it as `Rc::try_map(r, f)` instead of `r.try_map(f)`. This
320
+ + /// is so that there is no conflict with a method on the inner type.
321
+ + ///
322
+ + /// # Examples
323
+ + ///
324
+ + /// ```
325
+ + /// #![feature(smart_pointer_try_map)]
326
+ + ///
327
+ + /// use std::rc::Rc;
328
+ + ///
329
+ + /// let b = Rc::new(7);
330
+ + /// let new = Rc::try_map(b, |&i| u32::try_from(i)).unwrap();
331
+ + /// assert_eq!(*new, 7);
332
+ + /// ```
333
+ + #[cfg(not(no_global_oom_handling))]
334
+ + #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
335
+ + pub fn try_map<R>(
336
+ + this: Self,
337
+ + f: impl FnOnce(&T) -> R,
338
+ + ) -> <R::Residual as Residual<Rc<R::Output, A>>>::TryType
339
+ + where
340
+ + R: Try,
341
+ + R::Residual: Residual<Rc<R::Output, A>>,
342
+ + {
343
+ + if size_of::<T>() == size_of::<R::Output>()
344
+ + && align_of::<T>() == align_of::<R::Output>()
345
+ + && Rc::is_unique(&this)
346
+ + {
347
+ + unsafe {
348
+ + let (ptr, alloc) = Rc::into_raw_with_allocator(this);
349
+ + let value = ptr.read();
350
+ + let mut allocation =
351
+ + Rc::from_raw_in(ptr.cast::<mem::MaybeUninit<R::Output>>(), alloc);
352
+ +
353
+ + Rc::get_mut_unchecked(&mut allocation).write(f(&value)?);
354
+ + try { allocation.assume_init() }
355
+ + }
356
+ + } else {
357
+ + let output = f(&*this)?;
358
+ + let (ptr, alloc) = Rc::into_raw_with_allocator(this);
359
+ + unsafe { Rc::decrement_strong_count_in(ptr, &alloc) }
360
+ +
361
+ + try { Rc::new_in(output, alloc) }
362
+ + }
363
+ + }
364
+ }
365
+
366
+ impl<T> Rc<[T]> {
367
+ diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs
368
+ index 625a29dd9b7a098bd339881a5106eaf5455c2d7a..e72449d670ed256a2769b3d3ca50b069614c4343 100644
369
+ --- a/library/alloc/src/sync.rs
370
+ +++ b/library/alloc/src/sync.rs
371
+ @@ -673,93 +673,6 @@ impl<T> Arc<T> {
372
+ )?))
373
+ }
374
+ }
375
+ -
376
+ - /// Maps the value in an `Arc`, reusing the allocation if possible.
377
+ - ///
378
+ - /// `f` is called on a reference to the value in the `Arc`, and the result is returned, also in
379
+ - /// an `Arc`.
380
+ - ///
381
+ - /// Note: this is an associated function, which means that you have
382
+ - /// to call it as `Arc::map(a, f)` instead of `r.map(a)`. This
383
+ - /// is so that there is no conflict with a method on the inner type.
384
+ - ///
385
+ - /// # Examples
386
+ - ///
387
+ - /// ```
388
+ - /// #![feature(smart_pointer_try_map)]
389
+ - ///
390
+ - /// use std::sync::Arc;
391
+ - ///
392
+ - /// let r = Arc::new(7);
393
+ - /// let new = Arc::map(r, |i| i + 7);
394
+ - /// assert_eq!(*new, 14);
395
+ - /// ```
396
+ - #[cfg(not(no_global_oom_handling))]
397
+ - #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
398
+ - pub fn map<U>(this: Self, f: impl FnOnce(&T) -> U) -> Arc<U> {
399
+ - if size_of::<T>() == size_of::<U>()
400
+ - && align_of::<T>() == align_of::<U>()
401
+ - && Arc::is_unique(&this)
402
+ - {
403
+ - unsafe {
404
+ - let ptr = Arc::into_raw(this);
405
+ - let value = ptr.read();
406
+ - let mut allocation = Arc::from_raw(ptr.cast::<mem::MaybeUninit<U>>());
407
+ -
408
+ - Arc::get_mut_unchecked(&mut allocation).write(f(&value));
409
+ - allocation.assume_init()
410
+ - }
411
+ - } else {
412
+ - Arc::new(f(&*this))
413
+ - }
414
+ - }
415
+ -
416
+ - /// Attempts to map the value in an `Arc`, reusing the allocation if possible.
417
+ - ///
418
+ - /// `f` is called on a reference to the value in the `Arc`, and if the operation succeeds, the
419
+ - /// result is returned, also in an `Arc`.
420
+ - ///
421
+ - /// Note: this is an associated function, which means that you have
422
+ - /// to call it as `Arc::try_map(a, f)` instead of `a.try_map(f)`. This
423
+ - /// is so that there is no conflict with a method on the inner type.
424
+ - ///
425
+ - /// # Examples
426
+ - ///
427
+ - /// ```
428
+ - /// #![feature(smart_pointer_try_map)]
429
+ - ///
430
+ - /// use std::sync::Arc;
431
+ - ///
432
+ - /// let b = Arc::new(7);
433
+ - /// let new = Arc::try_map(b, |&i| u32::try_from(i)).unwrap();
434
+ - /// assert_eq!(*new, 7);
435
+ - /// ```
436
+ - #[cfg(not(no_global_oom_handling))]
437
+ - #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
438
+ - pub fn try_map<R>(
439
+ - this: Self,
440
+ - f: impl FnOnce(&T) -> R,
441
+ - ) -> <R::Residual as Residual<Arc<R::Output>>>::TryType
442
+ - where
443
+ - R: Try,
444
+ - R::Residual: Residual<Arc<R::Output>>,
445
+ - {
446
+ - if size_of::<T>() == size_of::<R::Output>()
447
+ - && align_of::<T>() == align_of::<R::Output>()
448
+ - && Arc::is_unique(&this)
449
+ - {
450
+ - unsafe {
451
+ - let ptr = Arc::into_raw(this);
452
+ - let value = ptr.read();
453
+ - let mut allocation = Arc::from_raw(ptr.cast::<mem::MaybeUninit<R::Output>>());
454
+ -
455
+ - Arc::get_mut_unchecked(&mut allocation).write(f(&value)?);
456
+ - try { allocation.assume_init() }
457
+ - }
458
+ - } else {
459
+ - try { Arc::new(f(&*this)?) }
460
+ - }
461
+ - }
462
+ }
463
+
464
+ impl<T, A: Allocator> Arc<T, A> {
465
+ @@ -1263,6 +1176,102 @@ impl<T, A: Allocator> Arc<T, A> {
466
+
467
+ Some(inner)
468
+ }
469
+ +
470
+ + /// Maps the value in an `Arc`, reusing the allocation if possible.
471
+ + ///
472
+ + /// `f` is called on a reference to the value in the `Arc`, and the result is returned, also in
473
+ + /// an `Arc`.
474
+ + ///
475
+ + /// Note: this is an associated function, which means that you have
476
+ + /// to call it as `Arc::map(a, f)` instead of `r.map(a)`. This
477
+ + /// is so that there is no conflict with a method on the inner type.
478
+ + ///
479
+ + /// # Examples
480
+ + ///
481
+ + /// ```
482
+ + /// #![feature(smart_pointer_try_map)]
483
+ + ///
484
+ + /// use std::sync::Arc;
485
+ + ///
486
+ + /// let r = Arc::new(7);
487
+ + /// let new = Arc::map(r, |i| i + 7);
488
+ + /// assert_eq!(*new, 14);
489
+ + /// ```
490
+ + #[cfg(not(no_global_oom_handling))]
491
+ + #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
492
+ + pub fn map<U>(this: Self, f: impl FnOnce(&T) -> U) -> Arc<U, A> {
493
+ + if size_of::<T>() == size_of::<U>()
494
+ + && align_of::<T>() == align_of::<U>()
495
+ + && Arc::is_unique(&this)
496
+ + {
497
+ + unsafe {
498
+ + let (ptr, alloc) = Arc::into_raw_with_allocator(this);
499
+ + let value = ptr.read();
500
+ + let mut allocation = Arc::from_raw_in(ptr.cast::<mem::MaybeUninit<U>>(), alloc);
501
+ +
502
+ + Arc::get_mut_unchecked(&mut allocation).write(f(&value));
503
+ + allocation.assume_init()
504
+ + }
505
+ + } else {
506
+ + let output = f(&*this);
507
+ + let (ptr, alloc) = Arc::into_raw_with_allocator(this);
508
+ + unsafe { Arc::decrement_strong_count_in(ptr, &alloc) }
509
+ +
510
+ + Arc::new_in(output, alloc)
511
+ + }
512
+ + }
513
+ +
514
+ + /// Attempts to map the value in an `Arc`, reusing the allocation if possible.
515
+ + ///
516
+ + /// `f` is called on a reference to the value in the `Arc`, and if the operation succeeds, the
517
+ + /// result is returned, also in an `Arc`.
518
+ + ///
519
+ + /// Note: this is an associated function, which means that you have
520
+ + /// to call it as `Arc::try_map(a, f)` instead of `a.try_map(f)`. This
521
+ + /// is so that there is no conflict with a method on the inner type.
522
+ + ///
523
+ + /// # Examples
524
+ + ///
525
+ + /// ```
526
+ + /// #![feature(smart_pointer_try_map)]
527
+ + ///
528
+ + /// use std::sync::Arc;
529
+ + ///
530
+ + /// let b = Arc::new(7);
531
+ + /// let new = Arc::try_map(b, |&i| u32::try_from(i)).unwrap();
532
+ + /// assert_eq!(*new, 7);
533
+ + /// ```
534
+ + #[cfg(not(no_global_oom_handling))]
535
+ + #[unstable(feature = "smart_pointer_try_map", issue = "144419")]
536
+ + pub fn try_map<R>(
537
+ + this: Self,
538
+ + f: impl FnOnce(&T) -> R,
539
+ + ) -> <R::Residual as Residual<Arc<R::Output, A>>>::TryType
540
+ + where
541
+ + R: Try,
542
+ + R::Residual: Residual<Arc<R::Output, A>>,
543
+ + {
544
+ + if size_of::<T>() == size_of::<R::Output>()
545
+ + && align_of::<T>() == align_of::<R::Output>()
546
+ + && Arc::is_unique(&this)
547
+ + {
548
+ + unsafe {
549
+ + let (ptr, alloc) = Arc::into_raw_with_allocator(this);
550
+ + let value = ptr.read();
551
+ + let mut allocation =
552
+ + Arc::from_raw_in(ptr.cast::<mem::MaybeUninit<R::Output>>(), alloc);
553
+ +
554
+ + Arc::get_mut_unchecked(&mut allocation).write(f(&value)?);
555
+ + try { allocation.assume_init() }
556
+ + }
557
+ + } else {
558
+ + let output = f(&*this)?;
559
+ + let (ptr, alloc) = Arc::into_raw_with_allocator(this);
560
+ + unsafe { Arc::decrement_strong_count_in(ptr, &alloc) }
561
+ +
562
+ + try { Arc::new_in(output, alloc) }
563
+ + }
564
+ + }
565
+ }
566
+
567
+ impl<T> Arc<[T]> {
568
+ diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr
569
+ index 8df8346f772ba48245d3cfe5bcf93635579ca6d7..32525a41f946c3965f6ef734043f2390e3e363d5 100644
570
+ --- a/tests/ui/privacy/suggest-box-new.stderr
571
+ +++ b/tests/ui/privacy/suggest-box-new.stderr
572
+ @@ -147,10 +147,10 @@ LL - let _ = Box::<i32> {};
573
+ LL + let _ = Box::<i32>::new_in(_, _);
574
+ |
575
+ LL - let _ = Box::<i32> {};
576
+ -LL + let _ = Box::<i32>::map(_, _);
577
+ +LL + let _ = Box::<i32>::into_inner(_);
578
+ |
579
+ LL - let _ = Box::<i32> {};
580
+ -LL + let _ = Box::<i32>::into_inner(_);
581
+ +LL + let _ = Box::<i32>::map(_, _);
582
+ |
583
+ = and 7 other candidates
584
+ help: consider using the `Default` trait
patches/20261028T105419Z/rust-lang--rust-part011/b8dca7f7daf2eb91b65b3e0eeacf4c0ef49959c1.patch ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/intrinsic/mod.rs b/src/intrinsic/mod.rs
2
+ index 09ad3254e57146071d8b628b1a797ef5939c6953..b3b1bea68e0b42b3fc9a0089bb4c6ae59ca0c4da 100644
3
+ --- a/src/intrinsic/mod.rs
4
+ +++ b/src/intrinsic/mod.rs
5
+ @@ -171,7 +171,6 @@ fn f16_builtin<'gcc, 'tcx>(
6
+ sym::exp2f16 => "exp2f",
7
+ sym::fabs => "fabsf",
8
+ sym::floorf16 => "__builtin_floorf",
9
+ - sym::fmaf16 => "fmaf",
10
+ sym::logf16 => "logf",
11
+ sym::log2f16 => "log2f",
12
+ sym::log10f16 => "log10f",
13
+ @@ -249,7 +248,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
14
+ | sym::expf16
15
+ | sym::exp2f16
16
+ | sym::floorf16
17
+ - | sym::fmaf16
18
+ | sym::logf16
19
+ | sym::log2f16
20
+ | sym::log10f16
patches/20261028T105419Z/rust-lang--rust-part011/ba47895f5aee2ae4d79aa146ab7850948b743e33.patch ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_lints_internal/src/lib.rs b/clippy_lints_internal/src/lib.rs
2
+ index 2d06940981795b8859e9bd68804b124e14210b54..301d37153c94b16df9fd69f5a7b5ff7e4fe5e499 100644
3
+ --- a/clippy_lints_internal/src/lib.rs
4
+ +++ b/clippy_lints_internal/src/lib.rs
5
+ @@ -29,7 +29,6 @@ mod internal_paths;
6
+ mod lint_without_lint_pass;
7
+ mod msrv_attr_impl;
8
+ mod outer_expn_data_pass;
9
+ -mod produce_ice;
10
+ mod repeated_is_diagnostic_item;
11
+ mod symbols;
12
+ mod unnecessary_def_path;
13
+ @@ -47,7 +46,6 @@ static LINTS: &[&Lint] = &[
14
+ lint_without_lint_pass::MISSING_CLIPPY_VERSION_ATTRIBUTE,
15
+ msrv_attr_impl::MISSING_MSRV_ATTR_IMPL,
16
+ outer_expn_data_pass::OUTER_EXPN_EXPN_DATA,
17
+ - produce_ice::PRODUCE_ICE,
18
+ symbols::INTERNING_LITERALS,
19
+ symbols::SYMBOL_AS_STR,
20
+ unnecessary_def_path::UNNECESSARY_DEF_PATH,
21
+ @@ -61,7 +59,6 @@ pub fn register_lints(store: &mut LintStore) {
22
+ store.register_early_lint_pass(Box::new(|| {
23
+ Box::new(unsorted_clippy_utils_paths::UnsortedClippyUtilsPaths)
24
+ }));
25
+ - store.register_early_lint_pass(Box::new(|| Box::new(produce_ice::ProduceIce)));
26
+ store.register_late_lint_pass(Box::new(|_| Box::new(collapsible_span_lint_calls::CollapsibleCalls)));
27
+ store.register_late_lint_pass(Box::new(|_| Box::<symbols::Symbols>::default()));
28
+ store.register_late_lint_pass(Box::new(|_| {
29
+ diff --git a/clippy_lints_internal/src/produce_ice.rs b/clippy_lints_internal/src/produce_ice.rs
30
+ deleted file mode 100644
31
+ index 82a6bcdf36af60fffc3b7ab244d4d1540db58db9..0000000000000000000000000000000000000000
32
+ --- a/clippy_lints_internal/src/produce_ice.rs
33
+ +++ /dev/null
34
+ @@ -1,41 +0,0 @@
35
+ -use rustc_ast::ast::NodeId;
36
+ -use rustc_ast::visit::FnKind;
37
+ -use rustc_lint::{EarlyContext, EarlyLintPass, LintContext as _, declare_lint_pass, declare_tool_lint};
38
+ -use rustc_span::Span;
39
+ -
40
+ -declare_tool_lint! {
41
+ - /// ### What it does
42
+ - /// Not an actual lint. This lint is only meant for testing our customized internal compiler
43
+ - /// error message by calling `panic`.
44
+ - ///
45
+ - /// ### Why is this bad?
46
+ - /// ICE in large quantities can damage your teeth
47
+ - ///
48
+ - /// ### Example
49
+ - /// ```rust,ignore
50
+ - /// 🍦🍦🍦🍦🍦
51
+ - /// ```
52
+ - pub clippy::PRODUCE_ICE,
53
+ - Warn,
54
+ - "this message should not appear anywhere as we ICE before and don't emit the lint",
55
+ - report_in_external_macro: true
56
+ -}
57
+ -
58
+ -declare_lint_pass!(ProduceIce => [PRODUCE_ICE]);
59
+ -
60
+ -impl EarlyLintPass for ProduceIce {
61
+ - fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) {
62
+ - if is_trigger_fn(fn_kind) {
63
+ - cx.sess()
64
+ - .dcx()
65
+ - .span_delayed_bug(span, "Would you like some help with that?");
66
+ - }
67
+ - }
68
+ -}
69
+ -
70
+ -fn is_trigger_fn(fn_kind: FnKind<'_>) -> bool {
71
+ - match fn_kind {
72
+ - FnKind::Fn(_, _, func) => func.ident.name.as_str() == "it_looks_like_you_are_trying_to_kill_clippy",
73
+ - FnKind::Closure(..) => false,
74
+ - }
75
+ -}
76
+ diff --git a/tests/ui/custom_ice_message.rs b/tests/ui/custom_ice_message.rs
77
+ index c7e92b1bf164fdc5d88971a2381ad6e34c98f295..0102b9d76ecccddc39d356d165460e3aa023900e 100644
78
+ --- a/tests/ui/custom_ice_message.rs
79
+ +++ b/tests/ui/custom_ice_message.rs
80
+ @@ -1,15 +1,13 @@
81
+ //@rustc-env:RUST_BACKTRACE=0
82
+ //@normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo"
83
+ -//@normalize-stderr-test: "produce_ice.rs:\d*:\d*" -> "produce_ice.rs"
84
+ -//@normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints"
85
+ -//@normalize-stderr-test: "'rustc'" -> "'<unnamed>'"
86
+ +//@normalize-stderr-test: "custom_ice_message.rs:\d*:\d*" -> "custom_ice_message.rs"
87
+ //@normalize-stderr-test: "rustc 1\.\d+.* running on .*" -> "rustc <version> running on <target>"
88
+ //@normalize-stderr-test: "(?ms)query stack during panic:\n.*end of query stack\n" -> ""
89
+ +//@normalize-stderr-test: "note: delayed at .*" -> "note: delayed at <location>"
90
+ +//@normalize-stderr-test: "note: compiler flags: .*" -> "note: compiler flags: <flags>"
91
+
92
+ -#![deny(clippy::produce_ice)]
93
+ -#![allow(clippy::missing_clippy_version_attribute)]
94
+ -
95
+ -fn it_looks_like_you_are_trying_to_kill_clippy() {}
96
+ -//~^ ice: Would you like some help with that?
97
+ +#![feature(rustc_attrs)]
98
+
99
+ +#[rustc_delayed_bug_from_inside_query]
100
+ fn main() {}
101
+ +//~^ ice: delayed bug triggered by
102
+ diff --git a/tests/ui/custom_ice_message.stderr b/tests/ui/custom_ice_message.stderr
103
+ index c21963007c89e95219a74dabfb37dfe69edf00aa..5fc979cfaf67f36b86c55dbf25dd9de22af7c3c2 100644
104
+ --- a/tests/ui/custom_ice_message.stderr
105
+ +++ b/tests/ui/custom_ice_message.stderr
106
+ @@ -2,25 +2,23 @@ note: no errors encountered even though delayed bugs were created
107
+
108
+ note: those delayed bugs will now be shown as internal compiler errors
109
+
110
+ -error: internal compiler error: Would you like some help with that?
111
+ - --> tests/ui/custom_ice_message.rs:12:1
112
+ +error: internal compiler error: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
113
+ + --> tests/ui/custom_ice_message.rs
114
+ |
115
+ -LL | fn it_looks_like_you_are_trying_to_kill_clippy() {}
116
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
+ +LL | fn main() {}
118
+ + | ^^^^^^^^^
119
+ |
120
+ -note: delayed at clippy_lints_internal/src/produce_ice.rs - disabled backtrace
121
+ - --> tests/ui/custom_ice_message.rs:12:1
122
+ +note: delayed at <location>
123
+ + --> tests/ui/custom_ice_message.rs
124
+ |
125
+ -LL | fn it_looks_like_you_are_trying_to_kill_clippy() {}
126
+ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127
+ +LL | fn main() {}
128
+ + | ^^^^^^^^^
129
+
130
+ -note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml
131
+ -
132
+ -note: please make sure that you have updated to the latest nightly
133
+ +note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly
134
+
135
+ note: rustc <version> running on <target>
136
+
137
+ -note: compiler flags: -Z ui-testing -Z deduplicate-diagnostics=no -Z next-solver=coherence
138
+ +note: compiler flags: <flags>
139
+
140
+ note: Clippy version: foo
141
+
patches/20261028T105419Z/rust-lang--rust-part011/ba4efa6a5ab8987bff3a3a962cb45444050cbdec.patch ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/src/edit_lints.rs b/clippy_dev/src/edit_lints.rs
2
+ index 4ced81f5b1d3dc85f2cd26758ee7678cb282d131..078e0f2c6cd867d76ef211596fbc969183a79c39 100644
3
+ --- a/clippy_dev/src/edit_lints.rs
4
+ +++ b/clippy_dev/src/edit_lints.rs
5
+ @@ -1,10 +1,8 @@
6
+ use crate::parse::cursor::{self, Capture, Cursor};
7
+ -use crate::parse::{
8
+ - ActiveLint, DeprecatedLint, Lint, LintData, LintName, ParseCx, ParsedLints, RenamedLint, SourceFile, Span,
9
+ -};
10
+ +use crate::parse::{ActiveLint, DeprecatedLint, Lint, LintData, LintName, ParseCx, ParsedLints, RenamedLint};
11
+ use crate::utils::{
12
+ - ErrAction, FileUpdater, UpdateMode, UpdateStatus, Version, delete_dir_if_exists, delete_file_if_exists,
13
+ - expect_action, try_rename_dir, try_rename_file, walk_dir_no_dot_or_target,
14
+ + ErrAction, FileUpdater, SourceFile, Span, UpdateMode, UpdateStatus, Version, delete_dir_if_exists,
15
+ + delete_file_if_exists, expect_action, try_rename_dir, try_rename_file, walk_dir_no_dot_or_target,
16
+ };
17
+ use core::mem;
18
+ use rustc_lexer::TokenKind;
19
+ diff --git a/clippy_dev/src/fmt.rs b/clippy_dev/src/fmt.rs
20
+ index ea136417425ba3ec9aebac0d44044de648ab99cc..b479c4d70c9580c22aabf7ba67e837eae94dcf2c 100644
21
+ --- a/clippy_dev/src/fmt.rs
22
+ +++ b/clippy_dev/src/fmt.rs
23
+ @@ -1,8 +1,7 @@
24
+ use crate::generate::gen_sorted_lints_file;
25
+ use crate::new_parse_cx;
26
+ -use crate::parse::VecBuf;
27
+ use crate::utils::{
28
+ - ErrAction, FileUpdater, UpdateMode, UpdateStatus, expect_action, run_with_output, split_args_for_threads,
29
+ + ErrAction, FileUpdater, UpdateMode, UpdateStatus, VecBuf, expect_action, run_with_output, split_args_for_threads,
30
+ walk_dir_no_dot_or_target,
31
+ };
32
+ use itertools::Itertools as _;
33
+ diff --git a/clippy_dev/src/generate.rs b/clippy_dev/src/generate.rs
34
+ index fe11d87bf06553bdceb33402aa495c542bee4bb1..f250c92f455190bf1ebf5e596bd2e1496946cb72 100644
35
+ --- a/clippy_dev/src/generate.rs
36
+ +++ b/clippy_dev/src/generate.rs
37
+ @@ -1,6 +1,6 @@
38
+ use crate::parse::cursor::Cursor;
39
+ -use crate::parse::{LintData, LintPass, ParsedLints, VecBuf};
40
+ -use crate::utils::{FileUpdater, UpdateMode, UpdateStatus, slice_groups, update_text_region_fn};
41
+ +use crate::parse::{LintData, LintPass, ParsedLints};
42
+ +use crate::utils::{FileUpdater, UpdateMode, UpdateStatus, VecBuf, slice_groups, update_text_region_fn};
43
+ use core::range::Range;
44
+ use itertools::Itertools as _;
45
+ use std::collections::HashSet;
46
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
47
+ index 92edee2b37922b8fe7778c23783700ea76213969..95fb22accc079f46fc8b1b66425340cd99ba4939 100644
48
+ --- a/clippy_dev/src/parse.rs
49
+ +++ b/clippy_dev/src/parse.rs
50
+ @@ -1,85 +1,15 @@
51
+ pub mod cursor;
52
+
53
+ use self::cursor::{Capture, Cursor, IdentPat};
54
+ -use crate::utils::{ErrAction, File, Scoped, expect_action, slice_groups_mut, walk_dir_no_dot_or_target};
55
+ -use core::cell::Cell;
56
+ -use core::fmt::{self, Display, Write as _};
57
+ -use core::hash::{Hash, Hasher};
58
+ -use core::ptr;
59
+ +use crate::utils::{
60
+ + ErrAction, Scoped, SourceFile, Span, StrBuf, VecBuf, expect_action, slice_groups_mut, walk_dir_no_dot_or_target,
61
+ +};
62
+ +use core::fmt::{self, Display};
63
+ use core::range::Range;
64
+ use rustc_arena::{DroplessArena, TypedArena};
65
+ use rustc_data_structures::fx::FxHashMap;
66
+ -use std::str::pattern::Pattern;
67
+ use std::{fs, path};
68
+
69
+ -#[derive(Eq)]
70
+ -pub struct SourceFile<'cx> {
71
+ - // `cargo dev rename_lint` needs to be able to rename files.
72
+ - pub path: Cell<&'cx str>,
73
+ - pub contents: String,
74
+ -}
75
+ -impl<'cx> SourceFile<'cx> {
76
+ - pub fn load(path: &'cx str) -> Self {
77
+ - let mut contents = String::new();
78
+ - File::open_read(path).read_append_to_string(&mut contents);
79
+ - SourceFile {
80
+ - path: Cell::new(path),
81
+ - contents,
82
+ - }
83
+ - }
84
+ -
85
+ - /// Splits the file's path into the crate it's a part of and the module it implements.
86
+ - ///
87
+ - /// Only supports paths in the form `CRATE_NAME/src/PATH/TO/FILE.rs` using the current
88
+ - /// platform's path separator. The module path returned will use the current platform's
89
+ - /// path separator.
90
+ - pub fn path_as_krate_mod(&self) -> (&'cx str, &'cx str) {
91
+ - let path = self.path.get();
92
+ - let Some((krate, path)) = path.split_once(path::MAIN_SEPARATOR) else {
93
+ - return ("", "");
94
+ - };
95
+ - let module = if let Some(path) = path.strip_prefix("src")
96
+ - && let Some(path) = path.strip_prefix(path::MAIN_SEPARATOR)
97
+ - && let Some(path) = path.strip_suffix(".rs")
98
+ - {
99
+ - if path == "lib" {
100
+ - ""
101
+ - } else if let Some(path) = path.strip_suffix("mod")
102
+ - && let Some(path) = path.strip_suffix(path::MAIN_SEPARATOR)
103
+ - {
104
+ - path
105
+ - } else {
106
+ - path
107
+ - }
108
+ - } else {
109
+ - ""
110
+ - };
111
+ - (krate, module)
112
+ - }
113
+ -}
114
+ -impl PartialEq<SourceFile<'_>> for SourceFile<'_> {
115
+ - fn eq(&self, other: &SourceFile<'_>) -> bool {
116
+ - // We should only be creating one source file per path.
117
+ - ptr::addr_eq(self, other)
118
+ - }
119
+ -}
120
+ -impl Hash for SourceFile<'_> {
121
+ - fn hash<H: Hasher>(&self, state: &mut H) {
122
+ - ptr::hash(self, state);
123
+ - }
124
+ -}
125
+ -
126
+ -#[derive(Clone, Copy)]
127
+ -pub struct Span<'cx> {
128
+ - pub file: &'cx SourceFile<'cx>,
129
+ - pub range: Range<u32>,
130
+ -}
131
+ -impl<'cx> Span<'cx> {
132
+ - pub fn new(file: &'cx SourceFile<'cx>, range: Range<u32>) -> Self {
133
+ - Self { file, range }
134
+ - }
135
+ -}
136
+ -
137
+ pub struct ParseCxImpl<'cx> {
138
+ pub arena: &'cx DroplessArena,
139
+ pub source_files: &'cx TypedArena<SourceFile<'cx>>,
140
+ @@ -100,92 +30,6 @@ pub fn new_parse_cx<'env, T>(f: impl for<'cx> FnOnce(&'cx mut Scoped<'cx, 'env,
141
+ }))
142
+ }
143
+
144
+ -/// A string used as a temporary buffer used to avoid allocating for short lived strings.
145
+ -pub struct StrBuf(String);
146
+ -impl StrBuf {
147
+ - /// Creates a new buffer with the specified initial capacity.
148
+ - pub fn with_capacity(cap: usize) -> Self {
149
+ - Self(String::with_capacity(cap))
150
+ - }
151
+ -
152
+ - /// Allocates the result of formatting the given value onto the arena.
153
+ - pub fn alloc_display<'cx>(&mut self, arena: &'cx DroplessArena, value: impl Display) -> &'cx str {
154
+ - self.0.clear();
155
+ - write!(self.0, "{value}").expect("`Display` impl returned an error");
156
+ - arena.alloc_str(&self.0)
157
+ - }
158
+ -
159
+ - /// Allocates the string onto the arena with all ascii characters converted to
160
+ - /// lowercase.
161
+ - pub fn alloc_ascii_lower<'cx>(&mut self, arena: &'cx DroplessArena, s: &str) -> &'cx str {
162
+ - self.0.clear();
163
+ - self.0.push_str(s);
164
+ - self.0.make_ascii_lowercase();
165
+ - arena.alloc_str(&self.0)
166
+ - }
167
+ -
168
+ - /// Collects all elements into the buffer and allocates that onto the arena.
169
+ - pub fn alloc_collect<'cx, I>(&mut self, arena: &'cx DroplessArena, iter: I) -> &'cx str
170
+ - where
171
+ - I: IntoIterator,
172
+ - String: Extend<I::Item>,
173
+ - {
174
+ - self.0.clear();
175
+ - self.0.extend(iter);
176
+ - if self.0.is_empty() {
177
+ - ""
178
+ - } else {
179
+ - arena.alloc_str(&self.0)
180
+ - }
181
+ - }
182
+ -
183
+ - /// Allocates the result of replacing all instances the pattern with the given string
184
+ - /// onto the arena.
185
+ - pub fn alloc_replaced<'cx>(
186
+ - &mut self,
187
+ - arena: &'cx DroplessArena,
188
+ - s: &str,
189
+ - pat: impl Pattern,
190
+ - replacement: &str,
191
+ - ) -> &'cx str {
192
+ - let mut parts = s.split(pat);
193
+ - let Some(first) = parts.next() else {
194
+ - return "";
195
+ - };
196
+ - self.0.clear();
197
+ - self.0.push_str(first);
198
+ - for part in parts {
199
+ - self.0.push_str(replacement);
200
+ - self.0.push_str(part);
201
+ - }
202
+ - if self.0.is_empty() {
203
+ - ""
204
+ - } else {
205
+ - arena.alloc_str(&self.0)
206
+ - }
207
+ - }
208
+ -
209
+ - /// Performs an operation with the freshly cleared buffer.
210
+ - pub fn with<T>(&mut self, f: impl FnOnce(&mut String) -> T) -> T {
211
+ - self.0.clear();
212
+ - f(&mut self.0)
213
+ - }
214
+ -}
215
+ -
216
+ -pub struct VecBuf<T>(Vec<T>);
217
+ -impl<T> VecBuf<T> {
218
+ - /// Creates a new buffer with the specified initial capacity.
219
+ - pub fn with_capacity(cap: usize) -> Self {
220
+ - Self(Vec::with_capacity(cap))
221
+ - }
222
+ -
223
+ - /// Performs an operation with the freshly cleared buffer.
224
+ - pub fn with<R>(&mut self, f: impl FnOnce(&mut Vec<T>) -> R) -> R {
225
+ - self.0.clear();
226
+ - f(&mut self.0)
227
+ - }
228
+ -}
229
+ -
230
+ #[derive(Clone, Copy, PartialEq, Eq, Hash)]
231
+ pub enum LintTool {
232
+ Rustc,
233
+ diff --git a/clippy_dev/src/utils.rs b/clippy_dev/src/utils.rs
234
+ index f10540e98ca74b07d8fd9c435c904f8be251b3b3..d3e95ffb87b40c4148a2ccbf85906a85bb4574d9 100644
235
+ --- a/clippy_dev/src/utils.rs
236
+ +++ b/clippy_dev/src/utils.rs
237
+ @@ -1,20 +1,22 @@
238
+ -use core::fmt::{self, Display};
239
+ +use core::cell::Cell;
240
+ +use core::fmt::{self, Display, Write as _};
241
+ +use core::hash::{Hash, Hasher};
242
+ use core::marker::PhantomData;
243
+ -use core::mem;
244
+ use core::num::NonZero;
245
+ use core::ops::{Deref, DerefMut};
246
+ use core::range::Range;
247
+ use core::str::FromStr;
248
+ +use core::str::pattern::Pattern;
249
+ +use core::{mem, ptr};
250
+ +use rustc_arena::DroplessArena;
251
+ use std::ffi::OsStr;
252
+ use std::fs::{self, OpenOptions};
253
+ use std::io::{self, Read as _, Seek as _, SeekFrom, Write as _};
254
+ -use std::path::{Path, PathBuf};
255
+ +use std::path::{self, Path, PathBuf};
256
+ use std::process::{self, Command, Stdio};
257
+ use std::{env, thread};
258
+ use walkdir::WalkDir;
259
+
260
+ -use crate::parse::SourceFile;
261
+ -
262
+ pub struct Scoped<'inner, 'outer: 'inner, T>(T, PhantomData<&'inner mut T>, PhantomData<&'outer mut ()>);
263
+ impl<T> Scoped<'_, '_, T> {
264
+ pub fn new(value: T) -> Self {
265
+ @@ -698,3 +700,165 @@ pub fn slice_groups_mut<T>(
266
+ }
267
+ I { slice, split_idx }
268
+ }
269
+ +
270
+ +/// A string used as a temporary buffer used to avoid allocating for short lived strings.
271
+ +pub struct StrBuf(String);
272
+ +impl StrBuf {
273
+ + /// Creates a new buffer with the specified initial capacity.
274
+ + pub fn with_capacity(cap: usize) -> Self {
275
+ + Self(String::with_capacity(cap))
276
+ + }
277
+ +
278
+ + /// Allocates the result of formatting the given value onto the arena.
279
+ + pub fn alloc_display<'cx>(&mut self, arena: &'cx DroplessArena, value: impl Display) -> &'cx str {
280
+ + self.0.clear();
281
+ + write!(self.0, "{value}").expect("`Display` impl returned an error");
282
+ + if self.0.is_empty() {
283
+ + ""
284
+ + } else {
285
+ + arena.alloc_str(&self.0)
286
+ + }
287
+ + }
288
+ +
289
+ + /// Allocates the string onto the arena with all ascii characters converted to
290
+ + /// lowercase.
291
+ + pub fn alloc_ascii_lower<'cx>(&mut self, arena: &'cx DroplessArena, s: &str) -> &'cx str {
292
+ + self.0.clear();
293
+ + self.0.push_str(s);
294
+ + self.0.make_ascii_lowercase();
295
+ + if self.0.is_empty() {
296
+ + ""
297
+ + } else {
298
+ + arena.alloc_str(&self.0)
299
+ + }
300
+ + }
301
+ +
302
+ + /// Collects all elements into the buffer and allocates that onto the arena.
303
+ + pub fn alloc_collect<'cx, I>(&mut self, arena: &'cx DroplessArena, iter: I) -> &'cx str
304
+ + where
305
+ + I: IntoIterator,
306
+ + String: Extend<I::Item>,
307
+ + {
308
+ + self.0.clear();
309
+ + self.0.extend(iter);
310
+ + if self.0.is_empty() {
311
+ + ""
312
+ + } else {
313
+ + arena.alloc_str(&self.0)
314
+ + }
315
+ + }
316
+ +
317
+ + /// Allocates the result of replacing all instances the pattern with the given string
318
+ + /// onto the arena.
319
+ + pub fn alloc_replaced<'cx>(
320
+ + &mut self,
321
+ + arena: &'cx DroplessArena,
322
+ + s: &str,
323
+ + pat: impl Pattern,
324
+ + replacement: &str,
325
+ + ) -> &'cx str {
326
+ + let mut parts = s.split(pat);
327
+ + let Some(first) = parts.next() else {
328
+ + return "";
329
+ + };
330
+ + self.0.clear();
331
+ + self.0.push_str(first);
332
+ + for part in parts {
333
+ + self.0.push_str(replacement);
334
+ + self.0.push_str(part);
335
+ + }
336
+ + if self.0.is_empty() {
337
+ + ""
338
+ + } else {
339
+ + arena.alloc_str(&self.0)
340
+ + }
341
+ + }
342
+ +
343
+ + /// Performs an operation with the freshly cleared buffer.
344
+ + pub fn with<T>(&mut self, f: impl FnOnce(&mut String) -> T) -> T {
345
+ + self.0.clear();
346
+ + f(&mut self.0)
347
+ + }
348
+ +}
349
+ +
350
+ +pub struct VecBuf<T>(Vec<T>);
351
+ +impl<T> VecBuf<T> {
352
+ + /// Creates a new buffer with the specified initial capacity.
353
+ + pub fn with_capacity(cap: usize) -> Self {
354
+ + Self(Vec::with_capacity(cap))
355
+ + }
356
+ +
357
+ + /// Performs an operation with the freshly cleared buffer.
358
+ + pub fn with<R>(&mut self, f: impl FnOnce(&mut Vec<T>) -> R) -> R {
359
+ + self.0.clear();
360
+ + f(&mut self.0)
361
+ + }
362
+ +}
363
+ +
364
+ +#[derive(Eq)]
365
+ +pub struct SourceFile<'cx> {
366
+ + // `cargo dev rename_lint` needs to be able to rename files.
367
+ + pub path: Cell<&'cx str>,
368
+ + pub contents: String,
369
+ +}
370
+ +impl<'cx> SourceFile<'cx> {
371
+ + pub fn load(path: &'cx str) -> Self {
372
+ + let mut contents = String::new();
373
+ + File::open_read(path).read_append_to_string(&mut contents);
374
+ + SourceFile {
375
+ + path: Cell::new(path),
376
+ + contents,
377
+ + }
378
+ + }
379
+ +
380
+ + /// Splits the file's path into the crate it's a part of and the module it implements.
381
+ + ///
382
+ + /// Only supports paths in the form `CRATE_NAME/src/PATH/TO/FILE.rs` using the current
383
+ + /// platform's path separator. The module path returned will use the current platform's
384
+ + /// path separator.
385
+ + pub fn path_as_krate_mod(&self) -> (&'cx str, &'cx str) {
386
+ + let path = self.path.get();
387
+ + let Some((krate, path)) = path.split_once(path::MAIN_SEPARATOR) else {
388
+ + return ("", "");
389
+ + };
390
+ + let module = if let Some(path) = path.strip_prefix("src")
391
+ + && let Some(path) = path.strip_prefix(path::MAIN_SEPARATOR)
392
+ + && let Some(path) = path.strip_suffix(".rs")
393
+ + {
394
+ + if path == "lib" {
395
+ + ""
396
+ + } else if let Some(path) = path.strip_suffix("mod")
397
+ + && let Some(path) = path.strip_suffix(path::MAIN_SEPARATOR)
398
+ + {
399
+ + path
400
+ + } else {
401
+ + path
402
+ + }
403
+ + } else {
404
+ + ""
405
+ + };
406
+ + (krate, module)
407
+ + }
408
+ +}
409
+ +impl PartialEq<SourceFile<'_>> for SourceFile<'_> {
410
+ + fn eq(&self, other: &SourceFile<'_>) -> bool {
411
+ + // We should only be creating one source file per path.
412
+ + ptr::addr_eq(self, other)
413
+ + }
414
+ +}
415
+ +impl Hash for SourceFile<'_> {
416
+ + fn hash<H: Hasher>(&self, state: &mut H) {
417
+ + ptr::hash(self, state);
418
+ + }
419
+ +}
420
+ +
421
+ +#[derive(Clone, Copy)]
422
+ +pub struct Span<'cx> {
423
+ + pub file: &'cx SourceFile<'cx>,
424
+ + pub range: Range<u32>,
425
+ +}
426
+ +impl<'cx> Span<'cx> {
427
+ + pub fn new(file: &'cx SourceFile<'cx>, range: Range<u32>) -> Self {
428
+ + Self { file, range }
429
+ + }
430
+ +}
patches/20261028T105419Z/rust-lang--rust-part011/bceece16f135c3862071c51ebabf7d4e42114e35.patch ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
2
+ index bd1ad70fe6a1426882505480e825f479593916b6..44f410408a40a22aeee96517233852be11e31204 100644
3
+ --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
4
+ +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
5
+ @@ -491,6 +491,12 @@ impl<'db> MirLowerCtx<'_, 'db> {
6
+ )?
7
+ }
8
+ Pat::Ref { pat, mutability: _ } => {
9
+ + let ty = cond_place.ty(&self.result, &self.infcx, self.env).ty;
10
+ + if !ty.is_ref() {
11
+ + return Err(MirLowerError::TypeError(
12
+ + "non reference type matched with reference pattern",
13
+ + ));
14
+ + }
15
+ let cond_place = cond_place.project(ProjectionElem::Deref);
16
+ self.pattern_match_inner(current, current_else, cond_place, *pat, mode)?
17
+ }
18
+ diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs
19
+ index 1f6aa5c926b152448c2a1e737864e93f0cccdde1..e4f3b61be4556412eea887d5db2e7953fc6acbab 100644
20
+ --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs
21
+ +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs
22
+ @@ -49,3 +49,19 @@ fn foo() {
23
+ "#,
24
+ );
25
+ }
26
+ +
27
+ +#[test]
28
+ +fn ref_pattern_on_unresolved_alias() {
29
+ + lower_mir(
30
+ + r#"
31
+ +//- minicore: sized
32
+ +trait Tr {
33
+ + type A;
34
+ +}
35
+ +
36
+ +fn f<T: Tr>(x: T::A) {
37
+ + let &() = x;
38
+ +}
39
+ +"#,
40
+ + );
41
+ +}
patches/20261028T105419Z/rust-lang--rust-part011/bedeb1e61284f000f0958bc3c04da7b68ef4abb3.patch ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_dev/src/parse.rs b/clippy_dev/src/parse.rs
2
+ index d4e7fdfdba52175945e3961f44d2aa59dd07946b..2bc30b61d346a0d5237e710cc99b1bb265266635 100644
3
+ --- a/clippy_dev/src/parse.rs
4
+ +++ b/clippy_dev/src/parse.rs
5
+ @@ -354,22 +354,18 @@ impl<'cx> ParseCxImpl<'cx> {
6
+ #[rustfmt::skip]
7
+ static LINT_DECL_TOKENS: &[cursor::Pat] = &[
8
+ // !{ /// docs
9
+ - Bang, OpenBrace, AnyComment,
10
+ + Bang, OpenBrace, AnyComments,
11
+ // #[clippy::version = "version"]
12
+ Pound, OpenBracket, Ident(IdentPat::clippy), DoubleColon,
13
+ Ident(IdentPat::version), Eq, LitStr, CloseBracket,
14
+ // pub NAME, GROUP,
15
+ - Ident(IdentPat::r#pub), CaptureIdent, Comma, AnyComment, CaptureIdent, Comma,
16
+ - ];
17
+ - #[rustfmt::skip]
18
+ - static PASS_DECL_TOKENS: &[cursor::Pat] = &[
19
+ - // !( NAME <'lt> => [
20
+ - Bang, OpenParen, CaptureDocLines, CaptureIdent, CaptureOptLifetimeArg, FatArrow, OpenBracket,
21
+ + Ident(IdentPat::r#pub), CaptureIdent, Comma, AnyComments, CaptureIdent, Comma,
22
+ ];
23
+
24
+ let mut cursor = Cursor::new(&file.contents);
25
+ let mut captures = [Capture::EMPTY; 3];
26
+ while let Some(mac_name) = cursor.find_any_ident() {
27
+ + captures[1] = Capture::EMPTY;
28
+ match cursor.get_text(mac_name) {
29
+ "declare_clippy_lint"
30
+ if cursor.match_all(LINT_DECL_TOKENS, &mut captures) && cursor.find_pat(CloseBrace) =>
31
+ @@ -387,7 +383,11 @@ impl<'cx> ParseCxImpl<'cx> {
32
+ .is_none()
33
+ );
34
+ },
35
+ - mac @ ("declare_lint_pass" | "impl_lint_pass") if cursor.match_all(PASS_DECL_TOKENS, &mut captures) => {
36
+ + mac @ ("declare_lint_pass" | "impl_lint_pass")
37
+ + if cursor.match_all(&[Bang, OpenParen, CaptureDocLines, CaptureIdent], &mut captures)
38
+ + && cursor.opt_match_all(&[Lt, CaptureLifetime, Gt], &mut captures[2..])
39
+ + && cursor.match_all(&[FatArrow, OpenBracket], &mut captures) =>
40
+ + {
41
+ let mac = if matches!(mac, "declare_lint_pass") {
42
+ LintPassMac::Declare
43
+ } else {
44
+ diff --git a/clippy_dev/src/parse/cursor.rs b/clippy_dev/src/parse/cursor.rs
45
+ index 5a30931040a323383ecca651979c70934ca49d3c..c7ad710f8d20987f68877db73ad9b10796c698ae 100644
46
+ --- a/clippy_dev/src/parse/cursor.rs
47
+ +++ b/clippy_dev/src/parse/cursor.rs
48
+ @@ -1,4 +1,4 @@
49
+ -use core::slice;
50
+ +use core::{ptr, slice};
51
+ use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind};
52
+
53
+ /// A token pattern used for searching and matching by the [`Cursor`].
54
+ @@ -9,12 +9,11 @@ use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind};
55
+ /// the `*`.
56
+ #[derive(Clone, Copy)]
57
+ pub enum Pat {
58
+ - Ident(IdentPat),
59
+ /// Matches any number of comments and doc comments.
60
+ - AnyComment,
61
+ + AnyComments,
62
+ CaptureDocLines,
63
+ CaptureIdent,
64
+ - LitStr,
65
+ + CaptureLifetime,
66
+ CaptureLitStr,
67
+ Bang,
68
+ CloseBrace,
69
+ @@ -24,13 +23,14 @@ pub enum Pat {
70
+ DoubleColon,
71
+ Eq,
72
+ FatArrow,
73
+ + Gt,
74
+ + Ident(IdentPat),
75
+ Lifetime,
76
+ + LitStr,
77
+ Lt,
78
+ - Gt,
79
+ OpenBrace,
80
+ OpenBracket,
81
+ OpenParen,
82
+ - CaptureOptLifetimeArg,
83
+ Pound,
84
+ Semi,
85
+ }
86
+ @@ -145,14 +145,13 @@ impl<'txt> Cursor<'txt> {
87
+ ///
88
+ /// For each capture made by the pattern one item will be taken from the capture
89
+ /// sequence with the result placed inside.
90
+ - #[expect(clippy::too_many_lines)]
91
+ fn match_impl(&mut self, pat: Pat, captures: &mut slice::IterMut<'_, Capture>) -> bool {
92
+ loop {
93
+ match (pat, self.next_token.kind) {
94
+ #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/6697
95
+ (_, TokenKind::Whitespace)
96
+ | (
97
+ - Pat::AnyComment,
98
+ + Pat::AnyComments,
99
+ TokenKind::BlockComment { terminated: true, .. } | TokenKind::LineComment { .. },
100
+ ) => self.step(),
101
+ (Pat::Bang, TokenKind::Bang)
102
+ @@ -199,34 +198,6 @@ impl<'txt> Cursor<'txt> {
103
+ }
104
+ return false;
105
+ },
106
+ - (Pat::CaptureOptLifetimeArg, TokenKind::Lt) => {
107
+ - self.step();
108
+ - loop {
109
+ - match self.next_token.kind {
110
+ - TokenKind::Lifetime { .. } => break,
111
+ - TokenKind::Whitespace => self.step(),
112
+ - _ => return false,
113
+ - }
114
+ - }
115
+ - *captures.next().unwrap() = Capture {
116
+ - pos: self.pos,
117
+ - len: self.next_token.len,
118
+ - };
119
+ - self.step();
120
+ - loop {
121
+ - match self.next_token.kind {
122
+ - TokenKind::Gt => break,
123
+ - TokenKind::Whitespace => self.step(),
124
+ - _ => return false,
125
+ - }
126
+ - }
127
+ - self.step();
128
+ - return true;
129
+ - },
130
+ - (Pat::CaptureOptLifetimeArg, _) => {
131
+ - *captures.next().unwrap() = Capture { pos: 0, len: 0 };
132
+ - return true;
133
+ - },
134
+ #[rustfmt::skip]
135
+ (
136
+ Pat::CaptureLitStr,
137
+ @@ -237,7 +208,8 @@ impl<'txt> Cursor<'txt> {
138
+ ..
139
+ },
140
+ )
141
+ - | (Pat::CaptureIdent, TokenKind::Ident) => {
142
+ + | (Pat::CaptureIdent, TokenKind::Ident)
143
+ + | (Pat::CaptureLifetime, TokenKind::Lifetime { .. }) => {
144
+ *captures.next().unwrap() = Capture { pos: self.pos, len: self.next_token.len };
145
+ self.step();
146
+ return true;
147
+ @@ -263,7 +235,7 @@ impl<'txt> Cursor<'txt> {
148
+ *captures.next().unwrap() = Capture::EMPTY;
149
+ return true;
150
+ },
151
+ - (Pat::AnyComment, _) => return true,
152
+ + (Pat::AnyComments, _) => return true,
153
+ _ => return false,
154
+ }
155
+ }
156
+ @@ -375,6 +347,24 @@ impl<'txt> Cursor<'txt> {
157
+ pats.iter().all(|&p| self.match_impl(p, &mut captures))
158
+ }
159
+
160
+ + /// Attempts to match a sequence of patterns at the current position. Returns whether
161
+ + /// all patterns were successfully matched.
162
+ + ///
163
+ + /// Captures will be written to the given slice in the order they're matched. If a
164
+ + /// capture is matched, but there are no more capture slots this will panic. If the
165
+ + /// match is completed without filling all the capture slots they will be left
166
+ + /// unmodified.
167
+ + ///
168
+ + /// If the match fails the cursor will be positioned at the first failing token.
169
+ + #[must_use]
170
+ + pub fn opt_match_all(&mut self, pats: &[Pat], captures: &mut [Capture]) -> bool {
171
+ + let mut captures = captures.iter_mut();
172
+ + pats.iter()
173
+ + .try_for_each(|p| self.match_impl(*p, &mut captures).ok_or(p))
174
+ + .err()
175
+ + .is_none_or(|p| ptr::addr_eq(pats.as_ptr(), p))
176
+ + }
177
+ +
178
+ /// Attempts to match a single pattern at the current position. Returns whether the
179
+ /// pattern was successfully matched.
180
+ ///
patches/20261028T105419Z/rust-lang--rust-part011/d02b65b54d71567d7cc1d668a4524aab9b5eb33c.patch ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/book/src/lint_configuration.md b/book/src/lint_configuration.md
2
+ index a782f4aca6c53a49e2b483d8931b957556b59074..f323d7040d260c99e24fa063996ddaa171b58d18 100644
3
+ --- a/book/src/lint_configuration.md
4
+ +++ b/book/src/lint_configuration.md
5
+ @@ -907,7 +907,7 @@ crate. For example, `pub(crate)` items.
6
+ ## `module-item-order-groupings`
7
+ The named groupings of different source item kinds within modules.
8
+
9
+ -**Default Value:** `[["modules", ["extern_crate", "mod", "foreign_mod"]], ["use", ["use"]], ["macros", ["macro"]], ["global_asm", ["global_asm"]], ["UPPER_SNAKE_CASE", ["static", "const"]], ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl"]], ["lower_snake_case", ["fn"]]]`
10
+ +**Default Value:** `[["modules", ["extern_crate", "mod", "foreign_mod"]], ["use", ["use"]], ["macros", ["macro"]], ["global_asm", ["global_asm"]], ["UPPER_SNAKE_CASE", ["static", "const"]], ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl", "test_binder_constraints"]], ["lower_snake_case", ["fn"]]]`
11
+
12
+ ---
13
+ **Affected lints:**
14
+ diff --git a/clippy_config/src/types.rs b/clippy_config/src/types.rs
15
+ index 4dc2549c6e233d130cb123f0f300b42aa603c232..fd602e4ca5b25b585e9cc23f9990433717d99208 100644
16
+ --- a/clippy_config/src/types.rs
17
+ +++ b/clippy_config/src/types.rs
18
+ @@ -459,6 +459,7 @@ conf_enum! {
19
+ TraitAlias("trait_alias"),
20
+ Impl("impl"),
21
+ Fn("fn"),
22
+ + TestBinderConstraints("test_binder_constraints"),
23
+ }
24
+ }
25
+
26
+ @@ -483,6 +484,7 @@ impl SourceItemOrderingModuleItemKind {
27
+ TraitAlias,
28
+ Impl,
29
+ Fn,
30
+ + TestBinderConstraints,
31
+ ]
32
+ }
33
+ }
34
+ @@ -648,6 +650,7 @@ impl FromDefault<()> for SourceItemOrderingModuleItemGroupings {
35
+ SourceItemOrderingModuleItemKind::Trait,
36
+ SourceItemOrderingModuleItemKind::TraitAlias,
37
+ SourceItemOrderingModuleItemKind::Impl,
38
+ + SourceItemOrderingModuleItemKind::TestBinderConstraints,
39
+ ],
40
+ ),
41
+ ("lower_snake_case".into(), vec![SourceItemOrderingModuleItemKind::Fn]),
42
+ @@ -668,6 +671,7 @@ impl FromDefault<()> for SourceItemOrderingModuleItemGroupings {
43
+ (SourceItemOrderingModuleItemKind::Trait, 5),
44
+ (SourceItemOrderingModuleItemKind::TraitAlias, 5),
45
+ (SourceItemOrderingModuleItemKind::Impl, 5),
46
+ + (SourceItemOrderingModuleItemKind::TestBinderConstraints, 5),
47
+ (SourceItemOrderingModuleItemKind::Fn, 6),
48
+ ]),
49
+ back_lut: HashMap::from_iter([
50
+ @@ -686,12 +690,16 @@ impl FromDefault<()> for SourceItemOrderingModuleItemGroupings {
51
+ (SourceItemOrderingModuleItemKind::Trait, "PascalCase".into()),
52
+ (SourceItemOrderingModuleItemKind::TraitAlias, "PascalCase".into()),
53
+ (SourceItemOrderingModuleItemKind::Impl, "PascalCase".into()),
54
+ + (
55
+ + SourceItemOrderingModuleItemKind::TestBinderConstraints,
56
+ + "PascalCase".into(),
57
+ + ),
58
+ (SourceItemOrderingModuleItemKind::Fn, "lower_snake_case".into()),
59
+ ]),
60
+ }
61
+ }
62
+ fn display_default((): ()) -> impl Display {
63
+ - r#"[["modules", ["extern_crate", "mod", "foreign_mod"]], ["use", ["use"]], ["macros", ["macro"]], ["global_asm", ["global_asm"]], ["UPPER_SNAKE_CASE", ["static", "const"]], ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl"]], ["lower_snake_case", ["fn"]]]"#
64
+ + r#"[["modules", ["extern_crate", "mod", "foreign_mod"]], ["use", ["use"]], ["macros", ["macro"]], ["global_asm", ["global_asm"]], ["UPPER_SNAKE_CASE", ["static", "const"]], ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl", "test_binder_constraints"]], ["lower_snake_case", ["fn"]]]"#
65
+ }
66
+ }
67
+ impl DeserializeOrDefault<()> for SourceItemOrderingModuleItemGroupings {
68
+ diff --git a/clippy_lints/src/arbitrary_source_item_ordering.rs b/clippy_lints/src/arbitrary_source_item_ordering.rs
69
+ index 73b63697d844d3d054a72514b4f28f63dfdbebe2..65ef6f63e9777df68164e2c4ec38f5e0ab33a258 100644
70
+ --- a/clippy_lints/src/arbitrary_source_item_ordering.rs
71
+ +++ b/clippy_lints/src/arbitrary_source_item_ordering.rs
72
+ @@ -630,6 +630,7 @@ fn convert_module_item_kind(value: &ItemKind<'_>) -> SourceItemOrderingModuleIte
73
+ ItemKind::Trait { .. } => Trait,
74
+ ItemKind::TraitAlias(..) => TraitAlias,
75
+ ItemKind::Impl(..) => Impl,
76
+ + ItemKind::TestBinderConstraints { .. } => TestBinderConstraints,
77
+ }
78
+ }
79
+
80
+ diff --git a/clippy_lints/src/definition_in_module_root.rs b/clippy_lints/src/definition_in_module_root.rs
81
+ index 14c440abfd98239ec10b77400fa18521db9ae40c..035f2160de21ae17aac49dded4c45c49db41914f 100644
82
+ --- a/clippy_lints/src/definition_in_module_root.rs
83
+ +++ b/clippy_lints/src/definition_in_module_root.rs
84
+ @@ -139,7 +139,8 @@ fn definition_kind(item: &ast::Item) -> Option<&'static str> {
85
+ | ItemKind::MacCall(..)
86
+ | ItemKind::MacroDef(..)
87
+ | ItemKind::Delegation(..)
88
+ - | ItemKind::DelegationMac(..) => None,
89
+ + | ItemKind::DelegationMac(..)
90
+ + | ItemKind::TestBinderConstraints(..) => None,
91
+ }
92
+ }
93
+
94
+ diff --git a/clippy_lints/src/item_name_repetitions.rs b/clippy_lints/src/item_name_repetitions.rs
95
+ index a78faf0be976a33169c81237149a3602d9980425..8c604aadc811e00be5a7519a14d14d8fdf94b21a 100644
96
+ --- a/clippy_lints/src/item_name_repetitions.rs
97
+ +++ b/clippy_lints/src/item_name_repetitions.rs
98
+ @@ -533,7 +533,11 @@ impl LateLintPass<'_> for ItemNameRepetitions {
99
+ | ItemKind::Union(ident, ..)
100
+ | ItemKind::Use(_, UseKind::Single(ident)) => ident,
101
+
102
+ - ItemKind::ForeignMod { .. } | ItemKind::GlobalAsm { .. } | ItemKind::Impl(_) | ItemKind::Use(..) => return,
103
+ + ItemKind::ForeignMod { .. }
104
+ + | ItemKind::GlobalAsm { .. }
105
+ + | ItemKind::Impl(_)
106
+ + | ItemKind::Use(..)
107
+ + | ItemKind::TestBinderConstraints { .. } => return,
108
+ };
109
+
110
+ let item_name = ident.name.as_str();
111
+ diff --git a/clippy_lints/src/manual_float_methods.rs b/clippy_lints/src/manual_float_methods.rs
112
+ index 38359500434928a1165b76a1d54563ae6b353dff..5e1d12179aacd873a1096616842e8355de9ec7b4 100644
113
+ --- a/clippy_lints/src/manual_float_methods.rs
114
+ +++ b/clippy_lints/src/manual_float_methods.rs
115
+ @@ -118,7 +118,8 @@ fn is_not_const(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
116
+ | DefKind::Impl { .. }
117
+ | DefKind::OpaqueTy
118
+ | DefKind::SyntheticCoroutineBody
119
+ - | DefKind::TyParam => true,
120
+ + | DefKind::TyParam
121
+ + | DefKind::TestBinderConstraints => true,
122
+
123
+ DefKind::AnonConst
124
+ | DefKind::Const { .. }
125
+ diff --git a/clippy_lints/src/min_ident_chars.rs b/clippy_lints/src/min_ident_chars.rs
126
+ index 28fd8b33b71032fd96d401a6094904067f06c0a9..e5a292806259d548d79b177be322918d62e4467e 100644
127
+ --- a/clippy_lints/src/min_ident_chars.rs
128
+ +++ b/clippy_lints/src/min_ident_chars.rs
129
+ @@ -142,7 +142,8 @@ impl LateLintPass<'_> for MinIdentChars {
130
+ | ItemKind::ForeignMod { .. }
131
+ | ItemKind::GlobalAsm { .. }
132
+ | ItemKind::Impl(_)
133
+ - | ItemKind::Use(..) => return,
134
+ + | ItemKind::Use(..)
135
+ + | ItemKind::TestBinderConstraints { .. } => return,
136
+ };
137
+ if let Some(missing) = self.check_sym(ident.name)
138
+ && !(matches!(i.kind, ItemKind::Fn { .. })
139
+ diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs
140
+ index 30d88207b863720ffb003acc5329a0ae60a4e7b0..51423b9811fcbc0e518eed82ec0388ce800462d1 100644
141
+ --- a/clippy_lints/src/missing_doc.rs
142
+ +++ b/clippy_lints/src/missing_doc.rs
143
+ @@ -140,7 +140,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
144
+ ItemKind::ExternCrate(..)
145
+ | ItemKind::ForeignMod { .. }
146
+ | ItemKind::GlobalAsm { .. }
147
+ - | ItemKind::Use(..) => return,
148
+ + | ItemKind::Use(..)
149
+ + | ItemKind::TestBinderConstraints { .. } => return,
150
+
151
+ ItemKind::Mod(ident, ..) => {
152
+ if item.span.from_expansion() && item.span.eq_ctxt(ident.span) {
153
+ diff --git a/clippy_utils/src/check_proc_macro.rs b/clippy_utils/src/check_proc_macro.rs
154
+ index cbbbca7e60388945c018422e86c7fcf4de126bfe..4cf8b680955272823486724f22f3a3886719b225 100644
155
+ --- a/clippy_utils/src/check_proc_macro.rs
156
+ +++ b/clippy_utils/src/check_proc_macro.rs
157
+ @@ -288,6 +288,7 @@ fn item_search_pat(item: &Item<'_>) -> (Pat, Pat) {
158
+ ItemKind::TraitAlias(..) => (Pat::Str("trait"), Pat::Str(";")),
159
+ ItemKind::GlobalAsm { .. } => return (Pat::Str("global_asm"), Pat::Str("")),
160
+ ItemKind::Use(..) => return (Pat::Str(""), Pat::Str("")),
161
+ + ItemKind::TestBinderConstraints { .. } => return (Pat::Str(""), Pat::Str("")),
162
+ };
163
+ if item.vis_span.is_empty() {
164
+ (start_pat, end_pat)
165
+ diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
166
+ index 464b5fcfeb04e071495b4a4342ca4a308c542e63..76313e2fdd7ae59eabde9e1d4ddd93ace8799382 100644
167
+ --- a/clippy_utils/src/lib.rs
168
+ +++ b/clippy_utils/src/lib.rs
169
+ @@ -2788,7 +2788,9 @@ pub fn expr_use_sites<'tcx>(
170
+ | Node::TraitRef(_)
171
+ | Node::Ty(_)
172
+ | Node::TyPat(_)
173
+ - | Node::WherePredicate(_) => {
174
+ + | Node::WherePredicate(_)
175
+ + | Node::TestBinderForall(_)
176
+ + | Node::TestBinderExists(_) => {
177
+ // This shouldn't be possible to hit; the inner iterator should have
178
+ // been moved to the end before we hit any of these nodes.
179
+ debug_assert!(false, "found {parent:?} which is after the final use node");
180
+ diff --git a/tests/ui-toml/arbitrary_source_item_ordering/default_exp/clippy.toml b/tests/ui-toml/arbitrary_source_item_ordering/default_exp/clippy.toml
181
+ index af3aa1cc62a49f9a0a966ee1fb6ec12af4bd69ee..8d02935ea2de03ea80a28efe36713a233690df26 100644
182
+ --- a/tests/ui-toml/arbitrary_source_item_ordering/default_exp/clippy.toml
183
+ +++ b/tests/ui-toml/arbitrary_source_item_ordering/default_exp/clippy.toml
184
+ @@ -6,7 +6,7 @@ module-item-order-groupings = [
185
+ ["macros", ["macro"]],
186
+ ["global_asm", ["global_asm"]],
187
+ ["UPPER_SNAKE_CASE", ["static", "const"]],
188
+ - ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl"]],
189
+ + ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl", "test_binder_constraints"]],
190
+ ["lower_snake_case", ["fn"]]
191
+ ]
192
+ module-items-ordered-within-groupings = "none"
patches/20261028T105419Z/rust-lang--rust-part011/db59539ce6f8be0394f91699763b2c8256946983.patch ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/clippy_lints/src/transmute/missing_transmute_annotations.rs b/clippy_lints/src/transmute/missing_transmute_annotations.rs
2
+ index ddcc577cbd199dcc345be0149fecd60000938b78..4321eff7be63e19cf5f48a8568b020cf82ff1da6 100644
3
+ --- a/clippy_lints/src/transmute/missing_transmute_annotations.rs
4
+ +++ b/clippy_lints/src/transmute/missing_transmute_annotations.rs
5
+ @@ -5,6 +5,7 @@ use clippy_utils::source::SpanExt as _;
6
+ use rustc_errors::Applicability;
7
+ use rustc_hir::{Expr, GenericArg, HirId, LetStmt, Node, Path, TyKind};
8
+ use rustc_lint::LateContext;
9
+ +use rustc_middle::ty::print::with_types_for_suggestion;
10
+ use rustc_middle::ty::{self, Ty};
11
+ use rustc_span::Span;
12
+
13
+ @@ -95,7 +96,7 @@ pub(super) fn check<'tcx>(
14
+ diag.span_suggestion(
15
+ span,
16
+ "consider adding missing annotations",
17
+ - format!("{}::<{from_ty}, {to_ty}>", last.ident),
18
+ + with_types_for_suggestion!(format!("{}::<{from_ty}, {to_ty}>", last.ident)),
19
+ Applicability::MaybeIncorrect,
20
+ );
21
+ }
22
+ diff --git a/tests/ui/missing_transmute_annotations.fixed b/tests/ui/missing_transmute_annotations.fixed
23
+ index 2602a2fda51353effb54b9799a8a795df23cf2da..a719d793cc7850d5c28419b01ba49bd49f181df2 100644
24
+ --- a/tests/ui/missing_transmute_annotations.fixed
25
+ +++ b/tests/ui/missing_transmute_annotations.fixed
26
+ @@ -9,7 +9,7 @@ extern crate macro_rules;
27
+ macro_rules! local_bad_transmute {
28
+ ($e:expr) => {
29
+ std::mem::transmute::<[u16; 2], i32>($e)
30
+ - //~^ ERROR: transmute used without annotations
31
+ + //~^ missing_transmute_annotations
32
+ };
33
+ }
34
+
35
+ @@ -36,18 +36,18 @@ unsafe fn foo2() -> i32 {
36
+ unsafe {
37
+ let mut i: i32 = 0;
38
+ i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
39
+ - //~^ ERROR: transmute used without annotations
40
+ + //~^ missing_transmute_annotations
41
+ i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
42
+ - //~^ ERROR: transmute used without annotations
43
+ + //~^ missing_transmute_annotations
44
+ i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
45
+ - //~^ ERROR: transmute used without annotations
46
+ + //~^ missing_transmute_annotations
47
+ i = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
48
+ - //~^ ERROR: transmute used without annotations
49
+ + //~^ missing_transmute_annotations
50
+
51
+ let x: i32 = bar(std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]));
52
+ - //~^ ERROR: transmute used without annotations
53
+ + //~^ missing_transmute_annotations
54
+ bar(std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]));
55
+ - //~^ ERROR: transmute used without annotations
56
+ + //~^ missing_transmute_annotations
57
+
58
+ i = local_bad_transmute!([1u16, 2u16]);
59
+
60
+ @@ -55,21 +55,30 @@ unsafe fn foo2() -> i32 {
61
+ i = bad_transmute!([1u16, 2u16]);
62
+
63
+ i = std::mem::transmute::<[i16; 2], i32>([0i16, 0i16]);
64
+ - //~^ ERROR: transmute used without annotations
65
+ + //~^ missing_transmute_annotations
66
+
67
+ i = std::mem::transmute::<Foo, i32>(Foo::A);
68
+ - //~^ ERROR: transmute used without annotations
69
+ + //~^ missing_transmute_annotations
70
+
71
+ i
72
+ }
73
+ }
74
+
75
+ +#[expect(invalid_value)]
76
+ +// https://github.com/rust-lang/rust-clippy/issues/15839
77
+ +fn function_name_in_suggestion() {
78
+ + trait T {}
79
+ + struct S(*mut dyn T);
80
+ + let _ = S(unsafe { std::mem::transmute::<(usize, usize), *mut dyn T>((0usize, 0usize)) });
81
+ + //~^ missing_transmute_annotations
82
+ +}
83
+ +
84
+ fn main() {
85
+ let x: _ = unsafe { std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]) };
86
+ - //~^ ERROR: transmute used without annotations
87
+ + //~^ missing_transmute_annotations
88
+ unsafe {
89
+ let x: _ = std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
90
+ - //~^ ERROR: transmute used without annotations
91
+ + //~^ missing_transmute_annotations
92
+
93
+ // Should not warn.
94
+ std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
95
+ diff --git a/tests/ui/missing_transmute_annotations.rs b/tests/ui/missing_transmute_annotations.rs
96
+ index fe7b7238d33fe3b4be4afb55787d34624c4b3a75..ac0724244cff557729ba844a92f6d44c8366798c 100644
97
+ --- a/tests/ui/missing_transmute_annotations.rs
98
+ +++ b/tests/ui/missing_transmute_annotations.rs
99
+ @@ -9,7 +9,7 @@ extern crate macro_rules;
100
+ macro_rules! local_bad_transmute {
101
+ ($e:expr) => {
102
+ std::mem::transmute($e)
103
+ - //~^ ERROR: transmute used without annotations
104
+ + //~^ missing_transmute_annotations
105
+ };
106
+ }
107
+
108
+ @@ -36,18 +36,18 @@ unsafe fn foo2() -> i32 {
109
+ unsafe {
110
+ let mut i: i32 = 0;
111
+ i = std::mem::transmute([1u16, 2u16]);
112
+ - //~^ ERROR: transmute used without annotations
113
+ + //~^ missing_transmute_annotations
114
+ i = std::mem::transmute::<_, _>([1u16, 2u16]);
115
+ - //~^ ERROR: transmute used without annotations
116
+ + //~^ missing_transmute_annotations
117
+ i = std::mem::transmute::<_, i32>([1u16, 2u16]);
118
+ - //~^ ERROR: transmute used without annotations
119
+ + //~^ missing_transmute_annotations
120
+ i = std::mem::transmute::<[u16; 2], _>([1u16, 2u16]);
121
+ - //~^ ERROR: transmute used without annotations
122
+ + //~^ missing_transmute_annotations
123
+
124
+ let x: i32 = bar(std::mem::transmute::<[u16; 2], _>([1u16, 2u16]));
125
+ - //~^ ERROR: transmute used without annotations
126
+ + //~^ missing_transmute_annotations
127
+ bar(std::mem::transmute::<[u16; 2], _>([1u16, 2u16]));
128
+ - //~^ ERROR: transmute used without annotations
129
+ + //~^ missing_transmute_annotations
130
+
131
+ i = local_bad_transmute!([1u16, 2u16]);
132
+
133
+ @@ -55,21 +55,30 @@ unsafe fn foo2() -> i32 {
134
+ i = bad_transmute!([1u16, 2u16]);
135
+
136
+ i = std::mem::transmute([0i16, 0i16]);
137
+ - //~^ ERROR: transmute used without annotations
138
+ + //~^ missing_transmute_annotations
139
+
140
+ i = std::mem::transmute(Foo::A);
141
+ - //~^ ERROR: transmute used without annotations
142
+ + //~^ missing_transmute_annotations
143
+
144
+ i
145
+ }
146
+ }
147
+
148
+ +#[expect(invalid_value)]
149
+ +// https://github.com/rust-lang/rust-clippy/issues/15839
150
+ +fn function_name_in_suggestion() {
151
+ + trait T {}
152
+ + struct S(*mut dyn T);
153
+ + let _ = S(unsafe { std::mem::transmute((0usize, 0usize)) });
154
+ + //~^ missing_transmute_annotations
155
+ +}
156
+ +
157
+ fn main() {
158
+ let x: _ = unsafe { std::mem::transmute::<_, i32>([1u16, 2u16]) };
159
+ - //~^ ERROR: transmute used without annotations
160
+ + //~^ missing_transmute_annotations
161
+ unsafe {
162
+ let x: _ = std::mem::transmute::<_, i32>([1u16, 2u16]);
163
+ - //~^ ERROR: transmute used without annotations
164
+ + //~^ missing_transmute_annotations
165
+
166
+ // Should not warn.
167
+ std::mem::transmute::<[u16; 2], i32>([1u16, 2u16]);
168
+ diff --git a/tests/ui/missing_transmute_annotations.stderr b/tests/ui/missing_transmute_annotations.stderr
169
+ index 63f7e28ee7dc61c0af54bcce8dd2a010b2c7ce5f..d4854c122da5c46abfde7ff79a23d39a76be4fe7 100644
170
+ --- a/tests/ui/missing_transmute_annotations.stderr
171
+ +++ b/tests/ui/missing_transmute_annotations.stderr
172
+ @@ -61,16 +61,22 @@ LL | i = std::mem::transmute(Foo::A);
173
+ | ^^^^^^^^^ help: consider adding missing annotations: `transmute::<Foo, i32>`
174
+
175
+ error: transmute used without annotations
176
+ - --> tests/ui/missing_transmute_annotations.rs:68:35
177
+ + --> tests/ui/missing_transmute_annotations.rs:72:34
178
+ + |
179
+ +LL | let _ = S(unsafe { std::mem::transmute((0usize, 0usize)) });
180
+ + | ^^^^^^^^^ help: consider adding missing annotations: `transmute::<(usize, usize), *mut dyn T>`
181
+ +
182
+ +error: transmute used without annotations
183
+ + --> tests/ui/missing_transmute_annotations.rs:77:35
184
+ |
185
+ LL | let x: _ = unsafe { std::mem::transmute::<_, i32>([1u16, 2u16]) };
186
+ | ^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>`
187
+
188
+ error: transmute used without annotations
189
+ - --> tests/ui/missing_transmute_annotations.rs:71:30
190
+ + --> tests/ui/missing_transmute_annotations.rs:80:30
191
+ |
192
+ LL | let x: _ = std::mem::transmute::<_, i32>([1u16, 2u16]);
193
+ | ^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 2], i32>`
194
+
195
+ -error: aborting due to 11 previous errors
196
+ +error: aborting due to 12 previous errors
197
+
patches/20261028T105419Z/rust-lang--rust-part011/dda473214ee4569372af5f627a769b7413e15093.patch ADDED
The diff for this file is too large to render. See raw diff
 
patches/20261028T105419Z/rust-lang--rust-part011/deb81605189b7df985187428eb2ef9f934e2804d.patch ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
2
+ index 811536a5f221e6c0b227b6b4fd3cc5b11cc4987a..11cdbea3c426a3c40f2ae37333b9b60e9d82356c 100644
3
+ --- a/compiler/rustc_lint_defs/src/builtin.rs
4
+ +++ b/compiler/rustc_lint_defs/src/builtin.rs
5
+ @@ -289,6 +289,8 @@ declare_lint! {
6
+ /// enum Foo { A }
7
+ /// ```
8
+ ///
9
+ + /// {{produces}}
10
+ + ///
11
+ /// ### Explanation
12
+ ///
13
+ /// While some representations may be specified more than once, the compiler
14
+ diff --git a/tests/ui/repr/repr-repeated-attrs.rs b/tests/ui/repr/repr-repeated-attrs.rs
15
+ new file mode 100644
16
+ index 0000000000000000000000000000000000000000..a6dd3fb6e8b15776c7e8862666cd614b38b2b6e8
17
+ --- /dev/null
18
+ +++ b/tests/ui/repr/repr-repeated-attrs.rs
19
+ @@ -0,0 +1,68 @@
20
+ +// Tests to ensure we warn on repeated `#[repr(..)]` attributes.
21
+ +
22
+ +#[repr(transparent, transparent)]
23
+ +//~^ ERROR transparent struct cannot have other repr hints
24
+ +#[repr(transparent)]
25
+ +struct SeveralTransparentReprs(*mut u8);
26
+ +
27
+ +#[repr(transparent)]
28
+ +//~^ ERROR transparent struct cannot have other repr hints
29
+ +#[repr(transparent)]
30
+ +struct MultilineOnly(*mut u8);
31
+ +
32
+ +#[repr(Rust, Rust)]
33
+ +//~^ WARN representation attribute is specified more than once
34
+ +struct SeveralRustReprs(u8);
35
+ +
36
+ +#[repr(C, C)]
37
+ +//~^ WARN representation attribute is specified more than once
38
+ +#[repr(C, C, C)]
39
+ +struct SeveralC(u8);
40
+ +
41
+ +#[repr(u8, u8)]
42
+ +//~^ ERROR conflicting representation hints
43
+ +//~| WARN this was previously accepted
44
+ +enum SeveralPrimitiveRerprs {
45
+ + Variant,
46
+ +}
47
+ +
48
+ +#[repr(C, C, u8)] //~ WARN representation attribute is specified more than once
49
+ +//~^ ERROR conflicting representation hints
50
+ +//~| WARN this was previously accepted
51
+ +#[repr(C, u8, u8)]
52
+ +enum SeveralCAndPrims {
53
+ + Variant(u8),
54
+ +}
55
+ +
56
+ +#[repr(Rust, u8, u8)]
57
+ +//~^ ERROR conflicting representation hints
58
+ +//~^^ ERROR conflicting representation hints
59
+ +//~| WARN this was previously accepted
60
+ +enum RustAndPrimDisallowed {
61
+ + Variant(u8),
62
+ +}
63
+ +
64
+ +#[repr(u8, u8)] //~ ERROR conflicting representation hints
65
+ +//~^ WARN this was previously accepted
66
+ +#[repr(u16)]
67
+ +enum ConflictingPrimReprs {
68
+ + Variant,
69
+ +}
70
+ +
71
+ +#[repr(C, u8)]
72
+ +//~^ ERROR conflicting representation hints
73
+ +//~| WARN this was previously accepted
74
+ +enum CWithIntsCausesFCW1 {
75
+ + A,
76
+ + B,
77
+ +}
78
+ +
79
+ +#[repr(C, C, u8, u8, u8)] //~ WARN representation attribute is specified more than once
80
+ +//~^ ERROR conflicting representation hints
81
+ +//~| WARN this was previously accepted
82
+ +enum CWithIntsCausesFCW2 {
83
+ + A,
84
+ + B,
85
+ +}
86
+ +
87
+ +fn main() {}
88
+ diff --git a/tests/ui/repr/repr-repeated-attrs.stderr b/tests/ui/repr/repr-repeated-attrs.stderr
89
+ new file mode 100644
90
+ index 0000000000000000000000000000000000000000..72c312a13ea11adf3b3d21f1898c7299be0cf66a
91
+ --- /dev/null
92
+ +++ b/tests/ui/repr/repr-repeated-attrs.stderr
93
+ @@ -0,0 +1,200 @@
94
+ +error[E0692]: transparent struct cannot have other repr hints
95
+ + --> $DIR/repr-repeated-attrs.rs:3:8
96
+ + |
97
+ +LL | #[repr(transparent, transparent)]
98
+ + | ^^^^^^^^^^^ ^^^^^^^^^^^
99
+ +LL |
100
+ +LL | #[repr(transparent)]
101
+ + | ^^^^^^^^^^^
102
+ +
103
+ +error[E0692]: transparent struct cannot have other repr hints
104
+ + --> $DIR/repr-repeated-attrs.rs:8:8
105
+ + |
106
+ +LL | #[repr(transparent)]
107
+ + | ^^^^^^^^^^^
108
+ +LL |
109
+ +LL | #[repr(transparent)]
110
+ + | ^^^^^^^^^^^
111
+ +
112
+ +warning: representation attribute is specified more than once
113
+ + --> $DIR/repr-repeated-attrs.rs:13:8
114
+ + |
115
+ +LL | #[repr(Rust, Rust)]
116
+ + | ^^^^ ^^^^
117
+ + |
118
+ + = note: for consistency, only specify the representation once
119
+ + = note: `#[warn(repeated_reprs)]` on by default
120
+ +
121
+ +warning: representation attribute is specified more than once
122
+ + --> $DIR/repr-repeated-attrs.rs:17:8
123
+ + |
124
+ +LL | #[repr(C, C)]
125
+ + | ^ ^
126
+ +LL |
127
+ +LL | #[repr(C, C, C)]
128
+ + | ^ ^ ^
129
+ + |
130
+ + = note: for consistency, only specify the representation once
131
+ +
132
+ +error[E0566]: conflicting representation hints
133
+ + --> $DIR/repr-repeated-attrs.rs:22:8
134
+ + |
135
+ +LL | #[repr(u8, u8)]
136
+ + | ^^ ^^
137
+ + |
138
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
139
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
140
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
141
+ +
142
+ +error[E0566]: conflicting representation hints
143
+ + --> $DIR/repr-repeated-attrs.rs:29:8
144
+ + |
145
+ +LL | #[repr(C, C, u8)]
146
+ + | ^ ^ ^^
147
+ +...
148
+ +LL | #[repr(C, u8, u8)]
149
+ + | ^ ^^ ^^
150
+ + |
151
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
152
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
153
+ +
154
+ +warning: representation attribute is specified more than once
155
+ + --> $DIR/repr-repeated-attrs.rs:29:8
156
+ + |
157
+ +LL | #[repr(C, C, u8)]
158
+ + | ^ ^ ^^
159
+ +...
160
+ +LL | #[repr(C, u8, u8)]
161
+ + | ^ ^^ ^^
162
+ + |
163
+ + = note: for consistency, only specify the representation once
164
+ +
165
+ +error[E0566]: conflicting representation hints
166
+ + --> $DIR/repr-repeated-attrs.rs:37:8
167
+ + |
168
+ +LL | #[repr(Rust, u8, u8)]
169
+ + | ^^^^ ^^ ^^
170
+ +
171
+ +error[E0566]: conflicting representation hints
172
+ + --> $DIR/repr-repeated-attrs.rs:37:8
173
+ + |
174
+ +LL | #[repr(Rust, u8, u8)]
175
+ + | ^^^^ ^^ ^^
176
+ + |
177
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
178
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
179
+ +
180
+ +error[E0566]: conflicting representation hints
181
+ + --> $DIR/repr-repeated-attrs.rs:44:8
182
+ + |
183
+ +LL | #[repr(u8, u8)]
184
+ + | ^^ ^^
185
+ +LL |
186
+ +LL | #[repr(u16)]
187
+ + | ^^^
188
+ + |
189
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
190
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
191
+ +
192
+ +error[E0566]: conflicting representation hints
193
+ + --> $DIR/repr-repeated-attrs.rs:51:8
194
+ + |
195
+ +LL | #[repr(C, u8)]
196
+ + | ^ ^^
197
+ + |
198
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
199
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
200
+ +
201
+ +error[E0566]: conflicting representation hints
202
+ + --> $DIR/repr-repeated-attrs.rs:59:8
203
+ + |
204
+ +LL | #[repr(C, C, u8, u8, u8)]
205
+ + | ^ ^ ^^ ^^ ^^
206
+ + |
207
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
208
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
209
+ +
210
+ +warning: representation attribute is specified more than once
211
+ + --> $DIR/repr-repeated-attrs.rs:59:8
212
+ + |
213
+ +LL | #[repr(C, C, u8, u8, u8)]
214
+ + | ^ ^ ^^ ^^ ^^
215
+ + |
216
+ + = note: for consistency, only specify the representation once
217
+ +
218
+ +error: aborting due to 9 previous errors; 4 warnings emitted
219
+ +
220
+ +Some errors have detailed explanations: E0566, E0692.
221
+ +For more information about an error, try `rustc --explain E0566`.
222
+ +Future incompatibility report: Future breakage diagnostic:
223
+ +error[E0566]: conflicting representation hints
224
+ + --> $DIR/repr-repeated-attrs.rs:22:8
225
+ + |
226
+ +LL | #[repr(u8, u8)]
227
+ + | ^^ ^^
228
+ + |
229
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
230
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
231
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
232
+ +
233
+ +Future breakage diagnostic:
234
+ +error[E0566]: conflicting representation hints
235
+ + --> $DIR/repr-repeated-attrs.rs:29:8
236
+ + |
237
+ +LL | #[repr(C, C, u8)]
238
+ + | ^ ^ ^^
239
+ +...
240
+ +LL | #[repr(C, u8, u8)]
241
+ + | ^ ^^ ^^
242
+ + |
243
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
244
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
245
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
246
+ +
247
+ +Future breakage diagnostic:
248
+ +error[E0566]: conflicting representation hints
249
+ + --> $DIR/repr-repeated-attrs.rs:37:8
250
+ + |
251
+ +LL | #[repr(Rust, u8, u8)]
252
+ + | ^^^^ ^^ ^^
253
+ + |
254
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
255
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
256
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
257
+ +
258
+ +Future breakage diagnostic:
259
+ +error[E0566]: conflicting representation hints
260
+ + --> $DIR/repr-repeated-attrs.rs:44:8
261
+ + |
262
+ +LL | #[repr(u8, u8)]
263
+ + | ^^ ^^
264
+ +LL |
265
+ +LL | #[repr(u16)]
266
+ + | ^^^
267
+ + |
268
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
269
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
270
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
271
+ +
272
+ +Future breakage diagnostic:
273
+ +error[E0566]: conflicting representation hints
274
+ + --> $DIR/repr-repeated-attrs.rs:51:8
275
+ + |
276
+ +LL | #[repr(C, u8)]
277
+ + | ^ ^^
278
+ + |
279
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
280
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
281
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
282
+ +
283
+ +Future breakage diagnostic:
284
+ +error[E0566]: conflicting representation hints
285
+ + --> $DIR/repr-repeated-attrs.rs:59:8
286
+ + |
287
+ +LL | #[repr(C, C, u8, u8, u8)]
288
+ + | ^ ^ ^^ ^^ ^^
289
+ + |
290
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
291
+ + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
292
+ + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
293
+ +
patches/20261028T105419Z/rust-lang--rust-part011/e845ed8cc9c0c18cd30c71f7f7b1e2918531e84a.patch ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
2
+ index 12705809e4290e81d97fc1a1539abbdbe08c4244..efdbcbae63467c778f2a9cbb1094b348ae615725 100644
3
+ --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
4
+ +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
5
+ @@ -79,9 +79,9 @@ RUN /tmp/build-fuchsia-toolchain.sh
6
+ COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
7
+ RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh
8
+
9
+ -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-33/wasi-sdk-33.0-x86_64-linux.tar.gz | \
10
+ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34/wasi-sdk-34.0-x86_64-linux.tar.gz | \
11
+ tar -xz
12
+ -ENV WASI_SDK_PATH=/tmp/wasi-sdk-33.0-x86_64-linux
13
+ +ENV WASI_SDK_PATH=/tmp/wasi-sdk-34.0-x86_64-linux
14
+
15
+ COPY scripts/freebsd-toolchain.sh /tmp/
16
+ RUN /tmp/freebsd-toolchain.sh i686
17
+ diff --git a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile
18
+ index acbd99db6c4f8343e726ac5106772e647e970466..0a9b6f0fda91c0c345df9756fab8793e1553f83f 100644
19
+ --- a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile
20
+ +++ b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile
21
+ @@ -21,9 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
22
+ mingw-w64 \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-33/wasi-sdk-33.0-x86_64-linux.tar.gz | \
26
+ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34/wasi-sdk-34.0-x86_64-linux.tar.gz | \
27
+ tar -xz
28
+ -ENV WASI_SDK_PATH=/wasi-sdk-33.0-x86_64-linux
29
+ +ENV WASI_SDK_PATH=/wasi-sdk-34.0-x86_64-linux
30
+
31
+ ENV RUST_CONFIGURE_ARGS="--set rust.validate-mir-opts=3"
32
+
33
+ diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile
34
+ index 26e77bc5da200ff6a1328337e1594a38168aace0..6034f3d1d883c69d63938d1ce4fb0cb87339d407 100644
35
+ --- a/src/ci/docker/host-x86_64/test-various/Dockerfile
36
+ +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile
37
+ @@ -43,9 +43,9 @@ WORKDIR /
38
+ COPY scripts/sccache.sh /scripts/
39
+ RUN sh /scripts/sccache.sh
40
+
41
+ -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-33/wasi-sdk-33.0-x86_64-linux.tar.gz | \
42
+ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34/wasi-sdk-34.0-x86_64-linux.tar.gz | \
43
+ tar -xz
44
+ -ENV WASI_SDK_PATH=/wasi-sdk-33.0-x86_64-linux
45
+ +ENV WASI_SDK_PATH=/wasi-sdk-34.0-x86_64-linux
46
+
47
+ ENV RUST_CONFIGURE_ARGS="--musl-root-x86_64=/usr/local/x86_64-linux-musl \
48
+ --set rust.lld"
patches/20261028T105419Z/rust-lang--rust-part011/e99f23fec0b37494a9361b02fe509997896c5e37.patch ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
2
+ index 852f1cfda5168cb276db0467d6282d2810611de4..1a392ae1c05da77401159147aa04c74adbf258b6 100644
3
+ --- a/compiler/rustc_lint/src/lib.rs
4
+ +++ b/compiler/rustc_lint/src/lib.rs
5
+ @@ -367,7 +367,8 @@ fn register_builtins(store: &mut LintStore) {
6
+ UNUSED_PARENS,
7
+ UNUSED_BRACES,
8
+ REDUNDANT_SEMICOLONS,
9
+ - MAP_UNIT_FN
10
+ + MAP_UNIT_FN,
11
+ + REPEATED_REPRS
12
+ );
13
+
14
+ add_lint_group!("let_underscore", LET_UNDERSCORE_DROP, LET_UNDERSCORE_LOCK);
15
+ diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
16
+ index 11cdbea3c426a3c40f2ae37333b9b60e9d82356c..af5db6117f7b58651a1b00fc2632f3ee1ae6e9ea 100644
17
+ --- a/compiler/rustc_lint_defs/src/builtin.rs
18
+ +++ b/compiler/rustc_lint_defs/src/builtin.rs
19
+ @@ -95,6 +95,7 @@ pub mod hardwired {
20
+ REFINING_IMPL_TRAIT_INTERNAL,
21
+ REFINING_IMPL_TRAIT_REACHABLE,
22
+ RENAMED_AND_REMOVED_LINTS,
23
+ + REPEATED_REPRS,
24
+ REPR_C_ENUMS_LARGER_THAN_INT,
25
+ RESOLVING_TO_ITEMS_SHADOWING_SUPERTRAIT_ITEMS,
26
+ RTSAN_NONBLOCKING_ASYNC,
27
+ diff --git a/tests/ui/attributes/issue-100631.rs b/tests/ui/attributes/issue-100631.rs
28
+ index 9a30691a39ec38723ec803c8dcfe4dff4fb0e043..09b34ebfe7a2cac715083fef2d83d5f492f07ace 100644
29
+ --- a/tests/ui/attributes/issue-100631.rs
30
+ +++ b/tests/ui/attributes/issue-100631.rs
31
+ @@ -1,3 +1,4 @@
32
+ +//@ compile-flags: -W repeated-reprs
33
+ // issue #100631, make sure `TyCtxt::get_attr` only called by case that compiler
34
+ // can reasonably deal with multiple attributes.
35
+ // `repr` will use `TyCtxt::get_attrs` since it's `DuplicatesOk`.
36
+ diff --git a/tests/ui/attributes/issue-100631.stderr b/tests/ui/attributes/issue-100631.stderr
37
+ index 0ecc19ae85b3d9d8851ddef81a0ec6da492983e4..62d82c9b31335d521456e077c5c6b26bf1846fde 100644
38
+ --- a/tests/ui/attributes/issue-100631.stderr
39
+ +++ b/tests/ui/attributes/issue-100631.stderr
40
+ @@ -1,5 +1,5 @@
41
+ warning: `#[repr(..)]` attribute is specified more than once
42
+ - --> $DIR/issue-100631.rs:4:8
43
+ + --> $DIR/issue-100631.rs:5:8
44
+ |
45
+ LL | #[repr(C)]
46
+ | ^
47
+ @@ -8,10 +8,10 @@ LL | #[repr(C)]
48
+ | ^
49
+ |
50
+ = note: for consistency, only specify the representation once
51
+ - = note: `#[warn(repeated_reprs)]` on by default
52
+ + = note: requested on the command line with `-W repeated-reprs`
53
+
54
+ error[E0084]: unsupported representation for zero-variant enum
55
+ - --> $DIR/issue-100631.rs:4:8
56
+ + --> $DIR/issue-100631.rs:5:8
57
+ |
58
+ LL | #[repr(C)]
59
+ | ^
60
+ diff --git a/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr b/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr
61
+ index f40fb73acbb8bb51f6f29085dddc289aae031824..b0eb5636d04790da8e0f8ccc99ef7e8bf1f17830 100644
62
+ --- a/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr
63
+ +++ b/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr
64
+ @@ -449,3 +449,21 @@ note: the lint level is defined here
65
+ LL | #![forbid(forbidden_lint_groups)]
66
+ | ^^^^^^^^^^^^^^^^^^^^^
67
+
68
+ +Future breakage diagnostic:
69
+ +error: warn(unused) incompatible with previous forbid
70
+ + --> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
71
+ + |
72
+ +LL | #![forbid(unused)]
73
+ + | ------ `forbid` level set here
74
+ +LL | #![deny(unused)]
75
+ +LL | #![warn(unused)]
76
+ + | ^^^^^^ overruled by previous forbid
77
+ + |
78
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
79
+ + = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
80
+ +note: the lint level is defined here
81
+ + --> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11
82
+ + |
83
+ +LL | #![forbid(forbidden_lint_groups)]
84
+ + | ^^^^^^^^^^^^^^^^^^^^^
85
+ +
86
+ diff --git a/tests/ui/lint/outer-forbid.stderr b/tests/ui/lint/outer-forbid.stderr
87
+ index abe5959176d4a3774a7da0120c594b5a94bb848f..b2d7ad6c2aabcb817e960f1ef874eefb2041bf87 100644
88
+ --- a/tests/ui/lint/outer-forbid.stderr
89
+ +++ b/tests/ui/lint/outer-forbid.stderr
90
+ @@ -489,3 +489,21 @@ note: the lint level is defined here
91
+ LL | #![forbid(forbidden_lint_groups)]
92
+ | ^^^^^^^^^^^^^^^^^^^^^
93
+
94
+ +Future breakage diagnostic:
95
+ +error: allow(unused) incompatible with previous forbid
96
+ + --> $DIR/outer-forbid.rs:25:9
97
+ + |
98
+ +LL | #![forbid(unused, non_snake_case)]
99
+ + | ------ `forbid` level set here
100
+ +...
101
+ +LL | #[allow(unused)]
102
+ + | ^^^^^^ overruled by previous forbid
103
+ + |
104
+ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
105
+ + = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
106
+ +note: the lint level is defined here
107
+ + --> $DIR/outer-forbid.rs:18:11
108
+ + |
109
+ +LL | #![forbid(forbidden_lint_groups)]
110
+ + | ^^^^^^^^^^^^^^^^^^^^^
111
+ +
112
+ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs
113
+ index c013041ed4159192965aee2df1ce33862ba01b26..c62fc6036f60fc498ef710866e4a920bfaf1ea6a 100644
114
+ --- a/tests/ui/lint/unused/unused-attr-duplicate.rs
115
+ +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs
116
+ @@ -1,6 +1,6 @@
117
+ // Tests for repeating attribute warnings.
118
+ //@ aux-build:lint_unused_extern_crate.rs
119
+ -//@ compile-flags:--test
120
+ +//@ compile-flags:--test -W repeated-reprs
121
+ // Not tested due to extra requirements:
122
+ // - panic_handler: needs extra setup
123
+ // - target_feature: platform-specific
124
+ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr
125
+ index 6e4f7d23604c29224329ba678d8a5ffb514e2d01..feb1a79bf9b926b44998d48a68e69949135436b4 100644
126
+ --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr
127
+ +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr
128
+ @@ -25,7 +25,7 @@ LL | #[repr(C)]
129
+ | ^
130
+ |
131
+ = note: for consistency, only specify the representation once
132
+ - = note: `#[warn(repeated_reprs)]` on by default
133
+ + = note: requested on the command line with `-W repeated-reprs`
134
+
135
+ error: unused attribute
136
+ --> $DIR/unused-attr-duplicate.rs:14:1
137
+ diff --git a/tests/ui/repr/conflicting-repr-hints.rs b/tests/ui/repr/conflicting-repr-hints.rs
138
+ index 81a94aad78ff664db86444b89d0ce97815494c0a..6a265e13ad93d6292c1cc562893bdc70c340e1a7 100644
139
+ --- a/tests/ui/repr/conflicting-repr-hints.rs
140
+ +++ b/tests/ui/repr/conflicting-repr-hints.rs
141
+ @@ -1,3 +1,4 @@
142
+ +//@ compile-flags: -W repeated-reprs
143
+ #![allow(dead_code)]
144
+
145
+ #[repr(C)]
146
+ diff --git a/tests/ui/repr/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr
147
+ index 8f2655fd716f186b5918e9d8e19250d2e4ac27fd..2a81610e85f99739f53a3521742a191e98be1792 100644
148
+ --- a/tests/ui/repr/conflicting-repr-hints.stderr
149
+ +++ b/tests/ui/repr/conflicting-repr-hints.stderr
150
+ @@ -1,5 +1,5 @@
151
+ error[E0566]: conflicting representation hints
152
+ - --> $DIR/conflicting-repr-hints.rs:13:8
153
+ + --> $DIR/conflicting-repr-hints.rs:14:8
154
+ |
155
+ LL | #[repr(C, u64)]
156
+ | ^ ^^^
157
+ @@ -9,7 +9,7 @@ LL | #[repr(C, u64)]
158
+ = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
159
+
160
+ error[E0566]: conflicting representation hints
161
+ - --> $DIR/conflicting-repr-hints.rs:19:8
162
+ + --> $DIR/conflicting-repr-hints.rs:20:8
163
+ |
164
+ LL | #[repr(u32, u64)]
165
+ | ^^^ ^^^
166
+ @@ -18,70 +18,70 @@ LL | #[repr(u32, u64)]
167
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
168
+
169
+ warning: `#[repr(..)]` attribute is specified more than once
170
+ - --> $DIR/conflicting-repr-hints.rs:46:8
171
+ + --> $DIR/conflicting-repr-hints.rs:47:8
172
+ |
173
+ LL | #[repr(packed, packed(1))]
174
+ | ^^^^^^ ^^^^^^^^^
175
+ |
176
+ = note: for consistency, only specify the representation once
177
+ - = note: `#[warn(repeated_reprs)]` on by default
178
+ + = note: requested on the command line with `-W repeated-reprs`
179
+
180
+ error[E0587]: type has conflicting packed and align representation hints
181
+ - --> $DIR/conflicting-repr-hints.rs:29:1
182
+ + --> $DIR/conflicting-repr-hints.rs:30:1
183
+ |
184
+ LL | struct F(i32);
185
+ | ^^^^^^^^
186
+
187
+ error[E0587]: type has conflicting packed and align representation hints
188
+ - --> $DIR/conflicting-repr-hints.rs:33:1
189
+ + --> $DIR/conflicting-repr-hints.rs:34:1
190
+ |
191
+ LL | struct G(i32);
192
+ | ^^^^^^^^
193
+
194
+ error[E0587]: type has conflicting packed and align representation hints
195
+ - --> $DIR/conflicting-repr-hints.rs:37:1
196
+ + --> $DIR/conflicting-repr-hints.rs:38:1
197
+ |
198
+ LL | struct H(i32);
199
+ | ^^^^^^^^
200
+
201
+ error[E0634]: type has conflicting packed representation hints
202
+ - --> $DIR/conflicting-repr-hints.rs:40:1
203
+ + --> $DIR/conflicting-repr-hints.rs:41:1
204
+ |
205
+ LL | struct I(i32);
206
+ | ^^^^^^^^
207
+
208
+ error[E0634]: type has conflicting packed representation hints
209
+ - --> $DIR/conflicting-repr-hints.rs:44:1
210
+ + --> $DIR/conflicting-repr-hints.rs:45:1
211
+ |
212
+ LL | struct J(i32);
213
+ | ^^^^^^^^
214
+
215
+ error[E0587]: type has conflicting packed and align representation hints
216
+ - --> $DIR/conflicting-repr-hints.rs:50:1
217
+ + --> $DIR/conflicting-repr-hints.rs:51:1
218
+ |
219
+ LL | union X {
220
+ | ^^^^^^^
221
+
222
+ error[E0587]: type has conflicting packed and align representation hints
223
+ - --> $DIR/conflicting-repr-hints.rs:57:1
224
+ + --> $DIR/conflicting-repr-hints.rs:58:1
225
+ |
226
+ LL | union Y {
227
+ | ^^^^^^^
228
+
229
+ error[E0587]: type has conflicting packed and align representation hints
230
+ - --> $DIR/conflicting-repr-hints.rs:64:1
231
+ + --> $DIR/conflicting-repr-hints.rs:65:1
232
+ |
233
+ LL | union Z {
234
+ | ^^^^^^^
235
+
236
+ error[E0587]: type has conflicting packed and align representation hints
237
+ - --> $DIR/conflicting-repr-hints.rs:70:1
238
+ + --> $DIR/conflicting-repr-hints.rs:71:1
239
+ |
240
+ LL | pub struct S(u16);
241
+ | ^^^^^^^^^^^^
242
+
243
+ error[E0587]: type has conflicting packed and align representation hints
244
+ - --> $DIR/conflicting-repr-hints.rs:73:1
245
+ + --> $DIR/conflicting-repr-hints.rs:74:1
246
+ |
247
+ LL | pub union U {
248
+ | ^^^^^^^^^^^
249
+ @@ -92,7 +92,7 @@ Some errors have detailed explanations: E0566, E0587, E0634.
250
+ For more information about an error, try `rustc --explain E0566`.
251
+ Future incompatibility report: Future breakage diagnostic:
252
+ error[E0566]: conflicting representation hints
253
+ - --> $DIR/conflicting-repr-hints.rs:13:8
254
+ + --> $DIR/conflicting-repr-hints.rs:14:8
255
+ |
256
+ LL | #[repr(C, u64)]
257
+ | ^ ^^^
258
+ @@ -103,7 +103,7 @@ LL | #[repr(C, u64)]
259
+
260
+ Future breakage diagnostic:
261
+ error[E0566]: conflicting representation hints
262
+ - --> $DIR/conflicting-repr-hints.rs:19:8
263
+ + --> $DIR/conflicting-repr-hints.rs:20:8
264
+ |
265
+ LL | #[repr(u32, u64)]
266
+ | ^^^ ^^^
267
+ diff --git a/tests/ui/repr/repr-repeated-attrs.rs b/tests/ui/repr/repr-repeated-attrs.rs
268
+ index 7306b9192f09eb79deb39a8a9c4bc6b886591106..122eb9b7485efed89047a9a474fc0bf5a230a855 100644
269
+ --- a/tests/ui/repr/repr-repeated-attrs.rs
270
+ +++ b/tests/ui/repr/repr-repeated-attrs.rs
271
+ @@ -1,4 +1,5 @@
272
+ // Tests to ensure we warn on repeated `#[repr(..)]` attributes.
273
+ +//@ compile-flags: -W repeated-reprs
274
+
275
+ #[repr(transparent, transparent)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs]
276
+ //~^ ERROR transparent struct cannot have other repr hints
277
+ diff --git a/tests/ui/repr/repr-repeated-attrs.stderr b/tests/ui/repr/repr-repeated-attrs.stderr
278
+ index a0b8b1d7da3cc58d1eae30809f115711a2b65948..a1e54f621888950c88f4b4fe315502883d7c7c05 100644
279
+ --- a/tests/ui/repr/repr-repeated-attrs.stderr
280
+ +++ b/tests/ui/repr/repr-repeated-attrs.stderr
281
+ @@ -1,5 +1,5 @@
282
+ warning: `#[repr(..)]` attribute is specified more than once
283
+ - --> $DIR/repr-repeated-attrs.rs:3:8
284
+ + --> $DIR/repr-repeated-attrs.rs:4:8
285
+ |
286
+ LL | #[repr(transparent, transparent)]
287
+ | ^^^^^^^^^^^ ^^^^^^^^^^^
288
+ @@ -8,10 +8,10 @@ LL | #[repr(transparent)]
289
+ | ^^^^^^^^^^^
290
+ |
291
+ = note: for consistency, only specify the representation once
292
+ - = note: `#[warn(repeated_reprs)]` on by default
293
+ + = note: requested on the command line with `-W repeated-reprs`
294
+
295
+ error[E0692]: transparent struct cannot have other repr hints
296
+ - --> $DIR/repr-repeated-attrs.rs:3:8
297
+ + --> $DIR/repr-repeated-attrs.rs:4:8
298
+ |
299
+ LL | #[repr(transparent, transparent)]
300
+ | ^^^^^^^^^^^ ^^^^^^^^^^^
301
+ @@ -20,7 +20,7 @@ LL | #[repr(transparent)]
302
+ | ^^^^^^^^^^^
303
+
304
+ warning: `#[repr(..)]` attribute is specified more than once
305
+ - --> $DIR/repr-repeated-attrs.rs:8:8
306
+ + --> $DIR/repr-repeated-attrs.rs:9:8
307
+ |
308
+ LL | #[repr(transparent)]
309
+ | ^^^^^^^^^^^
310
+ @@ -31,7 +31,7 @@ LL | #[repr(transparent)]
311
+ = note: for consistency, only specify the representation once
312
+
313
+ error[E0692]: transparent struct cannot have other repr hints
314
+ - --> $DIR/repr-repeated-attrs.rs:8:8
315
+ + --> $DIR/repr-repeated-attrs.rs:9:8
316
+ |
317
+ LL | #[repr(transparent)]
318
+ | ^^^^^^^^^^^
319
+ @@ -40,7 +40,7 @@ LL | #[repr(transparent)]
320
+ | ^^^^^^^^^^^
321
+
322
+ warning: `#[repr(..)]` attribute is specified more than once
323
+ - --> $DIR/repr-repeated-attrs.rs:13:8
324
+ + --> $DIR/repr-repeated-attrs.rs:14:8
325
+ |
326
+ LL | #[repr(Rust, Rust)]
327
+ | ^^^^ ^^^^
328
+ @@ -48,7 +48,7 @@ LL | #[repr(Rust, Rust)]
329
+ = note: for consistency, only specify the representation once
330
+
331
+ warning: `#[repr(..)]` attribute is specified more than once
332
+ - --> $DIR/repr-repeated-attrs.rs:17:8
333
+ + --> $DIR/repr-repeated-attrs.rs:18:8
334
+ |
335
+ LL | #[repr(C, C)]
336
+ | ^ ^
337
+ @@ -59,7 +59,7 @@ LL | #[repr(C, C, C)]
338
+ = note: for consistency, only specify the representation once
339
+
340
+ warning: `#[repr(..)]` attribute is specified more than once
341
+ - --> $DIR/repr-repeated-attrs.rs:22:8
342
+ + --> $DIR/repr-repeated-attrs.rs:23:8
343
+ |
344
+ LL | #[repr(u8, u8)]
345
+ | ^^ ^^
346
+ @@ -67,7 +67,7 @@ LL | #[repr(u8, u8)]
347
+ = note: for consistency, only specify the representation once
348
+
349
+ error[E0566]: conflicting representation hints
350
+ - --> $DIR/repr-repeated-attrs.rs:22:8
351
+ + --> $DIR/repr-repeated-attrs.rs:23:8
352
+ |
353
+ LL | #[repr(u8, u8)]
354
+ | ^^ ^^
355
+ @@ -77,7 +77,7 @@ LL | #[repr(u8, u8)]
356
+ = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
357
+
358
+ warning: `#[repr(..)]` attribute is specified more than once
359
+ - --> $DIR/repr-repeated-attrs.rs:29:8
360
+ + --> $DIR/repr-repeated-attrs.rs:30:8
361
+ |
362
+ LL | #[repr(C, C, u8)]
363
+ | ^ ^ ^^
364
+ @@ -88,7 +88,7 @@ LL | #[repr(C, u8, u8)]
365
+ = note: for consistency, only specify the representation once
366
+
367
+ error[E0566]: conflicting representation hints
368
+ - --> $DIR/repr-repeated-attrs.rs:29:8
369
+ + --> $DIR/repr-repeated-attrs.rs:30:8
370
+ |
371
+ LL | #[repr(C, C, u8)]
372
+ | ^ ^ ^^
373
+ @@ -100,7 +100,7 @@ LL | #[repr(C, u8, u8)]
374
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
375
+
376
+ warning: `#[repr(..)]` attribute is specified more than once
377
+ - --> $DIR/repr-repeated-attrs.rs:37:14
378
+ + --> $DIR/repr-repeated-attrs.rs:38:14
379
+ |
380
+ LL | #[repr(Rust, u8, u8)]
381
+ | ^^ ^^
382
+ @@ -108,13 +108,13 @@ LL | #[repr(Rust, u8, u8)]
383
+ = note: for consistency, only specify the representation once
384
+
385
+ error[E0566]: conflicting representation hints
386
+ - --> $DIR/repr-repeated-attrs.rs:37:8
387
+ + --> $DIR/repr-repeated-attrs.rs:38:8
388
+ |
389
+ LL | #[repr(Rust, u8, u8)]
390
+ | ^^^^ ^^ ^^
391
+
392
+ error[E0566]: conflicting representation hints
393
+ - --> $DIR/repr-repeated-attrs.rs:37:8
394
+ + --> $DIR/repr-repeated-attrs.rs:38:8
395
+ |
396
+ LL | #[repr(Rust, u8, u8)]
397
+ | ^^^^ ^^ ^^
398
+ @@ -123,7 +123,7 @@ LL | #[repr(Rust, u8, u8)]
399
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
400
+
401
+ warning: `#[repr(..)]` attribute is specified more than once
402
+ - --> $DIR/repr-repeated-attrs.rs:45:8
403
+ + --> $DIR/repr-repeated-attrs.rs:46:8
404
+ |
405
+ LL | #[repr(u8, u8)]
406
+ | ^^ ^^
407
+ @@ -131,7 +131,7 @@ LL | #[repr(u8, u8)]
408
+ = note: for consistency, only specify the representation once
409
+
410
+ error[E0566]: conflicting representation hints
411
+ - --> $DIR/repr-repeated-attrs.rs:45:8
412
+ + --> $DIR/repr-repeated-attrs.rs:46:8
413
+ |
414
+ LL | #[repr(u8, u8)]
415
+ | ^^ ^^
416
+ @@ -143,7 +143,7 @@ LL | #[repr(u16)]
417
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
418
+
419
+ error[E0566]: conflicting representation hints
420
+ - --> $DIR/repr-repeated-attrs.rs:53:8
421
+ + --> $DIR/repr-repeated-attrs.rs:54:8
422
+ |
423
+ LL | #[repr(C, u8)]
424
+ | ^ ^^
425
+ @@ -152,7 +152,7 @@ LL | #[repr(C, u8)]
426
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
427
+
428
+ warning: `#[repr(..)]` attribute is specified more than once
429
+ - --> $DIR/repr-repeated-attrs.rs:61:8
430
+ + --> $DIR/repr-repeated-attrs.rs:62:8
431
+ |
432
+ LL | #[repr(C, C, u8, u8, u8)]
433
+ | ^ ^ ^^ ^^ ^^
434
+ @@ -160,7 +160,7 @@ LL | #[repr(C, C, u8, u8, u8)]
435
+ = note: for consistency, only specify the representation once
436
+
437
+ error[E0566]: conflicting representation hints
438
+ - --> $DIR/repr-repeated-attrs.rs:61:8
439
+ + --> $DIR/repr-repeated-attrs.rs:62:8
440
+ |
441
+ LL | #[repr(C, C, u8, u8, u8)]
442
+ | ^ ^ ^^ ^^ ^^
443
+ @@ -174,7 +174,7 @@ Some errors have detailed explanations: E0566, E0692.
444
+ For more information about an error, try `rustc --explain E0566`.
445
+ Future incompatibility report: Future breakage diagnostic:
446
+ error[E0566]: conflicting representation hints
447
+ - --> $DIR/repr-repeated-attrs.rs:22:8
448
+ + --> $DIR/repr-repeated-attrs.rs:23:8
449
+ |
450
+ LL | #[repr(u8, u8)]
451
+ | ^^ ^^
452
+ @@ -185,7 +185,7 @@ LL | #[repr(u8, u8)]
453
+
454
+ Future breakage diagnostic:
455
+ error[E0566]: conflicting representation hints
456
+ - --> $DIR/repr-repeated-attrs.rs:29:8
457
+ + --> $DIR/repr-repeated-attrs.rs:30:8
458
+ |
459
+ LL | #[repr(C, C, u8)]
460
+ | ^ ^ ^^
461
+ @@ -199,7 +199,7 @@ LL | #[repr(C, u8, u8)]
462
+
463
+ Future breakage diagnostic:
464
+ error[E0566]: conflicting representation hints
465
+ - --> $DIR/repr-repeated-attrs.rs:37:8
466
+ + --> $DIR/repr-repeated-attrs.rs:38:8
467
+ |
468
+ LL | #[repr(Rust, u8, u8)]
469
+ | ^^^^ ^^ ^^
470
+ @@ -210,7 +210,7 @@ LL | #[repr(Rust, u8, u8)]
471
+
472
+ Future breakage diagnostic:
473
+ error[E0566]: conflicting representation hints
474
+ - --> $DIR/repr-repeated-attrs.rs:45:8
475
+ + --> $DIR/repr-repeated-attrs.rs:46:8
476
+ |
477
+ LL | #[repr(u8, u8)]
478
+ | ^^ ^^
479
+ @@ -224,7 +224,7 @@ LL | #[repr(u16)]
480
+
481
+ Future breakage diagnostic:
482
+ error[E0566]: conflicting representation hints
483
+ - --> $DIR/repr-repeated-attrs.rs:53:8
484
+ + --> $DIR/repr-repeated-attrs.rs:54:8
485
+ |
486
+ LL | #[repr(C, u8)]
487
+ | ^ ^^
488
+ @@ -235,7 +235,7 @@ LL | #[repr(C, u8)]
489
+
490
+ Future breakage diagnostic:
491
+ error[E0566]: conflicting representation hints
492
+ - --> $DIR/repr-repeated-attrs.rs:61:8
493
+ + --> $DIR/repr-repeated-attrs.rs:62:8
494
+ |
495
+ LL | #[repr(C, C, u8, u8, u8)]
496
+ | ^ ^ ^^ ^^ ^^
patches/20261028T105419Z/rust-lang--rust-part011/fddaffe8e045a15eee8127b22317fb95b1a10127.patch ADDED
@@ -0,0 +1,697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/compiler/rustc_monomorphize/src/diagnostics.rs b/compiler/rustc_monomorphize/src/diagnostics.rs
2
+ index 51ce633f55a54637618631248db66cf43223057b..a1930dbea3cda8fbc57d6f369bb322b381d02eaa 100644
3
+ --- a/compiler/rustc_monomorphize/src/diagnostics.rs
4
+ +++ b/compiler/rustc_monomorphize/src/diagnostics.rs
5
+ @@ -101,18 +101,23 @@ pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm {
6
+ pub(crate) struct StartNotFound;
7
+
8
+ #[derive(Diagnostic)]
9
+ -#[diag("this function {$is_call ->
10
+ - [true] call
11
+ - *[false] definition
12
+ -} uses {$is_scalable ->
13
+ - [true] scalable
14
+ - *[false] SIMD
15
+ -} vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
16
+ - [true] {\" \"}in the caller
17
+ - *[false] {\"\"}
18
+ -}")]
19
+ +#[diag(
20
+ + "this function {$is_call ->
21
+ + [true] call
22
+ + *[false] definition
23
+ + } requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
24
+ + [true] {\" \"}in the caller
25
+ + *[false] {\"\"}
26
+ + }"
27
+ +)]
28
+ +#[note(
29
+ + "the function has type `{$ty}` in its signature, which is passed in {$is_scalable ->
30
+ + [true] scalable
31
+ + *[false] SIMD
32
+ + } vector registers under the \"{$abi}\" ABI"
33
+ +)]
34
+ #[help(
35
+ - "consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
36
+ + "consider enabling the missing target feature globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
37
+ )]
38
+ pub(crate) struct AbiErrorDisabledVectorType<'a> {
39
+ #[primary_span]
40
+ @@ -124,6 +129,7 @@ pub(crate) struct AbiErrorDisabledVectorType<'a> {
41
+ )]
42
+ pub span: Span,
43
+ pub required_feature: &'a str,
44
+ + pub abi: String,
45
+ pub ty: Ty<'a>,
46
+ /// Whether this is a problem at a call site or at a declaration.
47
+ pub is_call: bool,
48
+ diff --git a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
49
+ index e6c278bd8ce7b25d1dc7fcea701a7fe3f309bffb..24c42892766e7a592e901b4bf96f7b7a119403a3 100644
50
+ --- a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
51
+ +++ b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
52
+ @@ -84,6 +84,7 @@ fn do_check_simd_vector_abi<'tcx>(
53
+ tcx.dcx().emit_err(diagnostics::AbiErrorDisabledVectorType {
54
+ span,
55
+ required_feature: feature,
56
+ + abi: abi.conv.to_string(),
57
+ ty: arg_abi.layout.ty,
58
+ is_call,
59
+ is_scalable: false,
60
+ @@ -101,6 +102,7 @@ fn do_check_simd_vector_abi<'tcx>(
61
+ tcx.dcx().emit_err(diagnostics::AbiErrorDisabledVectorType {
62
+ span,
63
+ required_feature,
64
+ + abi: abi.conv.to_string(),
65
+ ty: arg_abi.layout.ty,
66
+ is_call,
67
+ is_scalable: true,
68
+ @@ -170,12 +172,8 @@ fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
69
+ tcx.dcx().delayed_bug("ABI computation failure should lead to compilation failure");
70
+ return;
71
+ };
72
+ - // Unlike the call-site check, we do also check "Rust" ABI functions here.
73
+ - // This should never trigger, *except* if we start making use of vector registers
74
+ - // for the "Rust" ABI and the user disables those vector registers (which should trigger a
75
+ - // warning as that's clearly disabling a "required" target feature for this target).
76
+ - // Using such a function is where disabling the vector register actually can start leading
77
+ - // to soundness issues, so erroring here seems good.
78
+ + // Unlike the call-site check, we do also check "Rust" ABI functions here. This can actually
79
+ + // trigger due to scalable vectors being require for the "Rust" ABI for some types.
80
+ let loc = || {
81
+ let def_id = instance.def_id();
82
+ (
83
+ diff --git a/tests/ui/abi/simd-abi-checks-avx.stderr b/tests/ui/abi/simd-abi-checks-avx.stderr
84
+ index 7489ca0194600b98d5a0882e23bcebcd794e223b..38e5310d34b26253be5cc3eff14f5178dc02a855 100644
85
+ --- a/tests/ui/abi/simd-abi-checks-avx.stderr
86
+ +++ b/tests/ui/abi/simd-abi-checks-avx.stderr
87
+ @@ -1,90 +1,101 @@
88
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
89
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
90
+ --> $DIR/simd-abi-checks-avx.rs:59:11
91
+ |
92
+ LL | f(g());
93
+ | ^^^ function called here
94
+ |
95
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
96
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
97
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
98
+
99
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
100
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
101
+ --> $DIR/simd-abi-checks-avx.rs:59:9
102
+ |
103
+ LL | f(g());
104
+ | ^^^^^^ function called here
105
+ |
106
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
107
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
108
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
109
+
110
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
111
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
112
+ --> $DIR/simd-abi-checks-avx.rs:65:14
113
+ |
114
+ LL | gavx(favx());
115
+ | ^^^^^^ function called here
116
+ |
117
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
118
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
119
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
120
+
121
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
122
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
123
+ --> $DIR/simd-abi-checks-avx.rs:65:9
124
+ |
125
+ LL | gavx(favx());
126
+ | ^^^^^^^^^^^^ function called here
127
+ |
128
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
129
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
130
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
131
+
132
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
133
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
134
+ --> $DIR/simd-abi-checks-avx.rs:75:19
135
+ |
136
+ LL | w(Wrapper(g()));
137
+ | ^^^ function called here
138
+ |
139
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
140
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
141
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
142
+
143
+ -error: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
144
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
145
+ --> $DIR/simd-abi-checks-avx.rs:75:9
146
+ |
147
+ LL | w(Wrapper(g()));
148
+ | ^^^^^^^^^^^^^^^ function called here
149
+ |
150
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
151
+ + = note: the function has type `Wrapper` in its signature, which is passed in SIMD vector registers under the "C" ABI
152
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
153
+
154
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
155
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
156
+ --> $DIR/simd-abi-checks-avx.rs:89:9
157
+ |
158
+ LL | some_extern();
159
+ | ^^^^^^^^^^^^^ function called here
160
+ |
161
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
162
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
163
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
164
+
165
+ -error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
166
+ +error: this function definition requires the `avx` target feature, which is not enabled
167
+ --> $DIR/simd-abi-checks-avx.rs:24:1
168
+ |
169
+ LL | unsafe extern "C" fn g() -> __m256 {
170
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
171
+ |
172
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
173
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
174
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
175
+
176
+ -error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
177
+ +error: this function definition requires the `avx` target feature, which is not enabled
178
+ --> $DIR/simd-abi-checks-avx.rs:19:1
179
+ |
180
+ LL | unsafe extern "C" fn f(_: __m256) {
181
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
182
+ |
183
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
184
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
185
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
186
+
187
+ -error: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
188
+ +error: this function definition requires the `avx` target feature, which is not enabled
189
+ --> $DIR/simd-abi-checks-avx.rs:14:1
190
+ |
191
+ LL | unsafe extern "C" fn w(_: Wrapper) {
192
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
193
+ |
194
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
195
+ + = note: the function has type `Wrapper` in its signature, which is passed in SIMD vector registers under the "C" ABI
196
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
197
+
198
+ -error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
199
+ +error: this function call requires the `avx` target feature, which is not enabled in the caller
200
+ --> $DIR/simd-abi-checks-avx.rs:53:8
201
+ |
202
+ LL | || g()
203
+ | ^^^ function called here
204
+ |
205
+ - = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
206
+ + = note: the function has type `std::arch::x86_64::__m256` in its signature, which is passed in SIMD vector registers under the "C" ABI
207
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
208
+
209
+ note: the above error was encountered while instantiating `fn in_closure::{closure#0}`
210
+ --> $DIR/simd-abi-checks-avx.rs:81:9
211
+ diff --git a/tests/ui/abi/simd-abi-checks-s390x.z10.stderr b/tests/ui/abi/simd-abi-checks-s390x.z10.stderr
212
+ index c401da52ba87874b51c407c2bb1ccb6269e2f21a..492066310c24681c2d7a94acf552bb810e4af793 100644
213
+ --- a/tests/ui/abi/simd-abi-checks-s390x.z10.stderr
214
+ +++ b/tests/ui/abi/simd-abi-checks-s390x.z10.stderr
215
+ @@ -1,20 +1,22 @@
216
+ -error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
217
+ +error: this function definition requires the `vector` target feature, which is not enabled
218
+ --> $DIR/simd-abi-checks-s390x.rs:33:1
219
+ |
220
+ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 {
221
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
222
+ |
223
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
224
+ + = note: the function has type `Simd<i8, 8>` in its signature, which is passed in SIMD vector registers under the "C" ABI
225
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
226
+
227
+ -error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
228
+ +error: this function definition requires the `vector` target feature, which is not enabled
229
+ --> $DIR/simd-abi-checks-s390x.rs:38:1
230
+ |
231
+ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 {
232
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
233
+ |
234
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
235
+ + = note: the function has type `Simd<i8, 16>` in its signature, which is passed in SIMD vector registers under the "C" ABI
236
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
237
+
238
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
239
+ +error: this function definition requires the `vector` target feature, which is not enabled
240
+ --> $DIR/simd-abi-checks-s390x.rs:84:1
241
+ |
242
+ LL | / extern "C" fn vector_transparent_wrapper_ret_small(
243
+ @@ -22,9 +24,10 @@ LL | | x: &TransparentWrapper<i8x8>,
244
+ LL | | ) -> TransparentWrapper<i8x8> {
245
+ | |_____________________________^ function defined here
246
+ |
247
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
248
+ + = note: the function has type `TransparentWrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
249
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
250
+
251
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
252
+ +error: this function definition requires the `vector` target feature, which is not enabled
253
+ --> $DIR/simd-abi-checks-s390x.rs:91:1
254
+ |
255
+ LL | / extern "C" fn vector_transparent_wrapper_ret(
256
+ @@ -32,55 +35,62 @@ LL | | x: &TransparentWrapper<i8x16>,
257
+ LL | | ) -> TransparentWrapper<i8x16> {
258
+ | |______________________________^ function defined here
259
+ |
260
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
261
+ + = note: the function has type `TransparentWrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
262
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
263
+
264
+ -error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
265
+ +error: this function definition requires the `vector` target feature, which is not enabled
266
+ --> $DIR/simd-abi-checks-s390x.rs:106:1
267
+ |
268
+ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 {
269
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
270
+ |
271
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
272
+ + = note: the function has type `Simd<i8, 8>` in its signature, which is passed in SIMD vector registers under the "C" ABI
273
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
274
+
275
+ -error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
276
+ +error: this function definition requires the `vector` target feature, which is not enabled
277
+ --> $DIR/simd-abi-checks-s390x.rs:111:1
278
+ |
279
+ LL | extern "C" fn vector_arg(x: i8x16) -> i64 {
280
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
281
+ |
282
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
283
+ + = note: the function has type `Simd<i8, 16>` in its signature, which is passed in SIMD vector registers under the "C" ABI
284
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
285
+
286
+ -error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
287
+ +error: this function definition requires the `vector` target feature, which is not enabled
288
+ --> $DIR/simd-abi-checks-s390x.rs:122:1
289
+ |
290
+ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 {
291
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
292
+ |
293
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
294
+ + = note: the function has type `Wrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
295
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
296
+
297
+ -error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
298
+ +error: this function definition requires the `vector` target feature, which is not enabled
299
+ --> $DIR/simd-abi-checks-s390x.rs:127:1
300
+ |
301
+ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 {
302
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
303
+ |
304
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
305
+ + = note: the function has type `Wrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
306
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
307
+
308
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
309
+ +error: this function definition requires the `vector` target feature, which is not enabled
310
+ --> $DIR/simd-abi-checks-s390x.rs:138:1
311
+ |
312
+ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 {
313
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
314
+ |
315
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
316
+ + = note: the function has type `TransparentWrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
317
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
318
+
319
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
320
+ +error: this function definition requires the `vector` target feature, which is not enabled
321
+ --> $DIR/simd-abi-checks-s390x.rs:143:1
322
+ |
323
+ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 {
324
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
325
+ |
326
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
327
+ + = note: the function has type `TransparentWrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
328
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
329
+
330
+ error: aborting due to 10 previous errors
331
+
332
+ diff --git a/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr b/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr
333
+ index c401da52ba87874b51c407c2bb1ccb6269e2f21a..492066310c24681c2d7a94acf552bb810e4af793 100644
334
+ --- a/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr
335
+ +++ b/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr
336
+ @@ -1,20 +1,22 @@
337
+ -error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
338
+ +error: this function definition requires the `vector` target feature, which is not enabled
339
+ --> $DIR/simd-abi-checks-s390x.rs:33:1
340
+ |
341
+ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 {
342
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
343
+ |
344
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
345
+ + = note: the function has type `Simd<i8, 8>` in its signature, which is passed in SIMD vector registers under the "C" ABI
346
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
347
+
348
+ -error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
349
+ +error: this function definition requires the `vector` target feature, which is not enabled
350
+ --> $DIR/simd-abi-checks-s390x.rs:38:1
351
+ |
352
+ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 {
353
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
354
+ |
355
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
356
+ + = note: the function has type `Simd<i8, 16>` in its signature, which is passed in SIMD vector registers under the "C" ABI
357
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
358
+
359
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
360
+ +error: this function definition requires the `vector` target feature, which is not enabled
361
+ --> $DIR/simd-abi-checks-s390x.rs:84:1
362
+ |
363
+ LL | / extern "C" fn vector_transparent_wrapper_ret_small(
364
+ @@ -22,9 +24,10 @@ LL | | x: &TransparentWrapper<i8x8>,
365
+ LL | | ) -> TransparentWrapper<i8x8> {
366
+ | |_____________________________^ function defined here
367
+ |
368
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
369
+ + = note: the function has type `TransparentWrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
370
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
371
+
372
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
373
+ +error: this function definition requires the `vector` target feature, which is not enabled
374
+ --> $DIR/simd-abi-checks-s390x.rs:91:1
375
+ |
376
+ LL | / extern "C" fn vector_transparent_wrapper_ret(
377
+ @@ -32,55 +35,62 @@ LL | | x: &TransparentWrapper<i8x16>,
378
+ LL | | ) -> TransparentWrapper<i8x16> {
379
+ | |______________________________^ function defined here
380
+ |
381
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
382
+ + = note: the function has type `TransparentWrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
383
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
384
+
385
+ -error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
386
+ +error: this function definition requires the `vector` target feature, which is not enabled
387
+ --> $DIR/simd-abi-checks-s390x.rs:106:1
388
+ |
389
+ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 {
390
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
391
+ |
392
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
393
+ + = note: the function has type `Simd<i8, 8>` in its signature, which is passed in SIMD vector registers under the "C" ABI
394
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
395
+
396
+ -error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
397
+ +error: this function definition requires the `vector` target feature, which is not enabled
398
+ --> $DIR/simd-abi-checks-s390x.rs:111:1
399
+ |
400
+ LL | extern "C" fn vector_arg(x: i8x16) -> i64 {
401
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
402
+ |
403
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
404
+ + = note: the function has type `Simd<i8, 16>` in its signature, which is passed in SIMD vector registers under the "C" ABI
405
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
406
+
407
+ -error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
408
+ +error: this function definition requires the `vector` target feature, which is not enabled
409
+ --> $DIR/simd-abi-checks-s390x.rs:122:1
410
+ |
411
+ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 {
412
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
413
+ |
414
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
415
+ + = note: the function has type `Wrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
416
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
417
+
418
+ -error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
419
+ +error: this function definition requires the `vector` target feature, which is not enabled
420
+ --> $DIR/simd-abi-checks-s390x.rs:127:1
421
+ |
422
+ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 {
423
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
424
+ |
425
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
426
+ + = note: the function has type `Wrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
427
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
428
+
429
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
430
+ +error: this function definition requires the `vector` target feature, which is not enabled
431
+ --> $DIR/simd-abi-checks-s390x.rs:138:1
432
+ |
433
+ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 {
434
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
435
+ |
436
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
437
+ + = note: the function has type `TransparentWrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
438
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
439
+
440
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
441
+ +error: this function definition requires the `vector` target feature, which is not enabled
442
+ --> $DIR/simd-abi-checks-s390x.rs:143:1
443
+ |
444
+ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 {
445
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
446
+ |
447
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
448
+ + = note: the function has type `TransparentWrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
449
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
450
+
451
+ error: aborting due to 10 previous errors
452
+
453
+ diff --git a/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr b/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr
454
+ index 59697d6af254a67c8380c94dfa4b4f5b0f421d51..d1d8389752d5d92ac1e84093efc3a060e550507b 100644
455
+ --- a/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr
456
+ +++ b/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr
457
+ @@ -8,23 +8,25 @@ warning: target feature `soft-float` must be disabled to ensure that the ABI of
458
+ = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
459
+ = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
460
+
461
+ -error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
462
+ +error: this function definition requires the `vector` target feature, which is not enabled
463
+ --> $DIR/simd-abi-checks-s390x.rs:33:1
464
+ |
465
+ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 {
466
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
467
+ |
468
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
469
+ + = note: the function has type `Simd<i8, 8>` in its signature, which is passed in SIMD vector registers under the "C" ABI
470
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
471
+
472
+ -error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
473
+ +error: this function definition requires the `vector` target feature, which is not enabled
474
+ --> $DIR/simd-abi-checks-s390x.rs:38:1
475
+ |
476
+ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 {
477
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
478
+ |
479
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
480
+ + = note: the function has type `Simd<i8, 16>` in its signature, which is passed in SIMD vector registers under the "C" ABI
481
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
482
+
483
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
484
+ +error: this function definition requires the `vector` target feature, which is not enabled
485
+ --> $DIR/simd-abi-checks-s390x.rs:84:1
486
+ |
487
+ LL | / extern "C" fn vector_transparent_wrapper_ret_small(
488
+ @@ -32,9 +34,10 @@ LL | | x: &TransparentWrapper<i8x8>,
489
+ LL | | ) -> TransparentWrapper<i8x8> {
490
+ | |_____________________________^ function defined here
491
+ |
492
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
493
+ + = note: the function has type `TransparentWrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
494
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
495
+
496
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
497
+ +error: this function definition requires the `vector` target feature, which is not enabled
498
+ --> $DIR/simd-abi-checks-s390x.rs:91:1
499
+ |
500
+ LL | / extern "C" fn vector_transparent_wrapper_ret(
501
+ @@ -42,55 +45,62 @@ LL | | x: &TransparentWrapper<i8x16>,
502
+ LL | | ) -> TransparentWrapper<i8x16> {
503
+ | |______________________________^ function defined here
504
+ |
505
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
506
+ + = note: the function has type `TransparentWrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
507
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
508
+
509
+ -error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
510
+ +error: this function definition requires the `vector` target feature, which is not enabled
511
+ --> $DIR/simd-abi-checks-s390x.rs:106:1
512
+ |
513
+ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 {
514
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
515
+ |
516
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
517
+ + = note: the function has type `Simd<i8, 8>` in its signature, which is passed in SIMD vector registers under the "C" ABI
518
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
519
+
520
+ -error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
521
+ +error: this function definition requires the `vector` target feature, which is not enabled
522
+ --> $DIR/simd-abi-checks-s390x.rs:111:1
523
+ |
524
+ LL | extern "C" fn vector_arg(x: i8x16) -> i64 {
525
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
526
+ |
527
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
528
+ + = note: the function has type `Simd<i8, 16>` in its signature, which is passed in SIMD vector registers under the "C" ABI
529
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
530
+
531
+ -error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
532
+ +error: this function definition requires the `vector` target feature, which is not enabled
533
+ --> $DIR/simd-abi-checks-s390x.rs:122:1
534
+ |
535
+ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 {
536
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
537
+ |
538
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
539
+ + = note: the function has type `Wrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
540
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
541
+
542
+ -error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
543
+ +error: this function definition requires the `vector` target feature, which is not enabled
544
+ --> $DIR/simd-abi-checks-s390x.rs:127:1
545
+ |
546
+ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 {
547
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
548
+ |
549
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
550
+ + = note: the function has type `Wrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
551
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
552
+
553
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
554
+ +error: this function definition requires the `vector` target feature, which is not enabled
555
+ --> $DIR/simd-abi-checks-s390x.rs:138:1
556
+ |
557
+ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 {
558
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
559
+ |
560
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
561
+ + = note: the function has type `TransparentWrapper<Simd<i8, 8>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
562
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
563
+
564
+ -error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
565
+ +error: this function definition requires the `vector` target feature, which is not enabled
566
+ --> $DIR/simd-abi-checks-s390x.rs:143:1
567
+ |
568
+ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 {
569
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
570
+ |
571
+ - = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
572
+ + = note: the function has type `TransparentWrapper<Simd<i8, 16>>` in its signature, which is passed in SIMD vector registers under the "C" ABI
573
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
574
+
575
+ error: aborting due to 10 previous errors; 2 warnings emitted
576
+
577
+ diff --git a/tests/ui/abi/simd-abi-checks-sse.rs b/tests/ui/abi/simd-abi-checks-sse.rs
578
+ index 736f32afcd4648790269b0aaf331f23d67a39bac..906b6ec65610ef7ad40786f05a14ec5d29f8e24c 100644
579
+ --- a/tests/ui/abi/simd-abi-checks-sse.rs
580
+ +++ b/tests/ui/abi/simd-abi-checks-sse.rs
581
+ @@ -6,6 +6,7 @@
582
+ //@ build-fail
583
+ //@ needs-llvm-components: x86
584
+ //@ ignore-backends: gcc
585
+ +//@ dont-require-annotations: NOTE
586
+ #![feature(no_core)]
587
+ #![no_core]
588
+ #![allow(improper_ctypes_definitions)]
589
+ @@ -15,5 +16,6 @@ use minicore::simd::Simd;
590
+
591
+ #[no_mangle]
592
+ pub unsafe extern "C" fn f(_: Simd<i64, 2>) {
593
+ - //~^ ERROR: this function definition uses SIMD vector type `Simd<i64, 2>` which (with the chosen ABI) requires the `sse` target feature, which is not enabled
594
+ + //~^ ERROR: requires the `sse` target feature
595
+ + //~| NOTE: the function has type `Simd<i64, 2>` in its signature, which is passed in SIMD vector registers under the "C" ABI
596
+ }
597
+ diff --git a/tests/ui/abi/simd-abi-checks-sse.stderr b/tests/ui/abi/simd-abi-checks-sse.stderr
598
+ index 1a6583a511e0c6caa2c0ed1081cf3c51e603374e..91f3f851fa2ca0aa814c6cedc2758c48f06cf31b 100644
599
+ --- a/tests/ui/abi/simd-abi-checks-sse.stderr
600
+ +++ b/tests/ui/abi/simd-abi-checks-sse.stderr
601
+ @@ -1,10 +1,11 @@
602
+ -error: this function definition uses SIMD vector type `Simd<i64, 2>` which (with the chosen ABI) requires the `sse` target feature, which is not enabled
603
+ - --> $DIR/simd-abi-checks-sse.rs:17:1
604
+ +error: this function definition requires the `sse` target feature, which is not enabled
605
+ + --> $DIR/simd-abi-checks-sse.rs:18:1
606
+ |
607
+ LL | pub unsafe extern "C" fn f(_: Simd<i64, 2>) {
608
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
609
+ |
610
+ - = help: consider enabling it globally (`-C target-feature=+sse`) or locally (`#[target_feature(enable="sse")]`)
611
+ + = note: the function has type `Simd<i64, 2>` in its signature, which is passed in SIMD vector registers under the "C" ABI
612
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+sse`) or locally (`#[target_feature(enable="sse")]`)
613
+
614
+ error: aborting due to 1 previous error
615
+
616
+ diff --git a/tests/ui/scalable-vectors/require-target-feature.rs b/tests/ui/scalable-vectors/require-target-feature.rs
617
+ index b3c1d3e510077bdd16bcbae9a59709bc6123399d..42194d2351a90693daee52e27352c87a2ed183e9 100644
618
+ --- a/tests/ui/scalable-vectors/require-target-feature.rs
619
+ +++ b/tests/ui/scalable-vectors/require-target-feature.rs
620
+ @@ -1,18 +1,27 @@
621
+ //@ build-fail
622
+ -//@ compile-flags: --crate-type=lib
623
+ -//@ only-aarch64
624
+ +//@ compile-flags: --crate-type=lib --target=aarch64-unknown-linux-gnu
625
+ +//@ needs-llvm-components: aarch64
626
+ +//@ add-minicore
627
+ +//@ dont-require-annotations: NOTE
628
+ +
629
+ #![allow(incomplete_features, internal_features)]
630
+ #![feature(
631
+ simd_ffi,
632
+ rustc_attrs,
633
+ - link_llvm_intrinsics
634
+ + link_llvm_intrinsics,
635
+ + no_core
636
+ )]
637
+ +#![no_core]
638
+ +
639
+ +extern crate minicore;
640
+ +use minicore::*;
641
+
642
+ -#[derive(Copy, Clone)]
643
+ #[rustc_scalable_vector(4)]
644
+ #[allow(non_camel_case_types)]
645
+ pub struct svint32_t(i32);
646
+
647
+ +impl Copy for svint32_t {}
648
+ +
649
+ #[inline(never)]
650
+ #[target_feature(enable = "sve")]
651
+ pub unsafe fn svdup_n_s32(op: i32) -> svint32_t {
652
+ @@ -25,7 +34,8 @@ pub unsafe fn svdup_n_s32(op: i32) -> svint32_t {
653
+ }
654
+
655
+ pub fn non_annotated_callee(x: svint32_t) {}
656
+ -//~^ ERROR: this function definition uses scalable vector type `svint32_t`
657
+ +//~^ ERROR: this function definition requires the `sve` target feature
658
+ +//~| NOTE: the function has type `svint32_t` in its signature, which is passed in scalable vector registers under the "Rust" ABI
659
+
660
+ #[target_feature(enable = "sve")]
661
+ pub fn annotated_callee(x: svint32_t) {} // okay!
662
+ diff --git a/tests/ui/scalable-vectors/require-target-feature.stderr b/tests/ui/scalable-vectors/require-target-feature.stderr
663
+ index 85b9e5b6579ce31d56bb7104275287839fb55a63..626b6817ce75be2edead876001246c3a3c4dbf32 100644
664
+ --- a/tests/ui/scalable-vectors/require-target-feature.stderr
665
+ +++ b/tests/ui/scalable-vectors/require-target-feature.stderr
666
+ @@ -1,5 +1,5 @@
667
+ warning: `extern` block uses type `svint32_t`, which is not FFI-safe
668
+ - --> $DIR/require-target-feature.rs:21:37
669
+ + --> $DIR/require-target-feature.rs:30:37
670
+ |
671
+ LL | fn _svdup_n_s32(op: i32) -> svint32_t;
672
+ | ^^^^^^^^^ not FFI-safe
673
+ @@ -7,19 +7,20 @@ LL | fn _svdup_n_s32(op: i32) -> svint32_t;
674
+ = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
675
+ = note: this struct has unspecified layout
676
+ note: the type is defined here
677
+ - --> $DIR/require-target-feature.rs:14:1
678
+ + --> $DIR/require-target-feature.rs:21:1
679
+ |
680
+ LL | pub struct svint32_t(i32);
681
+ | ^^^^^^^^^^^^^^^^^^^^
682
+ = note: `#[warn(improper_ctypes)]` on by default
683
+
684
+ -error: this function definition uses scalable vector type `svint32_t` which (with the chosen ABI) requires the `sve` target feature, which is not enabled
685
+ - --> $DIR/require-target-feature.rs:27:1
686
+ +error: this function definition requires the `sve` target feature, which is not enabled
687
+ + --> $DIR/require-target-feature.rs:36:1
688
+ |
689
+ LL | pub fn non_annotated_callee(x: svint32_t) {}
690
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
691
+ |
692
+ - = help: consider enabling it globally (`-C target-feature=+sve`) or locally (`#[target_feature(enable="sve")]`)
693
+ + = note: the function has type `svint32_t` in its signature, which is passed in scalable vector registers under the "Rust" ABI
694
+ + = help: consider enabling the missing target feature globally (`-C target-feature=+sve`) or locally (`#[target_feature(enable="sve")]`)
695
+
696
+ error: aborting due to 1 previous error; 1 warning emitted
697
+
progress/20261028T105419Z/rust-lang--rust-part011-patches.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repository": "rust-lang/rust", "patch_characters": 1435703, "before_characters": 15376687, "after_characters": 15464861, "collected_commits": 39, "status": "running", "updated_at": "2026-10-28T17:24:35.227088+00:00"}