Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Tail expr drop order crater run #129607

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions compiler/rustc_hir_analysis/src/check/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
}
}
if let Some(tail_expr) = blk.expr {
if visitor.tcx.features().shorter_tail_lifetimes
&& blk.span.edition().at_least_rust_2024()
{
visitor.terminating_scopes.insert(tail_expr.hir_id.local_id);
}
visitor.terminating_scopes.insert(tail_expr.hir_id.local_id);
visitor.visit_expr(tail_expr);
}
}
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_lint/src/tail_expr_drop_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for TailExprDropOrder {
_: Span,
def_id: rustc_span::def_id::LocalDefId,
) {
if cx.tcx.sess.at_least_rust_2024() && cx.tcx.features().shorter_tail_lifetimes {
Self::check_fn_or_closure(cx, fn_kind, body, def_id);
}
Self::check_fn_or_closure(cx, fn_kind, body, def_id);
}
}

Expand Down Expand Up @@ -185,10 +183,6 @@ impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> {

impl<'tcx, 'a> LintVisitor<'tcx, 'a> {
fn check_block_inner(&mut self, block: &Block<'tcx>) {
if !block.span.at_least_rust_2024() {
// We only lint for Edition 2024 onwards
return;
}
let Some(tail_expr) = block.expr else { return };
for stmt in block.stmts {
match stmt.kind {
Expand Down
20 changes: 4 additions & 16 deletions tests/ui/async-await/async-fn-size-moved-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See issue #59123 for a full explanation.

//@ needs-unwind Size of Futures change on panic=abort
//@ run-pass
//@ ignore-test

//@ edition:2018

Expand Down Expand Up @@ -70,11 +70,7 @@ async fn joined() {
let b = BigFut::new();
let c = BigFut::new();

let joiner = Joiner {
a: Some(a),
b: Some(b),
c: Some(c),
};
let joiner = Joiner { a: Some(a), b: Some(b), c: Some(c) };
joiner.await
}

Expand All @@ -83,11 +79,7 @@ async fn joined_with_noop() {
let b = BigFut::new();
let c = BigFut::new();

let joiner = Joiner {
a: Some(a),
b: Some(b),
c: Some(c),
};
let joiner = Joiner { a: Some(a), b: Some(b), c: Some(c) };
noop();
joiner.await
}
Expand All @@ -98,11 +90,7 @@ async fn mixed_sizes() {
let c = BigFut::new();
let d = BigFut::new();
let e = BigFut::new();
let joiner = Joiner {
a: Some(a),
b: Some(b),
c: Some(c),
};
let joiner = Joiner { a: Some(a), b: Some(b), c: Some(c) };

d.await;
e.await;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
//@ edition:2018
#![feature(async_closure)]
use std::future::Future;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ known-bug: #42940
//@ ignore-test

trait Captures<'a> {}
impl<T> Captures<'_> for T {}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/borrowck/issue-85581.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Regression test of #85581.
// Checks not to suggest to add `;` when the second mutable borrow
// is in the first's scope.
//@ ignore-test

use std::collections::BinaryHeap;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coercion/coerce-overloaded-autoderef.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ run-pass
//@ ignore-test
#![allow(unused_braces)]
#![allow(dead_code)]
//@ pretty-expanded FIXME #23616
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/drop/drop_order.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ run-pass
//@ ignore-test
//@ compile-flags: -Z validate-mir
#![feature(let_chains)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/drop/issue-23338-ensure-param-drop-order.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ run-pass
//@ ignore-test
#![allow(non_upper_case_globals)]

// This test is ensuring that parameters are indeed dropped after
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/drop/lint-tail-expr-drop-order-gated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// or the feature gate `shorter_tail_lifetimes` is disabled.

//@ revisions: neither no_feature_gate edition_less_than_2024
//@ check-pass
//@ ignore-test
//@ [neither] edition: 2021
//@ [no_feature_gate] compile-flags: -Z unstable-options
//@ [no_feature_gate] edition: 2024
Expand Down
1 change: 1 addition & 0 deletions tests/ui/drop/lint-tail-expr-drop-order.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ compile-flags: -Z unstable-options
//@ edition: 2024
//@ ignore-test

// Edition 2024 lint for change in drop order at tail expression
// This lint is to capture potential change in program semantics
Expand Down
1 change: 1 addition & 0 deletions tests/ui/drop/tail-expr-drop-order-negative.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
//@ revisions: edition2021 edition2024
//@ [edition2024] compile-flags: -Zunstable-options
//@ [edition2024] edition: 2024
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/drop/tail-expr-drop-order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@ aux-build:edition-2024-macros.rs
//@ compile-flags: -Z validate-mir -Zunstable-options
//@ edition: 2024
//@ run-pass
//@ ignore-test

#![feature(shorter_tail_lifetimes)]
#![allow(unused_imports)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
fn f() -> usize {
let c = std::cell::RefCell::new("..");
c.borrow().len() //~ ERROR: `c` does not live long enough
Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-29861.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
pub trait MakeRef<'a> {
type Ref;
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lifetimes/refcell-in-tail-expr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
//@ revisions: edition2021 edition2024
//@ [edition2021] edition: 2021
//@ [edition2024] edition: 2024
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lifetimes/shorter-tail-expr-lifetime.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
//@ revisions: edition2021 edition2024
//@ [edition2024] compile-flags: -Zunstable-options
//@ [edition2024] edition: 2024
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lifetimes/tail-expr-lock-poisoning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@ ignore-wasm no panic or subprocess support
//@ [edition2024] compile-flags: -Zunstable-options
//@ [edition2024] edition: 2024
//@ run-pass
//@ ignore-test
//@ needs-unwind
#![cfg_attr(edition2024, feature(shorter_tail_lifetimes))]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/macros/format-args-temporaries-in-write.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ check-fail
//@ ignore-test

use std::fmt::{self, Display};

Expand Down
1 change: 1 addition & 0 deletions tests/ui/nll/borrowed-temporary-error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
fn gimme(x: &(u32,)) -> &u32 {
&x.0
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/nll/issue-52534-1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
struct Test;

impl Test {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/nll/issue-54556-niconii.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
// This is a reduction of a concrete test illustrating a case that was
// annoying to Rust developer niconii (see comment thread on #21114).
//
Expand Down
1 change: 1 addition & 0 deletions tests/ui/nll/issue-54556-stephaneyfx.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
// This is a reduction of a concrete test illustrating a case that was
// annoying to Rust developer stephaneyfx (see issue #46413).
//
Expand Down
1 change: 1 addition & 0 deletions tests/ui/nll/issue-54556-temps-in-tail-diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
fn main() {
{
let mut _thing1 = D(Box::new("thing1"));
Expand Down
1 change: 1 addition & 0 deletions tests/ui/nll/issue-54556-used-vs-unused-tails.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
// This test case is exploring the space of how blocks with tail
// expressions and statements can be composed, trying to keep each
// case on one line so that we can compare them via a vertical scan
Expand Down
1 change: 1 addition & 0 deletions tests/ui/span/destructor-restrictions.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
// Tests the new destructor semantics.

use std::cell::RefCell;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
// This is just checking that we still reject code where temp values
// are borrowing values for longer than they will be around.
//
Expand Down
1 change: 1 addition & 0 deletions tests/ui/static/static-drop-scope.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ ignore-test
struct WithDtor;

impl Drop for WithDtor {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/thir-print/thir-tree-match.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ check-pass
//@ ignore-test
//@ compile-flags: -Zunpretty=thir-tree

enum Bar {
Expand Down
Loading