diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index a18e2d1d63887..76442de69d351 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -24,7 +24,7 @@ fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { } /// This is a callback from `rustc_ast` as it cannot access the implicit state -/// in `rustc_middle` otherwise. It is used to when diagnostic messages are +/// in `rustc_middle` otherwise. It is used when diagnostic messages are /// emitted and stores them in the current query, if there is one. fn track_diagnostic(diagnostic: &Diagnostic) { tls::with_context_opt(|icx| { diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 673b2e3a55a35..a6a04ac9ea6fc 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -445,6 +445,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { ); } } + // Try Levenshtein algorithm. + let typo_sugg = self.lookup_typo_candidate(path, ns, is_expected); if path.len() == 1 && self.self_type_is_available() { if let Some(candidate) = self.lookup_assoc_candidate(ident, ns, is_expected) { let self_is_available = self.self_value_is_available(path[0].ident.span); @@ -454,7 +456,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( span, "you might have meant to use the available field", - format!("self.{}", path_str), + format!("self.{path_str}"), Applicability::MachineApplicable, ); } else { @@ -465,7 +467,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( span, "you might have meant to call the method", - format!("self.{}", path_str), + format!("self.{path_str}"), Applicability::MachineApplicable, ); } @@ -476,11 +478,12 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( span, &format!("you might have meant to {}", candidate.action()), - format!("Self::{}", path_str), + format!("Self::{path_str}"), Applicability::MachineApplicable, ); } } + self.r.add_typo_suggestion(&mut err, typo_sugg, ident_span); return (err, candidates); } @@ -495,16 +498,14 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( call_span, - &format!("try calling `{}` as a method", ident), - format!("self.{}({})", path_str, args_snippet), + &format!("try calling `{ident}` as a method"), + format!("self.{path_str}({args_snippet})"), Applicability::MachineApplicable, ); return (err, candidates); } } - // Try Levenshtein algorithm. - let typo_sugg = self.lookup_typo_candidate(path, ns, is_expected); // Try context-dependent help if relaxed lookup didn't work. if let Some(res) = res { if self.smart_resolve_context_dependent_help( diff --git a/config.toml.example b/config.toml.example index dd886879b145d..a7968bca7be89 100644 --- a/config.toml.example +++ b/config.toml.example @@ -240,10 +240,6 @@ changelog-seen = 2 # Indicate whether git submodules are managed and updated automatically. #submodules = true -# Update git submodules only when the checked out commit in the submodules differs -# from what is committed in the main rustc repo. -#fast-submodules = true - # The path to (or name of) the GDB executable to use. This is only used for # executing the debuginfo test suite. #gdb = "gdb" diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index 46004c9914200..438bae01b60d2 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -1655,7 +1655,7 @@ impl Ipv6Addr { /// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1).to_ipv4_mapped(), None); /// ``` #[rustc_const_unstable(feature = "const_ipv6", issue = "76205")] - #[stable(feature = "ipv6_to_ipv4_mapped", since = "1.62.0")] + #[stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] diff --git a/src/bootstrap/CHANGELOG.md b/src/bootstrap/CHANGELOG.md index 5324c6bde4e1b..add73ebd44b8c 100644 --- a/src/bootstrap/CHANGELOG.md +++ b/src/bootstrap/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - The options `infodir`, `localstatedir`, and `gpg-password-file` are no longer allowed in config.toml. Previously, they were ignored without warning. Note that `infodir` and `localstatedir` are still accepted by `./configure`, with a warning. [#82451](https://github.com/rust-lang/rust/pull/82451) - Add options for enabling overflow checks, one for std (`overflow-checks-std`) and one for everything else (`overflow-checks`). Both default to false. - Change the names for `dist` commands to match the component they generate. [#90684](https://github.com/rust-lang/rust/pull/90684) +- The `build.fast-submodules` option has been removed. Fast submodule checkouts are enabled unconditionally. Automatic submodule handling can still be disabled with `build.submodules = false`. ### Non-breaking changes diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 6d46ea26e6a0b..916c8e5d187c2 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -926,23 +926,19 @@ def build_triple(self): return config return default_build_triple(self.verbose) - def check_submodule(self, module, slow_submodules): - if not slow_submodules: - checked_out = subprocess.Popen(["git", "rev-parse", "HEAD"], - cwd=os.path.join(self.rust_root, module), - stdout=subprocess.PIPE) - return checked_out - else: - return None + def check_submodule(self, module): + checked_out = subprocess.Popen(["git", "rev-parse", "HEAD"], + cwd=os.path.join(self.rust_root, module), + stdout=subprocess.PIPE) + return checked_out def update_submodule(self, module, checked_out, recorded_submodules): module_path = os.path.join(self.rust_root, module) - if checked_out is not None: - default_encoding = sys.getdefaultencoding() - checked_out = checked_out.communicate()[0].decode(default_encoding).strip() - if recorded_submodules[module] == checked_out: - return + default_encoding = sys.getdefaultencoding() + checked_out = checked_out.communicate()[0].decode(default_encoding).strip() + if recorded_submodules[module] == checked_out: + return print("Updating submodule", module) @@ -991,12 +987,8 @@ def update_submodules(self): git_version_str = require(['git', '--version']).split()[2].decode(default_encoding) self.git_version = distutils.version.LooseVersion(git_version_str) - slow_submodules = self.get_toml('fast-submodules') == "false" start_time = time() - if slow_submodules: - print('Unconditionally updating submodules') - else: - print('Updating only changed submodules') + print('Updating only changed submodules') default_encoding = sys.getdefaultencoding() # Only update submodules that are needed to build bootstrap. These are needed because Cargo # currently requires everything in a workspace to be "locally present" when starting a @@ -1022,7 +1014,7 @@ def update_submodules(self): filtered_submodules = [] submodules_names = [] for module in submodules: - check = self.check_submodule(module, slow_submodules) + check = self.check_submodule(module) filtered_submodules.append((module, check)) submodules_names.append(module) recorded = subprocess.Popen(["git", "ls-tree", "HEAD"] + submodules_names, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index e39c9fa1c5a6d..f9acd52274f88 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -50,7 +50,6 @@ pub struct Config { pub ninja_in_file: bool, pub verbose: usize, pub submodules: Option, - pub fast_submodules: bool, pub compiler_docs: bool, pub docs_minification: bool, pub docs: bool, @@ -517,7 +516,6 @@ define_config! { compiler_docs: Option = "compiler-docs", docs_minification: Option = "docs-minification", submodules: Option = "submodules", - fast_submodules: Option = "fast-submodules", gdb: Option = "gdb", nodejs: Option = "nodejs", npm: Option = "npm", @@ -705,7 +703,6 @@ impl Config { config.rust_optimize = true; config.rust_optimize_tests = true; config.submodules = None; - config.fast_submodules = true; config.docs = true; config.docs_minification = true; config.rust_rpath = true; @@ -847,7 +844,6 @@ impl Config { set(&mut config.compiler_docs, build.compiler_docs); set(&mut config.docs_minification, build.docs_minification); set(&mut config.docs, build.docs); - set(&mut config.fast_submodules, build.fast_submodules); set(&mut config.locked_deps, build.locked_deps); set(&mut config.vendor, build.vendor); set(&mut config.full_bootstrap, build.full_bootstrap); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index a4e35bf6d475b..769382525fbb8 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -556,27 +556,24 @@ impl Build { } // check_submodule - if self.config.fast_submodules { - let checked_out_hash = output( - Command::new("git").args(&["rev-parse", "HEAD"]).current_dir(&absolute_path), - ); - // update_submodules - let recorded = output( - Command::new("git") - .args(&["ls-tree", "HEAD"]) - .arg(relative_path) - .current_dir(&self.config.src), - ); - let actual_hash = recorded - .split_whitespace() - .nth(2) - .unwrap_or_else(|| panic!("unexpected output `{}`", recorded)); - - // update_submodule - if actual_hash == checked_out_hash.trim_end() { - // already checked out - return; - } + let checked_out_hash = + output(Command::new("git").args(&["rev-parse", "HEAD"]).current_dir(&absolute_path)); + // update_submodules + let recorded = output( + Command::new("git") + .args(&["ls-tree", "HEAD"]) + .arg(relative_path) + .current_dir(&self.config.src), + ); + let actual_hash = recorded + .split_whitespace() + .nth(2) + .unwrap_or_else(|| panic!("unexpected output `{}`", recorded)); + + // update_submodule + if actual_hash == checked_out_hash.trim_end() { + // already checked out + return; } println!("Updating submodule {}", relative_path.display()); diff --git a/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs b/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs new file mode 100644 index 0000000000000..ecd3f58811904 --- /dev/null +++ b/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs @@ -0,0 +1,46 @@ +struct A { + config: String, +} + +impl A { + fn new(cofig: String) -> Self { + Self { config } //~ Error cannot find value `config` in this scope + } + + fn do_something(cofig: String) { + println!("{config}"); //~ Error cannot find value `config` in this scope + } + + fn self_is_available(self, cofig: String) { + println!("{config}"); //~ Error cannot find value `config` in this scope + } +} + +trait B { + const BAR: u32 = 3; + type Baz; + fn bar(&self); + fn baz(&self) {} + fn bah() {} +} + +impl B for Box { + type Baz = String; + fn bar(&self) { + // let baz = 3; + baz(); + //~^ ERROR cannot find function `baz` + bah; + //~^ ERROR cannot find value `bah` + BAR; + //~^ ERROR cannot find value `BAR` in this scope + let foo: Baz = "".to_string(); + //~^ ERROR cannot find type `Baz` in this scope + } +} + +fn ba() {} +const BARR: u32 = 3; +type Bar = String; + +fn main() {} diff --git a/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr new file mode 100644 index 0000000000000..0b0a37f246c93 --- /dev/null +++ b/src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -0,0 +1,109 @@ +error[E0425]: cannot find value `config` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:7:16 + | +LL | Self { config } + | ^^^^^^ + | | + | a field by this name exists in `Self` + | help: a local variable with a similar name exists: `cofig` + +error[E0425]: cannot find value `config` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:11:20 + | +LL | println!("{config}"); + | ^^^^^^ + | | + | a field by this name exists in `Self` + | help: a local variable with a similar name exists: `cofig` + +error[E0425]: cannot find value `config` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:15:20 + | +LL | println!("{config}"); + | ^^^^^^ + | +help: you might have meant to use the available field + | +LL | println!("{self.config}"); + | ~~~~~~~~~~~ +help: a local variable with a similar name exists + | +LL | println!("{cofig}"); + | ~~~~~ + +error[E0425]: cannot find function `baz` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:31:9 + | +LL | baz(); + | ^^^ +... +LL | fn ba() {} + | ------- similarly named function `ba` defined here + | +help: you might have meant to call the method + | +LL | self.baz(); + | ~~~~~~~~ +help: a function with a similar name exists + | +LL | ba(); + | ~~ + +error[E0425]: cannot find value `bah` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:33:9 + | +LL | bah; + | ^^^ +... +LL | fn ba() {} + | ------- similarly named function `ba` defined here + | +help: you might have meant to call the associated function + | +LL | Self::bah; + | ~~~~~~~~~ +help: a function with a similar name exists + | +LL | ba; + | ~~ + +error[E0425]: cannot find value `BAR` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:35:9 + | +LL | BAR; + | ^^^ +... +LL | const BARR: u32 = 3; + | -------------------- similarly named constant `BARR` defined here + | +help: you might have meant to use the associated `const` + | +LL | Self::BAR; + | ~~~~~~~~~ +help: a constant with a similar name exists + | +LL | BARR; + | ~~~~ + +error[E0412]: cannot find type `Baz` in this scope + --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 + | +LL | let foo: Baz = "".to_string(); + | ^^^ +... +LL | type Bar = String; + | ------------------ similarly named type alias `Bar` defined here + | +help: you might have meant to use the associated type + | +LL | let foo: Self::Baz = "".to_string(); + | ~~~~~~~~~ +help: a type alias with a similar name exists + | +LL | let foo: Bar = "".to_string(); + | ~~~ + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0412, E0425. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs b/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs index af56ec11ef8ac..fff7da8e33f2f 100644 --- a/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs +++ b/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs @@ -12,12 +12,12 @@ use rustc_middle::ty::{self, FloatTy, InferTy, Ty}; use super::UNNECESSARY_CAST; -pub(super) fn check( - cx: &LateContext<'_>, - expr: &Expr<'_>, - cast_expr: &Expr<'_>, - cast_from: Ty<'_>, - cast_to: Ty<'_>, +pub(super) fn check<'tcx>( + cx: &LateContext<'tcx>, + expr: &Expr<'tcx>, + cast_expr: &Expr<'tcx>, + cast_from: Ty<'tcx>, + cast_to: Ty<'tcx>, ) -> bool { // skip non-primitive type cast if_chain! { diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs index ea4c0207bb013..8288f7a8b9b62 100644 --- a/src/tools/clippy/clippy_lints/src/dereference.rs +++ b/src/tools/clippy/clippy_lints/src/dereference.rs @@ -446,7 +446,7 @@ fn try_parse_ref_op<'tcx>( // Checks whether the type for a deref call actually changed the type, not just the mutability of // the reference. -fn deref_method_same_type(result_ty: Ty<'_>, arg_ty: Ty<'_>) -> bool { +fn deref_method_same_type<'tcx>(result_ty: Ty<'tcx>, arg_ty: Ty<'tcx>) -> bool { match (result_ty.kind(), arg_ty.kind()) { (ty::Ref(_, result_ty, _), ty::Ref(_, arg_ty, _)) => result_ty == arg_ty, @@ -541,8 +541,8 @@ fn is_auto_borrow_position(parent: Option>, child_id: HirId) -> bool { /// Adjustments are sometimes made in the parent block rather than the expression itself. fn find_adjustments<'tcx>( tcx: TyCtxt<'tcx>, - typeck: &'tcx TypeckResults<'_>, - expr: &'tcx Expr<'_>, + typeck: &'tcx TypeckResults<'tcx>, + expr: &'tcx Expr<'tcx>, ) -> &'tcx [Adjustment<'tcx>] { let map = tcx.hir(); let mut iter = map.parent_iter(expr.hir_id); @@ -581,7 +581,7 @@ fn find_adjustments<'tcx>( } #[expect(clippy::needless_pass_by_value)] -fn report(cx: &LateContext<'_>, expr: &Expr<'_>, state: State, data: StateData) { +fn report<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, state: State, data: StateData) { match state { State::DerefMethod { ty_changed_count, @@ -656,7 +656,7 @@ fn report(cx: &LateContext<'_>, expr: &Expr<'_>, state: State, data: StateData) } impl Dereferencing { - fn check_local_usage(&mut self, cx: &LateContext<'_>, e: &Expr<'_>, local: HirId) { + fn check_local_usage<'tcx>(&mut self, cx: &LateContext<'tcx>, e: &Expr<'tcx>, local: HirId) { if let Some(outer_pat) = self.ref_locals.get_mut(&local) { if let Some(pat) = outer_pat { // Check for auto-deref diff --git a/src/tools/clippy/clippy_lints/src/len_zero.rs b/src/tools/clippy/clippy_lints/src/len_zero.rs index dabbb8375f0a6..246f5aad8fbad 100644 --- a/src/tools/clippy/clippy_lints/src/len_zero.rs +++ b/src/tools/clippy/clippy_lints/src/len_zero.rs @@ -259,8 +259,8 @@ fn parse_len_output<'tcx>(cx: &LateContext<'_>, sig: FnSig<'tcx>) -> Option { - fn matches_is_empty_output(self, ty: Ty<'_>) -> bool { +impl<'tcx> LenOutput<'tcx> { + fn matches_is_empty_output(self, ty: Ty<'tcx>) -> bool { match (self, ty.kind()) { (_, &ty::Bool) => true, (Self::Option(id), &ty::Adt(adt, subs)) if id == adt.did() => subs.type_at(0).is_bool(), @@ -292,7 +292,7 @@ impl LenOutput<'_> { } /// Checks if the given signature matches the expectations for `is_empty` -fn check_is_empty_sig(sig: FnSig<'_>, self_kind: ImplicitSelfKind, len_output: LenOutput<'_>) -> bool { +fn check_is_empty_sig<'tcx>(sig: FnSig<'tcx>, self_kind: ImplicitSelfKind, len_output: LenOutput<'tcx>) -> bool { match &**sig.inputs_and_output { [arg, res] if len_output.matches_is_empty_output(*res) => { matches!( @@ -306,11 +306,11 @@ fn check_is_empty_sig(sig: FnSig<'_>, self_kind: ImplicitSelfKind, len_output: L } /// Checks if the given type has an `is_empty` method with the appropriate signature. -fn check_for_is_empty( - cx: &LateContext<'_>, +fn check_for_is_empty<'tcx>( + cx: &LateContext<'tcx>, span: Span, self_kind: ImplicitSelfKind, - output: LenOutput<'_>, + output: LenOutput<'tcx>, impl_ty: DefId, item_name: Symbol, item_kind: &str, diff --git a/src/tools/clippy/clippy_lints/src/methods/mod.rs b/src/tools/clippy/clippy_lints/src/methods/mod.rs index 35fc452ed7cf0..3bf48e18019df 100644 --- a/src/tools/clippy/clippy_lints/src/methods/mod.rs +++ b/src/tools/clippy/clippy_lints/src/methods/mod.rs @@ -2843,7 +2843,7 @@ enum SelfKind { impl SelfKind { fn matches<'a>(self, cx: &LateContext<'a>, parent_ty: Ty<'a>, ty: Ty<'a>) -> bool { - fn matches_value<'a>(cx: &LateContext<'a>, parent_ty: Ty<'_>, ty: Ty<'_>) -> bool { + fn matches_value<'a>(cx: &LateContext<'a>, parent_ty: Ty<'a>, ty: Ty<'a>) -> bool { if ty == parent_ty { true } else if ty.is_box() { diff --git a/src/tools/clippy/clippy_lints/src/ptr.rs b/src/tools/clippy/clippy_lints/src/ptr.rs index 86460c1b27e39..548f7b2528b11 100644 --- a/src/tools/clippy/clippy_lints/src/ptr.rs +++ b/src/tools/clippy/clippy_lints/src/ptr.rs @@ -395,9 +395,9 @@ impl<'tcx> DerefTy<'tcx> { fn check_fn_args<'cx, 'tcx: 'cx>( cx: &'cx LateContext<'tcx>, - tys: &'tcx [Ty<'_>], - hir_tys: &'tcx [hir::Ty<'_>], - params: &'tcx [Param<'_>], + tys: &'tcx [Ty<'tcx>], + hir_tys: &'tcx [hir::Ty<'tcx>], + params: &'tcx [Param<'tcx>], ) -> impl Iterator> + 'cx { tys.iter() .zip(hir_tys.iter()) diff --git a/src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs b/src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs index be6277332db4d..20b348fc14f7b 100644 --- a/src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs +++ b/src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs @@ -358,7 +358,7 @@ fn is_size_pair(ty: Ty<'_>) -> bool { } } -fn same_except_params(subs1: SubstsRef<'_>, subs2: SubstsRef<'_>) -> bool { +fn same_except_params<'tcx>(subs1: SubstsRef<'tcx>, subs2: SubstsRef<'tcx>) -> bool { // TODO: check const parameters as well. Currently this will consider `Array<5>` the same as // `Array<6>` for (ty1, ty2) in subs1.types().zip(subs2.types()).filter(|(ty1, ty2)| ty1 != ty2) { diff --git a/src/tools/clippy/clippy_utils/src/ty.rs b/src/tools/clippy/clippy_utils/src/ty.rs index 07d3d2807634f..75d27d3b59482 100644 --- a/src/tools/clippy/clippy_utils/src/ty.rs +++ b/src/tools/clippy/clippy_utils/src/ty.rs @@ -42,7 +42,7 @@ pub fn can_partially_move_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool } /// Walks into `ty` and returns `true` if any inner type is the same as `other_ty` -pub fn contains_ty(ty: Ty<'_>, other_ty: Ty<'_>) -> bool { +pub fn contains_ty<'tcx>(ty: Ty<'tcx>, other_ty: Ty<'tcx>) -> bool { ty.walk().any(|inner| match inner.unpack() { GenericArgKind::Type(inner_ty) => other_ty == inner_ty, GenericArgKind::Lifetime(_) | GenericArgKind::Const(_) => false, @@ -51,7 +51,7 @@ pub fn contains_ty(ty: Ty<'_>, other_ty: Ty<'_>) -> bool { /// Walks into `ty` and returns `true` if any inner type is an instance of the given adt /// constructor. -pub fn contains_adt_constructor(ty: Ty<'_>, adt: AdtDef<'_>) -> bool { +pub fn contains_adt_constructor<'tcx>(ty: Ty<'tcx>, adt: AdtDef<'tcx>) -> bool { ty.walk().any(|inner| match inner.unpack() { GenericArgKind::Type(inner_ty) => inner_ty.ty_adt_def() == Some(adt), GenericArgKind::Lifetime(_) | GenericArgKind::Const(_) => false,