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

Add support for trait-objects without a principal #56837

Merged
merged 12 commits into from
Jan 5, 2019

Conversation

arielb1
Copy link
Contributor

@arielb1 arielb1 commented Dec 15, 2018

The hard-error version of #56481 - should be merged after we do something about the traitobject crate.

Fixes #33140.
Fixes #57057.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 15, 2018
@arielb1 arielb1 force-pushed the nonprincipal-trait-objects branch from 03e5829 to 1cc08c2 Compare December 15, 2018 01:23
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.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:0931346a:start=1544837382368592687,finish=1544837459535084865,duration=77166492178
$ 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-5.0
---
    100% |████████████████████████████████| 61kB 10.2MB/s 
Collecting botocore==1.12.66 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/51/da/3ed787b6ca3d33f626c1ba4e014449825db0d557981c4bef71f886fb1424/botocore-1.12.66-py2.py3-none-any.whl (5.1MB)
    0% |                                | 10kB 42.1MB/s eta 0:00:01
    0% |▏                               | 20kB 42.8MB/s eta 0:00:01
    0% |▏                               | 30kB 48.8MB/s eta 0:00:01
    0% |▎                               | 40kB 52.8MB/s eta 0:00:01
---
[00:34:37]    Compiling rand v0.6.1
[00:34:40]    Compiling parking_lot_core v0.3.0
[00:34:42]    Compiling tempfile v3.0.5
[00:34:42]    Compiling parking_lot v0.6.4
[00:34:46] error[E0599]: no method named `def_id` found for type `std::option::Option<rustc::ty::Binder<rustc::ty::ExistentialTraitRef<'_>>>` in the current scope
[00:34:46]     --> src/librustdoc/clean/mod.rs:2642:37
[00:34:46] 2642 |                 let did = principal.def_id();
[00:34:46]      |                                     ^^^^^^
[00:34:46]      |
[00:34:46]      |
[00:34:46]      = note: the method `def_id` exists but the following trait bounds were not satisfied:
[00:34:46]              `std::option::Option<rustc::ty::Binder<rustc::ty::ExistentialTraitRef<'_>>> : clean::GetDefId`
[00:34:46]      = help: items from traits can only be used if the trait is implemented and in scope
[00:34:46]      = note: the following trait defines an item `def_id`, perhaps you need to implement it:
[00:34:46]              candidate #1: `clean::GetDefId`
[00:34:46] 
[00:34:46] error[E0599]: no method named `skip_binder` found for type `std::option::Option<rustc::ty::Binder<rustc::ty::ExistentialTraitRef<'_>>>` in the current scope
[00:34:46]     --> src/librustdoc/clean/mod.rs:2673:48
[00:34:4

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)

@arielb1
Copy link
Contributor Author

arielb1 commented Dec 15, 2018

cc someone who knows rustdoc (e.g., @QuietMisdreavus) about the last commit.

