Skip to content

thread 'rustc' panicked at 'assertion failed: !bounds.has_escaping_bound_vars()' #71798

Closed

Description

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
    *x
}

fn main() {
    let _ = test_ref &u;
}
$ rustc main.rs
error[E0425]: cannot find value `u` in this scope
 --> main.rs:6:23
  |
6 |     let _ = test_ref &u;
  |                       ^ not found in this scope

error[E0277]: the trait bound `u32: std::future::Future` is not satisfied
 --> main.rs:1:25
  |
1 | fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
  |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `u32`
2 |     *x
  |     -- this returned value is of type `u32`
  |
  = note: the return type of a function must have a statically known size

thread 'rustc' panicked at 'assertion failed: !bounds.has_escaping_bound_vars()', src/librustc_typeck/check/method/mod.rs:390:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.0-nightly (7f65393b9 2020-05-01) running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions