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

Rollup of 22 pull requests #57727

Closed
wants to merge 57 commits into
base: master
from

Conversation

Projects
None yet
@Centril
Copy link
Contributor

Centril commented Jan 18, 2019

Successful merges:

  • #56594 (Remove confusing comment about ideally using ! for c_void)
  • #57107 (Add a regression test for mutating a non-mut #[thread_local])
  • #57340 (Use correct tracking issue for c_variadic)
  • #57357 (Cleanup PartialEq docs.)
  • #57370 (Support passing cflags/cxxflags/ldflags to LLVM build)
  • #57475 (Add signed num::NonZeroI* types)
  • #57501 (High priority resolutions for associated variants)
  • #57551 (resolve: Add a test for issue #57539)
  • #57610 (Fix nested ? matchers)
  • #57634 (Remove an unused function argument)
  • #57635 (use structured macro and path resolve suggestions)
  • #57636 (Fix sources sidebar not showing up)
  • #57646 (Fixes text becoming invisible when element targetted)
  • #57649 (privacy: Account for associated existential types)
  • #57650 (librustc_metadata: Pass a default value when unwrapping a span)
  • #57654 (Add some links in std::fs.)
  • #57658 (Two HIR tweaks)
  • #57659 (Fix release manifest generation)
  • #57683 (Document Unpin in std::prelude documentation)
  • #57685 (Enhance Pin impl applicability for PartialEq and PartialOrd.)
  • #57698 (Fix typo bug in DepGraph::try_mark_green().)
  • #57720 (Fix suggestions given mulitple bad lifetimes)

Failed merges:

r? @ghost

sdroege and others added some commits Dec 7, 2018

Remove confusing comment about ideally using `!` for `c_void`
Using `!` for `c_void` would have the problem that pointers and
potentially references to an uninhabited type would be created, and at
least for references this is UB.

Also document in addition that newtype wrappers around `c_void` are not
recommended for representing opaque types (as a workaround for `extern
type` not being stable) but instead refer to the Nomicon.
Update code comments of `c_void` to explain the reasoning for its cur…
…rent implementation

We need at least two variants of the enum as otherwise the compiler
complains about the #[repr(u8)] attribute and we also need at least one
variant as otherwise the enum would be uninhabitated and dereferencing
pointers to it would be UB.

As such, mark the variants not unstable because they should not actually
exist but because they are temporary implementation details until
`extern type` is stable and can be used instead.
Cleanup PartialEq docs.
- Cleanup the `impl PartialEq<BookFormat> for Book` implementation
- Implement `impl PartialEq<Book> for BookFormat` so it’s symmetric
  - Fixes #53844.
- Removes the last example since it appears to be redundant with the
  previous two examples.
Support passing cflags/cxxflags/ldflags to LLVM build
This may be needed with some host compilers.
AB1908
Add some links in std::fs.
A few items were referenced, but did not have links.
Use `Lit` rather than `P<Lit>` in `hir::ExprKind`.
It's simpler and makes some benchmark run up to 1% faster. It also makes
`hir::ExprKind` more like `ast::ExprKind` (which underwent the
equivalent change in #55777).
Remove `hir::Label`.
It's identical to `ast::Label`.
Jethro Beekman

Centril added some commits Jan 18, 2019

Rollup merge of #57370 - petrhosek:llvm-flags, r=alexcrichton
Support passing cflags/cxxflags/ldflags to LLVM build

This may be needed with some host compilers.
Rollup merge of #57475 - SimonSapin:signed, r=alexcrichton
Add signed num::NonZeroI* types

Multiple people have asked for them in #49137. Given that the unsigned ones already exist, they are very easy to add and not an additional maintenance burden.
Rollup merge of #57501 - petrochenkov:highvar, r=alexreg
High priority resolutions for associated variants

In #56225 variants were assigned lowest priority during name resolution to avoid crater run and potential breakage.

This PR changes the rules to give variants highest priority instead.
Some motivation:
- If variants (and their constructors) are treated as associated items, then they are obviously *inherent* associated items since they don't come from traits.
- Inherent associated items have higher priority during resolution than associated items from traits.
- The reason is that there is a way to disambiguate in favor of trait items (`<Type as Trait>::Ambiguous`), but there's no way to disambiguate in favor of inherent items, so they became unusable in case of ambiguities if they have low priority.
- It's technically problematic to fallback from associated types to anything until lazy normalization (?) is implemented.

Crater found some regressions from this change, but they are all in type positions, e.g.
```rust
fn f() -> Self::Ambiguos { ... } // Variant `Ambiguous` or associated type `Ambiguous`?
```
, so variants are not usable there right now, but they may become usable in the future if rust-lang/rfcs#2593 is accepted.
This PR keeps code like this successfully resolving, but introduces a future-compatibility lint `ambiguous_associated_items` that recommends rewriting it as `<Self as Trait>::Ambiguous`.
Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis
resolve: Add a test for issue #57539

Add a test for the bugfix regression reported in #57539

Closes #57539
Rollup merge of #57610 - mark-i-m:nested-matchers, r=petrochenkov
Fix nested `?` matchers

fix #57597

I'm not 100% if this works yet...

cc @alercah

When  this is ready (but perhaps not yet):
Rollup merge of #57634 - oli-obk:remove_unused_argument, r=davidtwco
Remove an unused function argument

The only use was a debug printing, which might help someone with debugging dataflow problems, but seems otherwise useless
Rollup merge of #57635 - euclio:path-separators, r=michaelwoerister
use structured macro and path resolve suggestions
Rollup merge of #57636 - GuillaumeGomez:fix-sources-sidebar, r=QuietM…
…isdreavus

Fix sources sidebar not showing up

Fixes #57601.

The order of imports made it so that the sidebar creation was called before the sidebar sources were created. Like this, when the sources are loaded, they create the sidebar as expected.

r? @QuietMisdreavus
Rollup merge of #57646 - GuillaumeGomez:fix-css, r=QuietMisdreavus
Fixes text becoming invisible when element targetted

Fixes #57628.

r? @QuietMisdreavus
Rollup merge of #57649 - petrochenkov:privexist, r=arielb1
privacy: Account for associated existential types

Turns out they *can* be associated (but only in impls, not traits).
Fixes #53546 (comment)

r? @arielb1
Rollup merge of #57650 - AB1908:master, r=petrochenkov
librustc_metadata: Pass a default value when unwrapping a span

Fixes #57323.

When compiling with `static-nobundle` a-la

`rustc -l static-nobundle=nonexistent main.rs`

we now get a neat output in the form of:

```
error[E0658]: kind="static-nobundle" is feature gated (see issue #37403)
  |
  = help: add #![feature(static_nobundle)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
```
The build and tests completed successfully on my machine. Should I be adding a new test?
Rollup merge of #57654 - ehuss:fs-links, r=alexcrichton
Add some links in std::fs.

A few items were referenced, but did not have links.
Rollup merge of #57658 - nnethercote:rm-hir-P-Lit, r=michaelwoerister
Two HIR tweaks

Two HIR tweaks that make things slightly simpler and faster.
Rollup merge of #57683 - xfix:patch-15, r=QuietMisdreavus
Document Unpin in std::prelude documentation
Rollup merge of #57685 - pthariensflame:enhancement/pin-impl-applicab…
…ility, r=withoutboats

Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.

This allows for comparing for equality or ordering a `Pin<P>` and a `Pin<Q>` as long as `P` and `Q` are correspondingly comparable themselves *even when `P` and `Q` are different types*.
An example might be comparing a `Pin<&mut OsString>` to a `Pin<&mut PathBuf>`, which might arise from pin projections from a pair of larger contexts that aren't `Unpin`.
Rollup merge of #57698 - michaelwoerister:issue57692, r=Zoxc
Fix typo bug in DepGraph::try_mark_green().

r? @Zoxc

Fixes #57692.
Rollup merge of #57720 - dlrobertson:fix_57521, r=estebank
Fix suggestions given mulitple bad lifetimes

When given multiple lifetimes prior to type parameters in generic
parameters, do not ICE and print the correct suggestion.

r? @estebank

CC @pnkfelix

Fixes: #57521
@Centril

This comment has been minimized.

Copy link
Contributor Author

Centril commented Jan 18, 2019

@bors r+ p=22

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 18, 2019

📌 Commit ca72ad1 has been approved by Centril

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 18, 2019

⌛️ Testing commit ca72ad1 with merge fd3f45b...

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

Auto merge of #57727 - Centril:rollup, r=Centril
Rollup of 22 pull requests

Successful merges:

 - #56594 (Remove confusing comment about ideally using `!` for `c_void`)
 - #57107 (Add a regression test for mutating a non-mut #[thread_local])
 - #57340 (Use correct tracking issue for c_variadic)
 - #57357 (Cleanup PartialEq docs.)
 - #57370 (Support passing cflags/cxxflags/ldflags to LLVM build)
 - #57475 (Add signed num::NonZeroI* types)
 - #57501 (High priority resolutions for associated variants)
 - #57551 (resolve: Add a test for issue #57539)
 - #57610 (Fix nested `?` matchers)
 - #57634 (Remove an unused function argument)
 - #57635 (use structured macro and path resolve suggestions)
 - #57636 (Fix sources sidebar not showing up)
 - #57646 (Fixes text becoming invisible when element targetted)
 - #57649 (privacy: Account for associated existential types)
 - #57650 (librustc_metadata: Pass a default value when unwrapping a span)
 - #57654 (Add some links in std::fs.)
 - #57658 (Two HIR tweaks)
 - #57659 (Fix release manifest generation)
 - #57683 (Document Unpin in std::prelude documentation)
 - #57685 (Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.)
 - #57698 (Fix typo bug in DepGraph::try_mark_green().)
 - #57720 (Fix suggestions given mulitple bad lifetimes)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 18, 2019

💔 Test failed - checks-travis

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 18, 2019

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:04:01] 71  |                           Some(unsafe { $Ty(n) })
[00:04:01]     |                                ^^^^^^ unnecessary `unsafe` block
[00:04:01] ...
[00:04:01] 100 | / nonzero_integers! {
[00:04:01] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[00:04:01] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[00:04:01] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[00:04:01] ...   |
[00:04:01] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[00:04:01]     | |_- in this macro invocation
[00:04:01]     |
[00:04:01]     = note: #[warn(unused_unsafe)] on by default
[00:04:01] 
[00:04:01] 
[00:04:01] warning: unnecessary `unsafe` block
[00:04:01]    --> src/libcore/num/mod.rs:71:30
[00:04:01]     |
[00:04:01] 71  |                           Some(unsafe { $Ty(n) })
[00:04:01]     |                                ^^^^^^ unnecessary `unsafe` block
[00:04:01] ...
[00:04:01] 100 | / nonzero_integers! {
[00:04:01] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[00:04:01] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[00:04:01] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[00:04:01] ...   |
[00:04:01] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[00:04:01]     | |_- in this macro invocation
[00:04:01] 
[00:04:01] warning: unnecessary `unsafe` block
[00:04:01]     --> src/libcore/ptr.rs:2786:18
---
[00:04:01] 50  |                   #[rustc_layout_scalar_valid_range_start(1)]
[00:04:01]     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:04:01] ...
[00:04:01] 100 | / nonzero_integers! {
[00:04:01] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[00:04:01] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[00:04:01] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[00:04:01] ...   |
[00:04:01] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[00:04:01]     | |_- in this macro invocation
[00:04:01]     |
[00:04:01]     = note: #[warn(unused_attributes)] on by default
[00:04:01] 
[00:04:01] 
[00:04:01] warning: unused attribute
[00:04:01]    --> src/libcore/num/mod.rs:50:17
[00:04:01]     |
[00:04:01] 50  |                   #[rustc_layout_scalar_valid_range_start(1)]
[00:04:01]     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:04:01] ...
[00:04:01] 100 | / nonzero_integers! {
[00:04:01] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[00:04:01] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[00:04:01] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[00:04:01] ...   |
[00:04:01] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[00:04:01]     | |_- in this macro invocation
[00:04:01] 
[00:04:01] warning: unused attribute
[00:04:01]     --> src/libcore/ptr.rs:2721:1
---
[01:00:59] 71  |                           Some(unsafe { $Ty(n) })
[01:00:59]     |                                ^^^^^^ unnecessary `unsafe` block
[01:00:59] ...
[01:00:59] 100 | / nonzero_integers! {
[01:00:59] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[01:00:59] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[01:00:59] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[01:00:59] ...   |
[01:00:59] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[01:00:59]     | |_- in this macro invocation
[01:00:59]     |
[01:00:59]     = note: #[warn(unused_unsafe)] on by default
[01:00:59] 
[01:00:59] 
[01:00:59] warning: unnecessary `unsafe` block
[01:00:59]    --> src/libcore/num/mod.rs:71:30
[01:00:59]     |
[01:00:59] 71  |                           Some(unsafe { $Ty(n) })
[01:00:59]     |                                ^^^^^^ unnecessary `unsafe` block
[01:00:59] ...
[01:00:59] 100 | / nonzero_integers! {
[01:00:59] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[01:00:59] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[01:00:59] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[01:00:59] ...   |
[01:00:59] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[01:00:59]     | |_- in this macro invocation
[01:00:59] 
[01:00:59] warning: unnecessary `unsafe` block
[01:00:59]     --> src/libcore/ptr.rs:2786:18
---
[01:00:59] 50  |                   #[rustc_layout_scalar_valid_range_start(1)]
[01:00:59]     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:00:59] ...
[01:00:59] 100 | / nonzero_integers! {
[01:00:59] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[01:00:59] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[01:00:59] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[01:00:59] ...   |
[01:00:59] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[01:00:59]     | |_- in this macro invocation
[01:00:59]     |
[01:00:59]     = note: #[warn(unused_attributes)] on by default
[01:00:59] 
[01:00:59] 
[01:00:59] warning: unused attribute
[01:00:59]    --> src/libcore/num/mod.rs:50:17
[01:00:59]     |
[01:00:59] 50  |                   #[rustc_layout_scalar_valid_range_start(1)]
[01:00:59]     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:00:59] ...
[01:00:59] 100 | / nonzero_integers! {
[01:00:59] 101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
[01:00:59] 102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
[01:00:59] 103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
[01:00:59] ...   |
[01:00:59] 112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
[01:00:59]     | |_- in this macro invocation
[01:00:59] 
[01:00:59] warning: unused attribute
[01:00:59]     --> src/libcore/ptr.rs:2721:1
---
[01:06:20] 
[01:06:20] ---- [ui] ui/try-block/try-block-bad-type.rs stdout ----
[01:06:20] diff of stderr:
[01:06:20] 
[01:06:20] 5    |         ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32`
[01:06:20] 7    = help: the following implementations were found:
[01:06:20] 7    = help: the following implementations were found:
[01:06:20] -              <i32 as std::convert::From<core::num::NonZeroI32>>
[01:06:20] +              <i32 as std::convert::From<bool>>
[01:06:20] 9              <i32 as std::convert::From<i16>>
[01:06:20] -              <i32 as std::convert::From<i8>>
[01:06:20] +              <i32 as std::convert::From<u16>>
[01:06:20] 11              <i32 as std::convert::From<u8>>
[01:06:20] 13    = note: required by `std::convert::From::from`
[01:06:20] 
[01:06:20] 
[01:06:20] The actual stderr differed from the expected stderr.
[01:06:20] The actual stderr differed from the expected stderr.
[01:06:20] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/try-block/try-block-bad-type/try-block-bad-type.stderr
[01:06:20] To update references, rerun the tests and pass the `--bless` flag
[01:06:20] To only update this specific test, also pass `--test-args try-block/try-block-bad-type.rs`
[01:06:20] error: 1 errors occurred comparing output.
[01:06:20] status: exit code: 1
[01:06:20] status: exit code: 1
[01:06:20] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/try-block/try-block-bad-type.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/try-block/try-block-bad-type/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/arm-unknown-linux-gnueabihf/native/rust-test-helpers" "-Clinker=arm-linux-gnueabihf-gcc" "--edition" "2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/try-block/try-block-bad-type/auxiliary" "-A" "unused"
[01:06:20] ------------------------------------------
[01:06:20] 
[01:06:20] ------------------------------------------
[01:06:20] stderr:
[01:06:20] stderr:
[01:06:20] ------------------------------------------
[01:06:20] {"message":"the trait bound `i32: std::convert::From<&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/try-block/try-block-bad-type.rs","byte_start":121,"byte_end":129,"line_start":7,"line_end":7,"column_start":9,"column_end":17,"is_primary":true,"text":[{"text":"        Err(\"\")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied","highlight_start":9,"highlight_end":17}],"label":"the trait `std::convert::From<&str>` is not implemented for `i32`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the following implementations were found:\n  <i32 as std::convert::From<bool>>\n  <i32 as std::convert::From<i16>>\n  <i32 as std::convert::From<u16>>\n  <i32 as std::convert::From<u8>>\nand 2 others","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required by `std::convert::From::from`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied\n  --> /checkout/src/test/ui/try-block/try-block-bad-type.rs:7:9\n   |\nLL |         Err(\"\")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied\n   |         ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32`\n   |\n   = help: the following implementations were found:\n             <i32 as std::convert::From<bool>>\n             <i32 as std::convert::From<i16>>\n             <i32 as std::convert::From<u16>>\n             <i32 as std::convert::From<u8>>\n           and 2 others\n   = note: required by `std::convert::From::from`\n\n"}
[01:06:20] {"message":"type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == &str`","code":{"code":"E0271","explanation":"\nThis is because of a type mismatch between the associated type of some\ntrait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`)\nand another type `U` that is required to be equal to `T::Bar`, but is not.\nExamples follow.\n\nHere is a basic example:\n\n```compile_fail,E0271\ntrait Trait { type AssociatedType; }\n\nfn foo<T>(t: T) where T: Trait<AssociatedType=u32> {\n    println!(\"in foo\");\n}\n\nimpl Trait for i8 { type AssociatedType = &'static str; }\n\nfoo(3_i8);\n```\n\nHere is that same example again, with some explanatory comments:\n\n```compile_fail,E0271\ntrait Trait { type AssociatedType; }\n\nfn foo<T>(t: T) where T: Trait<AssociatedType=u32> {\n//                    ~~~~~~~~ ~~~~~~~~~~~~~~~~~~\n//                        |            |\n//         This says `foo` can         |\n//           only be used with         |\n//              some type that         |\n//         implements `Trait`.         |\n//                                     |\n//                             This says not only must\n//                             `T` be an impl of `Trait`\n//                             but also that the impl\n//                             must assign the type `u32`\n//                             to the associated type.\n    println!(\"in foo\");\n}\n\nimpl Trait for i8 { type AssociatedType = &'static str; }\n//~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n//      |                             |\n// `i8` does have                     |\n// implementation                     |\n// of `Trait`...                      |\n//                     ... but it is an implementation\n//                     that assigns `&'static str` to\n//                     the associated type.\n\nfoo(3_i8);\n// Here, we invoke `foo` with an `i8`, which does not satisfy\n// the constraint `<i8 as Trait>::AssociatedType=u32`, and\n// therefore the type-checker complains with this error code.\n```\n\nTo avoid those issues, you have to make the types match correctly.\nSo we can fix the previous examples like this:\n\n```\n// Basic Example:\ntrait Trait { type AssociatedType; }\n\nfn foo<T>(t: T) where T: Trait<AssociatedType = &'static str> {\n    println!(\"in foo\");\n}\n\nimpl Trait for i8 { type AssociatedType = &'static str; }\n\nfoo(3_i8);\n\n// For-Loop Example:\nlet vs = vec![1, 2, 3, 4];\nfor v in &vs {\n    match v {\n        &1 => {}\n        _ => {}\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":270,"byte_end":272,"line_start":12,"line_end":12,"column_start":9,"column_end":11,"is_primary":true,"text":[{"text":"        \"\" //~ ERROR type mismatch","highlight_start":9,"highlight_end":11}],"label":"expected i32, found &str","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `i32`\n   found type `&str`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0271]: type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == &str`\n  --> /checkout/src/test/ui/try-block/try-block-bad-type.rs:12:9\n   |\nLL |         \"\" //~ ERROR type mismatch\n   |         ^^ expected i32, found &str\n   |\n   = note: expected type `i32`\n              found type `&str`\n\n"}
[01:06:20] {"message":"type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == ()`","code":{"code":"E0271","explanation":"\nThis is because of a type mismatch between the associated type of some\ntrait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`)\nand another type `U` that is required to be equal to `T::Bar`, but is not.\nExamples follow.\n\nHere is a basic example:\n\n```compile_fail,E0271\ntrait Trait { type AssociatedType; }\n\nfn foo<T>(t: T) where T: Trait<AssociatedType=u32> {\n    println!(\"in foo\");\n}\n\nimpl Trait for i8 { type AssociatedType = &'static str; }\n\nfoo(3_i8);\n```\n\nHere is that same example again, with some explanatory comments:\n\n```compile_fail,E0271\ntrait Trait { type AssociatedType; }\n\nfn foo<T>(t: T) where T: Trait<AssociatedType=u32> {\n//                    ~~~~~~~~ ~~~~~~~~~~~~~~~~~~\n//                        |            |\n//         This says `foo` can         |\n//           only be used with         |\n//              some type that         |\n//         implements `Trait`.         |\n//                                     |\n//                             This says not only must\n//                             `T` be an impl of `Trait`\n//                             but also that the impl\n//                             must assign the type `u32`\n//                             to the associated type.\n    println!(\"in foo\");\n}\n\nimpl Trait for i8 { type AssociatedType = &'static str; }\n//~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n//      |                             |\n// `i8` does have                     |\n// implementation                     |\n// of `Trait`...                      |\n//                     ... but it is an implementation\n//                     that assigns `&'static str` to\n//                     the associated type.\n\nfoo(3_i8);\n// Here, we invoke `foo` with an `i8`, which does not satisfy\n// the constraint `<i8 as Trait>::AssociatedType=u32`, and\n// therefore the type-checker complains with this error code.\n```\n\nTo avoid those issues, you have to make the types match correctly.\nSo we can fix the previous examples like this:\n\n```\n// Basic Example:\ntrait Trait { type AssociatedType; }\n\nfn foo<T>(t: T) where T: Trait<AssociatedType = &'static str> {\n    println!(\"in foo\");\n}\n\nimpl Trait for i8 { type AssociatedType = &'static str; }\n\nfoo(3_i8);\n\n// For-Loop Example:\nlet vs = vec![1, 2, 3, 4];\nfor v in &vs {\n    match v {\n        &1 => {}\n        _ => {}\n    }\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":343,"byte_end":344,"line_start":15,"line_end":15,"column_start":39,"column_end":40,"is_primary":true,"text":[{"text":"    let res: Result<i32, i32> = try { }; //~ ERROR type mismatch","highlight_start":39,"highlight_end":40}],"label":"expected i32, found ()","suggested_replacement":null,"suggestion_applicability":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":341,"byte_end":344,"line_start":15,"line_end":15,"column_start":37,"column_end":40,"is_primary":false,"text":[{"text":"    let res: Result<i32, i32> = try { }; //~ ERROR type mismatch","highlight_start":37,"highlight_end":40}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},"macro_decl_name":"desugaring of `try block`","def_site_span":{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":341,"byte_end":344,"line_start":15,"line_end":15,"column_start":37,"column_end":40,"is_primary":false,"text":[{"text":"    let res: Result<i32, i32> = try { }; //~ ERROR type mismatch","highlight_start":37,"highlight_end":40}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}}}],"children":[{"message":"expected type `i32`\n   found type `()`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0271]: type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == ()`\n  --> /checkout/src/test/ui/try-block/try-block-bad-type.rs:15:39\n   |\nLL |     let res: Result<i32, i32> = try { }; //~ ERROR type mismatch\n   |                                       ^ expected i32, found ()\n   |\n   = note: expected type `i32`\n              found type `()`\n\n"}
[01:06:20] {"message":"the trait bound `(): std::ops::Try` 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/try-block/try-block-bad-type.rs","byte_start":393,"byte_end":396,"line_start":17,"line_end":17,"column_start":23,"column_end":26,"is_primary":true,"text":[{"text":"    let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied","highlight_start":23,"highlight_end":26}],"label":"the trait `std::ops::Try` is not implemented for `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":393,"byte_end":396,"line_start":17,"line_end":17,"column_start":23,"column_end":26,"is_primary":false,"text":[{"text":"    let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied","highlight_start":23,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},"macro_decl_name":"desugaring of `try block`","def_site_span":{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":393,"byte_end":396,"line_start":17,"line_end":17,"column_start":23,"column_end":26,"is_primary":false,"text":[{"text":"    let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied","highlight_start":23,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}}}],"children":[{"message":"required by `std::ops::Try::from_ok`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `(): std::ops::Try` is not satisfied\n  --> /checkout/src/test/ui/try-block/try-block-bad-type.rs:17:23\n   |\nLL |     let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied\n   |                       ^^^ the trait `std::ops::Try` is not implemented for `()`\n   |\n   = note: required by `std::ops::Try::from_ok`\n\n"}
[01:06:20] {"message":"the trait bound `i32: std::ops::Try` 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/try-block/try-block-bad-type.rs","byte_start":479,"byte_end":484,"line_start":19,"line_end":19,"column_start":24,"column_end":29,"is_primary":true,"text":[{"text":"    let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied","highlight_start":24,"highlight_end":29}],"label":"the trait `std::ops::Try` is not implemented for `i32`","suggested_replacement":null,"suggestion_applicability":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":479,"byte_end":484,"line_start":19,"line_end":19,"column_start":24,"column_end":29,"is_primary":false,"text":[{"text":"    let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied","highlight_start":24,"highlight_end":29}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},"macro_decl_name":"desugaring of `try block`","def_site_span":{"file_name":"/checkout/src/test/ui/try-block/try-block-bad-type.rs","byte_start":479,"byte_end":484,"line_start":19,"line_end":19,"column_start":24,"column_end":29,"is_primary":false,"text":[{"text":"    let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied","highlight_start":24,"highlight_end":29}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}}}],"children":[{"message":"required by `std::ops::Try::from_ok`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the trait bound `i32: std::ops::Try` is not satisfied\n  --> /checkout/src/test/ui/try-block/try-block-bad-type.rs:19:24\n   |\nLL |     let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied\n   |                        ^^^^^ the trait `std::ops::Try` is not implemented for `i32`\n   |\n   = note: required by `std::ops::Try::from_ok`\n\n"}
[01:06:20] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[01:06:20] {"message":"Some errors occurred: E0271, E0277.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0271, E0277.\n"}
[01:06:20] 
[01:06:20] ------------------------------------------
[01:06:20] 
[01:06:20] thread '[ui] ui/try-block/try-block-bad-type.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3245:9
---
[01:06:20] 
[01:06:20] 
[01:06:20] 
[01:06:20] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:495:22
[01:06:20] 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  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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"
[01:06:20] 
[01:06:20] 
[01:06:20] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target arm-unknown-linux-gnueabihf
[01:06:20] Build completed unsuccessfully in 1:02:44
---
travis_time:end:264f3912:start=1547811150419271592,finish=1547811150430131735,duration=10860143
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:22fd2d80
$ 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:06a2d996
travis_time:start:06a2d996
$ 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:00cb4630
$ 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)

@Centril Centril closed this Jan 18, 2019

@Centril Centril deleted the Centril:rollup branch Jan 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.