if let Some(principal_def_id) = obj.principal_def_id() {
principal_def_id
} else {
return Some(AccessLevel::Public)
Copy link
Contributor

Choose a reason for hiding this comment

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

What this code (and other uses of ty::Dynamic in rustc_privacy) really wants is to treat all the bounds (principal and not principal) uniformly and find minimum or maximum on them.
It's using principal because when it was written only Send and Sync could be non-principal components, and they could always be considered public.
Now things changed, non-principal components can be private auto traits, so this behavior is actually a bug.

Copy link
Contributor Author

@arielb1 arielb1 Dec 15, 2018

Choose a reason for hiding this comment

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

so this behavior is actually a bug.

It was a bug before, wasn't it?

Which of them is it - minimum or maximum? I'll fix it, especially if you can provide a test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is a pre-existing issue.
I'll try to come up with some tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in #56878

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Did a quick pass. This approach seems nice.

ty::Dynamic(ref data, ..) => tcx.has_attr(data.principal().def_id(), "fundamental"),
ty::Dynamic(ref data, ..) => {
if let Some(principal) = data.principal() {
// FIXME: this does not look quite correct!
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on this FIXME? I think we decided to just not make trait objects fundamental anyway, right? So maybe it's a moot point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, this will be refactored away by #56862, but I wrote this PR first. I'll rebase it on top of #56862.

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'll rebase this when that PR lands, to avoid annoying rebase cascades.

@@ -579,13 +579,18 @@ impl<'a, 'gcx, 'tcx> Binder<ExistentialPredicate<'tcx>> {
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}

impl<'tcx> List<ExistentialPredicate<'tcx>> {
pub fn principal(&self) -> ExistentialTraitRef<'tcx> {
pub fn principal(&self) -> Option<ExistentialTraitRef<'tcx>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a good place for a comment =)

}
}
// FIXME: also check auto-trait def-ids? (e.g. `impl Sync for Foo+Sync`)?
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a bug, yes. We'll have to handle the more general version of this check eventually, I imagine.

(I really wish we had just banned implementing traits for object types, but we didn't...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean, made object types "orphan everywhere"?

Copy link
Contributor Author

@arielb1 arielb1 Dec 17, 2018

Choose a reason for hiding this comment

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

Also, not related to this PR. I'll report an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is #56934. I might actually fix it in a later commit on this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean, made object types "orphan everywhere"?

Yes, basically.

@arielb1 arielb1 force-pushed the nonprincipal-trait-objects branch from 44e506a to b55bc4e Compare December 17, 2018 22:52
@arielb1
Copy link
Contributor Author

arielb1 commented Dec 17, 2018

I'll give this PR a proper rebase after #56481 and #56862 land.

@rust-highfive
Copy link
Collaborator

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.

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)

@bors
Copy link
Contributor

bors commented Dec 18, 2018

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

bors added a commit that referenced this pull request Dec 31, 2018
privacy: Use common `DefId` visiting infrastructure for all privacy visitors

One repeating pattern in privacy checking is going through a type, visiting all `DefId`s inside it and doing something with them.
This is the case because visibilities and reachabilities are attached to `DefId`s.

Previously various privacy visitors visited types slightly differently using their own methods, with most recently written `TypePrivacyVisitor` being the "gold standard".
This mostly worked okay, but differences could manifest in overly conservative reachability analysis, some errors being reported twice, some private-in-public lints (not errors) being wrongly reported or not reported.

This PR does something that I wanted to do since #32674 (comment) - factoring out the common visiting logic!
Now all the common logic is contained in `struct DefIdVisitorSkeleton`, with specific privacy visitors deciding only what to do with visited `DefId`s (via `trait DefIdVisitor`).

A bunch of cleanups is also applied in the process.
This area is somewhat tricky due to lots of easily miss-able details, but thankfully it's was well covered by tests in #46083 and previous PRs, so I'm relatively sure in the refactoring correctness.

Fixes #56837 (comment) in particular.
Also this will help with implementing #48054.
@bors bors closed this in #56878 Jan 1, 2019
@petrochenkov petrochenkov reopened this Jan 1, 2019
@arielb1 arielb1 force-pushed the nonprincipal-trait-objects branch from b55bc4e to ae924b4 Compare January 3, 2019 21:48
@arielb1 arielb1 force-pushed the nonprincipal-trait-objects branch from ae924b4 to 0b511b7 Compare January 3, 2019 23:50
@rust-highfive
Copy link
Collaborator

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:02b5807c:start=1546559531273178824,finish=1546559533486623435,duration=2213444611
$ 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:55:38] .................................................................................................... 2100/5232
[00:55:42] .................................................................................................... 2200/5232
[00:55:45] .................................................................................................... 2300/5232
[00:55:50] .................................................................................................... 2400/5232
[00:55:52] ..................................F..F.............................................................. 2500/5232
[00:56:00] .................................................................................................... 2700/5232
[00:56:04] .................................................................................................... 2800/5232
[00:56:07] .................................................................................................... 2900/5232
[00:56:10] .................................................................................................... 3000/5232
---
[00:57:24] 
[00:57:24] ---- [ui] ui/issues/issue-33140.rs stdout ----
[00:57:24] diff of stderr:
[00:57:24] 
[00:57:24] - error[E0119]: conflicting implementations of trait `Trait` for type `(dyn std::marker::Sync + std::marker::Send + 'static)`:
[00:57:24] + error[E0119]: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:
[00:57:24] 3    |
[00:57:24] 3    |
[00:57:24] 4 LL | impl Trait for dyn Send + Sync {
[00:57:24] 
[00:57:24] 5    | ------------------------------ first implementation here
[00:57:24] 6 ...
[00:57:24] 7 LL | impl Trait for dyn Sync + Send {
[00:57:24] -    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Sync + std::marker::Send + 'static)`
[00:57:24] +    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
[00:57:24] 9 
[00:57:24] - error[E0119]: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Sync + std::marker::Send + 'static)`:
[00:57:24] + error[E0119]: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:
[00:57:24] 12    |
[00:57:24] 12    |
[00:57:24] 13 LL | impl Trait2 for dyn Send + Sync {
[00:57:24] 
[00:57:24] 14    | ------------------------------- first implementation here
[00:57:24] 15 ...
[00:57:24] 16 LL | impl Trait2 for dyn Sync + Send + Sync {
[00:57:24] -    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Sync + std::marker::Send + 'static)`
[00:57:24] +    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
[00:57:24] 18 
[00:57:24] 19 error[E0592]: duplicate definitions with name `abc`
[00:57:24] 
[00:57:24] 
[00:57:24] The actual stderr differed from the expected stderr.
[00:57:24] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-33140/issue-33140.stderr
[00:57:24] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-33140/issue-33140.stderr
[00:57:24] To update references, rerun the tests and pass the `--bless` flag
[00:57:24] To only update this specific test, also pass `--test-args issues/issue-33140.rs`
[00:57:24] error: 1 errors occurred comparing output.
[00:57:24] status: exit code: 1
[00:57:24] status: exit code: 1
[00:57:24] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-33140.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/issues/issue-33140/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/issues/issue-33140/auxiliary" "-A" "unused"
[00:57:24] ------------------------------------------
[00:57:24] 
[00:57:24] ------------------------------------------
[00:57:24] stderr:
[00:57:24] stderr:
[00:57:24] ------------------------------------------
[00:57:24] {"message":"conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:","code":{"code":"E0119","explanation":"\nThere are conflicting trait implementations for the same type.\nExample of erroneous code:\n\n```compile_fail,E0119\ntrait MyTrait {\n    fn get(&self) -> usize;\n}\n\nimpl<T> MyTrait for T {\n    fn get(&self) -> usize { 0 }\n}\n\nstruct Foo {\n    value: usize\n}\n\nimpl MyTrait for Foo { // error: conflicting implementations of trait\n                       //        `MyTrait` for type `Foo`\n    fn get(&self) -> usize { self.value }\n}\n```\n\nWhen looking for the implementation for the trait, the compiler finds\nboth the `impl<T> MyTrait for T` where T is all types and the `impl\nMyTrait for Foo`. Since a trait cannot be implemented multiple times,\nthis is an error. So, when you write:\n\n```\ntrait MyTrait {\n    fn get(&self) -> usize;\n}\n\nimpl<T> MyTrait for T {\n    fn get(&self) -> usize { 0 }\n}\n```\n\nThis makes the trait implemented on all types in the scope. So if you\ntry to implement it on another one after that, the implementations will\nconflict. Example:\n\n```\ntrait MyTrait {\n    fn get(&self) -> usize;\n}\n\nimpl<T> MyTrait for T {\n    fn get(&self) -> usize { 0 }\n}\n\nstruct Foo;\n\nfn main() {\n    let f = Foo;\n\n    f.get(); // the trait is implemented so we can use it\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-33140.rs","byte_start":39,"byte_end":69,"line_start":5,"line_end":5,"column_start":1,"column_end":31,"is_primary":false,"text":[{"text":"impl Trait for dyn Send + Sync {","highlight_start":1,"highlight_end":31}],"label":"first implementation here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issues/issue-33140.rs","byte_start":106,"byte_end":136,"line_start":9,"line_end":9,"column_start":1,"column_end":31,"is_primary":true,"text":[{"text":"impl Trait for dyn Sync + Send {","highlight_start":1,"highlight_end":31}],"label":"conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0119]: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:\n  --> /checkout/src/test/ui/issues/issue-33140.rs:9:1\n   |\nLL | impl Trait for dyn Send + Sync {\n   | ------------------------------ first implementation here\n...\nLL | impl Trait for dyn Sync + Send {\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`\n\n"}
[00:57:24] {"message":"conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:","code":{"code":"E0119","explanation":"\nThere are conflicting trait implementations for the same type.\nExample of erroneous code:\n\n```comnd":22,"column_start":1,"column_end":39,"is_primary":true,"text":[{"text":"impl Trait2 for dyn Sync + Send + Sync {","highlight_start":1,"highlight_end":39}],"label":"conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0119]: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:\n  --> /checkout/src/test/ui/issues/issue-33140.rs:22:1\n   |\nLL | impl Trait2 for dyn Send + Sync {\n   | ------------------------------- first implementation here\n...\nLL | impl Trait2 for dyn Sync + Send + Sync {\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`\n\n"}
[00:57:24] {"message":"duplicate definitions with name `abc`","code":{"code":"E0592","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-33140.rs","byte_start":490,"byte_end":576,"line_start":29,"line_end":31,"column_start":5,"column_end":6,"is_primary":true,"text":[{"text":"    fn abc() -> bool { //~ ERROR duplicate definitions with name `abc`","highlight_start":5,"highlight_end":71},{"text":"        false","highlight_start":1,"highlight_end":14},{"text":"    }","highlight_start":1,"highlight_end":6}],"label":"duplicate definitions for `abc`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issues/issue-33140.rs","byte_start":612,"byte_end":649,"line_start":35,"line_end":37,"column_start":5,"column_end":6,"is_primary":false,"text":[{"text":"    fn abc() -> bool {","highlight_start":5,"highlight_end":23},{"text":"        true","highlight_start":1,"highlight_end":13},{"text":"    }","highlight_start":1,"highlight_end":6}],"label":"other definition for `abc`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0592]: duplicate definitions with name `abc`\n  --> /checkout/src/test/ui/issues/issue-33140.rs:29:5\n   |\nLL | /     fn abc() -> bool { //~ ERROR duplicate definitions with name `abc`\nLL | |         false\nLL | |     }\n   | |_____^ duplicate definitions for `abc`\n...\nLL | /     fn abc() -> bool {\nLL | |         true\nLL | |     }\n   | |_____- other definition for `abc`\n\n"}
[00:57:24] {"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 3 previous errors\n\n"}
[00:57:24] {"message":"Some errors occurred: E0119, E0592.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0119, E0592.\n"}
[00:57:24] {"message":"For more information about an error, try `rustc --explain E0119`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0119`.\n"}
[00:57:24] ------------------------------------------
[00:57:24] 
[00:57:24] thread '[ui] ui/issues/issue-33140.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3245:9
[00:57:24] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:57:24] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:57:24] 
[00:57:24] ---- [ui] ui/issues/issue-33140-trai `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
[00:57:24] 19    |
[00:57:24] 19    |
[00:57:24] 20 LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { }
[00:57:24] 
[00:57:24] 21    | ------------------------------------------------------- first implementation here
[00:57:24] 22 LL | unsafe impl Trait for ::std::marker::Sync + Send { }
[00:57:24] -    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Sync + std::marker::Send + 'static)`
[00:57:24] +    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
[00:57:24] 25    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
[00:57:24] 26    = note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
[00:57:24] 
[00:57:24] 27 
[00:57:24] 27 
[00:57:24] - warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Sync + std::marker::Send + 'static)`: (E0119)
[00:57:24] + warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
[00:57:24] 30    |
[00:57:24] 30    |
[00:57:24] 31 LL | unsafe impl Trait for ::std::marker::Sync + Send { }
[00:57:24] 
[00:57:24] 32    | ------------------------------------------------ first implementation here
[00:57:24] 33 LL | unsafe impl Trait for ::std::marker::Sync + S4-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-33140-traitobject-crate/auxiliary" "-A" "unused"
[00:57:24] ------------------------------------------
[00:57:24] 
[00:57:24] ------------------------------------------
[00:57:24] stderr:
[00:57:24] stderr:
[00:57:24] ------------------------------------------
[00:57:24] {"message":"conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)","code":{"code":"order_dependent_trait_objects","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs","byte_start":4277,"byte_end":4325,"line_start":84,"line_end":84,"column_start":1,"column_end":49,"is_primary":false,"text":[{"text":"unsafe impl Trait for ::std::marker::Send + Sync { }","highlight_start":1,"highlight_end":49}],"label":"first implementation here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs","byte_start":4330,"byte_end":4385,"line_start":85,"line_end":85,"column_start":1,"column_end":56,"is_primary":true,"text":[{"text":"unsafe impl Trait for ::std::marker::Send + Send + Sync { }","highlight_start":1,"highlight_end":56}],"label":"conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"lint level defined here","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs","byte_start":25,"byte_end":54,"line_start":3,"line_end":3,"column_start":9,"column_end":38,"is_primary":true,"text":[{"text":"#![warn(order_dependent_trait_objects)]","highlight_start":9,"highlight_end":38}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!","code":null,"level":"warning","spans":[],"children":[],"rendered":null},{"message":"for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)\n  --> /checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs:85:1\n   |\nLL | unsafe impl Trait for ::std::marker::Send + Sync { }\n   | ------------------------------------------------ first implementation here\nLL | unsafe impl Trait for ::std::marker::Send + Send + Sync { }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`\n   |\nnote: lint level defined here\n  --> /checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs:3:9\n   |\nLL | #![warn(order_dependent_trait_objects)]\n   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!\n   = note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>\n\n"}
[00:57:24] {"message":"conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)","code":{"code":"order_dependent_trait_objects","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs","byte_start":4330,"byte_end":4385,"line_start":85,"line_end":85,"column_start":1,"column_end":56,"is_primary":false,"text":[{"text":"unsafe impl Trait for ::std::marker::Send + Send + Sync { }","highlight_start":1,"highlight_end":56}],"label":"first implementation here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs","byte_start":4390,"byte_end":4438,"line_start":86,"line_end":86,"column_start":1,"column_end":49,"is_primary":true,"text":[{"text":"unsafe impl Trait for ::std::marker::Sync + Send { }","highlight_start":1,"highlight_end":49}],"label":"conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!","code":null,"level":"warning","spans":[],"children":[],"rendered":null},{"message":"for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendrimary":true,"text":[{"text":"unsafe impl Trait for ::std::marker::Sync + Send + Sync { }","highlight_start":1,"highlight_end":56}],"label":"conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!","code":null,"level":"warning","spans":[],"children":[],"rendered":null},{"message":"for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)\n  --> /checkout/src/test/ui/issues/issue-33140-traitobject-crate.rs:88:1\n   |\nLL | unsafe impl Trait for ::std::marker::Sync + Send { }\n   | ------------------------------------------------ first implementation here\nLL | unsafe impl Trait for ::std::marker::Sync + Sync { }\nLL | unsafe impl Trait for ::std::marker::Sync + Send + Sync { }\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`\n   |\n   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!\n   = note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>\n\n"}
[00:57:24] ------------------------------------------
[00:57:2travis_time:end:1507bf5d:start=1546559541641918592,finish=1546562986091179430,duration=3444449260838
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:18bd2358

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)

@arielb1
Copy link
Contributor Author

arielb1 commented Jan 4, 2019

Annoying instability. How does this happen?
A: it's sorting by DefPathHash. I'll fix it to sort by string value.

This makes sure they are printed in a compiler-version-independent
order, avoiding ui test instability.
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 4, 2019

📌 Commit c213b0d 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 4, 2019
@bors
Copy link
Contributor

bors commented Jan 5, 2019

⌛ Testing commit c213b0d with merge 2fba17f...

bors added a commit that referenced this pull request Jan 5, 2019
…akis

Add support for trait-objects without a principal

The hard-error version of #56481 - should be merged after we do something about the `traitobject` crate.

Fixes #33140.
Fixes #57057.

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented Jan 5, 2019

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 2fba17f to master...

@bors bors merged commit c213b0d into rust-lang:master Jan 5, 2019
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Jan 5, 2019
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 5, 2019
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 7, 2019
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 5, 2020
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang/rust#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang/rust#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang/rust#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
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.

5 participants