non_local_defs: point the parent item when appropriate
This commit is contained in:
parent
98273ec612
commit
c7d300442f
13 changed files with 330 additions and 481 deletions
|
@ -543,11 +543,6 @@ lint_non_local_definitions_cargo_update = the {$macro_kind} `{$macro_name}` may
|
||||||
lint_non_local_definitions_deprecation = this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
lint_non_local_definitions_deprecation = this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
.move_help =
|
|
||||||
move this `impl` block outside of the current {$body_kind_descr} {$depth ->
|
|
||||||
[one] `{$body_name}`
|
|
||||||
*[other] `{$body_name}` and up {$depth} bodies
|
|
||||||
}
|
|
||||||
.remove_help = remove `{$may_remove_part}` to make the `impl` local
|
.remove_help = remove `{$may_remove_part}` to make the `impl` local
|
||||||
.without_trait = methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
.without_trait = methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
.with_trait = an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
.with_trait = an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
|
@ -555,6 +550,12 @@ lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks sho
|
||||||
.exception = items in an anonymous const item (`const _: () = {"{"} ... {"}"}`) are treated as in the same scope as the anonymous const's declaration
|
.exception = items in an anonymous const item (`const _: () = {"{"} ... {"}"}`) are treated as in the same scope as the anonymous const's declaration
|
||||||
.const_anon = use a const-anon item to suppress this lint
|
.const_anon = use a const-anon item to suppress this lint
|
||||||
|
|
||||||
|
lint_non_local_definitions_impl_move_help =
|
||||||
|
move the `impl` block outside of this {$body_kind_descr} {$depth ->
|
||||||
|
[one] `{$body_name}`
|
||||||
|
*[other] `{$body_name}` and up {$depth} bodies
|
||||||
|
}
|
||||||
|
|
||||||
lint_non_local_definitions_macro_rules = non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
|
lint_non_local_definitions_macro_rules = non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
|
||||||
.help =
|
.help =
|
||||||
remove the `#[macro_export]` or move this `macro_rules!` outside the of the current {$body_kind_descr} {$depth ->
|
remove the `#[macro_export]` or move this `macro_rules!` outside the of the current {$body_kind_descr} {$depth ->
|
||||||
|
|
|
@ -1336,8 +1336,7 @@ pub enum NonLocalDefinitionsDiag {
|
||||||
body_name: String,
|
body_name: String,
|
||||||
cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
|
cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
|
||||||
const_anon: Option<Option<Span>>,
|
const_anon: Option<Option<Span>>,
|
||||||
move_help: Span,
|
move_to: Option<(Span, Vec<Span>)>,
|
||||||
may_move: Vec<Span>,
|
|
||||||
may_remove: Option<(Span, String)>,
|
may_remove: Option<(Span, String)>,
|
||||||
has_trait: bool,
|
has_trait: bool,
|
||||||
self_ty_str: String,
|
self_ty_str: String,
|
||||||
|
@ -1362,8 +1361,7 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
||||||
body_name,
|
body_name,
|
||||||
cargo_update,
|
cargo_update,
|
||||||
const_anon,
|
const_anon,
|
||||||
move_help,
|
move_to,
|
||||||
may_move,
|
|
||||||
may_remove,
|
may_remove,
|
||||||
has_trait,
|
has_trait,
|
||||||
self_ty_str,
|
self_ty_str,
|
||||||
|
@ -1385,11 +1383,13 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
||||||
diag.note(fluent::lint_without_trait);
|
diag.note(fluent::lint_without_trait);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut ms = MultiSpan::from_span(move_help);
|
if let Some((move_help, may_move)) = move_to {
|
||||||
for sp in may_move {
|
let mut ms = MultiSpan::from_span(move_help);
|
||||||
ms.push_span_label(sp, fluent::lint_non_local_definitions_may_move);
|
for sp in may_move {
|
||||||
|
ms.push_span_label(sp, fluent::lint_non_local_definitions_may_move);
|
||||||
|
}
|
||||||
|
diag.span_help(ms, fluent::lint_non_local_definitions_impl_move_help);
|
||||||
}
|
}
|
||||||
diag.span_help(ms, fluent::lint_move_help);
|
|
||||||
|
|
||||||
if let Some((span, part)) = may_remove {
|
if let Some((span, part)) = may_remove {
|
||||||
diag.arg("may_remove_part", part);
|
diag.arg("may_remove_part", part);
|
||||||
|
|
|
@ -198,17 +198,21 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
|
||||||
}
|
}
|
||||||
collector.visit_generics(&impl_.generics);
|
collector.visit_generics(&impl_.generics);
|
||||||
|
|
||||||
let may_move: Vec<Span> = collector
|
let mut may_move: Vec<Span> = collector
|
||||||
.paths
|
.paths
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|path| {
|
.filter_map(|path| {
|
||||||
if path_has_local_parent(&path, cx, parent, parent_parent) {
|
if let Some(did) = path.res.opt_def_id()
|
||||||
Some(path_span_without_args(&path))
|
&& did_has_local_parent(did, cx.tcx, parent, parent_parent)
|
||||||
|
{
|
||||||
|
Some(cx.tcx.def_span(did))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
may_move.sort();
|
||||||
|
may_move.dedup();
|
||||||
|
|
||||||
let const_anon = matches!(parent_def_kind, DefKind::Const | DefKind::Static { .. })
|
let const_anon = matches!(parent_def_kind, DefKind::Const | DefKind::Static { .. })
|
||||||
.then_some(span_for_const_anon_suggestion);
|
.then_some(span_for_const_anon_suggestion);
|
||||||
|
@ -244,13 +248,21 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
let move_to = if may_move.is_empty() {
|
||||||
|
ms.push_span_label(
|
||||||
|
cx.tcx.def_span(parent),
|
||||||
|
fluent::lint_non_local_definitions_impl_move_help,
|
||||||
|
);
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some((cx.tcx.def_span(parent), may_move))
|
||||||
|
};
|
||||||
|
|
||||||
cx.emit_span_lint(
|
cx.emit_span_lint(
|
||||||
NON_LOCAL_DEFINITIONS,
|
NON_LOCAL_DEFINITIONS,
|
||||||
ms,
|
ms,
|
||||||
NonLocalDefinitionsDiag::Impl {
|
NonLocalDefinitionsDiag::Impl {
|
||||||
depth: self.body_depth,
|
depth: self.body_depth,
|
||||||
move_help: item.span,
|
|
||||||
body_kind_descr: cx.tcx.def_kind_descr(parent_def_kind, parent),
|
body_kind_descr: cx.tcx.def_kind_descr(parent_def_kind, parent),
|
||||||
body_name: parent_opt_item_name
|
body_name: parent_opt_item_name
|
||||||
.map(|s| s.to_ident_string())
|
.map(|s| s.to_ident_string())
|
||||||
|
@ -259,7 +271,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
|
||||||
const_anon,
|
const_anon,
|
||||||
self_ty_str,
|
self_ty_str,
|
||||||
of_trait_str,
|
of_trait_str,
|
||||||
may_move,
|
move_to,
|
||||||
may_remove,
|
may_remove,
|
||||||
has_trait: impl_.of_trait.is_some(),
|
has_trait: impl_.of_trait.is_some(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,14 +6,10 @@ LL | non_local_macro::non_local_impl!(LocalStruct);
|
||||||
| |
|
| |
|
||||||
| `LocalStruct` is not local
|
| `LocalStruct` is not local
|
||||||
| `Debug` is not local
|
| `Debug` is not local
|
||||||
|
| move the `impl` block outside of this constant `_IMPL_DEBUG`
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant `_IMPL_DEBUG`
|
|
||||||
--> $DIR/cargo-update.rs:17:1
|
|
||||||
|
|
|
||||||
LL | non_local_macro::non_local_impl!(LocalStruct);
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: the macro `non_local_macro::non_local_impl` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
|
= note: the macro `non_local_macro::non_local_impl` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
|
||||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
|
@ -2,7 +2,10 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
|
||||||
--> $DIR/consts.rs:13:5
|
--> $DIR/consts.rs:13:5
|
||||||
|
|
|
|
||||||
LL | const Z: () = {
|
LL | const Z: () = {
|
||||||
| - help: use a const-anon item to suppress this lint: `_`
|
| -----------
|
||||||
|
| | |
|
||||||
|
| | help: use a const-anon item to suppress this lint: `_`
|
||||||
|
| move the `impl` block outside of this constant `Z`
|
||||||
...
|
...
|
||||||
LL | impl Uto for &Test {}
|
LL | impl Uto for &Test {}
|
||||||
| ^^^^^---^^^^^-----
|
| ^^^^^---^^^^^-----
|
||||||
|
@ -12,11 +15,6 @@ LL | impl Uto for &Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant `Z`
|
|
||||||
--> $DIR/consts.rs:13:5
|
|
||||||
|
|
|
||||||
LL | impl Uto for &Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
@ -24,6 +22,8 @@ LL | impl Uto for &Test {}
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:24:5
|
--> $DIR/consts.rs:24:5
|
||||||
|
|
|
|
||||||
|
LL | static A: u32 = {
|
||||||
|
| ------------- move the `impl` block outside of this static `A`
|
||||||
LL | impl Uto2 for Test {}
|
LL | impl Uto2 for Test {}
|
||||||
| ^^^^^----^^^^^----
|
| ^^^^^----^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -32,17 +32,14 @@ LL | impl Uto2 for Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current static `A`
|
|
||||||
--> $DIR/consts.rs:24:5
|
|
||||||
|
|
|
||||||
LL | impl Uto2 for Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:32:5
|
--> $DIR/consts.rs:32:5
|
||||||
|
|
|
|
||||||
|
LL | const B: u32 = {
|
||||||
|
| ------------ move the `impl` block outside of this constant `B`
|
||||||
LL | impl Uto3 for Test {}
|
LL | impl Uto3 for Test {}
|
||||||
| ^^^^^----^^^^^----
|
| ^^^^^----^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -51,75 +48,60 @@ LL | impl Uto3 for Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant `B`
|
|
||||||
--> $DIR/consts.rs:32:5
|
|
||||||
|
|
|
||||||
LL | impl Uto3 for Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:43:5
|
--> $DIR/consts.rs:43:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
LL | impl Test {
|
LL | impl Test {
|
||||||
| ^^^^^----
|
| ^^^^^----
|
||||||
| |
|
| |
|
||||||
| `Test` is not local
|
| `Test` is not local
|
||||||
|
|
|
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/consts.rs:43:5
|
|
||||||
|
|
|
||||||
LL | / impl Test {
|
|
||||||
LL | |
|
|
||||||
LL | | fn foo() {}
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:50:9
|
--> $DIR/consts.rs:50:9
|
||||||
|
|
|
|
||||||
LL | impl Test {
|
LL | const {
|
||||||
| ^^^^^----
|
| ___________-
|
||||||
| |
|
LL | | impl Test {
|
||||||
| `Test` is not local
|
| | ^^^^^----
|
||||||
|
|
| | |
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
| | `Test` is not local
|
||||||
help: move this `impl` block outside of the current inline constant `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/consts.rs:50:9
|
|
||||||
|
|
|
||||||
LL | / impl Test {
|
|
||||||
LL | |
|
LL | |
|
||||||
LL | | fn hoo() {}
|
LL | | fn hoo() {}
|
||||||
LL | | }
|
... |
|
||||||
| |_________^
|
LL | | 1
|
||||||
|
LL | | };
|
||||||
|
| |_____- move the `impl` block outside of this inline constant `<unnameable>` and up 2 bodies
|
||||||
|
|
|
||||||
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:59:9
|
--> $DIR/consts.rs:59:9
|
||||||
|
|
|
|
||||||
|
LL | const _: u32 = {
|
||||||
|
| ------------ move the `impl` block outside of this constant `_` and up 2 bodies
|
||||||
LL | impl Test {
|
LL | impl Test {
|
||||||
| ^^^^^----
|
| ^^^^^----
|
||||||
| |
|
| |
|
||||||
| `Test` is not local
|
| `Test` is not local
|
||||||
|
|
|
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
help: move this `impl` block outside of the current constant `_` and up 2 bodies
|
|
||||||
--> $DIR/consts.rs:59:9
|
|
||||||
|
|
|
||||||
LL | / impl Test {
|
|
||||||
LL | |
|
|
||||||
LL | | fn foo2() {}
|
|
||||||
LL | | }
|
|
||||||
| |_________^
|
|
||||||
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:72:9
|
--> $DIR/consts.rs:72:9
|
||||||
|
|
|
|
||||||
|
LL | let _a = || {
|
||||||
|
| -- move the `impl` block outside of this closure `<unnameable>` and up 2 bodies
|
||||||
LL | impl Uto9 for Test {}
|
LL | impl Uto9 for Test {}
|
||||||
| ^^^^^----^^^^^----
|
| ^^^^^----^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -128,29 +110,25 @@ LL | impl Uto9 for Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current closure `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/consts.rs:72:9
|
|
||||||
|
|
|
||||||
LL | impl Uto9 for Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/consts.rs:79:9
|
--> $DIR/consts.rs:79:9
|
||||||
|
|
|
|
||||||
LL | impl Uto10 for Test {}
|
LL | type A = [u32; {
|
||||||
| ^^^^^-----^^^^^----
|
| ____________________-
|
||||||
| | |
|
LL | | impl Uto10 for Test {}
|
||||||
| | `Test` is not local
|
| | ^^^^^-----^^^^^----
|
||||||
| `Uto10` is not local
|
| | | |
|
||||||
|
| | | `Test` is not local
|
||||||
|
| | `Uto10` is not local
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }];
|
||||||
|
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/consts.rs:79:9
|
|
||||||
|
|
|
||||||
LL | impl Uto10 for Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: 8 warnings emitted
|
warning: 8 warnings emitted
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive-trait.rs:7:5
|
--> $DIR/exhaustive-trait.rs:7:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
LL | impl PartialEq<()> for Dog {
|
LL | impl PartialEq<()> for Dog {
|
||||||
| ^^^^^---------^^^^^^^^^---
|
| ^^^^^---------^^^^^^^^^---
|
||||||
| | |
|
| | |
|
||||||
|
@ -9,22 +11,15 @@ LL | impl PartialEq<()> for Dog {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive-trait.rs:7:5
|
|
||||||
|
|
|
||||||
LL | / impl PartialEq<()> for Dog {
|
|
||||||
LL | |
|
|
||||||
LL | | fn eq(&self, _: &()) -> bool {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive-trait.rs:14:5
|
--> $DIR/exhaustive-trait.rs:14:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl PartialEq<()> for &Dog {
|
LL | impl PartialEq<()> for &Dog {
|
||||||
| ^^^^^---------^^^^^^^^^----
|
| ^^^^^---------^^^^^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -33,21 +28,14 @@ LL | impl PartialEq<()> for &Dog {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive-trait.rs:14:5
|
|
||||||
|
|
|
||||||
LL | / impl PartialEq<()> for &Dog {
|
|
||||||
LL | |
|
|
||||||
LL | | fn eq(&self, _: &()) -> bool {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive-trait.rs:21:5
|
--> $DIR/exhaustive-trait.rs:21:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl PartialEq<Dog> for () {
|
LL | impl PartialEq<Dog> for () {
|
||||||
| ^^^^^---------^^^^^^^^^^--
|
| ^^^^^---------^^^^^^^^^^--
|
||||||
| | |
|
| | |
|
||||||
|
@ -56,21 +44,14 @@ LL | impl PartialEq<Dog> for () {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive-trait.rs:21:5
|
|
||||||
|
|
|
||||||
LL | / impl PartialEq<Dog> for () {
|
|
||||||
LL | |
|
|
||||||
LL | | fn eq(&self, _: &Dog) -> bool {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive-trait.rs:28:5
|
--> $DIR/exhaustive-trait.rs:28:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl PartialEq<&Dog> for () {
|
LL | impl PartialEq<&Dog> for () {
|
||||||
| ^^^^^---------^^^^^^^^^^^--
|
| ^^^^^---------^^^^^^^^^^^--
|
||||||
| | |
|
| | |
|
||||||
|
@ -79,21 +60,14 @@ LL | impl PartialEq<&Dog> for () {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive-trait.rs:28:5
|
|
||||||
|
|
|
||||||
LL | / impl PartialEq<&Dog> for () {
|
|
||||||
LL | |
|
|
||||||
LL | | fn eq(&self, _: &&Dog) -> bool {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive-trait.rs:35:5
|
--> $DIR/exhaustive-trait.rs:35:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl PartialEq<Dog> for &Dog {
|
LL | impl PartialEq<Dog> for &Dog {
|
||||||
| ^^^^^---------^^^^^^^^^^----
|
| ^^^^^---------^^^^^^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -102,21 +76,14 @@ LL | impl PartialEq<Dog> for &Dog {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive-trait.rs:35:5
|
|
||||||
|
|
|
||||||
LL | / impl PartialEq<Dog> for &Dog {
|
|
||||||
LL | |
|
|
||||||
LL | | fn eq(&self, _: &Dog) -> bool {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive-trait.rs:42:5
|
--> $DIR/exhaustive-trait.rs:42:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl PartialEq<&Dog> for &Dog {
|
LL | impl PartialEq<&Dog> for &Dog {
|
||||||
| ^^^^^---------^^^^^^^^^^^----
|
| ^^^^^---------^^^^^^^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -125,16 +92,6 @@ LL | impl PartialEq<&Dog> for &Dog {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive-trait.rs:42:5
|
|
||||||
|
|
|
||||||
LL | / impl PartialEq<&Dog> for &Dog {
|
|
||||||
LL | |
|
|
||||||
LL | | fn eq(&self, _: &&Dog) -> bool {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: 6 warnings emitted
|
warning: 6 warnings emitted
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:10:5
|
--> $DIR/exhaustive.rs:10:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
LL | impl Test {
|
LL | impl Test {
|
||||||
| ^^^^^----
|
| ^^^^^----
|
||||||
| |
|
| |
|
||||||
| `Test` is not local
|
| `Test` is not local
|
||||||
|
|
|
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:10:5
|
|
||||||
|
|
|
||||||
LL | / impl Test {
|
|
||||||
LL | |
|
|
||||||
LL | | fn foo() {}
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:15:5
|
--> $DIR/exhaustive.rs:15:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Display for Test {
|
LL | impl Display for Test {
|
||||||
| ^^^^^-------^^^^^----
|
| ^^^^^-------^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -29,37 +26,28 @@ LL | impl Display for Test {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:15:5
|
|
||||||
|
|
|
||||||
LL | / impl Display for Test {
|
|
||||||
LL | |
|
|
||||||
LL | | fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:22:5
|
--> $DIR/exhaustive.rs:22:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl dyn Trait {}
|
LL | impl dyn Trait {}
|
||||||
| ^^^^^^^^^-----
|
| ^^^^^^^^^-----
|
||||||
| |
|
| |
|
||||||
| `Trait` is not local
|
| `Trait` is not local
|
||||||
|
|
|
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:22:5
|
|
||||||
|
|
|
||||||
LL | impl dyn Trait {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:25:5
|
--> $DIR/exhaustive.rs:25:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl<T: Trait> Trait for Vec<T> { }
|
LL | impl<T: Trait> Trait for Vec<T> { }
|
||||||
| ^^^^^^^^^^^^^^^-----^^^^^---^^^
|
| ^^^^^^^^^^^^^^^-----^^^^^---^^^
|
||||||
| | |
|
| | |
|
||||||
|
@ -68,16 +56,14 @@ LL | impl<T: Trait> Trait for Vec<T> { }
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:25:5
|
|
||||||
|
|
|
||||||
LL | impl<T: Trait> Trait for Vec<T> { }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:28:5
|
--> $DIR/exhaustive.rs:28:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for &dyn Trait {}
|
LL | impl Trait for &dyn Trait {}
|
||||||
| ^^^^^-----^^^^^----------
|
| ^^^^^-----^^^^^----------
|
||||||
| | |
|
| | |
|
||||||
|
@ -86,16 +72,14 @@ LL | impl Trait for &dyn Trait {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:28:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for &dyn Trait {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:31:5
|
--> $DIR/exhaustive.rs:31:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for *mut Test {}
|
LL | impl Trait for *mut Test {}
|
||||||
| ^^^^^-----^^^^^---------
|
| ^^^^^-----^^^^^---------
|
||||||
| | |
|
| | |
|
||||||
|
@ -104,16 +88,14 @@ LL | impl Trait for *mut Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:31:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for *mut Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:34:5
|
--> $DIR/exhaustive.rs:34:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for *mut [Test] {}
|
LL | impl Trait for *mut [Test] {}
|
||||||
| ^^^^^-----^^^^^-----------
|
| ^^^^^-----^^^^^-----------
|
||||||
| | |
|
| | |
|
||||||
|
@ -122,16 +104,14 @@ LL | impl Trait for *mut [Test] {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:34:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for *mut [Test] {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:37:5
|
--> $DIR/exhaustive.rs:37:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for [Test; 8] {}
|
LL | impl Trait for [Test; 8] {}
|
||||||
| ^^^^^-----^^^^^---------
|
| ^^^^^-----^^^^^---------
|
||||||
| | |
|
| | |
|
||||||
|
@ -140,16 +120,14 @@ LL | impl Trait for [Test; 8] {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:37:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for [Test; 8] {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:40:5
|
--> $DIR/exhaustive.rs:40:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for (Test,) {}
|
LL | impl Trait for (Test,) {}
|
||||||
| ^^^^^-----^^^^^-------
|
| ^^^^^-----^^^^^-------
|
||||||
| | |
|
| | |
|
||||||
|
@ -158,16 +136,14 @@ LL | impl Trait for (Test,) {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:40:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for (Test,) {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:43:5
|
--> $DIR/exhaustive.rs:43:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for fn(Test) -> () {}
|
LL | impl Trait for fn(Test) -> () {}
|
||||||
| ^^^^^-----^^^^^--------------
|
| ^^^^^-----^^^^^--------------
|
||||||
| | |
|
| | |
|
||||||
|
@ -176,16 +152,14 @@ LL | impl Trait for fn(Test) -> () {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:43:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for fn(Test) -> () {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:46:5
|
--> $DIR/exhaustive.rs:46:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
|
...
|
||||||
LL | impl Trait for fn() -> Test {}
|
LL | impl Trait for fn() -> Test {}
|
||||||
| ^^^^^-----^^^^^------------
|
| ^^^^^-----^^^^^------------
|
||||||
| | |
|
| | |
|
||||||
|
@ -194,16 +168,13 @@ LL | impl Trait for fn() -> Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/exhaustive.rs:46:5
|
|
||||||
|
|
|
||||||
LL | impl Trait for fn() -> Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:50:9
|
--> $DIR/exhaustive.rs:50:9
|
||||||
|
|
|
|
||||||
|
LL | let _a = || {
|
||||||
|
| -- move the `impl` block outside of this closure `<unnameable>` and up 2 bodies
|
||||||
LL | impl Trait for Test {}
|
LL | impl Trait for Test {}
|
||||||
| ^^^^^-----^^^^^----
|
| ^^^^^-----^^^^^----
|
||||||
| | |
|
| | |
|
||||||
|
@ -212,11 +183,6 @@ LL | impl Trait for Test {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current closure `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/exhaustive.rs:50:9
|
|
||||||
|
|
|
||||||
LL | impl Trait for Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -231,13 +197,14 @@ LL | impl Trait for *mut InsideMain {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/exhaustive.rs:58:5
|
--> $DIR/exhaustive.rs:9:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for *mut InsideMain {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^----------^^^
|
| ^^^^^^^^^
|
||||||
| |
|
...
|
||||||
| may need to be moved as well
|
LL | struct InsideMain;
|
||||||
|
| ----------------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -251,13 +218,14 @@ LL | impl Trait for *mut [InsideMain] {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/exhaustive.rs:60:5
|
--> $DIR/exhaustive.rs:9:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for *mut [InsideMain] {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^----------^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
...
|
||||||
| may need to be moved as well
|
LL | struct InsideMain;
|
||||||
|
| ----------------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -271,13 +239,14 @@ LL | impl Trait for [InsideMain; 8] {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/exhaustive.rs:62:5
|
--> $DIR/exhaustive.rs:9:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for [InsideMain; 8] {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^^----------^^^^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
...
|
||||||
| may need to be moved as well
|
LL | struct InsideMain;
|
||||||
|
| ----------------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -291,13 +260,14 @@ LL | impl Trait for (InsideMain,) {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/exhaustive.rs:64:5
|
--> $DIR/exhaustive.rs:9:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for (InsideMain,) {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^^----------^^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
...
|
||||||
| may need to be moved as well
|
LL | struct InsideMain;
|
||||||
|
| ----------------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -311,13 +281,14 @@ LL | impl Trait for fn(InsideMain) -> () {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/exhaustive.rs:66:5
|
--> $DIR/exhaustive.rs:9:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for fn(InsideMain) -> () {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^^^^----------^^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
...
|
||||||
| may need to be moved as well
|
LL | struct InsideMain;
|
||||||
|
| ----------------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -331,18 +302,21 @@ LL | impl Trait for fn() -> InsideMain {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/exhaustive.rs:68:5
|
--> $DIR/exhaustive.rs:9:1
|
||||||
|
|
|
|
||||||
LL | impl Trait for fn() -> InsideMain {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^----------^^^
|
| ^^^^^^^^^
|
||||||
| |
|
...
|
||||||
| may need to be moved as well
|
LL | struct InsideMain;
|
||||||
|
| ----------------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:72:9
|
--> $DIR/exhaustive.rs:72:9
|
||||||
|
|
|
|
||||||
|
LL | fn inside_inside() {
|
||||||
|
| ------------------ move the `impl` block outside of this function `inside_inside` and up 2 bodies
|
||||||
LL | impl Display for InsideMain {
|
LL | impl Display for InsideMain {
|
||||||
| ^^^^^-------^^^^^----------
|
| ^^^^^-------^^^^^----------
|
||||||
| | |
|
| | |
|
||||||
|
@ -351,35 +325,20 @@ LL | impl Display for InsideMain {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `inside_inside` and up 2 bodies
|
|
||||||
--> $DIR/exhaustive.rs:72:9
|
|
||||||
|
|
|
||||||
LL | / impl Display for InsideMain {
|
|
||||||
LL | |
|
|
||||||
LL | | fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_________^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/exhaustive.rs:79:9
|
--> $DIR/exhaustive.rs:79:9
|
||||||
|
|
|
|
||||||
|
LL | fn inside_inside() {
|
||||||
|
| ------------------ move the `impl` block outside of this function `inside_inside` and up 2 bodies
|
||||||
|
...
|
||||||
LL | impl InsideMain {
|
LL | impl InsideMain {
|
||||||
| ^^^^^----------
|
| ^^^^^----------
|
||||||
| |
|
| |
|
||||||
| `InsideMain` is not local
|
| `InsideMain` is not local
|
||||||
|
|
|
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
help: move this `impl` block outside of the current function `inside_inside` and up 2 bodies
|
|
||||||
--> $DIR/exhaustive.rs:79:9
|
|
||||||
|
|
|
||||||
LL | / impl InsideMain {
|
|
||||||
LL | |
|
|
||||||
LL | | fn bar() {}
|
|
||||||
LL | | }
|
|
||||||
| |_________^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: 20 warnings emitted
|
warning: 20 warnings emitted
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/from-local-for-global.rs:8:5
|
--> $DIR/from-local-for-global.rs:8:5
|
||||||
|
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| --------- move the `impl` block outside of this function `main`
|
||||||
LL | impl From<Cat> for () {
|
LL | impl From<Cat> for () {
|
||||||
| ^^^^^----^^^^^^^^^^--
|
| ^^^^^----^^^^^^^^^^--
|
||||||
| | |
|
| | |
|
||||||
|
@ -9,16 +11,6 @@ LL | impl From<Cat> for () {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
|
||||||
--> $DIR/from-local-for-global.rs:8:5
|
|
||||||
|
|
|
||||||
LL | / impl From<Cat> for () {
|
|
||||||
LL | |
|
|
||||||
LL | | fn from(_: Cat) -> () {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
|
@ -32,19 +24,14 @@ LL | impl From<Wrap<Wrap<Elephant>>> for () {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/from-local-for-global.rs:18:5
|
--> $DIR/from-local-for-global.rs:7:1
|
||||||
|
|
|
|
||||||
LL | impl From<Wrap<Wrap<Elephant>>> for () {
|
LL | fn main() {
|
||||||
| ^ -------- may need to be moved as well
|
| ^^^^^^^^^
|
||||||
| _____|
|
...
|
||||||
| |
|
LL | struct Elephant;
|
||||||
LL | |
|
| --------------- may need to be moved as well
|
||||||
LL | | fn from(_: Wrap<Wrap<Elephant>>) -> Self {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -59,13 +46,13 @@ LL | impl StillNonLocal for &Foo {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `only_global`
|
help: move the `impl` block outside of this function `only_global`
|
||||||
--> $DIR/from-local-for-global.rs:32:5
|
--> $DIR/from-local-for-global.rs:30:1
|
||||||
|
|
|
|
||||||
LL | impl StillNonLocal for &Foo {}
|
LL | fn only_global() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^---^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
| |
|
LL | struct Foo;
|
||||||
| may need to be moved as well
|
| ---------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -79,19 +66,13 @@ LL | impl From<Local1> for GlobalSameFunction {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `same_function`
|
help: move the `impl` block outside of this function `same_function`
|
||||||
--> $DIR/from-local-for-global.rs:40:5
|
--> $DIR/from-local-for-global.rs:38:1
|
||||||
|
|
|
|
||||||
LL | impl From<Local1> for GlobalSameFunction {
|
LL | fn same_function() {
|
||||||
| ^ ------ may need to be moved as well
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
| _____|
|
LL | struct Local1(GlobalSameFunction);
|
||||||
| |
|
| ------------- may need to be moved as well
|
||||||
LL | |
|
|
||||||
LL | | fn from(x: Local1) -> GlobalSameFunction {
|
|
||||||
LL | | x.0
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -105,19 +86,14 @@ LL | impl From<Local2> for GlobalSameFunction {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `same_function`
|
help: move the `impl` block outside of this function `same_function`
|
||||||
--> $DIR/from-local-for-global.rs:48:5
|
--> $DIR/from-local-for-global.rs:38:1
|
||||||
|
|
|
|
||||||
LL | impl From<Local2> for GlobalSameFunction {
|
LL | fn same_function() {
|
||||||
| ^ ------ may need to be moved as well
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
| _____|
|
...
|
||||||
| |
|
LL | struct Local2(GlobalSameFunction);
|
||||||
LL | |
|
| ------------- may need to be moved as well
|
||||||
LL | | fn from(x: Local2) -> GlobalSameFunction {
|
|
||||||
LL | | x.0
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: 5 warnings emitted
|
warning: 5 warnings emitted
|
||||||
|
|
|
@ -9,13 +9,13 @@ LL | impl<T: Local> Global for Vec<T> { }
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/generics.rs:9:5
|
--> $DIR/generics.rs:6:1
|
||||||
|
|
|
|
||||||
LL | impl<T: Local> Global for Vec<T> { }
|
LL | fn main() {
|
||||||
| ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
LL | trait Local {};
|
||||||
| may need to be moved as well
|
| ----------- may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
|
@ -30,18 +30,21 @@ LL | impl Uto7 for Test where Local: std::any::Any {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `bad`
|
help: move the `impl` block outside of this function `bad`
|
||||||
--> $DIR/generics.rs:20:5
|
--> $DIR/generics.rs:18:1
|
||||||
|
|
|
|
||||||
LL | impl Uto7 for Test where Local: std::any::Any {}
|
LL | fn bad() {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^
|
||||||
| |
|
LL | struct Local;
|
||||||
| may need to be moved as well
|
| ------------ may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/generics.rs:23:5
|
--> $DIR/generics.rs:23:5
|
||||||
|
|
|
|
||||||
|
LL | fn bad() {
|
||||||
|
| -------- move the `impl` block outside of this function `bad`
|
||||||
|
...
|
||||||
LL | impl<T> Uto8 for T {}
|
LL | impl<T> Uto8 for T {}
|
||||||
| ^^^^^^^^----^^^^^-
|
| ^^^^^^^^----^^^^^-
|
||||||
| | |
|
| | |
|
||||||
|
@ -50,11 +53,6 @@ LL | impl<T> Uto8 for T {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `bad`
|
|
||||||
--> $DIR/generics.rs:23:5
|
|
||||||
|
|
|
||||||
LL | impl<T> Uto8 for T {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -68,19 +66,14 @@ LL | impl Default for UwU<OwO> {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `fun`
|
help: move the `impl` block outside of this function `fun`
|
||||||
--> $DIR/generics.rs:32:5
|
--> $DIR/generics.rs:29:1
|
||||||
|
|
|
|
||||||
LL | impl Default for UwU<OwO> {
|
LL | fn fun() {
|
||||||
| ^ --- may need to be moved as well
|
| ^^^^^^^^
|
||||||
| _____|
|
LL | #[derive(Debug)]
|
||||||
| |
|
LL | struct OwO;
|
||||||
LL | |
|
| ---------- may need to be moved as well
|
||||||
LL | | fn default() -> Self {
|
|
||||||
LL | | UwU(OwO)
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -94,17 +87,14 @@ LL | impl AsRef<Cat> for () {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `meow`
|
help: move the `impl` block outside of this function `meow`
|
||||||
--> $DIR/generics.rs:43:5
|
--> $DIR/generics.rs:40:1
|
||||||
|
|
|
|
||||||
LL | impl AsRef<Cat> for () {
|
LL | fn meow() {
|
||||||
| ^ --- may need to be moved as well
|
| ^^^^^^^^^
|
||||||
| _____|
|
LL | #[derive(Debug)]
|
||||||
| |
|
LL | struct Cat;
|
||||||
LL | |
|
| ---------- may need to be moved as well
|
||||||
LL | | fn as_ref(&self) -> &Cat { &Cat }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -118,19 +108,14 @@ LL | impl PartialEq<B> for G {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `fun2`
|
help: move the `impl` block outside of this function `fun2`
|
||||||
--> $DIR/generics.rs:54:5
|
--> $DIR/generics.rs:51:1
|
||||||
|
|
|
|
||||||
LL | impl PartialEq<B> for G {
|
LL | fn fun2() {
|
||||||
| ^ - may need to be moved as well
|
| ^^^^^^^^^
|
||||||
| _____|
|
LL | #[derive(Debug, Default)]
|
||||||
| |
|
LL | struct B;
|
||||||
LL | |
|
| -------- may need to be moved as well
|
||||||
LL | | fn eq(&self, _: &B) -> bool {
|
|
||||||
LL | | true
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -143,19 +128,13 @@ LL | impl From<Wrap<Wrap<Lion>>> for () {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `rawr`
|
help: move the `impl` block outside of this function `rawr`
|
||||||
--> $DIR/generics.rs:69:5
|
--> $DIR/generics.rs:66:1
|
||||||
|
|
|
|
||||||
LL | impl From<Wrap<Wrap<Lion>>> for () {
|
LL | fn rawr() {
|
||||||
| ^ ---- may need to be moved as well
|
| ^^^^^^^^^
|
||||||
| _____|
|
LL | struct Lion;
|
||||||
| |
|
| ----------- may need to be moved as well
|
||||||
LL | |
|
|
||||||
LL | | fn from(_: Wrap<Wrap<Lion>>) -> Self {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
|
@ -169,19 +148,13 @@ LL | impl From<()> for Wrap<Lion> {
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `rawr`
|
help: move the `impl` block outside of this function `rawr`
|
||||||
--> $DIR/generics.rs:76:5
|
--> $DIR/generics.rs:66:1
|
||||||
|
|
|
|
||||||
LL | impl From<()> for Wrap<Lion> {
|
LL | fn rawr() {
|
||||||
| ^ ---- may need to be moved as well
|
| ^^^^^^^^^
|
||||||
| _____|
|
LL | struct Lion;
|
||||||
| |
|
| ----------- may need to be moved as well
|
||||||
LL | |
|
|
||||||
LL | | fn from(_: ()) -> Self {
|
|
||||||
LL | | todo!()
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: 8 warnings emitted
|
warning: 8 warnings emitted
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/inside-macro_rules.rs:9:13
|
--> $DIR/inside-macro_rules.rs:9:13
|
||||||
|
|
|
|
||||||
|
LL | fn my_func() {
|
||||||
|
| ------------ move the `impl` block outside of this function `my_func`
|
||||||
LL | impl MacroTrait for OutsideStruct {}
|
LL | impl MacroTrait for OutsideStruct {}
|
||||||
| ^^^^^----------^^^^^-------------
|
| ^^^^^----------^^^^^-------------
|
||||||
| | |
|
| | |
|
||||||
|
@ -12,14 +14,6 @@ LL | m!();
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `my_func`
|
|
||||||
--> $DIR/inside-macro_rules.rs:9:13
|
|
||||||
|
|
|
||||||
LL | impl MacroTrait for OutsideStruct {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
...
|
|
||||||
LL | m!();
|
|
||||||
| ---- in this macro invocation
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
|
@ -9,21 +9,19 @@ LL | impl<T> Trait<InsideMain> for &Vec<below::Type<(InsideMain, T)>>
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/suggest-moving-inner.rs:12:5
|
--> $DIR/suggest-moving-inner.rs:5:1
|
||||||
|
|
|
|
||||||
LL | impl<T> Trait<InsideMain> for &Vec<below::Type<(InsideMain, T)>>
|
LL | fn main() {
|
||||||
| ^ ---------- ----------- ---------- may need to be moved as well
|
| ^^^^^^^^^
|
||||||
| | | |
|
LL | mod below {
|
||||||
| | | may need to be moved as well
|
LL | pub struct Type<T>(T);
|
||||||
| _____| may need to be moved as well
|
| ------------------ may need to be moved as well
|
||||||
| |
|
LL | }
|
||||||
LL | |
|
LL | struct InsideMain;
|
||||||
LL | | where
|
| ----------------- may need to be moved as well
|
||||||
LL | | T: HasFoo
|
LL | trait HasFoo {}
|
||||||
| | ------ may need to be moved as well
|
| ------------ may need to be moved as well
|
||||||
LL | | {}
|
|
||||||
| |______^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ LL | impl Test for &Local {}
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current function `main`
|
help: move the `impl` block outside of this function `main`
|
||||||
--> $DIR/trait-solver-overflow-123573.rs:12:5
|
--> $DIR/trait-solver-overflow-123573.rs:10:1
|
||||||
|
|
|
|
||||||
LL | impl Test for &Local {}
|
LL | fn main() {
|
||||||
| ^^^^^^^^^^^^^^^-----^^^
|
| ^^^^^^^^^
|
||||||
| |
|
LL | struct Local {}
|
||||||
| may need to be moved as well
|
| ------------ may need to be moved as well
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
|
|
|
@ -1,111 +1,116 @@
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/weird-exprs.rs:8:5
|
--> $DIR/weird-exprs.rs:8:5
|
||||||
|
|
|
|
||||||
LL | impl Uto for *mut Test {}
|
LL | type A = [u32; {
|
||||||
| ^^^^^---^^^^^---------
|
| ________________-
|
||||||
| | |
|
LL | | impl Uto for *mut Test {}
|
||||||
| | `*mut Test` is not local
|
| | ^^^^^---^^^^^---------
|
||||||
| `Uto` is not local
|
| | | |
|
||||||
|
| | | `*mut Test` is not local
|
||||||
|
| | `Uto` is not local
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }];
|
||||||
|
| |_- move the `impl` block outside of this constant expression `<unnameable>`
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>`
|
|
||||||
--> $DIR/weird-exprs.rs:8:5
|
|
||||||
|
|
|
||||||
LL | impl Uto for *mut Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
= note: `#[warn(non_local_definitions)]` on by default
|
= note: `#[warn(non_local_definitions)]` on by default
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/weird-exprs.rs:16:9
|
--> $DIR/weird-exprs.rs:16:9
|
||||||
|
|
|
|
||||||
LL | impl Uto for Test {}
|
LL | Discr = {
|
||||||
| ^^^^^---^^^^^----
|
| _____________-
|
||||||
| | |
|
LL | | impl Uto for Test {}
|
||||||
| | `Test` is not local
|
| | ^^^^^---^^^^^----
|
||||||
| `Uto` is not local
|
| | | |
|
||||||
|
| | | `Test` is not local
|
||||||
|
| | `Uto` is not local
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }
|
||||||
|
| |_____- move the `impl` block outside of this constant expression `<unnameable>`
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>`
|
|
||||||
--> $DIR/weird-exprs.rs:16:9
|
|
||||||
|
|
|
||||||
LL | impl Uto for Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/weird-exprs.rs:25:9
|
--> $DIR/weird-exprs.rs:25:9
|
||||||
|
|
|
|
||||||
LL | impl Test {
|
LL | let _array = [0i32; {
|
||||||
| ^^^^^----
|
| _________________________-
|
||||||
| |
|
LL | | impl Test {
|
||||||
| `Test` is not local
|
| | ^^^^^----
|
||||||
|
|
| | |
|
||||||
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
| | `Test` is not local
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/weird-exprs.rs:25:9
|
|
||||||
|
|
|
||||||
LL | / impl Test {
|
|
||||||
LL | |
|
LL | |
|
||||||
LL | | fn bar() {}
|
LL | | fn bar() {}
|
||||||
LL | | }
|
... |
|
||||||
| |_________^
|
LL | | 1
|
||||||
|
LL | | }];
|
||||||
|
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||||
|
|
|
||||||
|
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/weird-exprs.rs:34:9
|
--> $DIR/weird-exprs.rs:34:9
|
||||||
|
|
|
|
||||||
LL | impl Uto for &Test {}
|
LL | type A = [u32; {
|
||||||
| ^^^^^---^^^^^-----
|
| ____________________-
|
||||||
| | |
|
LL | | impl Uto for &Test {}
|
||||||
| | `&'_ Test` is not local
|
| | ^^^^^---^^^^^-----
|
||||||
| `Uto` is not local
|
| | | |
|
||||||
|
| | | `&'_ Test` is not local
|
||||||
|
| | `Uto` is not local
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }];
|
||||||
|
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/weird-exprs.rs:34:9
|
|
||||||
|
|
|
||||||
LL | impl Uto for &Test {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/weird-exprs.rs:41:9
|
--> $DIR/weird-exprs.rs:41:9
|
||||||
|
|
|
|
||||||
LL | impl Uto for &(Test,) {}
|
LL | fn a(_: [u32; {
|
||||||
| ^^^^^---^^^^^--------
|
| ___________________-
|
||||||
| | |
|
LL | | impl Uto for &(Test,) {}
|
||||||
| | `&'_ (Test,)` is not local
|
| | ^^^^^---^^^^^--------
|
||||||
| `Uto` is not local
|
| | | |
|
||||||
|
| | | `&'_ (Test,)` is not local
|
||||||
|
| | `Uto` is not local
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }]) {}
|
||||||
|
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/weird-exprs.rs:41:9
|
|
||||||
|
|
|
||||||
LL | impl Uto for &(Test,) {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
|
||||||
--> $DIR/weird-exprs.rs:48:9
|
--> $DIR/weird-exprs.rs:48:9
|
||||||
|
|
|
|
||||||
LL | impl Uto for &(Test,Test) {}
|
LL | fn b() -> [u32; {
|
||||||
| ^^^^^---^^^^^------------
|
| _____________________-
|
||||||
| | |
|
LL | | impl Uto for &(Test,Test) {}
|
||||||
| | `&'_ (Test, Test)` is not local
|
| | ^^^^^---^^^^^------------
|
||||||
| `Uto` is not local
|
| | | |
|
||||||
|
| | | `&'_ (Test, Test)` is not local
|
||||||
|
| | `Uto` is not local
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }] { todo!() }
|
||||||
|
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
|
||||||
|
|
|
|
||||||
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
|
||||||
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
|
||||||
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
|
|
||||||
--> $DIR/weird-exprs.rs:48:9
|
|
||||||
|
|
|
||||||
LL | impl Uto for &(Test,Test) {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
|
||||||
|
|
||||||
warning: 6 warnings emitted
|
warning: 6 warnings emitted
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue