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

Beta regression: References to what's supposed to be static singleton don't pointer compare as equal on 1.23.0-beta.1 #46371

Closed
hsivonen opened this Issue Nov 29, 2017 · 15 comments

Comments

@hsivonen
Copy link
Contributor

hsivonen commented Nov 29, 2017

Steps to reproduce:

  1. git clone https://github.com/hsivonen/encoding_rs
  2. cd encoding_rs
  3. rustup default beta
  4. cargo test --release

Actual results:

failures:

---- test_labels_names::test_all_labels stdout ----
	thread 'test_labels_names::test_all_labels' panicked at 'assertion failed: `(left == right)`
  left: `Some(Encoding { windows-1252 })`,
 right: `Some(Encoding { windows-1252 })`', src/test_labels_names.rs:11:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- tests::test_label_resolution stdout ----
	thread 'tests::test_label_resolution' panicked at 'assertion failed: `(left == right)`
  left: `Some(Encoding { UTF-8 })`,
 right: `Some(Encoding { UTF-8 })`', src/lib.rs:4419:8

Note how left and right in both cases have the same debug stringification.

The eq implementation assumes that there is one instance of each encoding so it's OK to pointer compare them.

Various previous stable channel releases work. Nightly works. Beta works in debug mode. 1.23.0-beta.1 fails in release mode.

encoding_rs issue, Firefox bug

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Nov 29, 2017

Will probably be the codegen-units thing. Singleton statics should use linkonce/linkonce_odr linkage, although it is not entirely clear to me whether it is up to user to do so or up to us (the compiler).

cc @michaelwoerister @alexcrichton

EDIT: It is certainly a user responsibility if a singleton common for multiple crate versions is desired.

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Nov 29, 2017

Hm, statics should always have external linkage (we don't use linkonce or linkonce_odr anywhere these days). Maybe the symbol internalizer wrongly decides that it can make multiple internal copies?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Nov 29, 2017

This may also be related to #46239 and fixed by #46253, the IR doesn't obviously contain multiple instances of the static here and there's no codegen units involved, so I'd be surprised if the collector came into this!

@rillian

This comment has been minimized.

Copy link
Contributor

rillian commented Dec 4, 2017

Being fixed by #46253 is possible; I can't reproduce with today's nightly rust. @michaelwoerister, can you make sure that gets into to the next beta, please?

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Dec 4, 2017

I don't think this was fixed by that PR.

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Dec 4, 2017

@rillian I'll do a backport of #46253 tomorrow.

@nagisa Do you have an alternative theory?

@Mark-Simulacrum Mark-Simulacrum added this to the 1.23 milestone Dec 5, 2017

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Dec 19, 2017

I cannot reproduce this with the latest beta anymore. Could you give it a try, @hsivonen?

Also, regarding the question why crater did not find this issue: it seems that crater does not do optimized builds and thus could not have run into this.

bors added a commit that referenced this issue Dec 22, 2017

Auto merge of #46925 - arielb1:make-the-trains-run-on-time, r=arielb1
Bounce out the layout refactor from beta

@eddyb's #45225 was supposed to get into get into 1.24, but due to an ordering mistake, it had snuck into 1.23.

That wide-effect translation-changing PR had poked LLVM's weak corners and caused many regressions (3 of them have fixes I include here, but also #46897, #46845, #46449, #46371). I don't think it is a good idea to land it in the beta (1.23) because there are bound to be some regressions we didn't patch.

Therefore, I am reverting it in time for stable, along with its related regression fixes.

r? @michaelwoerister (I think)
@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Dec 29, 2017

Note that @arielb1 claimed that #46925 fixed this regression.

(Though, oddly enough, @michaelwoerister 's statement of being unable to reproduce preceded that PR landing...)

Anyway, without triggering a beta .3 release (that would, if I understand correctly, get the latest commit on the beta channel into rustup), it might be difficult for users to test out the latest beta...

@eddyb

This comment has been minimized.

Copy link
Member

eddyb commented Dec 29, 2017

@pnkfelix There was a backport of #46253 before @arielb1 reverted the layout PR and the bugfix backports related to it, from beta.

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Dec 30, 2017

@eddyb so was @nagisa wrong when they said that they thought #46253 would not fix this?

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Dec 30, 2017

Yeah, I probably was wrong. I didn’t look at the example closely enough before making the statement and forgot to edit it later on. Sorry.

@hsivonen

This comment has been minimized.

Copy link
Contributor Author

hsivonen commented Jan 3, 2018

Could you give it a try, @hsivonen?

It seems that stable is 1.22.1 and beta is 1.24.0-beta.1. Those both work. Nightly works, too.

What should I tell rustup to test the latest 1.23?

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Jan 3, 2018

What should I tell rustup to test the latest 1.23?

Good question. @alexcrichton would know best, I guess?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 3, 2018

There's info on how to test it in the prerelease announcement, lemme know if it doesn't work though!

@hsivonen

This comment has been minimized.

Copy link
Contributor Author

hsivonen commented Jan 3, 2018

The 1.23.0 release candidate works.

Thank you!

@hsivonen hsivonen closed this Jan 3, 2018

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.