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

Check the type of statics and constants for Sizedness #55004

Merged
merged 4 commits into from
Oct 19, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Oct 12, 2018

fixes #54410

@rust-highfive
Copy link
Collaborator

r? @cramertj

(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 Oct 12, 2018
@cramertj
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 12, 2018

📌 Commit a7603804abcaf4f14cd0d4206a3f7faea15a7670 has been approved by cramertj

@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 Oct 12, 2018
@bors
Copy link
Contributor

bors commented Oct 13, 2018

⌛ Testing commit a7603804abcaf4f14cd0d4206a3f7faea15a7670 with merge eed7c3888fca748d699f94524ce95f34d966e603...

@bors
Copy link
Contributor

bors commented Oct 13, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 13, 2018
@rust-highfive
Copy link
Collaborator

The job armhf-gnu of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:58:41] 
[00:58:41] ---- [ui] ui/issues/issue-54410.rs stdout ----
[00:58:41] diff of stderr:
[00:58:41] 
[00:58:41] - error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
[00:58:41] + error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
[00:58:41] 3    |
[00:58:41] 3    |
[00:58:41] 4 LL |     pub static mut symbol: [c_char];
[00:58:41] 5    |                            ^^^^^^^^ doesn't have a size known at compile-time
[00:58:41] 6    |
[00:58:41] -    = help: the trait `std::marker::Sized` is not implemented for `[i8]`
[00:58:41] +    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
[00:58:41] +    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
[00:58:41] 8    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[00:58:41] 9 
[00:58:41] 10 error: aborting due to previous error
[00:58:41] 
[00:58:41] 
[00:58:41] The actual stderr differed from the expected stderr.
[00:58:41] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-54410/issue-54410.stderr
[00:58:41] To update references, rerun the tests and pass the `--bless` flag
[00:58:41] To only update this specific test, also pass `--test-args issues/issue-54410.rs`
[00:58:41] error: 1 errors occurred comparing output.
[00:58:41] status: exit code: 1
[00:58:41] status: exit code: 1
[00:58:41] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-54410.rs" "--target=arm-unknown-linux-gnueabihf" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-54410/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/arm-unknown-linux-gnueabihf/native/rust-test-helpers" "-Clinker=arm-linux-gnueabihf-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-54410/auxiliary" "-A" "unused"
[00:58:41] ------------------------------------------
[00:58:41] 
[00:58:41] ------------------------------------------
[00:58:41] stderr:
[00:58:41] stderr:
[00:58:41] ------------------------------------------
[00:58:41] {"message":"the size for values of type `[u8]` cannot be known at compilation time","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-54410.rs","byte_start":66,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":36,"is_primary":true,"text":[{"text":"    pub static mut symbol: [c_char];","highlight_start":28,"highlight_end":36}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `[u8]`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `[u8]` cannot be known at compilation time\n  --> /checkout/src/test/ui/issues/issue-54410.rs:3:28\n   |\nLL |     pub static mut symbol: [c_char];\n   |                            ^^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `[u8]`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n\n"}
[00:58:41] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:58:41] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:58:41] ------------------------------------------
[00:58:41] 
[00:58:41] thread '[ui] ui/issues/issue-54410.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3277:9
[00:58:41] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:58:41] 
[00:58:41] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:501:22
[00:58:41] 
[00:58:41] 
[00:58:41] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-arm-unknown-linux-gnueabihf" "--mode" "ui" "--target" "arm-unknown-linux-gnueabihf" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "arm-linux-gnueabihf-gcc" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/arm-unknown-linux-gnueabihf/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--llvm-version" "8.0.0svn\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--remote-test-client" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/remote-test-client" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:58:41] 
[00:58:41] 
[00:58:41] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target arm-unknown-linux-gnueabihf
[00:58:41] Build completed unsuccessfully in 0:54:56
---
travis_time:end:03f0e1f5:start=1539472808495079623,finish=1539472808503898575,duration=8818952
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:10dd9b57
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:13530608
travis_time:start:13530608
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:110049ae
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 14, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 15, 2018

@bors r=cramertj

@bors
Copy link
Contributor

bors commented Oct 15, 2018

📌 Commit 9889fef214f6901918cae16202c9a748427f1fa6 has been approved by cramertj

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 15, 2018
@bors
Copy link
Contributor

bors commented Oct 15, 2018

⌛ Testing commit 9889fef214f6901918cae16202c9a748427f1fa6 with merge 3d3fbf59a1bd04e2f084148a2fdbdb811dd17c37...

@bors
Copy link
Contributor

bors commented Oct 15, 2018

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 15, 2018
@kennytm
Copy link
Member

kennytm commented Oct 15, 2018

Failed the test doc::doc_target from cargo:

 Documenting foo v0.0.1 (C:\projects\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\cit\t503\foo)
     Running `rustdoc --crate-name foo src\lib.rs --color never --target arm-unknown-linux-gnueabihf -o C:\projects\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\cit\t503\foo\target\arm-unknown-linux-gnueabihf\doc -L dependency=C:\projects\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\cit\t503\foo\target\arm-unknown-linux-gnueabihf\debug\deps -L dependency=C:\projects\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\cit\t503\foo\target\debug\deps`
error: requires `sized` lang_item
error: Could not document `foo`.

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 15, 2018

blocked on rust-lang/cargo#6176

@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 16, 2018

Updated a test in cargo which was using no_core and thus had no Sized lang item by default. That's all very unstable and behind feature flags, so we're good.

@bors r=cramertj

@bors
Copy link
Contributor

bors commented Oct 16, 2018

📌 Commit 10a01c1 has been approved by cramertj

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 16, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Oct 18, 2018
Check the type of statics and constants for `Sized`ness

fixes rust-lang#54410
@bors
Copy link
Contributor

bors commented Oct 19, 2018

⌛ Testing commit 10a01c1 with merge cb5e1b9...

bors added a commit that referenced this pull request Oct 19, 2018
Check the type of statics and constants for `Sized`ness

fixes #54410
@bors
Copy link
Contributor

bors commented Oct 19, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: cramertj
Pushing cb5e1b9 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

ICE (stable segfault) in LLVM with creative FFI types
5 participants