-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #122505 - oli-obk:visit_nested_body2, r=<try>
Don't walk the bodies of free constants for reachability. follow-up to #122371 we don't have generic constants yet, so we don't need to handle failure to eval a free constant. Associated consts and generic consts will be a different topic, that I will look into in a follow-up r? `@tmiasko`
- Loading branch information
Showing
8 changed files
with
161 additions
and
47 deletions.
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
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
16 changes: 16 additions & 0 deletions
16
tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.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,16 @@ | ||
//! This test checks that we do not monomorphize functions that are only | ||
//! used to evaluate static items, but never used in runtime code. | ||
//@compile-flags: --crate-type=lib -Copt-level=0 | ||
|
||
const fn foo() {} | ||
|
||
pub static FOO: () = foo(); | ||
|
||
// CHECK-NOT: define{{.*}}foo{{.*}} | ||
|
||
const fn bar() {} | ||
|
||
pub const BAR: () = bar(); | ||
|
||
// CHECK-NOT: define{{.*}}bar{{.*}} |
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