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

Make `str` indexing generic on `SliceIndex`. #57604

Merged
merged 1 commit into from Jan 22, 2019

Conversation

Projects
None yet
6 participants
@alercah
Copy link
Contributor

alercah commented Jan 14, 2019

Fixes #55603

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 14, 2019

r? @kennytm

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

@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Jan 14, 2019

Could you revert the formatting or split it into a separate commit? It is hard to review what is actually changed.

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Jan 14, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:2b8f2c3c:start=1547489114052355413,finish=1547489252298054981,duration=138245699568
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[01:05:37] .................................................................................................... 4400/5303
[01:05:40] ..............................................................i..................................... 4500/5303
[01:05:47] .................................................................................................... 4600/5303
[01:05:50] .................................................................................................... 4700/5303
[01:05:53] .................................................................................F....F............. 4800/5303
[01:06:01] .................................................................................................... 5000/5303
[01:06:04] .................................................................................................... 5100/5303
[01:06:07] .................................................................................................... 5200/5303
[01:06:10] ..........................................i......................................................... 5300/5303
[01:06:10] ..........................................i......................................................... 5300/5303
[01:06:10] ...
[01:06:10] failures:
[01:06:10] 
[01:06:10] ---- [ui] ui/str/str-idx.rs stdout ----
[01:06:10] diff of stderr:
[01:06:10] 
[01:06:10] - error[E0277]: the type `str` cannot be indexed by `{integer}`
[01:06:10] + error[E0277]: the trait bound `{integer}: std::slice::SliceIndex<str>` is not satisfied
[01:06:10] 3    |
[01:06:10] 3    |
[01:06:10] 4 LL |     let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
[01:06:10] -    |                 ^^^^ `str` cannot be indexed by `{integer}`
[01:06:10] -    |                 ^^^^ `str` cannot be indexed by `{integer}`
[01:06:10] +    |                 ^^^^ slice indices are of type `usize` or ranges of `usize`
[01:06:10] 6    |
[01:06:10] -    = help: the trait `std::ops::Index<{integer}>` is not implemented for `str`
[01:06:10] +    = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
[01:06:10] +    = note: required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str`
[01:06:10] 9 error: aborting due to previous error
[01:06:10] 10 
[01:06:10] 
[01:06:10] 
[01:06:10] 
[01:06:10] The actual stderr differed from the expected stderr.
[01:06:10] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/str/str-idx/str-idx.stderr
[01:06:10] To update references, rerun the tests and pass the `--bless` flag
[01:06:10] To only update this specific test, also pass `--test-args str/str-idx.rs`
[01:06:10] error: 1 errors occurred comparing output.
[01:06:10] status: exit code: 1
[01:06:10] status: exit code: 1
[01:06:10] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/str/str-idx.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/str/str-idx/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/str/str-idx/auxiliary" "-A" "unused"
[01:06:10] ------------------------------------------
[01:06:10] 
[01:06:10] ------------------------------------------
[01:06:10] stderr:
[01:06:10] stderr:
[01:06:10] ------------------------------------------
[01:06:10] {"message":"the trait bound `{integer}: std::slice::SliceIndex<str>` 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/str/str-idx.rs","byte_start":59,"byte_end":63,"line_start":3,"line_end":3,"column_start":17,"column_end":21,"is_primary":true,"text":[{"text":"    let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`","highlight_start":17,"highlight_end":21}],"label":"slice indices are of type `usize` or ranges of `usize`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `{integer}: std::slice::SliceIndex<str>` is not satisfied\n  --> /checkout/src/test/ui/str/str-idx.rs:3:17\n   |\nLL |     let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`\n   |                 ^^^^ slice indices are of type `usize` or ranges of `usize`\n   |\n   = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`\n   = note: required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str`\n\n"}
[01:06:10] {"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"}
[01:06:10] 
[01:06:10] ------------------------------------------
[01:06:10] 
[01:06:10] 
[01:06:10] thread '[ui] ui/str/str-idx.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3245:9
[01:06:10] 
[01:06:10] ---- [ui] ui/str/str-mut-idx.rs stdout ----
[01:06:10] diff of stderr:
[01:06:10] 
[01:06:10] 22    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
[01:06:10] 23    = note: the left-hand-side of an assignment must have a statically known size
[01:06:10] 24 
[01:06:10] - error[E0277]: the type `str` cannot be mutably indexed by `usize`
[01:06:10] + error[E0277]: the trait bound `usize: std::slice::SliceIndex<str>` is not satisfied
[01:06:10] 27    |
[01:06:10] 27    |
[01:06:10] 28 LL |     s[1usize] = bot();
[01:06:10] -    |     ^^^^^^^^^ `str` cannot be mutably indexed by `usize`
[01:06:10] -    |     ^^^^^^^^^ `str` cannot be mutably indexed by `usize`
[01:06:10] +    |     ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
[01:06:10] 30    |
[01:06:10] -    = help: the trait `std::ops::IndexMut<usize>` is not implemented for `str`
[01:06:10] +    = help: the trait `std::slice::SliceIndex<str>` is not implemented for `usize`
[01:06:10] +    = note: required because of the requirements on the impl of `std::ops::Index<usize>` for `str`
[01:06:10] 33 error: aborting due to 3 previous errors
[01:06:10] 34 
[01:06:10] 
[01:06:10] 
[01:06:10] 
[01:06:10] The actual stderr differed from the expected stderr.
[01:06:10] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/str/str-mut-idx/str-mut-idx.stderr
[01:06:10] To update references, rerun the tests and pass the `--bless` flag
[01:06:10] To only update this specific test, also pass `--test-args str/str-mut-idx.rs`
[01:06:10] error: 1 errors occurred comparing output.
[01:06:10] status: exit code: 1
[01:06:10] status: exit code: 1
[01:06:10] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/str/str-mut-idx.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/str/str-mut-idx/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/str/str-mut-idx/auxiliary" "-A" "unused"
[01:06:10] ------------------------------------------
[01:06:10] 
[01:06:10] ------------------------------------------
[01:06:10] stderr:
[01:06:10] stderr:
[01:06:10] ------------------------------------------
[01:06:10] {"message":"the size for values of type `str` 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/str/str-mut-idx.rs","byte_start":69,"byte_end":72,"line_start":4,"line_end":4,"column_start":15,"column_end":18,"is_primary":true,"text":[{"text":"    s[1..2] = bot();","highlight_start":15,"highlight_end":18}],"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 `str`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"required by `bot`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/str/str-mut-idx.rs","byte_start":0,"byte_end":16,"line_start":1,"line_end":1,"column_start":1,"column_end":17,"is_primary":true,"text":[{"text":"fn bot<T>() -> T { loop {} }","highlight_start":1,"highlight_end":17}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `str` cannot be known at compilation time\n  --> /checkout/src/test/ui/str/str-mut-idx.rs:4:15\n   |\nLL |     s[1..2] = bot();\n   |               ^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `str`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\nnote: required by `bot`\n  --> /checkout/src/test/ui/str/str-mut-idx.rs:1:1\n   |\nLL | fn bot<T>() -> T { loop {} }\n   | ^^^^^^^^^^^^^^^^\n\n"}
[01:06:10] {"message":"the size for values of type `str` 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/str/str-mut-idx.rs","byte_start":59,"byte_end":66,"line_start":4,"line_end":4,"column_start":5,"column_end":12,"is_primary":true,"text":[{"text":"    s[1..2] = bot();","highlight_start":5,"highlight_end":12}],"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 `str`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"the left-hand-side of an assignment must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `str` cannot be known at compilation time\n  --> /checkout/src/test/ui/str/str-mut-idx.rs:4:5\n   |\nLL |     s[1..2] = bot();\n   |     ^^^^^^^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `str`\n   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>\n   = note: the left-hand-side of an assignment must have a statically known size\n\n"}
[01:06:10] {"message":"the trait bound `usize: std::slice::SliceIndex<str>` 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/str/str-mut-idx.rs","byte_start":166,"byte_end":175,"line_start":7,"line_end":7,"column_start":5,"column_end":14,"is_primary":true,"text":[{"text":"    s[1usize] = bot();","highlight_start":5,"highlight_end":14}],"label":"slice indices are of type `usize` or ranges of `usize`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::slice::SliceIndex<str>` is not implemented for `usize`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required because of the requirements on the impl of `std::ops::Index<usize>` for `str`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `usize: std::slice::SliceIndex<str>` is not satisfied\n  --> /checkout/src/test/ui/str/str-mut-idx.rs:7:5\n   |\nLL |     s[1usize] = bot();\n   |     ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`\n   |\n   = help: the trait `std::slice::SliceIndex<str>` is not implemented for `usize`\n   = note: required because of the requirements on the impl of `std::ops::Index<usize>` for `str`\n\n"}
[01:06:10] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[01:06:10] 
[01:06:10] ------------------------------------------
[01:06:10] 
[01:06:10] thread '[ui] ui/str/str-mut-idx.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3245:9
---
[01:06:10] 
[01:06:10] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:495:22
[01:06:10] 
[01:06:10] 
[01:06: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/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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.0.0\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:06:10] 
[01:06:10] 
[01:06:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:06:10] Build completed unsuccessfully in 0:04:10
[01:06:10] Build completed unsuccessfully in 0:04:10
[01:06:10] Makefile:48: recipe for target 'check' failed
[01:06:10] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:04a7b5d4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Jan 14 19:13:53 UTC 2019
---
travis_time:end:1eaae0c8:start=1547493234157595398,finish=1547493234162237605,duration=4642207
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:313a8d84
$ 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" "

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)

@alercah

This comment has been minimized.

Copy link
Contributor Author

alercah commented Jan 14, 2019

My bad; my editor's autoformat must have snuck back on when I wasn't paying attention.

@alercah alercah force-pushed the alercah:str-index branch from b50b719 to be0fd3b Jan 14, 2019

@alercah

This comment has been minimized.

Copy link
Contributor Author

alercah commented Jan 14, 2019

Fixed, with some slight UX improvements too.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 14, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:0f089337:start=1547502980065685847,finish=1547503093718173008,duration=113652487161
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---

[00:03:55] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:55] tidy error: /checkout/src/libcore/slice/mod.rs:2383: trailing whitespace
[00:03:55] tidy error: /checkout/src/libcore/slice/mod.rs:2384: line longer than 100 chars
[00:03:55] tidy error: /checkout/src/test/ui/slice/slice-idx.rs:1: trailing whitespace
[00:03:55] tidy error: /checkout/src/test/ui/slice/slice-mut-idx.rs:3: trailing whitespace
[00:03:57] some tidy checks failed
[00:03:57] 
[00:03:57] 
[00:03:57] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:57] 
[00:03:57] 
[00:03:57] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:57] Build completed unsuccessfully in 0:00:52
[00:03:57] Build completed unsuccessfully in 0:00:52
[00:03:57] make: *** [tidy] Error 1
[00:03:57] Makefile:69: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:04278efd
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Jan 14 22:02:19 UTC 2019
---
travis_time:end:0d5b7a32:start=1547503340691036326,finish=1547503340695740254,duration=4703928
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:08e67398
$ 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:03f6ba24
travis_time:start:03f6ba24
$ 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:08272f4c
$ 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)

@alercah alercah force-pushed the alercah:str-index branch from be0fd3b to a58f9ff Jan 15, 2019

@alercah

This comment has been minimized.

Copy link
Contributor Author

alercah commented Jan 17, 2019

One more round of test failure fixes. @kennytm this should be ready for review.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 19, 2019

☔️ The latest upstream changes (presumably #57747) made this pull request unmergeable. Please resolve the merge conflicts.

@alercah alercah force-pushed the alercah:str-index branch from a58f9ff to c7d25a2 Jan 19, 2019

@alercah

This comment has been minimized.

Copy link
Contributor Author

alercah commented Jan 22, 2019

Ping for review. @sfackler since you said we could ping. ;)

@sfackler

This comment has been minimized.

Copy link
Member

sfackler commented Jan 22, 2019

@bors r+

Thanks!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 22, 2019

📌 Commit c7d25a2 has been approved by sfackler

Centril added a commit to Centril/rust that referenced this pull request Jan 22, 2019

Rollup merge of rust-lang#57604 - alercah:str-index, r=sfackler
Make `str` indexing generic on `SliceIndex`.

Fixes rust-lang#55603

bors added a commit that referenced this pull request Jan 22, 2019

Auto merge of #57830 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57537 (Small perf improvement for fmt)
 - #57552 (Default images)
 - #57604 (Make `str` indexing generic on `SliceIndex`.)
 - #57667 (Fix memory leak in P::filter_map)
 - #57677 (const_eval: Predetermine the layout of all locals when pushing a stack frame)
 - #57791 (Add regression test for #54582)
 - #57798 (Corrected spelling inconsistency)
 - #57809 (Add powerpc64-unknown-freebsd)
 - #57813 (fix validation range printing when encountering undef)

Failed merges:

r? @ghost

@bors bors merged commit c7d25a2 into rust-lang:master Jan 22, 2019

@Centril Centril added the relnotes label Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment