-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This code compiles on nightly today but it should not, because Foo
is not Copy
:
#![feature(const_fn)]
struct Foo(usize);
const fn get(x: Foo) -> usize {
x.0
}
const X: Foo = Foo(22);
static Y: usize = get(*&X); // also a problem for `const Y`
fn main() {
}
Note that the get(*&X)
in a function body properly results in an error.
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.