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

Type inference(?) regression, rand fails to build on nightly 2016-01-04 #30713

Closed
SimonSapin opened this issue Jan 5, 2016 · 9 comments
Closed
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@SimonSapin
Copy link
Contributor

The rand crate (rust-random/rand@4aa8f5b) builds correctly with rustc 1.7.0-nightly (8f11a9e 2016-01-03), but fails with rustc 1.7.0-nightly (d5e2290 2016-01-04):

% cargo build
   Compiling winapi-build v0.1.1
   Compiling libc v0.2.4
   Compiling winapi v0.2.5
   Compiling advapi32-sys v0.1.2
   Compiling rand v0.3.12 (file:///home/simon/projects/servo/deps/rand)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:147:29: 147:36 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:171:17: 171:38 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:150:25: 150:49 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:171:17: 171:38 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:162:29: 162:36 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:172:17: 172:37 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:165:25: 165:49 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:172:17: 172:37 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:147:29: 147:36 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:173:17: 173:37 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:150:25: 150:49 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:173:17: 173:37 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:162:29: 162:36 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:174:17: 174:38 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:134:37: 134:48 error: the type of this value must be known in this context
src/isaac.rs:134             ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
                                                     ^~~~~~~~~~~
src/isaac.rs:165:25: 165:49 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:174:17: 174:38 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:389:37: 389:44 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:416:17: 416:34 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:392:33: 392:60 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:416:17: 416:34 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:407:37: 407:44 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:417:17: 417:33 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:410:33: 410:60 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:417:17: 417:33 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:389:37: 389:44 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:418:17: 418:34 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:392:33: 392:60 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:418:17: 418:34 note: in this expansion of rngstepp! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:407:37: 407:44 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:419:17: 419:34 note: in this expansion of rngstepn! (defined in src/isaac.rs)
src/isaac.rs:373:42: 373:53 error: the type of this value must be known in this context
src/isaac.rs:373                 *self.mem.get_unchecked((($x >> 3).0 as usize) & (RAND_SIZE_64 - 1))
                                                          ^~~~~~~~~~~
src/isaac.rs:410:33: 410:60 note: in this expansion of ind! (defined in src/isaac.rs)
src/isaac.rs:419:17: 419:34 note: in this expansion of rngstepn! (defined in src/isaac.rs)
error: aborting due to 16 previous errors
Could not compile `rand`.
@SimonSapin
Copy link
Contributor Author

Also builds fine on 1.5.0 and 1.6.0-beta.1

@SimonSapin
Copy link
Contributor Author

402259d from #30523 is suspicious.

@SimonSapin
Copy link
Contributor Author

@eddyb pointed out on IRC that the real culprit is the new impls at https://github.com/rust-lang/rust/pull/30523/files#diff-0cfd5773528ef167f36c81b535a97a3dR127 which should be commented again until #23545 is fixed.

@solson
Copy link
Member

solson commented Jan 6, 2016

There's a fix in #30733.

@erickt erickt added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jan 6, 2016
@alexcrichton alexcrichton added I-nominated T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 10, 2016
@alexcrichton
Copy link
Member

Nominating for some discussion, but if there already has been discussion and I missed out please feel free to un-nominate :)

@eddyb
Copy link
Member

eddyb commented Jan 10, 2016

@alexcrichton We're currently waiting for a new nightly.

@SimonSapin
Copy link
Contributor Author

@alexcrichton this was discussed informally on IRC:

Previously, Wrapping(1_u32) << 2 would be unambiguous since Shl<usize> was the only Shl<_> trait implemented for Wrapping<u32>. #30523 added more impls such as Shl<u8>, so that expression became ambiguous and causes a type error.

#23545 is about resolving the ambiguity somehow (maybe defaulting to u32?) to avoid the compiler error. Until that’s done, #30733 removes (comments out) all but one impl again. #30733 has already landed in master, but has not reach the nightly channel yet. (multirust update today on Jan 11 gives me rustc 1.7.0-nightly (d5e2290 2016-01-04))

@alexcrichton
Copy link
Member

Thanks for the info @eddyb and @SimonSapin! I'd personally prefer to keep those impls (e.g. not have anything commented out), but may be worth discussing and perhaps holding off that change until #23545 is handled.

@alexcrichton
Copy link
Member

The libs team discussed this in triage yesterday and the conclusion was that the current state is where we'd like to be. We'll hold off on adding the relevant impls until #23545 is dealt with, and otherwise this has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants