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

Re-enable trivial bounds #51042

Merged
merged 5 commits into from
Jun 9, 2018
Merged

Conversation

matthewjasper
Copy link
Contributor

cc #50825

Remove implementations from global bounds in winnowing when there is ambiguity.

This results in the reverse of #24066 happening sometimes. I'm not sure if anything can be done about that though.

cc #48214

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 24, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:50:29] ............................................i.......................................................
[00:50:33] ....................................................................................................
[00:50:36] ....................................................................................................
[00:50:40] ....................................................................................................
[00:50:43] .................................................................................F..................
[00:50:52] ....................................................................................................
[00:50:57] ....................................................................................................
[00:51:03] ..............................................................................i.....................
[00:51:08] ......................................................i.............................................
---
[00:51:29] failures:
[00:51:29] 
[00:51:29] ---- [ui] ui/feature-gate-trivial_bounds.rs stdout ----
[00:51:29] 
[00:51:29] error: /checkout/src/test/ui/feature-gate-trivial_bounds.rs:31: expected error not found: 
[00:51:29] 
[00:51:29] error: /checkout/src/test/ui/feature-gate-trivial_bounds.rs:62: expected error not found: 
[00:51:29] 
[00:51:29] error: 0 unexpected errors found, 2 expected errors not found
[00:51:29] status: exit code: 101
[00:51:29] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gate-trivial_bounds.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-trivial_bounds/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-trivial_bounds/auxiliary" "-A" "unused"
[00:51:29] not found errors (from test file): [
[00:51:29]     Error {
[00:51:29]         line_num: 31,
[00:51:29]         kind: Some(
[00:51:29]         ),
[00:51:29]         ),
[00:51:29]         msg: ""
[00:51:29]     Error {
[00:51:29]         line_num: 62,
[00:51:29]         kind: Some(
[00:51:29]             Error
[00:51:29]             Error
[00:51:29]         ),
[00:51:29]         msg: ""
[00:51:29] ]
[00:51:29] 
[00:51:29] thread '[ui] ui/feature-gate-trivial_bounds.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1283:13
[00:51:29] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:51:29] 
[00:51:29] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:51:29] 
[00:51:29] 
[00:51:29] 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/x86_64-unknown-linux-gnu/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-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:51:29] 
[00:51:29] 
[00:51:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:51:29] Build completed unsuccessfully in 0:02:48
[00:51:29] Build completed unsuccessfully in 0:02:48
[00:51:29] Makefile:58: recipe for target 'check' failed
[00:51:29] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:069e7e16
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@matthewjasper
Copy link
Contributor Author

