Skip to content

mir: Improve size_of handling when arg is unsized #81243

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

Merged
merged 1 commit into from
Jan 24, 2021
Merged

mir: Improve size_of handling when arg is unsized #81243

merged 1 commit into from
Jan 24, 2021

Conversation

osa1
Copy link
Contributor

@osa1 osa1 commented Jan 21, 2021

As discussed on Zulip with @RalfJung.

@rust-highfive
Copy link
Contributor

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 21, 2021
@osa1
Copy link
Contributor Author

osa1 commented Jan 21, 2021

@RalfJung this seems to make the error worse though. Should I maybe try to find out why we try to evaluate this stuff even though the program has type errors? (problem described in https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Help.20fixing.20.2380742/near/223243016 IIUC)

@osa1
Copy link
Contributor Author

osa1 commented Jan 21, 2021

r? @RalfJung

@rust-highfive rust-highfive assigned RalfJung and unassigned davidtwco Jan 21, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Successfully built a3f694a571ee
Successfully tagged rust-ci:latest
Built container sha256:a3f694a571ee696b1d4d2cb8d9fd3bdfaa0af46712fe44ee9e1f5aaff9d14507
Uploading finished image to https://ci-caches.rust-lang.org/docker/aa85b52f727783ce661c5275c3edac7e8b4fbba025fc0a8e6392d6566595f3d157bb7da4c70e2eda4e5e6e7455d8337e7dfb6de6b288fcd6e68cf37f838a32b6
upload failed: - to s3://rust-lang-ci-sccache2/docker/aa85b52f727783ce661c5275c3edac7e8b4fbba025fc0a8e6392d6566595f3d157bb7da4c70e2eda4e5e6e7455d8337e7dfb6de6b288fcd6e68cf37f838a32b6 Unable to locate credentials
[CI_JOB_NAME=mingw-check]
---
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
skip untracked path cpu-usage.csv during rustfmt invocations
skip untracked path src/doc/book/ during rustfmt invocations
skip untracked path src/doc/rust-by-example/ during rustfmt invocations
skip untracked path src/llvm-project/ during rustfmt invocations
Diff in /checkout/compiler/rustc_middle/src/mir/interpret/error.rs at line 146:
                 "transmuting `{}` to `{}` is not possible, because these types do not have the same size",
                 from_ty, to_ty
Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" "--config-path" "/checkout" "--edition" "2018" "--unstable-features" "--skip-children" "--check" "/checkout/compiler/rustc_middle/src/mir/interpret/error.rs"` failed.
             ),
-            SizeOfUnsizedType(ty) => write!(
-                f,
-                "size_of called on unsized type `{}`",
-            ),
-            ),
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
+            SizeOfUnsizedType(ty) => write!(f, "size_of called on unsized type `{}`", ty),
     }
 }
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --stage 2 src/tools/tidy
Build completed unsuccessfully in 0:00:18

@RalfJung
Copy link
Member

this seems to make the error worse though

You mean because there's two errors now? Hm. Still that seems better than SizeOf just making up a nonsensical return value.^^

@osa1
Copy link
Contributor Author

osa1 commented Jan 21, 2021

You mean because there's two errors now? Hm. Still that seems better than SizeOf just making up a nonsensical return value.^^

Yeah. I started looking into this but it's going slow as I don't have much experience with the code base. If anyone have any tips that would be helpful.

@RalfJung
Copy link
Member

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Jan 22, 2021

📌 Commit e3faeb4 has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 23, 2021
…as-schievink

Rollup of 15 pull requests

Successful merges:

 - rust-lang#79841 (More clear documentation for NonNull<T>)
 - rust-lang#81072 (PlaceRef::ty: use method call syntax)
 - rust-lang#81130 (Edit rustc_middle::dep_graph module documentation)
 - rust-lang#81170 (Avoid hash_slice in VecDeque's Hash implementation)
 - rust-lang#81243 (mir: Improve size_of handling when arg is unsized)
 - rust-lang#81245 (Update cargo)
 - rust-lang#81249 (Lower closure prototype after its body.)
 - rust-lang#81252 (Add more self-profile info to rustc_resolve)
 - rust-lang#81275 (Fix <unknown> queries and add more timing info to render_html)
 - rust-lang#81281 (Inline methods of Path and OsString)
 - rust-lang#81283 (Note library tracking issue template in tracking issue template.)
 - rust-lang#81285 (Remove special casing of rustdoc in rustc_lint)
 - rust-lang#81288 (rustdoc: Fix visibility of trait and impl items)
 - rust-lang#81298 (replace RefCell with Cell in FnCtxt)
 - rust-lang#81301 (Fix small typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3a3470b into rust-lang:master Jan 24, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 24, 2021
@osa1 osa1 deleted the fix_80742_2 branch January 24, 2021 08:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants