Skip to content

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

New issue

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

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

Already on GitHub? # to your account

Closed
dwrensha opened this issue May 2, 2020 · 4 comments · Fixed by #71810
Closed

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

dwrensha opened this issue May 2, 2020 · 4 comments · Fixed by #71810
Assignees
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented May 2, 2020

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


@dwrensha
Copy link
Contributor Author

dwrensha commented May 2, 2020

Possibly related to #70813, though the panic happens at a different place.

@dwrensha
Copy link
Contributor Author

dwrensha commented May 2, 2020

Report from cargo-bisect-rustc:

searched nightlies: from nightly-2020-03-01 to nightly-2020-05-02
regressed nightly: nightly-2020-03-28
searched commits: from 2fbb075 to 7520894
regressed commit: 7b73d14

@jonas-schievink jonas-schievink added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 2, 2020
@estebank
Copy link
Contributor

estebank commented May 2, 2020

It is caused by a different underlying cause to #70813.

@estebank
Copy link
Contributor

estebank commented May 2, 2020

The underlying issue is a bad interaction in the following code 7b73d14#diff-18d99e659faf20ef0968cc7bad7f81b2R498-R513 with the call to lookup_op_method_in_trait (called by lookup_op_method) which expects there not to be any unresolved lifetimes. This happens because the code test_ref &u; is actually parsed and evaluated as test_ref & u; (test_ref and u).

@estebank estebank self-assigned this May 2, 2020
@Dylan-DPC-zz Dylan-DPC-zz added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 3, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 4, 2020
Do not try to find binop method on RHS `TyErr`

Fix rust-lang#71798.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 4, 2020
Do not try to find binop method on RHS `TyErr`

Fix rust-lang#71798.
@bors bors closed this as completed in 16a0349 May 4, 2020
Mark-Simulacrum pushed a commit to Mark-Simulacrum/rust that referenced this issue May 9, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants