Skip to content

Commit adb8ba3

Browse files
committed
Merge commit '4bdfb0741dbcecd5279a2635c3280726db0604b5' into clippyup
2 parents fde3000 + 4bdfb07 commit adb8ba3

File tree

127 files changed

+2707
-602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2707
-602
lines changed

src/tools/clippy/.github/workflows/clippy_bors.yml

-7
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ jobs:
8282
with:
8383
github_token: "${{ secrets.github_token }}"
8484

85-
- name: Install dependencies (Linux-i686)
86-
run: |
87-
sudo dpkg --add-architecture i386
88-
sudo apt-get update
89-
sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
90-
if: matrix.host == 'i686-unknown-linux-gnu'
91-
9285
- name: Checkout
9386
uses: actions/[email protected]
9487

src/tools/clippy/CHANGELOG.md

+175-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,181 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[b52fb523...master](https://github.com/rust-lang/rust-clippy/compare/b52fb523...master)
9+
[4f142aa1...master](https://github.com/rust-lang/rust-clippy/compare/4f142aa1...master)
10+
11+
## Rust 1.66
12+
13+
Current stable, released 2022-12-15
14+
15+
[b52fb523...4f142aa1](https://github.com/rust-lang/rust-clippy/compare/b52fb523...4f142aa1)
16+
17+
### New Lints
18+
19+
* [`manual_clamp`]
20+
[#9484](https://github.com/rust-lang/rust-clippy/pull/9484)
21+
* [`missing_trait_methods`]
22+
[#9670](https://github.com/rust-lang/rust-clippy/pull/9670)
23+
* [`unused_format_specs`]
24+
[#9637](https://github.com/rust-lang/rust-clippy/pull/9637)
25+
* [`iter_kv_map`]
26+
[#9409](https://github.com/rust-lang/rust-clippy/pull/9409)
27+
* [`manual_filter`]
28+
[#9451](https://github.com/rust-lang/rust-clippy/pull/9451)
29+
* [`box_default`]
30+
[#9511](https://github.com/rust-lang/rust-clippy/pull/9511)
31+
* [`implicit_saturating_add`]
32+
[#9549](https://github.com/rust-lang/rust-clippy/pull/9549)
33+
* [`as_ptr_cast_mut`]
34+
[#9572](https://github.com/rust-lang/rust-clippy/pull/9572)
35+
* [`disallowed_macros`]
36+
[#9495](https://github.com/rust-lang/rust-clippy/pull/9495)
37+
* [`partial_pub_fields`]
38+
[#9658](https://github.com/rust-lang/rust-clippy/pull/9658)
39+
* [`uninlined_format_args`]
40+
[#9233](https://github.com/rust-lang/rust-clippy/pull/9233)
41+
* [`cast_nan_to_int`]
42+
[#9617](https://github.com/rust-lang/rust-clippy/pull/9617)
43+
44+
### Moves and Deprecations
45+
46+
* `positional_named_format_parameters` was uplifted to rustc under the new name
47+
`named_arguments_used_positionally`
48+
[#8518](https://github.com/rust-lang/rust-clippy/pull/8518)
49+
* Moved [`implicit_saturating_sub`] to `style` (Now warn-by-default)
50+
[#9584](https://github.com/rust-lang/rust-clippy/pull/9584)
51+
* Moved `derive_partial_eq_without_eq` to `nursery` (now allow-by-default)
52+
[#9536](https://github.com/rust-lang/rust-clippy/pull/9536)
53+
54+
### Enhancements
55+
56+
* [`nonstandard_macro_braces`]: Now includes `matches!()` in the default lint config
57+
[#9471](https://github.com/rust-lang/rust-clippy/pull/9471)
58+
* [`suboptimal_flops`]: Now supports multiplication and subtraction operations
59+
[#9581](https://github.com/rust-lang/rust-clippy/pull/9581)
60+
* [`arithmetic_side_effects`]: Now detects cases with literals behind references
61+
[#9587](https://github.com/rust-lang/rust-clippy/pull/9587)
62+
* [`upper_case_acronyms`]: Now also checks enum names
63+
[#9580](https://github.com/rust-lang/rust-clippy/pull/9580)
64+
* [`needless_borrowed_reference`]: Now lints nested patterns
65+
[#9573](https://github.com/rust-lang/rust-clippy/pull/9573)
66+
* [`unnecessary_cast`]: Now works for non-trivial non-literal expressions
67+
[#9576](https://github.com/rust-lang/rust-clippy/pull/9576)
68+
* [`arithmetic_side_effects`]: Now detects operations with custom types
69+
[#9559](https://github.com/rust-lang/rust-clippy/pull/9559)
70+
* [`disallowed_methods`], [`disallowed_types`]: Not correctly lints types, functions and macros
71+
with the same path
72+
[#9495](https://github.com/rust-lang/rust-clippy/pull/9495)
73+
* [`self_named_module_files`], [`mod_module_files`]: Now take remapped path prefixes into account
74+
[#9475](https://github.com/rust-lang/rust-clippy/pull/9475)
75+
* [`bool_to_int_with_if`]: Now detects the inverse if case
76+
[#9476](https://github.com/rust-lang/rust-clippy/pull/9476)
77+
78+
### False Positive Fixes
79+
80+
* [`arithmetic_side_effects`]: Now allows operations that can't overflow
81+
[#9474](https://github.com/rust-lang/rust-clippy/pull/9474)
82+
* [`unnecessary_lazy_evaluations`]: No longer lints in external macros
83+
[#9486](https://github.com/rust-lang/rust-clippy/pull/9486)
84+
* [`needless_borrow`], [`explicit_auto_deref`]: No longer lint on unions that require the reference
85+
[#9490](https://github.com/rust-lang/rust-clippy/pull/9490)
86+
* [`almost_complete_letter_range`]: No longer lints in external macros
87+
[#9467](https://github.com/rust-lang/rust-clippy/pull/9467)
88+
* [`drop_copy`]: No longer lints on idiomatic cases in match arms
89+
[#9491](https://github.com/rust-lang/rust-clippy/pull/9491)
90+
* [`question_mark`]: No longer lints in const context
91+
[#9487](https://github.com/rust-lang/rust-clippy/pull/9487)
92+
* [`collapsible_if`]: Suggestion now work in macros
93+
[#9410](https://github.com/rust-lang/rust-clippy/pull/9410)
94+
* [`std_instead_of_core`]: No longer triggers on unstable modules
95+
[#9545](https://github.com/rust-lang/rust-clippy/pull/9545)
96+
* [`unused_peekable`]: No longer lints, if the peak is done in a closure or function
97+
[#9465](https://github.com/rust-lang/rust-clippy/pull/9465)
98+
* [`useless_attribute`]: No longer lints on `#[allow]` attributes for [`unsafe_removed_from_name`]
99+
[#9593](https://github.com/rust-lang/rust-clippy/pull/9593)
100+
* [`unnecessary_lazy_evaluations`]: No longer suggest switching to early evaluation when type has
101+
custom `Drop` implementation
102+
[#9551](https://github.com/rust-lang/rust-clippy/pull/9551)
103+
* [`unnecessary_cast`]: No longer lints on negative hexadecimal literals when cast as floats
104+
[#9609](https://github.com/rust-lang/rust-clippy/pull/9609)
105+
* [`use_self`]: No longer lints in proc macros
106+
[#9454](https://github.com/rust-lang/rust-clippy/pull/9454)
107+
* [`never_loop`]: Now takes `let ... else` statements into consideration.
108+
[#9496](https://github.com/rust-lang/rust-clippy/pull/9496)
109+
* [`default_numeric_fallback`]: Now ignores constants
110+
[#9636](https://github.com/rust-lang/rust-clippy/pull/9636)
111+
* [`uninit_vec`]: No longer lints `Vec::set_len(0)`
112+
[#9519](https://github.com/rust-lang/rust-clippy/pull/9519)
113+
* [`arithmetic_side_effects`]: Now ignores references to integer types
114+
[#9507](https://github.com/rust-lang/rust-clippy/pull/9507)
115+
* [`large_stack_arrays`]: No longer lints inside static items
116+
[#9466](https://github.com/rust-lang/rust-clippy/pull/9466)
117+
* [`ref_option_ref`]: No longer lints if the inner reference is mutable
118+
[#9684](https://github.com/rust-lang/rust-clippy/pull/9684)
119+
* [`ptr_arg`]: No longer lints if the argument is used as an incomplete trait object
120+
[#9645](https://github.com/rust-lang/rust-clippy/pull/9645)
121+
* [`should_implement_trait`]: Now also works for `default` methods
122+
[#9546](https://github.com/rust-lang/rust-clippy/pull/9546)
123+
124+
### Suggestion Fixes/Improvements
125+
126+
* [`derivable_impls`]: The suggestion is now machine applicable
127+
[#9429](https://github.com/rust-lang/rust-clippy/pull/9429)
128+
* [`match_single_binding`]: The suggestion now handles scrutinies with side effects better
129+
[#9601](https://github.com/rust-lang/rust-clippy/pull/9601)
130+
* [`zero_prefixed_literal`]: Only suggests using octal numbers, if this is possible
131+
[#9652](https://github.com/rust-lang/rust-clippy/pull/9652)
132+
* [`rc_buffer`]: The suggestion is no longer machine applicable to avoid semantic changes
133+
[#9633](https://github.com/rust-lang/rust-clippy/pull/9633)
134+
* [`print_literal`], [`write_literal`], [`uninlined_format_args`]: The suggestion now ignores
135+
comments after the macro call.
136+
[#9586](https://github.com/rust-lang/rust-clippy/pull/9586)
137+
* [`expect_fun_call`]:Improved the suggestion for `format!` calls with captured variables
138+
[#9586](https://github.com/rust-lang/rust-clippy/pull/9586)
139+
* [`nonstandard_macro_braces`]: The suggestion is now machine applicable and will no longer
140+
replace brackets inside the macro argument.
141+
[#9499](https://github.com/rust-lang/rust-clippy/pull/9499)
142+
* [`from_over_into`]: The suggestion is now a machine applicable and contains explanations
143+
[#9649](https://github.com/rust-lang/rust-clippy/pull/9649)
144+
* [`needless_return`]: The automatic suggestion now removes all required semicolons
145+
[#9497](https://github.com/rust-lang/rust-clippy/pull/9497)
146+
* [`to_string_in_format_args`]: The suggestion now keeps parenthesis around values
147+
[#9590](https://github.com/rust-lang/rust-clippy/pull/9590)
148+
* [`manual_assert`]: The suggestion now preserves comments
149+
[#9479](https://github.com/rust-lang/rust-clippy/pull/9479)
150+
* [`redundant_allocation`]: The suggestion applicability is now marked `MaybeIncorrect` to
151+
avoid semantic changes
152+
[#9634](https://github.com/rust-lang/rust-clippy/pull/9634)
153+
* [`assertions_on_result_states`]: The suggestion has been corrected, for cases where the
154+
`assert!` is not in a statement.
155+
[#9453](https://github.com/rust-lang/rust-clippy/pull/9453)
156+
* [`nonminimal_bool`]: The suggestion no longer expands macros
157+
[#9457](https://github.com/rust-lang/rust-clippy/pull/9457)
158+
* [`collapsible_match`]: Now specifies field names, when a struct is destructed
159+
[#9685](https://github.com/rust-lang/rust-clippy/pull/9685)
160+
* [`unnecessary_cast`]: The suggestion now adds parenthesis for negative numbers
161+
[#9577](https://github.com/rust-lang/rust-clippy/pull/9577)
162+
* [`redundant_closure`]: The suggestion now works for `impl FnMut` arguments
163+
[#9556](https://github.com/rust-lang/rust-clippy/pull/9556)
164+
165+
### ICE Fixes
166+
167+
* [`unnecessary_to_owned`]: Avoid ICEs in favor of false negatives if information is missing
168+
[#9505](https://github.com/rust-lang/rust-clippy/pull/9505)
169+
* [`manual_range_contains`]: No longer ICEs on values behind references
170+
[#9627](https://github.com/rust-lang/rust-clippy/pull/9627)
171+
* [`needless_pass_by_value`]: No longer ICEs on unsized `dyn Fn` arguments
172+
[#9531](https://github.com/rust-lang/rust-clippy/pull/9531)
173+
* `*_interior_mutable_const` lints: no longer ICE on const unions containing `!Freeze` types
174+
[#9539](https://github.com/rust-lang/rust-clippy/pull/9539)
175+
176+
### Others
177+
178+
* Released `rustc_tools_util` for version information on `Crates.io`. (Further adjustments will
179+
not be published as part of this changelog)
10180

11181
## Rust 1.65
12182

13-
Current stable, released 2022-11-03
183+
Released 2022-11-03
14184

15185
[3c7e7dbc...b52fb523](https://github.com/rust-lang/rust-clippy/compare/3c7e7dbc...b52fb523)
16186

@@ -3875,6 +4045,7 @@ Released 2018-09-13
38754045
[`alloc_instead_of_core`]: https://rust-lang.github.io/rust-clippy/master/index.html#alloc_instead_of_core
38764046
[`allow_attributes_without_reason`]: https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason
38774047
[`almost_complete_letter_range`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_letter_range
4048+
[`almost_complete_range`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range
38784049
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
38794050
[`approx_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
38804051
[`arithmetic_side_effects`]: https://rust-lang.github.io/rust-clippy/master/index.html#arithmetic_side_effects
@@ -4353,6 +4524,8 @@ Released 2018-09-13
43534524
[`self_named_constructors`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_constructors
43544525
[`self_named_module_files`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_module_files
43554526
[`semicolon_if_nothing_returned`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
4527+
[`semicolon_inside_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_inside_block
4528+
[`semicolon_outside_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_outside_block
43564529
[`separated_literal_suffix`]: https://rust-lang.github.io/rust-clippy/master/index.html#separated_literal_suffix
43574530
[`serde_api_misuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#serde_api_misuse
43584531
[`shadow_reuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_reuse

src/tools/clippy/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.67"
3+
version = "0.1.68"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"
@@ -23,7 +23,7 @@ path = "src/driver.rs"
2323
[dependencies]
2424
clippy_lints = { path = "clippy_lints" }
2525
semver = "1.0"
26-
rustc_tools_util = "0.2.1"
26+
rustc_tools_util = "0.3.0"
2727
tempfile = { version = "3.2", optional = true }
2828
termize = "0.1"
2929

@@ -55,7 +55,7 @@ tokio = { version = "1", features = ["io-util"] }
5555
rustc-semver = "1.1"
5656

5757
[build-dependencies]
58-
rustc_tools_util = "0.2.1"
58+
rustc_tools_util = "0.3.0"
5959

6060
[features]
6161
deny-warnings = ["clippy_lints/deny-warnings"]

src/tools/clippy/book/src/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Clippy
22

3-
[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test%22+event%3Apush+branch%3Aauto)
3+
[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test%20(bors)/badge.svg?branch=auto&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test+(bors)%22+event%3Apush+branch%3Aauto)
44
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)
55

66
A collection of lints to catch common mistakes and improve your

src/tools/clippy/build.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,5 @@ fn main() {
33
println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap());
44
// Don't rebuild even if nothing changed
55
println!("cargo:rerun-if-changed=build.rs");
6-
// forward git repo hashes we build at
7-
println!(
8-
"cargo:rustc-env=GIT_HASH={}",
9-
rustc_tools_util::get_commit_hash().unwrap_or_default()
10-
);
11-
println!(
12-
"cargo:rustc-env=COMMIT_DATE={}",
13-
rustc_tools_util::get_commit_date().unwrap_or_default()
14-
);
15-
println!(
16-
"cargo:rustc-env=RUSTC_RELEASE_CHANNEL={}",
17-
rustc_tools_util::get_channel()
18-
);
6+
rustc_tools_util::setup_version_info!();
197
}

src/tools/clippy/clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.67"
3+
version = "0.1.68"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

src/tools/clippy/clippy_lints/src/almost_complete_letter_range.rs renamed to src/tools/clippy/clippy_lints/src/almost_complete_range.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_span::Span;
1010

1111
declare_clippy_lint! {
1212
/// ### What it does
13-
/// Checks for ranges which almost include the entire range of letters from 'a' to 'z', but
14-
/// don't because they're a half open range.
13+
/// Checks for ranges which almost include the entire range of letters from 'a' to 'z'
14+
/// or digits from '0' to '9', but don't because they're a half open range.
1515
///
1616
/// ### Why is this bad?
1717
/// This (`'a'..'z'`) is almost certainly a typo meant to include all letters.
@@ -25,21 +25,21 @@ declare_clippy_lint! {
2525
/// let _ = 'a'..='z';
2626
/// ```
2727
#[clippy::version = "1.63.0"]
28-
pub ALMOST_COMPLETE_LETTER_RANGE,
28+
pub ALMOST_COMPLETE_RANGE,
2929
suspicious,
30-
"almost complete letter range"
30+
"almost complete range"
3131
}
32-
impl_lint_pass!(AlmostCompleteLetterRange => [ALMOST_COMPLETE_LETTER_RANGE]);
32+
impl_lint_pass!(AlmostCompleteRange => [ALMOST_COMPLETE_RANGE]);
3333

34-
pub struct AlmostCompleteLetterRange {
34+
pub struct AlmostCompleteRange {
3535
msrv: Msrv,
3636
}
37-
impl AlmostCompleteLetterRange {
37+
impl AlmostCompleteRange {
3838
pub fn new(msrv: Msrv) -> Self {
3939
Self { msrv }
4040
}
4141
}
42-
impl EarlyLintPass for AlmostCompleteLetterRange {
42+
impl EarlyLintPass for AlmostCompleteRange {
4343
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &Expr) {
4444
if let ExprKind::Range(Some(start), Some(end), RangeLimits::HalfOpen) = &e.kind {
4545
let ctxt = e.span.ctxt();
@@ -87,14 +87,18 @@ fn check_range(cx: &EarlyContext<'_>, span: Span, start: &Expr, end: &Expr, sugg
8787
Ok(LitKind::Byte(b'A') | LitKind::Char('A')),
8888
Ok(LitKind::Byte(b'Z') | LitKind::Char('Z')),
8989
)
90+
| (
91+
Ok(LitKind::Byte(b'0') | LitKind::Char('0')),
92+
Ok(LitKind::Byte(b'9') | LitKind::Char('9')),
93+
)
9094
)
9195
&& !in_external_macro(cx.sess(), span)
9296
{
9397
span_lint_and_then(
9498
cx,
95-
ALMOST_COMPLETE_LETTER_RANGE,
99+
ALMOST_COMPLETE_RANGE,
96100
span,
97-
"almost complete ascii letter range",
101+
"almost complete ascii range",
98102
|diag| {
99103
if let Some((span, sugg)) = sugg {
100104
diag.span_suggestion(

src/tools/clippy/clippy_lints/src/box_default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ declare_clippy_lint! {
3030
/// ```rust
3131
/// let x: Box<String> = Box::default();
3232
/// ```
33-
#[clippy::version = "1.65.0"]
33+
#[clippy::version = "1.66.0"]
3434
pub BOX_DEFAULT,
3535
perf,
3636
"Using Box::new(T::default()) instead of Box::default()"

src/tools/clippy/clippy_lints/src/casts/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ declare_clippy_lint! {
641641
/// ```rust,ignore
642642
/// let _: = 0_u64;
643643
/// ```
644-
#[clippy::version = "1.64.0"]
644+
#[clippy::version = "1.66.0"]
645645
pub CAST_NAN_TO_INT,
646646
suspicious,
647647
"casting a known floating-point NaN into an integer"

src/tools/clippy/clippy_lints/src/declared_lints.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
3535
crate::utils::internal_lints::produce_ice::PRODUCE_ICE_INFO,
3636
#[cfg(feature = "internal")]
3737
crate::utils::internal_lints::unnecessary_def_path::UNNECESSARY_DEF_PATH_INFO,
38-
crate::almost_complete_letter_range::ALMOST_COMPLETE_LETTER_RANGE_INFO,
38+
crate::almost_complete_range::ALMOST_COMPLETE_RANGE_INFO,
3939
crate::approx_const::APPROX_CONSTANT_INFO,
4040
crate::as_conversions::AS_CONVERSIONS_INFO,
4141
crate::asm_syntax::INLINE_ASM_X86_ATT_SYNTAX_INFO,
@@ -525,6 +525,8 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
525525
crate::returns::NEEDLESS_RETURN_INFO,
526526
crate::same_name_method::SAME_NAME_METHOD_INFO,
527527
crate::self_named_constructors::SELF_NAMED_CONSTRUCTORS_INFO,
528+
crate::semicolon_block::SEMICOLON_INSIDE_BLOCK_INFO,
529+
crate::semicolon_block::SEMICOLON_OUTSIDE_BLOCK_INFO,
528530
crate::semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED_INFO,
529531
crate::serde_api::SERDE_API_MISUSE_INFO,
530532
crate::shadow::SHADOW_REUSE_INFO,

src/tools/clippy/clippy_lints/src/dereference.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1390,10 +1390,15 @@ fn ty_auto_deref_stability<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, precedenc
13901390
continue;
13911391
},
13921392
ty::Param(_) => TyPosition::new_deref_stable_for_result(precedence, ty),
1393-
ty::Alias(ty::Projection, _) if ty.has_non_region_param() => TyPosition::new_deref_stable_for_result(precedence, ty),
1394-
ty::Infer(_) | ty::Error(_) | ty::Bound(..) | ty::Alias(ty::Opaque, ..) | ty::Placeholder(_) | ty::Dynamic(..) => {
1395-
Position::ReborrowStable(precedence).into()
1393+
ty::Alias(ty::Projection, _) if ty.has_non_region_param() => {
1394+
TyPosition::new_deref_stable_for_result(precedence, ty)
13961395
},
1396+
ty::Infer(_)
1397+
| ty::Error(_)
1398+
| ty::Bound(..)
1399+
| ty::Alias(ty::Opaque, ..)
1400+
| ty::Placeholder(_)
1401+
| ty::Dynamic(..) => Position::ReborrowStable(precedence).into(),
13971402
ty::Adt(..) if ty.has_placeholders() || ty.has_opaque_types() => {
13981403
Position::ReborrowStable(precedence).into()
13991404
},

0 commit comments

Comments
 (0)