From 43a08bd29969be0f8b83a525b46cfa9e4b99e863 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Mon, 16 Oct 2023 15:40:32 +0000 Subject: [PATCH 1/7] Add test for 113326 --- .../type-alias-impl-trait/recursive-fn-tait.rs | 17 +++++++++++++++++ .../recursive-fn-tait.stderr | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/ui/type-alias-impl-trait/recursive-fn-tait.rs create mode 100644 tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs new file mode 100644 index 00000000000..3d1759097d6 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs @@ -0,0 +1,17 @@ +// test for #113326 +#![feature(type_alias_impl_trait)] + +pub type Diff = impl Fn(usize) -> usize; + +pub fn lift() -> Diff { + |_: usize |loop {} +} + +pub fn add( + n: Diff, + m: Diff, +) -> Diff { + move |x: usize| m(n(x)) //~ ERROR: concrete type differs +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr new file mode 100644 index 00000000000..b2898a21190 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr @@ -0,0 +1,14 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/recursive-fn-tait.rs:14:5 + | +LL | move |x: usize| m(n(x)) + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:7:5: 7:16}`, got `{closure@$DIR/recursive-fn-tait.rs:14:5: 14:20}` + | +note: previous use here + --> $DIR/recursive-fn-tait.rs:7:5 + | +LL | |_: usize |loop {} + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + From a947654a96651e3acc911fe202907b283cd2ed5b Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 24 Oct 2023 16:51:26 +0000 Subject: [PATCH 2/7] Merge impl_wf_inference into coherence checking --- compiler/rustc_hir_analysis/src/lib.rs | 9 ++--- .../in-trait/coherence-constrained.rs | 26 +++++++++++++ .../in-trait/coherence-constrained.stderr | 25 +++++++++++++ tests/ui/impl-unused-tps.rs | 5 ++- tests/ui/impl-unused-tps.stderr | 37 +++++++++++++++---- 5 files changed, 87 insertions(+), 15 deletions(-) create mode 100644 tests/ui/async-await/in-trait/coherence-constrained.rs create mode 100644 tests/ui/async-await/in-trait/coherence-constrained.stderr diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 0622aa2ee80..f27ce7fa0e0 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -181,14 +181,11 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { })?; } - tcx.sess.track_errors(|| { - tcx.sess.time("impl_wf_inference", || { - tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)) - }); - })?; - tcx.sess.track_errors(|| { tcx.sess.time("coherence_checking", || { + // Check impls constrain their parameters + tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)); + for &trait_def_id in tcx.all_local_trait_impls(()).keys() { tcx.ensure().coherent_trait(trait_def_id); } diff --git a/tests/ui/async-await/in-trait/coherence-constrained.rs b/tests/ui/async-await/in-trait/coherence-constrained.rs new file mode 100644 index 00000000000..8e62b3e0e90 --- /dev/null +++ b/tests/ui/async-await/in-trait/coherence-constrained.rs @@ -0,0 +1,26 @@ +// edition: 2021 + +trait Foo { + type T; + + async fn foo(&self) -> Self::T; +} + +struct Bar; + +impl Foo for Bar { + type T = (); + + async fn foo(&self) {} + //~^ ERROR type annotations needed: cannot satisfy `::T == ()` +} + +impl Foo for Bar { + //~^ ERROR conflicting implementations of trait `Foo` for type `Bar` + type T = (); + + async fn foo(&self) {} + //~^ ERROR type annotations needed: cannot satisfy `::T == ()` +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/coherence-constrained.stderr b/tests/ui/async-await/in-trait/coherence-constrained.stderr new file mode 100644 index 00000000000..570a357ca8f --- /dev/null +++ b/tests/ui/async-await/in-trait/coherence-constrained.stderr @@ -0,0 +1,25 @@ +error[E0284]: type annotations needed: cannot satisfy `::T == ()` + --> $DIR/coherence-constrained.rs:14:5 + | +LL | async fn foo(&self) {} + | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `::T == ()` + +error[E0284]: type annotations needed: cannot satisfy `::T == ()` + --> $DIR/coherence-constrained.rs:22:5 + | +LL | async fn foo(&self) {} + | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `::T == ()` + +error[E0119]: conflicting implementations of trait `Foo` for type `Bar` + --> $DIR/coherence-constrained.rs:18:1 + | +LL | impl Foo for Bar { + | ---------------- first implementation here +... +LL | impl Foo for Bar { + | ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0119, E0284. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/impl-unused-tps.rs b/tests/ui/impl-unused-tps.rs index 7cc1ae613bc..3eb9daedf76 100644 --- a/tests/ui/impl-unused-tps.rs +++ b/tests/ui/impl-unused-tps.rs @@ -1,3 +1,5 @@ +//~ ERROR overflow evaluating the requirement `([isize; 0], _): Sized + trait Foo { fn get(&self, A: &A) { } } @@ -23,8 +25,7 @@ impl,U> Foo for [isize;3] { } impl Foo for U { - // OK, T, U are used everywhere. Note that the coherence check - // hasn't executed yet, so no errors about overlap. + //~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]` } impl Bar for T { diff --git a/tests/ui/impl-unused-tps.stderr b/tests/ui/impl-unused-tps.stderr index 053ab91c893..93215326c2f 100644 --- a/tests/ui/impl-unused-tps.stderr +++ b/tests/ui/impl-unused-tps.stderr @@ -1,33 +1,56 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:13:8 + --> $DIR/impl-unused-tps.rs:15:8 | LL | impl Foo for [isize;1] { | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:30:8 + --> $DIR/impl-unused-tps.rs:31:8 | LL | impl Bar for T { | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:38:8 + --> $DIR/impl-unused-tps.rs:39:8 | LL | impl Bar for T | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:46:8 + --> $DIR/impl-unused-tps.rs:47:8 | LL | impl Foo for T | ^ unconstrained type parameter error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:46:10 + --> $DIR/impl-unused-tps.rs:47:10 | LL | impl Foo for T | ^ unconstrained type parameter -error: aborting due to 5 previous errors +error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` + --> $DIR/impl-unused-tps.rs:27:1 + | +LL | impl Foo for [isize;0] { + | ---------------------------- first implementation here +... +LL | impl Foo for U { + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` -For more information about this error, try `rustc --explain E0207`. +error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) +note: required for `([isize; 0], _)` to implement `Bar` + --> $DIR/impl-unused-tps.rs:31:11 + | +LL | impl Bar for T { + | - ^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: 126 redundant requirements hidden + = note: required for `([isize; 0], _)` to implement `Bar` + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0119, E0207, E0275. +For more information about an error, try `rustc --explain E0119`. From 18b7d9eb8ce272713de56c02cd350665b5b1ff57 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 18 Oct 2023 19:28:46 +0000 Subject: [PATCH 3/7] Intern LocalDefId list from opaque query --- compiler/rustc_middle/src/query/mod.rs | 2 +- compiler/rustc_middle/src/ty/context.rs | 10 ++++++++++ compiler/rustc_ty_utils/src/opaque_types.rs | 7 +++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 340c5a769db..8bea404ccf2 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -339,7 +339,7 @@ rustc_queries! { query opaque_types_defined_by( key: LocalDefId - ) -> &'tcx [LocalDefId] { + ) -> &'tcx ty::List { desc { |tcx| "computing the opaque types defined by `{}`", tcx.def_path_str(key.to_def_id()) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index f7bce93fee5..80620efb0b3 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -157,6 +157,7 @@ pub struct CtxtInterners<'tcx> { external_constraints: InternedSet<'tcx, ExternalConstraintsData<'tcx>>, predefined_opaques_in_body: InternedSet<'tcx, PredefinedOpaquesData<'tcx>>, fields: InternedSet<'tcx, List>, + local_def_ids: InternedSet<'tcx, List>, } impl<'tcx> CtxtInterners<'tcx> { @@ -182,6 +183,7 @@ impl<'tcx> CtxtInterners<'tcx> { external_constraints: Default::default(), predefined_opaques_in_body: Default::default(), fields: Default::default(), + local_def_ids: Default::default(), } } @@ -1568,6 +1570,7 @@ slice_interners!( place_elems: pub mk_place_elems(PlaceElem<'tcx>), bound_variable_kinds: pub mk_bound_variable_kinds(ty::BoundVariableKind), fields: pub mk_fields(FieldIdx), + local_def_ids: intern_local_def_ids(LocalDefId), ); impl<'tcx> TyCtxt<'tcx> { @@ -1798,6 +1801,13 @@ impl<'tcx> TyCtxt<'tcx> { self.intern_clauses(clauses) } + pub fn mk_local_def_ids(self, clauses: &[LocalDefId]) -> &'tcx List { + // FIXME consider asking the input slice to be sorted to avoid + // re-interning permutations, in which case that would be asserted + // here. + self.intern_local_def_ids(clauses) + } + pub fn mk_const_list_from_iter(self, iter: I) -> T::Output where I: Iterator, diff --git a/compiler/rustc_ty_utils/src/opaque_types.rs b/compiler/rustc_ty_utils/src/opaque_types.rs index 06a30677d20..82c4f38511e 100644 --- a/compiler/rustc_ty_utils/src/opaque_types.rs +++ b/compiler/rustc_ty_utils/src/opaque_types.rs @@ -269,7 +269,10 @@ impl<'tcx> TypeVisitor> for OpaqueTypeCollector<'tcx> { } } -fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [LocalDefId] { +fn opaque_types_defined_by<'tcx>( + tcx: TyCtxt<'tcx>, + item: LocalDefId, +) -> &'tcx ty::List { let kind = tcx.def_kind(item); trace!(?kind); let mut collector = OpaqueTypeCollector::new(tcx, item); @@ -327,7 +330,7 @@ fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [ return tcx.opaque_types_defined_by(tcx.local_parent(item)); } } - tcx.arena.alloc_from_iter(collector.opaques) + tcx.mk_local_def_ids(&collector.opaques) } pub(super) fn provide(providers: &mut Providers) { From fd7bbc2aa506042e807ce3a63561fabf2ca94a6b Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 24 Oct 2023 20:51:13 -0400 Subject: [PATCH 4/7] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index d2f6a048529..df350923793 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit d2f6a048529eb8e9ebc55d793abd63456c98fac2 +Subproject commit df3509237935f9418351b77803df7bc05c009b3d From dc3d428a8a4771342fb76a4c7fa83569ac05c433 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Wed, 25 Oct 2023 09:38:37 +0000 Subject: [PATCH 5/7] Make THIR unused_unsafe lint consistent with MIR Updates THIR behavior to match the changes from #93678 --- compiler/rustc_mir_build/messages.ftl | 1 - .../rustc_mir_build/src/check_unsafety.rs | 152 +- compiler/rustc_mir_build/src/errors.rs | 5 - compiler/rustc_mir_build/src/lib.rs | 2 +- tests/ui/inline-const/expr-unsafe.thir.stderr | 3 - tests/ui/inline-const/pat-unsafe.thir.stderr | 6 - tests/ui/span/lint-unused-unsafe-thir.rs | 61 - tests/ui/span/lint-unused-unsafe-thir.stderr | 50 - tests/ui/span/lint-unused-unsafe.mir.stderr | 376 ++--- tests/ui/span/lint-unused-unsafe.rs | 8 +- tests/ui/span/lint-unused-unsafe.thir.stderr | 1402 +++++++++++++++++ ...-unnecessary-unsafe-in-closure.thir.stderr | 6 +- ...fc-2585-unsafe_op_in_unsafe_fn.thir.stderr | 6 +- 13 files changed, 1683 insertions(+), 395 deletions(-) delete mode 100644 tests/ui/span/lint-unused-unsafe-thir.rs delete mode 100644 tests/ui/span/lint-unused-unsafe-thir.stderr create mode 100644 tests/ui/span/lint-unused-unsafe.thir.stderr diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index db3886b32be..32711c23dc4 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -379,6 +379,5 @@ mir_build_unused_unsafe = unnecessary `unsafe` block .label = unnecessary `unsafe` block mir_build_unused_unsafe_enclosing_block_label = because it's nested under this `unsafe` block -mir_build_unused_unsafe_enclosing_fn_label = because it's nested under this `unsafe` fn mir_build_variant_defined_here = not covered diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 3265f92e514..45be5015371 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -13,6 +13,7 @@ use rustc_span::def_id::{DefId, LocalDefId}; use rustc_span::symbol::Symbol; use rustc_span::Span; +use std::mem; use std::ops::Bound; struct UnsafetyVisitor<'a, 'tcx> { @@ -24,7 +25,6 @@ struct UnsafetyVisitor<'a, 'tcx> { /// The current "safety context". This notably tracks whether we are in an /// `unsafe` block, and whether it has been used. safety_context: SafetyContext, - body_unsafety: BodyUnsafety, /// The `#[target_feature]` attributes of the body. Used for checking /// calls to functions with `#[target_feature]` (RFC 2396). body_target_features: &'tcx [Symbol], @@ -34,43 +34,50 @@ struct UnsafetyVisitor<'a, 'tcx> { in_union_destructure: bool, param_env: ParamEnv<'tcx>, inside_adt: bool, + warnings: &'a mut Vec, } impl<'tcx> UnsafetyVisitor<'_, 'tcx> { fn in_safety_context(&mut self, safety_context: SafetyContext, f: impl FnOnce(&mut Self)) { - if let ( - SafetyContext::UnsafeBlock { span: enclosing_span, .. }, - SafetyContext::UnsafeBlock { span: block_span, hir_id, .. }, - ) = (self.safety_context, safety_context) + let prev_context = mem::replace(&mut self.safety_context, safety_context); + + f(self); + + let safety_context = mem::replace(&mut self.safety_context, prev_context); + if let SafetyContext::UnsafeBlock { used, span, hir_id, nested_used_blocks } = + safety_context { - self.warn_unused_unsafe( - hir_id, - block_span, - Some(UnusedUnsafeEnclosing::Block { - span: self.tcx.sess.source_map().guess_head_span(enclosing_span), - }), - ); - f(self); - } else { - let prev_context = self.safety_context; - self.safety_context = safety_context; + if !used { + self.warn_unused_unsafe(hir_id, span, None); - f(self); + if let SafetyContext::UnsafeBlock { + nested_used_blocks: ref mut prev_nested_used_blocks, + .. + } = self.safety_context + { + prev_nested_used_blocks.extend(nested_used_blocks); + } + } else { + for block in nested_used_blocks { + self.warn_unused_unsafe( + block.hir_id, + block.span, + Some(UnusedUnsafeEnclosing::Block { + span: self.tcx.sess.source_map().guess_head_span(span), + }), + ); + } - if let SafetyContext::UnsafeBlock { used: false, span, hir_id } = self.safety_context { - self.warn_unused_unsafe( - hir_id, - span, - if self.unsafe_op_in_unsafe_fn_allowed() { - self.body_unsafety - .unsafe_fn_sig_span() - .map(|span| UnusedUnsafeEnclosing::Function { span }) - } else { - None - }, - ); + match self.safety_context { + SafetyContext::UnsafeBlock { + nested_used_blocks: ref mut prev_nested_used_blocks, + .. + } => { + prev_nested_used_blocks.push(NestedUsedBlock { hir_id, span }); + } + _ => (), + } } - self.safety_context = prev_context; } } @@ -102,18 +109,12 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { } fn warn_unused_unsafe( - &self, + &mut self, hir_id: hir::HirId, block_span: Span, enclosing_unsafe: Option, ) { - let block_span = self.tcx.sess.source_map().guess_head_span(block_span); - self.tcx.emit_spanned_lint( - UNUSED_UNSAFE, - hir_id, - block_span, - UnusedUnsafe { span: block_span, enclosing: enclosing_unsafe }, - ); + self.warnings.push(UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe }); } /// Whether the `unsafe_op_in_unsafe_fn` lint is `allow`ed at the current HIR node. @@ -128,7 +129,14 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { self.tcx.ensure_with_value().mir_built(def); let inner_thir = &inner_thir.steal(); let hir_context = self.tcx.hir().local_def_id_to_hir_id(def); - let mut inner_visitor = UnsafetyVisitor { thir: inner_thir, hir_context, ..*self }; + let safety_context = mem::replace(&mut self.safety_context, SafetyContext::Safe); + let mut inner_visitor = UnsafetyVisitor { + thir: inner_thir, + hir_context, + safety_context, + warnings: self.warnings, + ..*self + }; inner_visitor.visit_expr(&inner_thir[expr]); // Unsafe blocks can be used in the inner body, make sure to take it into account self.safety_context = inner_visitor.safety_context; @@ -195,8 +203,15 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { }); } BlockSafety::ExplicitUnsafe(hir_id) => { + let used = + matches!(self.tcx.lint_level_at_node(UNUSED_UNSAFE, hir_id), (Level::Allow, _)); self.in_safety_context( - SafetyContext::UnsafeBlock { span: block.span, hir_id, used: false }, + SafetyContext::UnsafeBlock { + span: block.span, + hir_id, + used, + nested_used_blocks: Vec::new(), + }, |this| visit::walk_block(this, block), ); } @@ -481,36 +496,29 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { } } -#[derive(Clone, Copy)] +#[derive(Clone)] enum SafetyContext { Safe, BuiltinUnsafeBlock, UnsafeFn, - UnsafeBlock { span: Span, hir_id: hir::HirId, used: bool }, + UnsafeBlock { + span: Span, + hir_id: hir::HirId, + used: bool, + nested_used_blocks: Vec, + }, } #[derive(Clone, Copy)] -enum BodyUnsafety { - /// The body is not unsafe. - Safe, - /// The body is an unsafe function. The span points to - /// the signature of the function. - Unsafe(Span), +struct NestedUsedBlock { + hir_id: hir::HirId, + span: Span, } -impl BodyUnsafety { - /// Returns whether the body is unsafe. - fn is_unsafe(&self) -> bool { - matches!(self, BodyUnsafety::Unsafe(_)) - } - - /// If the body is unsafe, returns the `Span` of its signature. - fn unsafe_fn_sig_span(self) -> Option { - match self { - BodyUnsafety::Unsafe(span) => Some(span), - BodyUnsafety::Safe => None, - } - } +struct UnusedUnsafeWarning { + hir_id: hir::HirId, + block_span: Span, + enclosing_unsafe: Option, } #[derive(Clone, Copy, PartialEq)] @@ -803,27 +811,37 @@ pub fn thir_check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) { } let hir_id = tcx.hir().local_def_id_to_hir_id(def); - let body_unsafety = tcx.hir().fn_sig_by_hir_id(hir_id).map_or(BodyUnsafety::Safe, |fn_sig| { + let safety_context = tcx.hir().fn_sig_by_hir_id(hir_id).map_or(SafetyContext::Safe, |fn_sig| { if fn_sig.header.unsafety == hir::Unsafety::Unsafe { - BodyUnsafety::Unsafe(fn_sig.span) + SafetyContext::UnsafeFn } else { - BodyUnsafety::Safe + SafetyContext::Safe } }); let body_target_features = &tcx.body_codegen_attrs(def.to_def_id()).target_features; - let safety_context = - if body_unsafety.is_unsafe() { SafetyContext::UnsafeFn } else { SafetyContext::Safe }; + let mut warnings = Vec::new(); let mut visitor = UnsafetyVisitor { tcx, thir, safety_context, hir_context: hir_id, - body_unsafety, body_target_features, assignment_info: None, in_union_destructure: false, param_env: tcx.param_env(def), inside_adt: false, + warnings: &mut warnings, }; visitor.visit_expr(&thir[expr]); + + warnings.sort_by_key(|w| w.block_span); + for UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe } in warnings { + let block_span = tcx.sess.source_map().guess_head_span(block_span); + tcx.emit_spanned_lint( + UNUSED_UNSAFE, + hir_id, + block_span, + UnusedUnsafe { span: block_span, enclosing: enclosing_unsafe }, + ); + } } diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index c09dd186418..730670a8369 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -392,11 +392,6 @@ pub enum UnusedUnsafeEnclosing { #[primary_span] span: Span, }, - #[label(mir_build_unused_unsafe_enclosing_fn_label)] - Function { - #[primary_span] - span: Span, - }, } pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> { diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index 099fefbf068..745c3046d22 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -20,7 +20,7 @@ mod build; mod check_unsafety; mod errors; pub mod lints; -pub mod thir; +mod thir; use rustc_middle::query::Providers; diff --git a/tests/ui/inline-const/expr-unsafe.thir.stderr b/tests/ui/inline-const/expr-unsafe.thir.stderr index 4737444fb61..1ab6e42fba0 100644 --- a/tests/ui/inline-const/expr-unsafe.thir.stderr +++ b/tests/ui/inline-const/expr-unsafe.thir.stderr @@ -1,9 +1,6 @@ warning: unnecessary `unsafe` block --> $DIR/expr-unsafe.rs:12:13 | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block | diff --git a/tests/ui/inline-const/pat-unsafe.thir.stderr b/tests/ui/inline-const/pat-unsafe.thir.stderr index d62c87fc8f3..0318b3ff2cc 100644 --- a/tests/ui/inline-const/pat-unsafe.thir.stderr +++ b/tests/ui/inline-const/pat-unsafe.thir.stderr @@ -1,9 +1,6 @@ warning: unnecessary `unsafe` block --> $DIR/pat-unsafe.rs:19:17 | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block | @@ -16,9 +13,6 @@ LL | #![warn(unused_unsafe)] warning: unnecessary `unsafe` block --> $DIR/pat-unsafe.rs:26:17 | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/span/lint-unused-unsafe-thir.rs b/tests/ui/span/lint-unused-unsafe-thir.rs deleted file mode 100644 index adb72c26bba..00000000000 --- a/tests/ui/span/lint-unused-unsafe-thir.rs +++ /dev/null @@ -1,61 +0,0 @@ -// FIXME: This file is tracking old lint behavior that's still unchanged in the -// unstable -Zthir-unsafeck implementation. See lint-unused-unsafe.rs for more details. -// -// Exercise the unused_unsafe attribute in some positive and negative cases - -// compile-flags: -Zthir-unsafeck - -#![allow(dead_code)] -#![deny(unused_unsafe)] - - -mod foo { - extern "C" { - pub fn bar(); - } -} - -fn callback(_f: F) -> T where F: FnOnce() -> T { panic!() } -unsafe fn unsf() {} - -fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad5() { unsafe { unsf() } } -fn bad6() { - unsafe { // don't put the warning here - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf() - } - } -} -unsafe fn bad7() { - unsafe { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf() - } - } -} - -unsafe fn good0() { unsf() } -fn good1() { unsafe { unsf() } } -fn good2() { - /* bug uncovered when implementing warning about unused unsafe blocks. Be - sure that when purity is inherited that the source of the unsafe-ness - is tracked correctly */ - unsafe { - unsafe fn what() -> Vec { panic!() } - - callback(|| { - what(); - }); - } -} - -unsafe fn good3() { foo::bar() } -fn good4() { unsafe { foo::bar() } } - -#[allow(unused_unsafe)] fn allowed() { unsafe {} } - -fn main() {} diff --git a/tests/ui/span/lint-unused-unsafe-thir.stderr b/tests/ui/span/lint-unused-unsafe-thir.stderr deleted file mode 100644 index 3bcbb759775..00000000000 --- a/tests/ui/span/lint-unused-unsafe-thir.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:21:13 - | -LL | fn bad1() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe-thir.rs:9:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:22:13 - | -LL | fn bad2() { unsafe { bad1() } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:23:20 - | -LL | unsafe fn bad3() { unsafe {} } - | ---------------- ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` fn - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:24:13 - | -LL | fn bad4() { unsafe { callback(||{}) } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:28:9 - | -LL | unsafe { // don't put the warning here - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:35:9 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 6 previous errors - diff --git a/tests/ui/span/lint-unused-unsafe.mir.stderr b/tests/ui/span/lint-unused-unsafe.mir.stderr index d8412908c73..9e8d3359242 100644 --- a/tests/ui/span/lint-unused-unsafe.mir.stderr +++ b/tests/ui/span/lint-unused-unsafe.mir.stderr @@ -1,77 +1,77 @@ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:26:13 + --> $DIR/lint-unused-unsafe.rs:22:13 | LL | fn bad1() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:14:9 + --> $DIR/lint-unused-unsafe.rs:10:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:27:13 + --> $DIR/lint-unused-unsafe.rs:23:13 | LL | fn bad2() { unsafe { bad1() } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:20 + --> $DIR/lint-unused-unsafe.rs:24:20 | LL | unsafe fn bad3() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:29:13 + --> $DIR/lint-unused-unsafe.rs:25:13 | LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:32:5 + --> $DIR/lint-unused-unsafe.rs:28:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:39:5 + --> $DIR/lint-unused-unsafe.rs:35:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:74:9 + --> $DIR/lint-unused-unsafe.rs:70:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:83:9 + --> $DIR/lint-unused-unsafe.rs:79:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:84:13 + --> $DIR/lint-unused-unsafe.rs:80:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:85:13 + --> $DIR/lint-unused-unsafe.rs:81:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:90:9 + --> $DIR/lint-unused-unsafe.rs:86:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:100:13 + --> $DIR/lint-unused-unsafe.rs:96:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -80,7 +80,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:101:13 + --> $DIR/lint-unused-unsafe.rs:97:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -89,7 +89,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:102:13 + --> $DIR/lint-unused-unsafe.rs:98:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -98,7 +98,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:112:17 + --> $DIR/lint-unused-unsafe.rs:108:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -107,13 +107,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:110:20 + --> $DIR/lint-unused-unsafe.rs:106:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:113:17 + --> $DIR/lint-unused-unsafe.rs:109:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -122,7 +122,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:114:17 + --> $DIR/lint-unused-unsafe.rs:110:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -131,37 +131,37 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:124:9 + --> $DIR/lint-unused-unsafe.rs:120:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:134:9 + --> $DIR/lint-unused-unsafe.rs:130:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:135:13 + --> $DIR/lint-unused-unsafe.rs:131:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:136:13 + --> $DIR/lint-unused-unsafe.rs:132:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:142:9 + --> $DIR/lint-unused-unsafe.rs:138:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:153:13 + --> $DIR/lint-unused-unsafe.rs:149:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -170,7 +170,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:154:13 + --> $DIR/lint-unused-unsafe.rs:150:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -179,7 +179,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:155:13 + --> $DIR/lint-unused-unsafe.rs:151:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -188,7 +188,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:166:17 + --> $DIR/lint-unused-unsafe.rs:162:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -197,13 +197,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:164:20 + --> $DIR/lint-unused-unsafe.rs:160:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:167:17 + --> $DIR/lint-unused-unsafe.rs:163:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -212,7 +212,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:168:17 + --> $DIR/lint-unused-unsafe.rs:164:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -221,37 +221,37 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:178:9 + --> $DIR/lint-unused-unsafe.rs:174:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:188:9 + --> $DIR/lint-unused-unsafe.rs:184:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:189:13 + --> $DIR/lint-unused-unsafe.rs:185:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:190:13 + --> $DIR/lint-unused-unsafe.rs:186:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:196:9 + --> $DIR/lint-unused-unsafe.rs:192:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:207:13 + --> $DIR/lint-unused-unsafe.rs:203:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -260,7 +260,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:208:13 + --> $DIR/lint-unused-unsafe.rs:204:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -269,7 +269,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:209:13 + --> $DIR/lint-unused-unsafe.rs:205:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -278,7 +278,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:220:17 + --> $DIR/lint-unused-unsafe.rs:216:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -287,13 +287,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:218:20 + --> $DIR/lint-unused-unsafe.rs:214:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:221:17 + --> $DIR/lint-unused-unsafe.rs:217:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -302,7 +302,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:222:17 + --> $DIR/lint-unused-unsafe.rs:218:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -311,13 +311,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:242:9 + --> $DIR/lint-unused-unsafe.rs:238:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:255:13 + --> $DIR/lint-unused-unsafe.rs:251:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -325,7 +325,7 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:268:13 + --> $DIR/lint-unused-unsafe.rs:264:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -333,37 +333,37 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:286:20 + --> $DIR/lint-unused-unsafe.rs:282:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:295:20 + --> $DIR/lint-unused-unsafe.rs:291:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:296:24 + --> $DIR/lint-unused-unsafe.rs:292:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:297:24 + --> $DIR/lint-unused-unsafe.rs:293:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:302:20 + --> $DIR/lint-unused-unsafe.rs:298:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:312:24 + --> $DIR/lint-unused-unsafe.rs:308:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -372,7 +372,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:313:24 + --> $DIR/lint-unused-unsafe.rs:309:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -381,7 +381,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:314:24 + --> $DIR/lint-unused-unsafe.rs:310:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -390,7 +390,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:324:28 + --> $DIR/lint-unused-unsafe.rs:320:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -399,13 +399,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:322:20 + --> $DIR/lint-unused-unsafe.rs:318:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:325:28 + --> $DIR/lint-unused-unsafe.rs:321:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -414,7 +414,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:326:28 + --> $DIR/lint-unused-unsafe.rs:322:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -423,37 +423,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:336:20 + --> $DIR/lint-unused-unsafe.rs:332:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:346:20 + --> $DIR/lint-unused-unsafe.rs:342:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:347:24 + --> $DIR/lint-unused-unsafe.rs:343:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:348:24 + --> $DIR/lint-unused-unsafe.rs:344:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:354:20 + --> $DIR/lint-unused-unsafe.rs:350:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:365:24 + --> $DIR/lint-unused-unsafe.rs:361:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -462,7 +462,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:366:24 + --> $DIR/lint-unused-unsafe.rs:362:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -471,7 +471,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:367:24 + --> $DIR/lint-unused-unsafe.rs:363:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -480,7 +480,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:378:28 + --> $DIR/lint-unused-unsafe.rs:374:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -489,13 +489,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:376:20 + --> $DIR/lint-unused-unsafe.rs:372:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:379:28 + --> $DIR/lint-unused-unsafe.rs:375:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -504,7 +504,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:380:28 + --> $DIR/lint-unused-unsafe.rs:376:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -513,37 +513,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:390:20 + --> $DIR/lint-unused-unsafe.rs:386:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:400:20 + --> $DIR/lint-unused-unsafe.rs:396:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:401:24 + --> $DIR/lint-unused-unsafe.rs:397:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:402:24 + --> $DIR/lint-unused-unsafe.rs:398:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:408:20 + --> $DIR/lint-unused-unsafe.rs:404:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:419:24 + --> $DIR/lint-unused-unsafe.rs:415:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -552,7 +552,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:420:24 + --> $DIR/lint-unused-unsafe.rs:416:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -561,7 +561,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:421:24 + --> $DIR/lint-unused-unsafe.rs:417:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -570,7 +570,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:432:28 + --> $DIR/lint-unused-unsafe.rs:428:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -579,13 +579,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:430:20 + --> $DIR/lint-unused-unsafe.rs:426:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:433:28 + --> $DIR/lint-unused-unsafe.rs:429:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -594,7 +594,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:434:28 + --> $DIR/lint-unused-unsafe.rs:430:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -603,13 +603,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:454:20 + --> $DIR/lint-unused-unsafe.rs:450:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:467:24 + --> $DIR/lint-unused-unsafe.rs:463:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -617,7 +617,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:480:24 + --> $DIR/lint-unused-unsafe.rs:476:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -625,37 +625,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:499:20 + --> $DIR/lint-unused-unsafe.rs:495:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:508:20 + --> $DIR/lint-unused-unsafe.rs:504:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:509:24 + --> $DIR/lint-unused-unsafe.rs:505:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:510:24 + --> $DIR/lint-unused-unsafe.rs:506:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:515:20 + --> $DIR/lint-unused-unsafe.rs:511:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:525:24 + --> $DIR/lint-unused-unsafe.rs:521:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -664,7 +664,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:526:24 + --> $DIR/lint-unused-unsafe.rs:522:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -673,7 +673,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:527:24 + --> $DIR/lint-unused-unsafe.rs:523:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -682,7 +682,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:537:28 + --> $DIR/lint-unused-unsafe.rs:533:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -691,13 +691,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:535:20 + --> $DIR/lint-unused-unsafe.rs:531:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:538:28 + --> $DIR/lint-unused-unsafe.rs:534:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -706,7 +706,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:539:28 + --> $DIR/lint-unused-unsafe.rs:535:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -715,37 +715,37 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:549:20 + --> $DIR/lint-unused-unsafe.rs:545:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:559:20 + --> $DIR/lint-unused-unsafe.rs:555:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:560:24 + --> $DIR/lint-unused-unsafe.rs:556:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:561:24 + --> $DIR/lint-unused-unsafe.rs:557:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:567:20 + --> $DIR/lint-unused-unsafe.rs:563:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:578:24 + --> $DIR/lint-unused-unsafe.rs:574:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -754,7 +754,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:579:24 + --> $DIR/lint-unused-unsafe.rs:575:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -763,7 +763,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:580:24 + --> $DIR/lint-unused-unsafe.rs:576:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -772,7 +772,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:591:28 + --> $DIR/lint-unused-unsafe.rs:587:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -781,13 +781,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:589:20 + --> $DIR/lint-unused-unsafe.rs:585:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:592:28 + --> $DIR/lint-unused-unsafe.rs:588:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -796,7 +796,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:593:28 + --> $DIR/lint-unused-unsafe.rs:589:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -805,37 +805,37 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:603:20 + --> $DIR/lint-unused-unsafe.rs:599:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:613:20 + --> $DIR/lint-unused-unsafe.rs:609:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:614:24 + --> $DIR/lint-unused-unsafe.rs:610:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:615:24 + --> $DIR/lint-unused-unsafe.rs:611:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:621:20 + --> $DIR/lint-unused-unsafe.rs:617:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:632:24 + --> $DIR/lint-unused-unsafe.rs:628:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -844,7 +844,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:633:24 + --> $DIR/lint-unused-unsafe.rs:629:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -853,7 +853,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:634:24 + --> $DIR/lint-unused-unsafe.rs:630:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -862,7 +862,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:645:28 + --> $DIR/lint-unused-unsafe.rs:641:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -871,13 +871,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:643:20 + --> $DIR/lint-unused-unsafe.rs:639:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:646:28 + --> $DIR/lint-unused-unsafe.rs:642:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -886,7 +886,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:647:28 + --> $DIR/lint-unused-unsafe.rs:643:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -895,13 +895,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:667:20 + --> $DIR/lint-unused-unsafe.rs:663:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:680:24 + --> $DIR/lint-unused-unsafe.rs:676:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -909,7 +909,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:693:24 + --> $DIR/lint-unused-unsafe.rs:689:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -917,37 +917,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:711:24 + --> $DIR/lint-unused-unsafe.rs:707:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:721:24 + --> $DIR/lint-unused-unsafe.rs:717:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:722:28 + --> $DIR/lint-unused-unsafe.rs:718:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:723:28 + --> $DIR/lint-unused-unsafe.rs:719:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:729:24 + --> $DIR/lint-unused-unsafe.rs:725:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:740:28 + --> $DIR/lint-unused-unsafe.rs:736:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -956,7 +956,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:741:28 + --> $DIR/lint-unused-unsafe.rs:737:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -965,7 +965,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:742:28 + --> $DIR/lint-unused-unsafe.rs:738:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -974,7 +974,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:753:32 + --> $DIR/lint-unused-unsafe.rs:749:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -983,13 +983,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:751:24 + --> $DIR/lint-unused-unsafe.rs:747:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:754:32 + --> $DIR/lint-unused-unsafe.rs:750:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -998,7 +998,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:755:32 + --> $DIR/lint-unused-unsafe.rs:751:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1007,37 +1007,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:765:24 + --> $DIR/lint-unused-unsafe.rs:761:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:775:24 + --> $DIR/lint-unused-unsafe.rs:771:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:776:28 + --> $DIR/lint-unused-unsafe.rs:772:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:777:28 + --> $DIR/lint-unused-unsafe.rs:773:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:783:24 + --> $DIR/lint-unused-unsafe.rs:779:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:794:28 + --> $DIR/lint-unused-unsafe.rs:790:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1046,7 +1046,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:795:28 + --> $DIR/lint-unused-unsafe.rs:791:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1055,7 +1055,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:796:28 + --> $DIR/lint-unused-unsafe.rs:792:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1064,7 +1064,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:807:32 + --> $DIR/lint-unused-unsafe.rs:803:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1073,13 +1073,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:805:24 + --> $DIR/lint-unused-unsafe.rs:801:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:808:32 + --> $DIR/lint-unused-unsafe.rs:804:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1088,7 +1088,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:809:32 + --> $DIR/lint-unused-unsafe.rs:805:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1097,13 +1097,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:829:24 + --> $DIR/lint-unused-unsafe.rs:825:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:842:28 + --> $DIR/lint-unused-unsafe.rs:838:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1111,7 +1111,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:855:28 + --> $DIR/lint-unused-unsafe.rs:851:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1119,37 +1119,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:869:24 + --> $DIR/lint-unused-unsafe.rs:865:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:879:24 + --> $DIR/lint-unused-unsafe.rs:875:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:880:28 + --> $DIR/lint-unused-unsafe.rs:876:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:881:28 + --> $DIR/lint-unused-unsafe.rs:877:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:887:24 + --> $DIR/lint-unused-unsafe.rs:883:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:898:28 + --> $DIR/lint-unused-unsafe.rs:894:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1158,7 +1158,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:899:28 + --> $DIR/lint-unused-unsafe.rs:895:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1167,7 +1167,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:900:28 + --> $DIR/lint-unused-unsafe.rs:896:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1176,7 +1176,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:911:32 + --> $DIR/lint-unused-unsafe.rs:907:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1185,13 +1185,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:909:24 + --> $DIR/lint-unused-unsafe.rs:905:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:912:32 + --> $DIR/lint-unused-unsafe.rs:908:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1200,7 +1200,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:913:32 + --> $DIR/lint-unused-unsafe.rs:909:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1209,37 +1209,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:923:24 + --> $DIR/lint-unused-unsafe.rs:919:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:933:24 + --> $DIR/lint-unused-unsafe.rs:929:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:934:28 + --> $DIR/lint-unused-unsafe.rs:930:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:935:28 + --> $DIR/lint-unused-unsafe.rs:931:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:941:24 + --> $DIR/lint-unused-unsafe.rs:937:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:952:28 + --> $DIR/lint-unused-unsafe.rs:948:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1248,7 +1248,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:953:28 + --> $DIR/lint-unused-unsafe.rs:949:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1257,7 +1257,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:954:28 + --> $DIR/lint-unused-unsafe.rs:950:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1266,7 +1266,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:965:32 + --> $DIR/lint-unused-unsafe.rs:961:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1275,13 +1275,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:963:24 + --> $DIR/lint-unused-unsafe.rs:959:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:966:32 + --> $DIR/lint-unused-unsafe.rs:962:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1290,7 +1290,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:967:32 + --> $DIR/lint-unused-unsafe.rs:963:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1299,13 +1299,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:987:24 + --> $DIR/lint-unused-unsafe.rs:983:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1000:28 + --> $DIR/lint-unused-unsafe.rs:996:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1313,7 +1313,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1013:28 + --> $DIR/lint-unused-unsafe.rs:1009:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1321,13 +1321,13 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1059:29 + --> $DIR/lint-unused-unsafe.rs:1055:29 | LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1066:33 + --> $DIR/lint-unused-unsafe.rs:1062:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1336,7 +1336,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1067:33 + --> $DIR/lint-unused-unsafe.rs:1063:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1345,7 +1345,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1068:33 + --> $DIR/lint-unused-unsafe.rs:1064:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1354,13 +1354,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1073:29 + --> $DIR/lint-unused-unsafe.rs:1069:29 | LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1080:33 + --> $DIR/lint-unused-unsafe.rs:1076:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1369,7 +1369,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1081:33 + --> $DIR/lint-unused-unsafe.rs:1077:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1378,7 +1378,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1082:33 + --> $DIR/lint-unused-unsafe.rs:1078:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1387,13 +1387,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1092:22 + --> $DIR/lint-unused-unsafe.rs:1088:22 | LL | let _x: [(); unsafe { 0 }] = []; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1096:22 + --> $DIR/lint-unused-unsafe.rs:1092:22 | LL | let _x: [(); unsafe { unsafe { size() } }] = []; | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/span/lint-unused-unsafe.rs b/tests/ui/span/lint-unused-unsafe.rs index 5d042768be0..ca615f64f22 100644 --- a/tests/ui/span/lint-unused-unsafe.rs +++ b/tests/ui/span/lint-unused-unsafe.rs @@ -3,12 +3,8 @@ // edition:2018 -// revisions: mir - -// FIXME: Adapt -Zthir-unsafeck to behave the same as the mir version after #93678, -// then delete lint-unused-unsafe-thir.rs, and go back to using the settings below -// // revisions: mir thir -// // [thir]compile-flags: -Zthir-unsafeck +// revisions: mir thir +// [thir]compile-flags: -Zthir-unsafeck #![allow(dead_code)] #![deny(unused_unsafe)] diff --git a/tests/ui/span/lint-unused-unsafe.thir.stderr b/tests/ui/span/lint-unused-unsafe.thir.stderr new file mode 100644 index 00000000000..9e8d3359242 --- /dev/null +++ b/tests/ui/span/lint-unused-unsafe.thir.stderr @@ -0,0 +1,1402 @@ +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:22:13 + | +LL | fn bad1() { unsafe {} } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:10:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:23:13 + | +LL | fn bad2() { unsafe { bad1() } } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:24:20 + | +LL | unsafe fn bad3() { unsafe {} } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:25:13 + | +LL | fn bad4() { unsafe { callback(||{}) } } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:28:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:35:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:70:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:79:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:80:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:81:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:86:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:96:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:97:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:98:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:108:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:106:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:109:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:110:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:120:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:130:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:131:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:132:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:138:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:149:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:150:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:151:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:162:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:160:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:163:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:164:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:174:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:184:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:185:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:186:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:192:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:203:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:204:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:205:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:216:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:214:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:217:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:218:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:238:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:251:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:264:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:282:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:291:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:292:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:293:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:298:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:308:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:309:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:310:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:320:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:318:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:321:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:322:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:332:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:342:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:343:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:344:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:350:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:361:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:362:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:363:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:374:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:372:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:375:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:376:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:386:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:396:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:397:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:398:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:404:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:415:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:416:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:417:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:428:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:426:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:429:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:430:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:450:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:463:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:476:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:495:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:504:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:505:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:506:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:511:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:521:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:522:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:523:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:533:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:531:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:534:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:535:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:545:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:555:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:556:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:557:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:563:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:574:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:575:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:576:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:587:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:585:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:588:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:589:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:599:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:609:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:610:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:611:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:617:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:628:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:629:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:630:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:641:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:639:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:642:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:643:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:663:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:676:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:689:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:707:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:717:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:718:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:719:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:725:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:736:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:737:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:738:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:749:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:747:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:750:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:751:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:761:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:771:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:772:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:773:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:779:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:790:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:791:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:792:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:803:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:801:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:804:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:805:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:825:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:838:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:851:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:865:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:875:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:876:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:877:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:883:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:894:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:895:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:896:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:907:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:905:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:908:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:909:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:919:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:929:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:930:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:931:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:937:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:948:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:949:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:950:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:961:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:959:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:962:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:963:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:983:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:996:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1009:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1055:29 + | +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1062:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = async { unsf() }; +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1063:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1064:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1069:29 + | +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1076:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = async { unsf() }; +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1077:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1078:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1088:22 + | +LL | let _x: [(); unsafe { 0 }] = []; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1092:22 + | +LL | let _x: [(); unsafe { unsafe { size() } }] = []; + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 174 previous errors + diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr index 9e9cbcf33ae..2267da31512 100644 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr +++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr @@ -16,9 +16,9 @@ LL | #[deny(unused_unsafe)] error: unnecessary `unsafe` block --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:12:38 | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | v.set_len(24); LL | |w: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr index 13c080e5b6a..4cdd97e5e06 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr @@ -76,12 +76,10 @@ LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:14 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5 | LL | unsafe { unsafe { unsf() } } - | ------ ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 From 11debd778a5f50d7a7240b653e36b22d3450f0a5 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Wed, 25 Oct 2023 19:14:03 +0800 Subject: [PATCH 6/7] Fix problematic comment Signed-off-by: cui fliter --- tests/ui/const-generics/const-arg-in-const-arg.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/const-generics/const-arg-in-const-arg.rs b/tests/ui/const-generics/const-arg-in-const-arg.rs index 9eaa54347f1..c1a4c3dc348 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.rs +++ b/tests/ui/const-generics/const-arg-in-const-arg.rs @@ -1,5 +1,5 @@ // revisions: min -// we use a single revision because t his shoudl have a `full` revision +// we use a single revision because this should have a `full` revision // but right now that ICEs and I(@BoxyUwU) could not get stderr normalization to work #![cfg_attr(full, feature(generic_const_exprs))] From 1be00334578c09dc5b41de0f19e841add69eb22e Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 25 Oct 2023 14:27:00 +0000 Subject: [PATCH 7/7] Fix some coroutine sentences that don't make sense anymore. These happened during the `generator` -> `coroutine` rename. --- library/core/src/ops/coroutine.rs | 2 +- src/doc/unstable-book/src/language-features/coroutines.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/ops/coroutine.rs b/library/core/src/ops/coroutine.rs index e01a893a068..cd5ca988f7e 100644 --- a/library/core/src/ops/coroutine.rs +++ b/library/core/src/ops/coroutine.rs @@ -29,7 +29,7 @@ pub enum CoroutineState { /// The trait implemented by builtin coroutine types. /// -/// Coroutines, also commonly referred to as coroutines, are currently an +/// Coroutines are currently an /// experimental language feature in Rust. Added in [RFC 2033] coroutines are /// currently intended to primarily provide a building block for async/await /// syntax but will likely extend to also providing an ergonomic definition for diff --git a/src/doc/unstable-book/src/language-features/coroutines.md b/src/doc/unstable-book/src/language-features/coroutines.md index fb1ba791aef..f8e5a22fbd5 100644 --- a/src/doc/unstable-book/src/language-features/coroutines.md +++ b/src/doc/unstable-book/src/language-features/coroutines.md @@ -18,7 +18,7 @@ Coroutines are an extra-unstable feature in the compiler right now. Added in [RFC 2033] they're mostly intended right now as a information/constraint gathering phase. The intent is that experimentation can happen on the nightly compiler before actual stabilization. A further RFC will be required to -stabilize coroutines/coroutines and will likely contain at least a few small +stabilize coroutines and will likely contain at least a few small tweaks to the overall design. [RFC 2033]: https://github.com/rust-lang/rfcs/pull/2033