-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Don't remove generics unless certain they come from a statically linked lib. #65781
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/ui/cross-crate/issue-64872/auxiliary/another_vtable_for_obj.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// compile-flags: -C debuginfo=2 --crate-type=rlib | ||
|
||
extern crate reexport_obj; | ||
use reexport_obj::Object; | ||
|
||
pub fn another_dyn_debug() { | ||
let ref u = 1_u32; | ||
let _d = &u as &dyn crate::Object; | ||
_d.method() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// compile-flags: -C debuginfo=2 --crate-type=rlib | ||
|
||
pub trait Object { fn method(&self) { } } | ||
|
||
impl Object for u32 { } | ||
impl Object for () { } | ||
impl<T> Object for &T { } | ||
|
||
pub fn unused() { | ||
let ref u = 0_u32; | ||
let _d = &u as &dyn crate::Object; | ||
_d.method() | ||
} |
5 changes: 5 additions & 0 deletions
5
src/test/ui/cross-crate/issue-64872/auxiliary/reexport_obj.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// compile-flags: -C debuginfo=2 -C prefer-dynamic --crate-type=dylib | ||
|
||
extern crate def_obj; | ||
|
||
pub use def_obj::Object; |
12 changes: 12 additions & 0 deletions
12
src/test/ui/cross-crate/issue-64872/chain-of-rlibs-and-dylibs.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// note that these aux-build directives must be in this order: the later crates | ||
// depend on the earlier ones. | ||
|
||
// aux-build:def_obj.rs | ||
// aux-build:rexport_obj.rs | ||
// aux-build:another_vtable_for_obj.rs | ||
|
||
extern crate another_vtable_for_obj; | ||
|
||
pub fn main() { | ||
another_vtable_for_obj::another_dyn_debug(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little worried that the new
-Z
flag is needed here, do you know what effect that'll have on general crate compilations? I think we still want to be sure that a debug mode compile shares as many generics as it possibly can, and release mode should be fine both before/after this change since no sharing happens.Basically do general
cargo build
scenarios still share generics amongst all of their rlib crates?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure they do not, since this test itself serves as evidence of a case where we see less sharing. I take that to be further work that would need to be addressed in say #65890