Pushed a commit to fix #51044 as well

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:54] ............................................i.......................................................
[00:58:59] ....................................................................................................
[00:59:02] ....................................................................................................
[00:59:06] ....................................................................................................
[00:59:10] .................................................................................F..................
[00:59:21] ....................................................................................................
[00:59:27] ....................................................................................................
[00:59:34] ..............................................................................i.....................
[00:59:41] .......................................................i............................................
[00:59:41] .......................................................i............................................
[00:59:46] ...........................................................................ii.......................
[00:59:54] ....................................................................................................
[01:00:02] .....................................................................................i..............
[01:00:06] To only update this specific test, also pass `--test-args feature-gate-trivial_bounds.rs`
[01:00:06] error: 1 errors occurred comparing output.
[01:00:06] status: exit code: 101
[01:00:06] status: exit code: 101
[01:00:06] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gate-trivial_bounds.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-trivial_bounds/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate-trivial_bounds/auxiliary" "-A" "unused"
[01:00:06] ------------------------------------------
[01:00:06] 
[01:00:06] ------------------------------------------
[01:00:06] stderr:
[01:00:06] stderr:
[01:00:06] ------------------------------------------
[01:00:06] {"message":"the trait bound `i32: Foo` is not satisfied","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/feature-gate-trivial_bounds.rs","byte_start":592,"byte_end":619,"line_start":20,"line_end":20,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"enum E where i32: Foo { V } //~ ERROR","highlight_start":1,"highlight_end":28}],"label":"the trait `Foo` is not implemented for `i32`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"see issue #48214","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"add #![feature(trivial_bounds)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `i32: Foo` is not satisfied\n  --> /checkout/src/test/ui/feature-gate-trivial_bounds.rs:20:1\n   |\nLL | enum E where i32: Foo { V } //~ ERROR\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`\n   |\n   = help: see issue #48214\n   = help: add #![feature(trivial_bounds)] to the crate attributes to enable\n\n"}
[01:00:06] {"message":"the trait bound `i32: Foo` is not satisfied","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(Withouting 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/feature-gate-trivial_bounds.rs","byte_start":667,"byte_end":692,"line_start":24,"line_end":24,"column_start":1,"column_end":26,"is_primary":true,"text":[{"text":"trait T where i32: Foo {} //~ ERROR","highlight_start":1,"highlight_end":26}],"label":"the trait `Foo` is not implemented for `i32`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"see issue #48214","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"add #![feature(trivial_bounds)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `i32: Foo` is not satisfied\n  --> /checkout/src/test/ui/feature-gate-trivial_bounds.rs:24:1\n   |\nLL | trait T where i32: Foo {} //~ ERROR\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`\n   |\n   = help: see issue #48214\n   = help: add #![feature(trivial_bounds)] to the crate attributes to enable\n\n"}
[01:00:06] {"message":"the trait bound `i32: Foo` is not satisfied","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 declar:"the trait bound `i32: Foo` is not satisfied","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/feature-gate-trivial_bounds.rs","byte_start":803,"byte_end":953,"line_start":30,"line_end":36,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"impl Foo for () where i32: Foo { //~ ERROR","highlight_start":1,"highlight_end":43},{"text":"    fn test(&self) {","highlight_start":1,"highlight_end":21},{"text":"        3i32.test();","highlight_start":1,"highlight_end":21},{"text":"        Foo::test(&4i32);","highlight_start":1,"highlight_end":26},{"text":"        generic_function(5i32);","highlight_start":1,"highlight_end":32},{"text":"    }","highlight_start":1,"highlight_end":6},{"text":"}","highlight_start":1,"highlight_end":2}],"label":"the trait `Foo` is not implemented for `i32`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"see issue #48214","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"add #![feature(trivial_bounds)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `i32: Foo` is not satisfied\n  --> /checkout/src/test/ui/feature-gate-trivial_bounds.rs:30:1\n   |\nLL | / impl Foo for () where i32: Foo { //~ ERROR\nLL | |     fn test(&self) {\nLL | |         3i32.test();\nLL | |         Foo::test(&4i32);\nLL | |         generic_function(5i32);\nLL | |     }\nLL | | }\n   | |_^ the trait `Foo` is not implemented for `i32`\n   |\n   = help: see issue #48214\n   = help: add #![feature(trivial_bounds)] to the crate attributes to enable\n\n"}
[01:00:06] {"message":"the trait bound `i32: Foo` is not satisfied","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\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/feature-gate-trivial_bounds.rs","byte_start":1074,"byte_end":1170,"line_start":46,"line_end":48,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> { //~ ERROR","highlight_start":1,"highlight_end":88},{"text":"    -s","highlight_start":1,"highlight_end":7},{"text":"}","highlight_start":1,"highlight_end":2}],"label":"the trait `std::ops::Neg` is not implemented for `std::string::String`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"see issue #48214","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"add #![feature(trivial_bounds)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied\n  --> /checkout/src/test/ui/feature-gate-trivial_bounds.rs:46:1\n   |\nLL | / fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> { //~ ERROR\nLL | |     -s\nLL | | }\n   | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String`\n   |\n   = help: see issue #482ition 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/feature-gate-trivial_bounds.rs","byte_start":1172,"byte_end":1239,"line_start":50,"line_end":52,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"fn use_for() where i32: Iterator { //~ ERROR","highlight_start":1,"highlight_end":45},{"text":"    for _ in 2i32 {}","highlight_start":1,"highlight_end":21},{"text":"}","highlight_start":1,"highlight_end":2}],"label":"`i32` is not an iterator; maybe try calling `.iter()` or a similar method","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::iter::Iterator` is not implemented for `i32`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"see issue #48214","code":null,"level":"help","spans":[],"children":[],"renden\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/feature-gate-trivial_bounds.rs","byte_start":1309,"byte_end":1351,"line_start":62,"line_end":62,"column_start":1,"column_end":43,"is_primary":true,"text":[{"text":"struct TwoStrs(str, str) where str: Sized; //~ ERROR","highlight_start":1,"highlight_end":43}],"label":"`str` does not have a constant size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `str`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"see issue #48214","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"add #![feature(trivial_bounds)] to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied\n  --> /checkout/src/test/ui/feature-gate-trivial_bounds.rs:62:1\n   |\nLL | struct TwoStrs(str, str) where str: Sized; //~ ERROR\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `str` does not have a constant size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `str`\n   = help: see issue #48214\n   = help: add #![feature(trivial_bounds)] to the crate attributes to enable\n\n"}
[01:00:06] {"message":"the trait bound `A + 'static: std::marker::Sized` is not satisfied in `Dst<A + 'static>`","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 fn unsized_local() where Dst<A>: Sized { //~ ERROR\nLL | |     let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);\nLL | | }\n   | |_^ `A + 'static` does not have a constant size known at compile-time\n   |\n   = help: within `Dst<A + 'static>`, the trait `std::marker::Sized` is not implemented for `A + 'static`\n   = note: required because it appears within the type `Dst<A + 'static>`\n   = help: see issue #48214\n   = help: add #![feature(trivial_bounds)] to the crate attributes to enable\n\n"}
[01:00:06] {"message":"the trait bound `str: std::marker::Sized` is not satisfied","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/feature-gate-trivial_bounds.rs","byte_start":1480,"byte_end":1575,"line_start":69,"line_end":71,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"fn return_str() -> str where str: Sized { //~ ERROR","highlight_start":1,"highlight_end":52},{"text":"    *\"Sized\".to_string().into_boxed_str()","highlight_start":1,"highlight_end":42},{"text":it code: 101
[01:00:06] 
[01:00:06] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:00:06] Build completed unsuccessfully in 0:03:20
[01:00:06] Build completed unsuccessfully in 0:03:20
[01:00:06] Makefile:58: recipe for target 'check' failed
[01:00:06] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0d8d3720
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
[01:17:28] ..............................................................................................i.....
[01:17:32] ....................................................................................................
[01:17:39] ....................................................................................................
[01:17:45] ....................................................................................................
[01:17:52] ................F...................................................................................
[01:18:08] ....................................................................................................
[01:18:14] ...i................................................................................................
[01:18:21] ..i..ii.............................................................................................
[01:18:30] ....................................................................................................
---
[01:19:10] failures:
[01:19:10] 
[01:19:10] ---- [compile-fail] compile-fail/issue-36839.rs stdout ----
[01:19:10] 
[01:19:10] error: /checkout/src/test/compile-fail/issue-36839.rs:24: unexpected error: '24:5: 26:6: the trait bound `(): Foo` is not satisfied [E0277]'
[01:19:10] 
[01:19:10] error: /checkout/src/test/compile-fail/issue-36839.rs:30: expected error not found: compilation successful
[01:19:10] 
[01:19:10] error: 1 unexpected errors found, 1 expected errors not found
[01:19:10] status: exit code: 101
[01:19:10] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/compile-fail/issue-36839.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/issue-36839/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/issue-36839/auxiliary" "-A" "unused"
[01:19:10] unexpected errors (from JSON output): [
[01:19:10]     Error {
[01:19:10]         line_num: 24,
[01:19:10]         kind: Some(
[01:19:10]         ),
[01:19:10]         ),
[01:19:10]         msg: "24:5: 26:6: the trait bound `(): Foo` is not satisfied [E0277]"
[01:19:10] ]
[01:19:10] 
[01:19:10] not found errors (from test file): [
[01:19:10]     Error {
[01:19:10]     Error {
[01:19:10]         line_num: 30,
[01:19:10]         kind: Some(
[01:19:10]             Error
[01:19:10]         ),
[01:19:10]         msg: "compilation successful"
[01:19:10] ]
[01:19:10] 
[01:19:10] thread '[compile-fail] compile-fail/issue-36839.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1283:13
[01:19:10] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[01:19:10] 
[01:19:10] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[01:19:10] 
[01:19:10] 
[01:19:10] 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/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/compile-fail" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "compile-fail" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:19:10] 
[01:19:10] 
[01:19:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:19:10] Build completed unsuccessfully in 0:20:03
[01:19:10] Build completed unsuccessfully in 0:20:03
[01:19:10] Makefile:58: recipe for target 'check' failed
[01:19:10] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0f7d4b79
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@TimNN
Copy link
Contributor

TimNN commented May 29, 2018

Triage ping, @nikomatsakis, this PR is waiting for your review.

@pietroalbini
Copy link
Member

Ping from triage! This PR needs a review, can @nikomatsakis or someone else from @rust-lang/compiler review this?

@nikomatsakis
Copy link
Contributor

I will review this one, but I haven't gotten to it yet.

@@ -2025,13 +2022,46 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
other: &EvaluatedCandidate<'tcx>)
-> bool
{
// Check if a bound would previously have been removed when normalizing
// the param_env so that it can be given the lowest priority. See
// #50825 for the motivation for this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. But makes sense. Chalk can't come soon enough!

let tcx = self.tcx().global_tcx();
return tcx.specializes((other_def, victim_def)) ||
tcx.impls_are_allowed_to_overlap(other_def, victim_def);
// FIXME also have an is_global here?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this FIXME is suggesting -- you did add one in ParamCandidate case, which seems like the case where it would be relevant..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just forgot to remove the comment

@Eijebong
Copy link
Contributor

Eijebong commented Jun 8, 2018

I confirm that this makes diesel master compile again 🎉

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jun 8, 2018

📌 Commit a1bddcf has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jun 8, 2018

🌲 The tree is currently closed for pull requests below priority 1, this pull request will be tested once the tree is reopened

@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 Jun 8, 2018
@nikomatsakis
Copy link
Contributor

@bors r- -- oops, had a few questions

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 8, 2018
@nikomatsakis
Copy link
Contributor

In particular, I wanted to know what was up with that FIXME -- maybe we should just remove it? I suspect it is outdated.

@lnicola
Copy link
Member

lnicola commented Jun 8, 2018

@nikomatsakis
Copy link
Contributor

Oh, I missed that =)

@bors r+ p=1 -- fixes regressions

@bors
Copy link
Contributor

bors commented Jun 9, 2018

📌 Commit a1bddcf has been approved by nikomatsakis

@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 Jun 9, 2018
@bors
Copy link
Contributor

bors commented Jun 9, 2018

⌛ Testing commit a1bddcf with merge 1c5626f...

bors added a commit that referenced this pull request Jun 9, 2018
…atsakis

Re-enable trivial bounds

cc #50825

Remove implementations from global bounds in winnowing when there is ambiguity.

This results in the reverse of #24066 happening sometimes. I'm not sure if anything can be done about that though.

cc #48214

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented Jun 9, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 1c5626f 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.

8 participants