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

Use free regions when determining self type in compare_impl_method #48419

Merged
merged 2 commits into from
Mar 11, 2018

Conversation

sapphire-arches
Copy link
Contributor

The ExplicitSelf::determine function expects to be able to compare regions. However, when the compare_self_type error reporting code runs we haven't resolved bound regions yet. Thus we replace them with free regions first. Fixes #48276

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2018
@pietroalbini
Copy link
Member

Thanks for the PR @bobtwinkles, the release team will periodically make sure this PR gets reviewed.

@nikomatsakis, this PR needs your review!

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 27, 2018

📌 Commit 9882050 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 Feb 27, 2018
@Manishearth
Copy link
Member

I get a failure on this in the rollup

[01:00:19] failures:
[01:00:19] 
[01:00:19] ---- [ui] ui/issue-48276.rs stdout ----
[01:00:19] 	diff of stderr:
[01:00:19] 
[01:00:19] 1	error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait
[01:00:19] 2	  --> $DIR/issue-48276.rs:21:5
[01:00:19] 3	   |
[01:00:19] -	15 |     fn from(a: A) -> Self;
[01:00:19] +	LL |     fn from(a: A) -> Self;
[01:00:19] 5	   |     ---------------------- trait method declared without `&self`
[01:00:19] 6	...
[01:00:19] -	21 |     fn from(self: &'a Self) -> &'b str {
[01:00:19] +	LL |     fn from(self: &'a Self) -> &'b str {
[01:00:19] 8	   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl
[01:00:19] 9	
[01:00:19] 10	error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait
[01:00:19] 
[01:00:19] 11	  --> $DIR/issue-48276.rs:30:5
[01:00:19] 12	   |
[01:00:19] -	30 |     fn from(&self) -> B {
[01:00:19] +	LL |     fn from(&self) -> B {
[01:00:19] 14	   |     ^^^^^^^^^^^^^^^^^^^ `&self` used in impl
[01:00:19] 15	   |
[01:00:19] 16	   = note: `from` from trait: `fn(T) -> Self`
[01:00:19] 
[01:00:19] 18	error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait
[01:00:19] 19	  --> $DIR/issue-48276.rs:37:5
[01:00:19] 20	   |
[01:00:19] -	37 |     fn from(&self) -> &'static str {
[01:00:19] +	LL |     fn from(&self) -> &'static str {
[01:00:19] 22	   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl
[01:00:19] 23	   |
[01:00:19] 24	   = note: `from` from trait: `fn(T) -> Self`
[01:00:19] 
[01:00:19] 25	
[01:00:19] 26	error: aborting due to 3 previous errors
[01:00:19] 27	
[01:00:19] +	If you want more information on this error, try using "rustc --explain E0185"
[01:00:19] 28	
[01:00:19] 
[01:00:19] 
[01:00:19] The actual stderr differed from the expected stderr.
[01:00:19] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-48276.stderr
[01:00:19] To update references, run this command from build directory:
[01:00:19] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'issue-48276.rs'
[01:00:19] 
[01:00:19] error: 1 errors occurred comparing output.
[01:00:19] status: exit code: 101
[01:00:19] stdout:
[01:00:19] ------------------------------------------
[01:00:19] 
[01:00:19] ------------------------------------------
[01:00:19] stderr:
[01:00:19] ------------------------------------------
[01:00:19] error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait
[01:00:19]   --> /checkout/src/test/ui/issue-48276.rs:21:5
[01:00:19]    |
[01:00:19] LL |     fn from(a: A) -> Self;
[01:00:19]    |     ---------------------- trait method declared without `&self`
[01:00:19] ...
[01:00:19] LL |     fn from(self: &'a Self) -> &'b str {
[01:00:19]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl
[01:00:19] 
[01:00:19] error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait
[01:00:19]   --> /checkout/src/test/ui/issue-48276.rs:30:5
[01:00:19]    |
[01:00:19] LL |     fn from(&self) -> B {
[01:00:19]    |     ^^^^^^^^^^^^^^^^^^^ `&self` used in impl
[01:00:19]    |
[01:00:19]    = note: `from` from trait: `fn(T) -> Self`
[01:00:19] 
[01:00:19] error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait
[01:00:19]   --> /checkout/src/test/ui/issue-48276.rs:37:5
[01:00:19]    |
[01:00:19] LL |     fn from(&self) -> &'static str {
[01:00:19]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl
[01:00:19]    |
[01:00:19]    = note: `from` from trait: `fn(T) -> Self`
[01:00:19] 
[01:00:19] error: aborting due to 3 previous errors
[01:00:19] 
[01:00:19] If you want more information on this error, try using "rustc --explain E0185"
[01:00:19] 
[01:00:19] ------------------------------------------
[01:00:19] 
[01:00:19] thread '[ui] ui/issue-48276.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2893:9
[01:00:19] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:00:19] 
[01:00:19] 
[01:00:19] failures:
[01:00:19]     [ui] ui/issue-48276.rs
[01:00:19] 
[01:00:19] test result: FAILED. 1243 passed; 1 failed; 4 ignored; 0 measured; 0 filtered out
[01:00:19] 
[01:00:19] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:476:22
[01:00:19] 

@pietroalbini
Copy link
Member

That failure is caused by #48449, which replaces line numbers with LL.

@Manishearth
Copy link
Member

@bors r-

re-r+ when this is fixed

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 28, 2018
bors added a commit that referenced this pull request Feb 28, 2018
Rollup of 10 pull requests

- Successful merges: #48355, #48359, #48380, #48419, #48420, #48461, #48522, #48570, #48572, #48603
- Failed merges:
@nikomatsakis
Copy link
Contributor

easiest way to fix is to rebase and re-run the UI tests locally

@sapphire-arches
Copy link
Contributor Author

sapphire-arches commented Mar 1, 2018 via email

The ExplicitSelf::determine function expects to be able to compare regions.
However, when the compare_self_type error reporting code runs we haven't
resolved bound regions yet. Thus we replace them with free regions first.
@sapphire-arches sapphire-arches added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 5, 2018
@sapphire-arches
Copy link
Contributor Author

Rebased and updated to new stderr format. Should be an easy review =)

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 9, 2018

📌 Commit c0d41fb 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 Mar 9, 2018
@bors
Copy link
Contributor

bors commented Mar 10, 2018

⌛ Testing commit c0d41fb with merge 9a46d8adb83f73c72a2e876764993c4746957199...

@bors
Copy link
Contributor

bors commented Mar 10, 2018

💔 Test failed - status-appveyor

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

Appveyor timeout on dist x86_64.

@bors retry

@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 Mar 10, 2018
@kennytm
Copy link
Member

kennytm commented Mar 10, 2018

Note: Timeout is due to being stuck when cloning rust-by-examples. This happened 1 month before in #47761 (comment).

@bors
Copy link
Contributor

bors commented Mar 10, 2018

⌛ Testing commit c0d41fb with merge 0bae326...

bors added a commit that referenced this pull request Mar 10, 2018
…sakis

Use free regions when determining self type in `compare_impl_method`

The ExplicitSelf::determine function expects to be able to compare regions. However, when the compare_self_type error reporting code runs we haven't resolved bound regions yet. Thus we replace them with free regions first. Fixes #48276
@bors
Copy link
Contributor

bors commented Mar 11, 2018

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

@bors bors merged commit c0d41fb into rust-lang:master Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: cannot relate bound region: ReStatic <= ReLateBound
7 participants