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

Rollup of 4 pull requests #117641

Merged
merged 9 commits into from
Nov 6, 2023
3 changes: 2 additions & 1 deletion compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _
use rustc_trait_selection::traits::{
self, ObligationCause, ObligationCauseCode, ObligationCtxt, WellFormedLoc,
};
use rustc_type_ir::TypeFlags;

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

Expand Down
8 changes: 4 additions & 4 deletions library/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ where
/// * A Producer initializes the value of one of its fields of a specific type. (or is otherwise
/// prepared to generate a value requested). eg, `backtrace::Backtrace` or
/// `std::backtrace::Backtrace`
/// * A Consumer requests an object of a specific type (say `std::backtrace::Backtrace). In the case
/// of a `dyn Error` trait object (the Producer), there are methods called `request_ref` and
/// `request_value` are available to simplify obtaining an ``Option<T>`` for a given type. * The
/// Producer, when requested, populates the given Request object which is given as a mutable
/// * A Consumer requests an object of a specific type (say `std::backtrace::Backtrace`). In the
/// case of a `dyn Error` trait object (the Producer), there are functions called `request_ref` and
/// `request_value` to simplify obtaining an `Option<T>` for a given type.
/// * The Producer, when requested, populates the given Request object which is given as a mutable
/// reference.
/// * The Consumer extracts a value or reference to the requested type from the `Request` object
/// wrapped in an `Option<T>`; in the case of `dyn Error` the aforementioned `request_ref` and `
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/late-bound-lifetimes/predicate-is-global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ impl Inherent {
fn inherent(&self) {}
}

// This trivial bound doesn't hold, but the unused lifetime tripped up that check after #117589, and
// showed up in its crater results (in `soa-derive 0.13.0`).
fn do_it()
where
for<'a> Inherent: Clone,
{
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(const_closures, const_trait_impl, effects)]
#![allow(incomplete_features)]

trait Foo {
fn foo(&self);
}

impl Foo for () {
fn foo(&self) {}
}

fn main() {
(const || { (()).foo() })();
//~^ ERROR: cannot call non-const fn
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions
--> $DIR/const_closure-const_trait_impl-ice-113381.rs:13:22
|
LL | (const || { (()).foo() })();
| ^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

error: aborting due to previous error

For more information about this error, try `rustc --explain E0015`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// check-pass

// effects ice https://github.com/rust-lang/rust/issues/113375 index out of bounds

#![allow(incomplete_features, unused)]
#![feature(effects, adt_const_params)]

struct Bar<T>(T);

impl<T> Bar<T> {
const fn value() -> usize {
42
}
}

struct Foo<const N: [u8; Bar::<u32>::value()]>;

pub fn main() {}
Loading