mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Migrate rustc_mir_transform to use TyCtxt::emit_diag_node_span_lint
This commit is contained in:
@@ -83,7 +83,7 @@ fn check_recursion<'tcx>(
|
||||
|
||||
let sp = tcx.def_span(def_id);
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def_id);
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
UNCONDITIONAL_RECURSION,
|
||||
hir_id,
|
||||
sp,
|
||||
|
||||
@@ -104,7 +104,7 @@ fn visit_statement(&mut self, stmt: &Statement<'tcx>, loc: Location) {
|
||||
&& let Some((lint_root, span, item)) =
|
||||
self.should_lint_const_item_usage(lhs, def_id, loc)
|
||||
{
|
||||
self.tcx.emit_node_span_lint(
|
||||
self.tcx.emit_diag_node_span_lint(
|
||||
CONST_ITEM_MUTATION,
|
||||
lint_root,
|
||||
span,
|
||||
@@ -150,7 +150,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, loc: Location) {
|
||||
if let Some((lint_root, span, item)) =
|
||||
self.should_lint_const_item_usage(place, def_id, lint_loc)
|
||||
{
|
||||
self.tcx.emit_node_span_lint(
|
||||
self.tcx.emit_diag_node_span_lint(
|
||||
CONST_ITEM_MUTATION,
|
||||
lint_root,
|
||||
span,
|
||||
|
||||
@@ -1990,7 +1990,7 @@ fn check_must_not_suspend_def(
|
||||
if let Some(reason_str) = find_attr!(tcx, def_id, MustNotSupend {reason} => reason) {
|
||||
let reason =
|
||||
reason_str.map(|s| errors::MustNotSuspendReason { span: data.source_span, reason: s });
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
rustc_session::lint::builtin::MUST_NOT_SUSPEND,
|
||||
hir_id,
|
||||
data.source_span,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Applicability, Diag, EmissionGuarantee, LintDiagnostic, Subdiagnostic, msg};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_errors::{
|
||||
Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic, msg,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_middle::mir::AssertKind;
|
||||
use rustc_middle::query::Key;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
@@ -48,7 +50,7 @@ pub(crate) fn emit_inline_always_target_feature_diagnostic<'a, 'tcx>(
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("function cannot return without recursing")]
|
||||
#[help("a `loop` may express intention better if this is on purpose")]
|
||||
pub(crate) struct UnconditionalRecursion {
|
||||
@@ -70,7 +72,7 @@ pub(crate) struct InvalidForceInline {
|
||||
pub reason: &'static str,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
pub(crate) enum ConstMutate {
|
||||
#[diag("attempting to modify a `const` item")]
|
||||
#[note(
|
||||
@@ -129,21 +131,26 @@ pub(crate) enum AssertLintKind {
|
||||
UnconditionalPanic,
|
||||
}
|
||||
|
||||
impl<'a, P: std::fmt::Debug> LintDiagnostic<'a, ()> for AssertLint<P> {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
|
||||
diag.primary_message(match self.lint_kind {
|
||||
AssertLintKind::ArithmeticOverflow => {
|
||||
msg!("this arithmetic operation will overflow")
|
||||
}
|
||||
AssertLintKind::UnconditionalPanic => {
|
||||
msg!("this operation will panic at runtime")
|
||||
}
|
||||
});
|
||||
impl<'a, P: std::fmt::Debug> Diagnostic<'a, ()> for AssertLint<P> {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
let mut diag = Diag::new(
|
||||
dcx,
|
||||
level,
|
||||
match self.lint_kind {
|
||||
AssertLintKind::ArithmeticOverflow => {
|
||||
msg!("this arithmetic operation will overflow")
|
||||
}
|
||||
AssertLintKind::UnconditionalPanic => {
|
||||
msg!("this operation will panic at runtime")
|
||||
}
|
||||
},
|
||||
);
|
||||
let label = self.assert_kind.diagnostic_message();
|
||||
self.assert_kind.add_args(&mut |name, value| {
|
||||
diag.arg(name, value);
|
||||
});
|
||||
diag.span_label(self.span, label);
|
||||
diag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,14 +163,14 @@ pub(crate) fn lint(&self) -> &'static Lint {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("call to inline assembly that may unwind")]
|
||||
pub(crate) struct AsmUnwindCall {
|
||||
#[label("call to inline assembly that may unwind")]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(
|
||||
"call to {$foreign ->
|
||||
[true] foreign function
|
||||
@@ -181,7 +188,7 @@ pub(crate) struct FfiUnwindCall {
|
||||
pub foreign: bool,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("taking a reference to a function item does not give a function pointer")]
|
||||
pub(crate) struct FnItemRef {
|
||||
#[suggestion(
|
||||
@@ -194,14 +201,14 @@ pub(crate) struct FnItemRef {
|
||||
pub ident: Ident,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("value captured by `{$name}` is never read")]
|
||||
#[help("did you mean to capture by reference instead?")]
|
||||
pub(crate) struct UnusedCaptureMaybeCaptureRef {
|
||||
pub name: Symbol,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("variable `{$name}` is assigned to, but never used")]
|
||||
#[note("consider using `_{$name}` instead")]
|
||||
pub(crate) struct UnusedVarAssignedOnly {
|
||||
@@ -210,7 +217,7 @@ pub(crate) struct UnusedVarAssignedOnly {
|
||||
pub typo: Option<PatternTypo>,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("value assigned to `{$name}` is never read")]
|
||||
pub(crate) struct UnusedAssign {
|
||||
pub name: Symbol,
|
||||
@@ -237,14 +244,14 @@ pub(crate) struct UnusedAssignSuggestion {
|
||||
pub rhs_borrow_span: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("value passed to `{$name}` is never read")]
|
||||
#[help("maybe it is overwritten before being read?")]
|
||||
pub(crate) struct UnusedAssignPassed {
|
||||
pub name: Symbol,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("unused variable: `{$name}`")]
|
||||
pub(crate) struct UnusedVariable {
|
||||
pub name: Symbol,
|
||||
@@ -331,11 +338,13 @@ pub(crate) struct MustNotSupend<'a, 'tcx> {
|
||||
}
|
||||
|
||||
// Needed for def_path_str
|
||||
impl<'a> LintDiagnostic<'a, ()> for MustNotSupend<'_, '_> {
|
||||
fn decorate_lint<'b>(self, diag: &'b mut rustc_errors::Diag<'a, ()>) {
|
||||
diag.primary_message(msg!(
|
||||
"{$pre}`{$def_path}`{$post} held across a suspend point, but should not be"
|
||||
));
|
||||
impl<'a> Diagnostic<'a, ()> for MustNotSupend<'_, '_> {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
let mut diag = Diag::new(
|
||||
dcx,
|
||||
level,
|
||||
msg!("{$pre}`{$def_path}`{$post} held across a suspend point, but should not be"),
|
||||
);
|
||||
diag.span_label(self.yield_sp, msg!("the value is held across this suspend point"));
|
||||
if let Some(reason) = self.reason {
|
||||
diag.subdiagnostic(reason);
|
||||
@@ -344,6 +353,7 @@ fn decorate_lint<'b>(self, diag: &'b mut rustc_errors::Diag<'a, ()>) {
|
||||
diag.arg("pre", self.pre);
|
||||
diag.arg("def_path", self.tcx.def_path_str(self.def_id));
|
||||
diag.arg("post", self.post);
|
||||
diag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
|
||||
.lint_root;
|
||||
let span = terminator.source_info.span;
|
||||
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
FFI_UNWIND_CALLS,
|
||||
lint_root,
|
||||
span,
|
||||
@@ -115,7 +115,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
|
||||
let span = terminator.source_info.span;
|
||||
|
||||
let foreign = fn_def_id.is_some();
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
FFI_UNWIND_CALLS,
|
||||
lint_root,
|
||||
span,
|
||||
|
||||
@@ -175,7 +175,7 @@ fn emit_lint(
|
||||
ret,
|
||||
);
|
||||
|
||||
self.tcx.emit_node_span_lint(
|
||||
self.tcx.emit_diag_node_span_lint(
|
||||
FUNCTION_ITEM_REFERENCES,
|
||||
lint_root,
|
||||
span,
|
||||
|
||||
@@ -297,7 +297,7 @@ fn report_assert_as_lint(
|
||||
let source_info = self.body.source_info(location);
|
||||
if let Some(lint_root) = self.lint_root(*source_info) {
|
||||
let span = source_info.span;
|
||||
self.tcx.emit_node_span_lint(
|
||||
self.tcx.emit_diag_node_span_lint(
|
||||
lint_kind.lint(),
|
||||
lint_root,
|
||||
span,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_index::bit_set::MixedBitSet;
|
||||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::{
|
||||
self, BasicBlock, Body, ClearCrossCrate, Local, Location, MirDumper, Place, StatementKind,
|
||||
@@ -451,7 +451,7 @@ pub(crate) fn run_lint<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId, body: &Body<
|
||||
}
|
||||
|
||||
let span = local_labels[0].span;
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::TAIL_EXPR_DROP_ORDER,
|
||||
lint_root.unwrap_or(CRATE_HIR_ID),
|
||||
span,
|
||||
@@ -498,7 +498,7 @@ fn assign_observables_names(
|
||||
names
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("relative drop order changing in Rust 2024")]
|
||||
struct TailExprDropOrderLint<'a> {
|
||||
#[subdiagnostic]
|
||||
|
||||
@@ -968,7 +968,7 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
|
||||
let typo = maybe_suggest_typo();
|
||||
errors::UnusedVariableSugg::TryPrefix { spans: vec![def_span], name, typo }
|
||||
};
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
hir_id,
|
||||
def_span,
|
||||
@@ -1018,7 +1018,7 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
|
||||
}
|
||||
|
||||
let typo = maybe_suggest_typo();
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
hir_id,
|
||||
def_span,
|
||||
@@ -1060,7 +1060,7 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
|
||||
errors::UnusedVariableSugg::TryPrefix { name, typo, spans: vec![def_span] }
|
||||
};
|
||||
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
hir_id,
|
||||
spans,
|
||||
@@ -1126,20 +1126,20 @@ fn report_unused_assignments(self) {
|
||||
source_info.span,
|
||||
self.body,
|
||||
);
|
||||
tcx.emit_node_span_lint(
|
||||
tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::UNUSED_ASSIGNMENTS,
|
||||
hir_id,
|
||||
source_info.span,
|
||||
errors::UnusedAssign { name, help: suggestion.is_none(), suggestion },
|
||||
)
|
||||
}
|
||||
AccessKind::Param => tcx.emit_node_span_lint(
|
||||
AccessKind::Param => tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::UNUSED_ASSIGNMENTS,
|
||||
hir_id,
|
||||
source_info.span,
|
||||
errors::UnusedAssignPassed { name },
|
||||
),
|
||||
AccessKind::Capture => tcx.emit_node_span_lint(
|
||||
AccessKind::Capture => tcx.emit_diag_node_span_lint(
|
||||
lint::builtin::UNUSED_ASSIGNMENTS,
|
||||
hir_id,
|
||||
decl_span,
|
||||
|
||||
@@ -26,8 +26,6 @@ LL | | }, e.mark(3), e.ok(4));
|
||||
| |__________________________this value will be stored in a temporary; let us call it `#1`
|
||||
| `#1` will be dropped later as of Edition 2024
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#3` invokes this custom destructor
|
||||
--> $DIR/drop-order-comparisons.rs:503:1
|
||||
|
|
||||
@@ -49,6 +47,8 @@ note: `#2` invokes this custom destructor
|
||||
LL | impl<'b> Drop for LogDrop<'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/drop-order-comparisons.rs:30:25
|
||||
|
|
||||
@@ -74,8 +74,6 @@ LL | | }, e.mark(1), e.ok(4));
|
||||
| |__________________________this value will be stored in a temporary; let us call it `#1`
|
||||
| `#1` will be dropped later as of Edition 2024
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#2` invokes this custom destructor
|
||||
--> $DIR/drop-order-comparisons.rs:503:1
|
||||
|
|
||||
@@ -87,6 +85,8 @@ note: `#1` invokes this custom destructor
|
||||
LL | impl<'b> Drop for LogDrop<'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
warning: relative drop order changing in Rust 2024
|
||||
--> $DIR/drop-order-comparisons.rs:102:19
|
||||
@@ -106,8 +106,6 @@ LL | | }, e.mark(1), e.ok(4));
|
||||
| |__________________________this value will be stored in a temporary; let us call it `#1`
|
||||
| `#1` will be dropped later as of Edition 2024
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#2` invokes this custom destructor
|
||||
--> $DIR/drop-order-comparisons.rs:503:1
|
||||
|
|
||||
@@ -119,6 +117,8 @@ note: `#1` invokes this custom destructor
|
||||
LL | impl<'b> Drop for LogDrop<'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
warning: relative drop order changing in Rust 2024
|
||||
--> $DIR/drop-order-comparisons.rs:223:24
|
||||
@@ -138,8 +138,6 @@ LL | | }, e.mark(2), e.ok(3));
|
||||
| |__________________________this value will be stored in a temporary; let us call it `#1`
|
||||
| `#1` will be dropped later as of Edition 2024
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#2` invokes this custom destructor
|
||||
--> $DIR/drop-order-comparisons.rs:503:1
|
||||
|
|
||||
@@ -151,6 +149,8 @@ note: `#1` invokes this custom destructor
|
||||
LL | impl<'b> Drop for LogDrop<'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
warning: relative drop order changing in Rust 2024
|
||||
--> $DIR/drop-order-comparisons.rs:249:24
|
||||
@@ -170,8 +170,6 @@ LL | | }, e.mark(2), e.ok(3));
|
||||
| |__________________________this value will be stored in a temporary; let us call it `#1`
|
||||
| `#1` will be dropped later as of Edition 2024
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#2` invokes this custom destructor
|
||||
--> $DIR/drop-order-comparisons.rs:503:1
|
||||
|
|
||||
@@ -183,6 +181,8 @@ note: `#1` invokes this custom destructor
|
||||
LL | impl<'b> Drop for LogDrop<'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
warning: `if let` assigns a shorter lifetime since Edition 2024
|
||||
--> $DIR/drop-order-comparisons.rs:125:13
|
||||
|
||||
@@ -16,8 +16,6 @@ LL | x.get() + LoudDropper.get()
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:10:1
|
||||
|
|
||||
@@ -29,6 +27,8 @@ note: `x` invokes this custom destructor
|
||||
LL | impl Drop for LoudDropper {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:6:9
|
||||
|
|
||||
@@ -53,8 +53,6 @@ LL | x.get() + LoudDropper.get()
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:10:1
|
||||
|
|
||||
@@ -66,6 +64,8 @@ note: `x` invokes this custom destructor
|
||||
LL | impl Drop for LoudDropper {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
error: relative drop order changing in Rust 2024
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:92:7
|
||||
@@ -85,8 +85,6 @@ LL | { LoudDropper.get() }
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:10:1
|
||||
|
|
||||
@@ -98,6 +96,8 @@ note: `x` invokes this custom destructor
|
||||
LL | impl Drop for LoudDropper {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
error: relative drop order changing in Rust 2024
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:145:5
|
||||
@@ -117,14 +117,14 @@ LL | LoudDropper.get()
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:10:1
|
||||
|
|
||||
LL | impl Drop for LoudDropper {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
error: relative drop order changing in Rust 2024
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:162:14
|
||||
@@ -144,9 +144,9 @@ LL | extract(&T::default())
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
|
||||
error: relative drop order changing in Rust 2024
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:176:5
|
||||
@@ -166,8 +166,6 @@ LL | LoudDropper.get()
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:10:1
|
||||
|
|
||||
@@ -179,6 +177,8 @@ note: `x` invokes this custom destructor
|
||||
LL | impl Drop for LoudDropper {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
error: relative drop order changing in Rust 2024
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:220:5
|
||||
@@ -198,8 +198,6 @@ LL | LoudDropper3.get()
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:193:5
|
||||
|
|
||||
@@ -211,6 +209,8 @@ note: `x` invokes this custom destructor
|
||||
LL | impl Drop for LoudDropper2 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
error: relative drop order changing in Rust 2024
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:233:13
|
||||
@@ -230,8 +230,6 @@ LL | let _x = LoudDropper;
|
||||
LL | ));
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#1` invokes this custom destructor
|
||||
--> $DIR/lint-tail-expr-drop-order.rs:10:1
|
||||
|
|
||||
@@ -243,6 +241,8 @@ note: `_x` invokes this custom destructor
|
||||
LL | impl Drop for LoudDropper {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ LL | }
|
||||
LL | }
|
||||
| - now the temporary value is dropped here, before the local variables in the block or statement
|
||||
|
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: `#2` invokes this custom destructor
|
||||
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1
|
||||
|
|
||||
@@ -40,6 +38,8 @@ note: `e` invokes this custom destructor
|
||||
LL | impl std::ops::Drop for Drop {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
|
||||
= warning: this changes meaning in Rust 2024
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:6:9
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user