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

Rust 1.18 regression, size of Self cannot be statically determined #41805

Closed
brson opened this issue May 7, 2017 · 5 comments
Closed

Rust 1.18 regression, size of Self cannot be statically determined #41805

brson opened this issue May 7, 2017 · 5 comments
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. relnotes Marks issues that should be documented in the release notes of the next release. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@brson
Copy link
Contributor

brson commented May 7, 2017

https://github.com/AskePit/note_gen

101 brian@ip-10-145-43-250:~/dev/note_gen⟫ git log -1
commit 9cb62bd28f5bfe919ed27b267500e596af3d290b
Author: Shalakin Nikolay <askepit@gmail.com>
Date:   Wed Mar 1 22:02:16 2017 +0300

    Update README.md
brian@ip-10-145-43-250:/mnt2/dev⟫ rustc +beta -Vv
rustc 1.18.0-beta.1 (4dce67253 2017-04-25)
binary: rustc
commit-hash: 4dce67253d67785c74c8d270c38d774edd0deed8
commit-date: 2017-04-25
host: x86_64-unknown-linux-gnu
release: 1.18.0-beta.1
LLVM version: 3.9
brian@ip-10-145-43-250:~/dev/note_gen⟫ cargo +beta test
   Compiling libc v0.2.20
   Compiling rand v0.3.15
   Compiling note_gen v0.1.0 (file:///mnt2/dev/note_gen)
error[E0161]: cannot move a value of type Self: the size of Self cannot be statically determined
  --> src/main.rs:12:16
   |
12 |            String::from(Self::rand().to_str())
   |                         ^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `note_gen`.

To learn more, run the command again with --verbose.

cc @AskePit

@brson brson added regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 7, 2017
@Mark-Simulacrum
Copy link
Member

Introduced in 910c481 -- rollup PR #41246. Most likely caused by #41232, cc @arielb1

@arielb1
Copy link
Contributor

arielb1 commented May 8, 2017

This looks correct. After all, this variant does not work on stable too:

trait Item {
	fn to_str(&self) -> &str;
	fn count() -> i32;
	fn rand() -> Self;
	fn rand_str() -> String {
		let x = Self::rand(); //~ ERROR the trait bound `Self: std::marker::Sized` is not satisfied
		String::from(x.to_str())
	}
}

I don't think you can actually implement this on an unsized type, however.

@nikomatsakis
Copy link
Contributor

I agree that the new error seems correct.

@nagisa
Copy link
Member

nagisa commented May 18, 2017

It seems like the behaviour is intended. If this is indeed a regression we should document it in the release notes.

@nagisa nagisa added P-high High priority relnotes Marks issues that should be documented in the release notes of the next release. labels May 18, 2017
@brson
Copy link
Contributor Author

brson commented May 25, 2017

I noted it on the relnotes thread. Thanks for investigating.

@brson brson closed this as completed May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. relnotes Marks issues that should be documented in the release notes of the next release. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants