Skip to content

Commit 189d6c7

Browse files
committed
Auto merge of #117641 - matthiaskrgr:rollup-f9c12td, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #117190 (add test for #113381) - #117516 (add test for #113375) - #117631 (Documentation cleanup for core::error::Request.) - #117637 (Check binders with bound vars for global bounds that don't hold) r? `@ghost` `@rustbot` modify labels: rollup
2 parents fb61292 + 9efe60b commit 189d6c7

File tree

6 files changed

+58
-5
lines changed

6 files changed

+58
-5
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _
3232
use rustc_trait_selection::traits::{
3333
self, ObligationCause, ObligationCauseCode, ObligationCtxt, WellFormedLoc,
3434
};
35+
use rustc_type_ir::TypeFlags;
3536

3637
use std::cell::LazyCell;
3738
use std::ops::{ControlFlow, Deref};
@@ -1877,7 +1878,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
18771878
continue;
18781879
}
18791880
// Match the existing behavior.
1880-
if pred.is_global() && !pred.has_late_bound_vars() {
1881+
if pred.is_global() && !pred.has_type_flags(TypeFlags::HAS_BINDER_VARS) {
18811882
let pred = self.normalize(span, None, pred);
18821883
let hir_node = tcx.hir().find_by_def_id(self.body_def_id);
18831884

library/core/src/error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,10 @@ where
439439
/// * A Producer initializes the value of one of its fields of a specific type. (or is otherwise
440440
/// prepared to generate a value requested). eg, `backtrace::Backtrace` or
441441
/// `std::backtrace::Backtrace`
442-
/// * A Consumer requests an object of a specific type (say `std::backtrace::Backtrace). In the case
443-
/// of a `dyn Error` trait object (the Producer), there are methods called `request_ref` and
444-
/// `request_value` are available to simplify obtaining an ``Option<T>`` for a given type. * The
445-
/// Producer, when requested, populates the given Request object which is given as a mutable
442+
/// * A Consumer requests an object of a specific type (say `std::backtrace::Backtrace`). In the
443+
/// case of a `dyn Error` trait object (the Producer), there are functions called `request_ref` and
444+
/// `request_value` to simplify obtaining an `Option<T>` for a given type.
445+
/// * The Producer, when requested, populates the given Request object which is given as a mutable
446446
/// reference.
447447
/// * The Consumer extracts a value or reference to the requested type from the `Request` object
448448
/// wrapped in an `Option<T>`; in the case of `dyn Error` the aforementioned `request_ref` and `

tests/ui/late-bound-lifetimes/predicate-is-global.rs

+8
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ impl Inherent {
2929
fn inherent(&self) {}
3030
}
3131

32+
// This trivial bound doesn't hold, but the unused lifetime tripped up that check after #117589, and
33+
// showed up in its crater results (in `soa-derive 0.13.0`).
34+
fn do_it()
35+
where
36+
for<'a> Inherent: Clone,
37+
{
38+
}
39+
3240
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(const_closures, const_trait_impl, effects)]
2+
#![allow(incomplete_features)]
3+
4+
trait Foo {
5+
fn foo(&self);
6+
}
7+
8+
impl Foo for () {
9+
fn foo(&self) {}
10+
}
11+
12+
fn main() {
13+
(const || { (()).foo() })();
14+
//~^ ERROR: cannot call non-const fn
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions
2+
--> $DIR/const_closure-const_trait_impl-ice-113381.rs:13:22
3+
|
4+
LL | (const || { (()).foo() })();
5+
| ^^^^^
6+
|
7+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0015`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// check-pass
2+
3+
// effects ice https://github.com/rust-lang/rust/issues/113375 index out of bounds
4+
5+
#![allow(incomplete_features, unused)]
6+
#![feature(effects, adt_const_params)]
7+
8+
struct Bar<T>(T);
9+
10+
impl<T> Bar<T> {
11+
const fn value() -> usize {
12+
42
13+
}
14+
}
15+
16+
struct Foo<const N: [u8; Bar::<u32>::value()]>;
17+
18+
pub fn main() {}

0 commit comments

Comments
 (0)