Skip to content

Commit

Permalink
Auto merge of rust-lang#134879 - Zalathar:rollup-olayokx, r=Zalathar
Browse files Browse the repository at this point in the history
Rollup of 3 pull requests

Successful merges:

 - rust-lang#133460 (Use `check-run-results` for `run-fail` test stderr)
 - rust-lang#134627 (Avoid ICE in borrowck)
 - rust-lang#134799 (nits: Cleanups in `librustdoc::clean`)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 29, 2024
2 parents 480eec0 + 8dc9921 commit 869b3cc
Show file tree
Hide file tree
Showing 366 changed files with 930 additions and 234 deletions.
10 changes: 8 additions & 2 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,8 +1950,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
target_test: impl Fn(RegionVid) -> bool,
) -> (BlameConstraint<'tcx>, Vec<ExtraConstraintInfo>) {
// Find all paths
let (path, target_region) =
self.find_constraint_paths_between_regions(from_region, target_test).unwrap();
let (path, target_region) = self
.find_constraint_paths_between_regions(from_region, target_test)
.or_else(|| {
self.find_constraint_paths_between_regions(from_region, |r| {
self.cannot_name_placeholder(from_region, r)
})
})
.unwrap();
debug!(
"path={:#?}",
path.iter()
Expand Down
22 changes: 10 additions & 12 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn clean_poly_trait_ref_with_constraints<'tcx>(
)
}

fn clean_lifetime(lifetime: &hir::Lifetime, cx: &mut DocContext<'_>) -> Lifetime {
fn clean_lifetime(lifetime: &hir::Lifetime, cx: &DocContext<'_>) -> Lifetime {
if let Some(
rbv::ResolvedArg::EarlyBound(did)
| rbv::ResolvedArg::LateBound(_, _, did)
Expand Down Expand Up @@ -362,9 +362,9 @@ pub(crate) fn clean_predicate<'tcx>(
let bound_predicate = predicate.kind();
match bound_predicate.skip_binder() {
ty::ClauseKind::Trait(pred) => clean_poly_trait_predicate(bound_predicate.rebind(pred), cx),
ty::ClauseKind::RegionOutlives(pred) => clean_region_outlives_predicate(pred),
ty::ClauseKind::RegionOutlives(pred) => Some(clean_region_outlives_predicate(pred)),
ty::ClauseKind::TypeOutlives(pred) => {
clean_type_outlives_predicate(bound_predicate.rebind(pred), cx)
Some(clean_type_outlives_predicate(bound_predicate.rebind(pred), cx))
}
ty::ClauseKind::Projection(pred) => {
Some(clean_projection_predicate(bound_predicate.rebind(pred), cx))
Expand Down Expand Up @@ -396,32 +396,30 @@ fn clean_poly_trait_predicate<'tcx>(
})
}

fn clean_region_outlives_predicate(
pred: ty::RegionOutlivesPredicate<'_>,
) -> Option<WherePredicate> {
fn clean_region_outlives_predicate(pred: ty::RegionOutlivesPredicate<'_>) -> WherePredicate {
let ty::OutlivesPredicate(a, b) = pred;

Some(WherePredicate::RegionPredicate {
WherePredicate::RegionPredicate {
lifetime: clean_middle_region(a).expect("failed to clean lifetime"),
bounds: vec![GenericBound::Outlives(
clean_middle_region(b).expect("failed to clean bounds"),
)],
})
}
}

fn clean_type_outlives_predicate<'tcx>(
pred: ty::Binder<'tcx, ty::TypeOutlivesPredicate<'tcx>>,
cx: &mut DocContext<'tcx>,
) -> Option<WherePredicate> {
) -> WherePredicate {
let ty::OutlivesPredicate(ty, lt) = pred.skip_binder();

Some(WherePredicate::BoundPredicate {
WherePredicate::BoundPredicate {
ty: clean_middle_ty(pred.rebind(ty), cx, None, None),
bounds: vec![GenericBound::Outlives(
clean_middle_region(lt).expect("failed to clean lifetimes"),
)],
bound_params: Vec::new(),
})
}
}

fn clean_middle_term<'tcx>(
Expand Down Expand Up @@ -1860,7 +1858,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T

/// Returns `None` if the type could not be normalized
fn normalize<'tcx>(
cx: &mut DocContext<'tcx>,
cx: &DocContext<'tcx>,
ty: ty::Binder<'tcx, Ty<'tcx>>,
) -> Option<ty::Binder<'tcx, Ty<'tcx>>> {
// HACK: low-churn fix for #79459 while we wait for a trait normalization fix
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ignore::Walk;
const ENTRY_LIMIT: u32 = 901;
// FIXME: The following limits should be reduced eventually.

const ISSUES_ENTRY_LIMIT: u32 = 1667;
const ISSUES_ENTRY_LIMIT: u32 = 1679;

const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/array-slice-vec/dst-raw-slice.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Test bounds checking for DST raw slices

//@ run-fail
//@ error-pattern:index out of bounds
//@ check-run-results:index out of bounds
//@ ignore-emscripten no processes

#[allow(unconditional_panic)]
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/array-slice-vec/dst-raw-slice.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/dst-raw-slice.rs:11:18:
index out of bounds: the len is 3 but the index is 3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/array-slice-vec/vec-overrun.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:index out of bounds: the len is 1 but the index is 2
//@ check-run-results:index out of bounds: the len is 1 but the index is 2
//@ ignore-emscripten no processes

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/array-slice-vec/vec-overrun.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/vec-overrun.rs:11:17:
index out of bounds: the len is 1 but the index is 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// be talking about `async fn`s instead.

//@ run-fail
//@ error-pattern: thread 'main' panicked
//@ error-pattern: `async fn` resumed after completion
//@ check-run-results: thread 'main' panicked
//@ check-run-results: `async fn` resumed after completion
//@ edition:2018

#![feature(coroutines, coroutine_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/issue-65419-async-fn-resume-after-completion.rs:11:16:
`async fn` resumed after completion
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

//@ run-fail
//@ needs-unwind
//@ error-pattern: thread 'main' panicked
//@ error-pattern: `async fn` resumed after panicking
//@ check-run-results: thread 'main' panicked
//@ check-run-results: `async fn` resumed after panicking
//@ edition:2018

#![feature(coroutines, coroutine_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
thread 'main' panicked at $DIR/issue-65419-async-fn-resume-after-panic.rs:15:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at $DIR/issue-65419-async-fn-resume-after-panic.rs:14:16:
`async fn` resumed after panicking
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// panic when resumed after completion.

//@ run-fail
//@ error-pattern:coroutine resumed after completion
//@ check-run-results:coroutine resumed after completion
//@ edition:2018

#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/issue-65419-coroutine-resume-after-completion.rs:15:5:
coroutine resumed after completion
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/binop/binop-fail-3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:quux
//@ check-run-results:quux
//@ ignore-emscripten no processes

fn foo() -> ! {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/binop/binop-fail-3.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/binop-fail-3.rs:6:5:
quux
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/binop/binop-panic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:quux
//@ check-run-results:quux
//@ ignore-emscripten no processes

fn my_err(s: String) -> ! {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/binop/binop-panic.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/binop-panic.rs:7:5:
quux
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1 change: 1 addition & 0 deletions tests/ui/binop/binop-panic.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bye
2 changes: 1 addition & 1 deletion tests/ui/borrowck/borrowck-local-borrow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:panic 1
//@ check-run-results:panic 1
//@ ignore-emscripten no processes

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/borrowck/borrowck-local-borrow.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/borrowck-local-borrow.rs:8:5:
panic 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ known-bug: #133252
// Regression test for borrowck ICE #133252
//@ edition:2021
use std::future::Future;

Expand All @@ -7,6 +7,8 @@ fn ice() -> impl Future<Output = &'static dyn Owned> {
async {
let not_static = 0;
force_send(async_load(&not_static));
//~^ ERROR implementation of `LoadQuery` is not general enough
//~| ERROR `not_static` does not live long enough
loop {}
}
}
Expand Down Expand Up @@ -41,3 +43,5 @@ impl Future for SimpleFuture {
loop {}
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
error: implementation of `LoadQuery` is not general enough
--> $DIR/implementation-not-general-enough-ice-133252.rs:9:9
|
LL | force_send(async_load(&not_static));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `LoadQuery` is not general enough
|
= note: `LoadQuery<'0>` would have to be implemented for the type `&u8`, for any lifetime `'0`...
= note: ...but `LoadQuery<'1>` is actually implemented for the type `&'1 u8`, for some specific lifetime `'1`

error[E0597]: `not_static` does not live long enough
--> $DIR/implementation-not-general-enough-ice-133252.rs:9:31
|
LL | async {
| - return type of async block is &(dyn Owned + '1)
LL | let not_static = 0;
| ---------- binding `not_static` declared here
LL | force_send(async_load(&not_static));
| -----------^^^^^^^^^^^-
| | |
| | borrowed value does not live long enough
| argument requires that `not_static` is borrowed for `'1`
...
LL | }
| - `not_static` dropped here while still borrowed
|
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
--> $DIR/implementation-not-general-enough-ice-133252.rs:16:18
|
LL | fn force_send<T: Send>(_: T) {}
| ^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0597`.
2 changes: 1 addition & 1 deletion tests/ui/borrowck/issue-28934.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// which were not being considered during the contraction phase.

//@ run-fail
//@ error-pattern:explicit panic
//@ check-run-results:explicit panic
//@ ignore-emscripten no processes

struct Parser<'i: 't, 't>(&'i u8, &'t u8);
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/borrowck/issue-28934.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/issue-28934.rs:14:9:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/closures/diverging-closure.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:oops
//@ check-run-results:oops
//@ ignore-emscripten no processes

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/closures/diverging-closure.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/diverging-closure.rs:7:9:
oops
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/consts/issue-29798.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:index out of bounds: the len is 5 but the index is 5
//@ check-run-results:index out of bounds: the len is 5 but the index is 5
//@ ignore-emscripten no processes

const fn test(x: usize) -> i32 {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/consts/issue-29798.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/issue-29798.rs:6:5:
index out of bounds: the len is 5 but the index is 5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/coroutine/coroutine-resume-after-panic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ run-fail
//@ needs-unwind
//@ error-pattern:coroutine resumed after panicking
//@ check-run-results:coroutine resumed after panicking
//@ ignore-emscripten no processes

// Test that we get the correct message for resuming a panicked coroutine.
Expand Down
5 changes: 5 additions & 0 deletions tests/ui/coroutine/coroutine-resume-after-panic.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
thread 'main' panicked at $DIR/coroutine-resume-after-panic.rs:18:9:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at $DIR/coroutine-resume-after-panic.rs:17:30:
coroutine resumed after panicking
2 changes: 1 addition & 1 deletion tests/ui/expr/if/expr-if-panic-fn.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:explicit panic
//@ check-run-results:explicit panic
//@ ignore-emscripten no processes

fn f() -> ! {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/expr/if/expr-if-panic-fn.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/expr-if-panic-fn.rs:6:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/expr/if/expr-if-panic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:explicit panic
//@ check-run-results:explicit panic
//@ ignore-emscripten no processes

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/expr/if/expr-if-panic.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/expr-if-panic.rs:9:9:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/expr/if/if-check-panic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:Number is odd
//@ check-run-results:Number is odd
//@ ignore-emscripten no processes

fn even(x: usize) -> bool {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/expr/if/if-check-panic.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/if-check-panic.rs:19:9:
Number is odd
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/expr/if/if-cond-bot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:quux
//@ check-run-results:quux
//@ ignore-emscripten no processes

fn my_err(s: String) -> ! {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/expr/if/if-cond-bot.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/if-cond-bot.rs:7:5:
quux
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1 change: 1 addition & 0 deletions tests/ui/expr/if/if-cond-bot.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bye
2 changes: 1 addition & 1 deletion tests/ui/extern/issue-18576.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:stop
//@ check-run-results:stop
//@ ignore-emscripten no processes

// #18576
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/extern/issue-18576.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/issue-18576.rs:11:5:
stop
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/fn/expr-fn-panic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:explicit panic
//@ check-run-results:explicit panic
//@ ignore-emscripten no processes

fn f() -> ! {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/fn/expr-fn-panic.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/expr-fn-panic.rs:6:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1 change: 1 addition & 0 deletions tests/ui/hashmap/hashmap-capacity-overflow.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ run-fail
//@ error-pattern:capacity overflow
//@ ignore-emscripten no processes
//@ compile-flags: --remap-path-prefix={{rust-src-base}}=remapped

use std::collections::hash_map::HashMap;
use std::mem::size_of;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/imports/glob-use-std.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Issue #7580

//@ run-fail
//@ error-pattern:panic works
//@ check-run-results:panic works
//@ ignore-emscripten no processes

use std::*;
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/imports/glob-use-std.run.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thread 'main' panicked at $DIR/glob-use-std.rs:10:5:
panic works
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-12920.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-fail
//@ error-pattern:explicit panic
//@ check-run-results:explicit panic
//@ ignore-emscripten no processes

pub fn main() {
Expand Down
Loading

0 comments on commit 869b3cc

Please sign in to comment.