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

[MIR] Handle coercion casts properly when building the MIR #33303

Merged
merged 1 commit into from
May 2, 2016

Conversation

Aatch
Copy link
Contributor

@Aatch Aatch commented May 1, 2016

Coercion casts (expr as T where the type of expr can be coerced to
T) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle FnPtr -> FnPtr casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes #33295

/cc @eddyb

Coercion casts (`expr as T` where the type of `expr` can be coerced to
`T`) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle `FnPtr -> FnPtr` casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes rust-lang#33295
@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@Aatch Aatch changed the title Handle coercion casts properly when building the MIR [MIR] Handle coercion casts properly when building the MIR May 1, 2016
@arielb1
Copy link
Contributor

arielb1 commented May 1, 2016

@bors r+

@bors
Copy link
Contributor

bors commented May 1, 2016

📌 Commit 3906aef has been approved by arielb1

@bors
Copy link
Contributor

bors commented May 1, 2016

⌛ Testing commit 3906aef with merge 9db2745...

bors added a commit that referenced this pull request May 1, 2016
[MIR] Handle coercion casts properly when building the MIR

Coercion casts (`expr as T` where the type of `expr` can be coerced to
`T`) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle `FnPtr -> FnPtr` casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes #33295

/cc @eddyb
@bors
Copy link
Contributor

bors commented May 1, 2016

💔 Test failed - auto-mac-64-opt-rustbuild

@arielb1
Copy link
Contributor

arielb1 commented May 1, 2016

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/rustbuild/src/rust-buildbot/slave/auto-mac-64-opt-rustbuild/build/src/librbml/leb128.rs:46
note: Run with `RUST_BACKTRACE=1` for a backtrace.

@alexcrichton
Maybe run the bots with RUST_BACKTRACE=1 set to get a better handle on this craziness?

@bors retry

@bors
Copy link
Contributor

bors commented May 1, 2016

💔 Test failed - auto-win-msvc-32-opt

@arielb1
Copy link
Contributor

arielb1 commented May 1, 2016

---- [codegen-units] codegen-units\partitioning\local-inlining.rs stdout ----

error: compilation failed!
status: exit code: 101
command: PATH="C:\bot\slave\auto-win-msvc-32-opt\build\obj\i686-pc-windows-msvc/stage2/bin;C:\bot\slave\auto-win-msvc-32-opt\build\obj\i686-pc-windows-msvc\stage2\bin;C:\bot\slave\auto-win-msvc-32-opt\build\obj\i686-pc-windows-msvc\llvm\Release\lib;C:\mingw-w64\i686-4.9.1-win32-dwarf-rt_v3-rev1\mingw32\bin;C:\Python27;C:\msys64\mingw32\bin;C:\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\msys64\usr\bin;C:\python27;C:\python27\scripts;C:\program files (x86)\inno setup 5;C:\program files (x86)\CMake\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0" i686-pc-windows-msvc/stage2/bin/rustc.exe C:/bot/slave/auto-win-msvc-32-opt/build/src/test/codegen-units/partitioning\local-inlining.rs -L i686-pc-windows-msvc/test/codegen-units/ --target=i686-pc-windows-msvc -L i686-pc-windows-msvc/test/codegen-units/partitioning\local-inlining.stage2-i686-pc-windows-msvc.codegen-units.libaux -C prefer-dynamic -o i686-pc-windows-msvc/test/codegen-units/partitioning\local-inlining.stage2-i686-pc-windows-msvc.exe --cfg rtopt -C rpath -O -L i686-pc-windows-msvc/rt -Zprint-trans-items=lazy -Zincremental=tmp
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: could not load dep-graph from `tmp\dep_graph.rbml`: The system cannot find the file specified. (os error 2)
error: aborting due to previous error

What the **** - cc @nikomatsakis @michaelwoerister

@bors retry

@bors
Copy link
Contributor

bors commented May 1, 2016

💔 Test failed - auto-linux-64-opt-mir

@eddyb
Copy link
Member

eddyb commented May 1, 2016

@bors retry

@bors
Copy link
Contributor

bors commented May 1, 2016

💔 Test failed - auto-win-msvc-64-opt-mir

@alexcrichton
Copy link
Member

@bors: retry

On Sun, May 1, 2016 at 10:46 AM, bors [email protected] wrote:

[image: 💔] Test failed - auto-win-msvc-64-opt-mir
http://buildbot.rust-lang.org/builders/auto-win-msvc-64-opt-mir/builds/544


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#33303 (comment)

@alexcrichton
Copy link
Member

Spurious because of #31657

@bors
Copy link
Contributor

bors commented May 2, 2016

⌛ Testing commit 3906aef with merge 0eb575c...

bors added a commit that referenced this pull request May 2, 2016
[MIR] Handle coercion casts properly when building the MIR

Coercion casts (`expr as T` where the type of `expr` can be coerced to
`T`) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle `FnPtr -> FnPtr` casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes #33295

/cc @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: unsupported cast [MIR]
6 participants