Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/72679.sh: fixed with no errors #400

Merged
merged 1 commit into from
Jun 22, 2020
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#72679

#!/bin/bash

rustc -Z mir-opt-level=2 - << EOF

#![cfg_attr(const_fn, feature(const_fn))]

// Ctor(..) is transformed to Ctor { 0: ... } in HAIR lowering, so directly
// calling constructors doesn't require them to be const.

type ExternalType = std::panic::AssertUnwindSafe<(Option<i32>, Result<i32, bool>)>;

const fn call_external_constructors_in_local_vars() -> ExternalType {
    let f = Some;
    let g = Err;
    let h = std::panic::AssertUnwindSafe;
    let x = f(5);
    let y = g(false);
    let z = h((x, y));
    z
}

const CALL_EXTERNAL_CONSTRUCTORS_IN_LOCAL_VARS: ExternalType = {
    let f = Some;
    let g = Err;
    let h = std::panic::AssertUnwindSafe;
    let x = f(5);
    let y = g(false);
    let z = h((x, y));
    z
};


fn main() {
    assert_eq!(
        (call_external_constructors_in_local_vars().0,),
        (CALL_EXTERNAL_CONSTRUCTORS_IN_LOCAL_VARS.0,)
    );
}

EOF
=== stdout ===
=== stderr ===
==============

=== stdout ===
=== stderr ===
==============
@JohnTitor JohnTitor merged commit 075363c into master Jun 22, 2020
@JohnTitor JohnTitor deleted the autofix/ices/72679.sh branch June 22, 2020 11:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants