-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking issue for the #[alloc_error_handler] attribute (for no_std + liballoc) #51540
Copy link
Copy link
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.S-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.WG-embeddedWorking group: Embedded systemsWorking group: Embedded systemsdisposition-closeThis PR / issue is in PFCP or FCP with a disposition to close it.This PR / issue is in PFCP or FCP with a disposition to close it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Metadata
Metadata
Assignees
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.S-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.WG-embeddedWorking group: Embedded systemsWorking group: Embedded systemsdisposition-closeThis PR / issue is in PFCP or FCP with a disposition to close it.This PR / issue is in PFCP or FCP with a disposition to close it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This attribute is mandatory when using the
alloccrate without thestdcrate. It is used like this:Implementation PR: #52191
Blocking issues
unsafe fnwhich is then unsoundly invoked #134225Original issue:
In a
no_stdprogram or staticlib, linking to thealloccrate may cause this error:This is fixed by providing the
oomlang item, which is is normally provided by thestdcrate (where it calls a dynamically-settable hook #51245, then aborts). This is called byalloc::alloc::handle_alloc_error(which is called byVecand others on memory allocation failure).However, defining a lang item is an unstable feature.
Possible solutions include:
#[panic_implementation]attribute:The downside is that this is one more mandatory hoop to jump through for
no_stdprogram that would have been fine with a default hook that aborts.Movestd’s dynamically-settable hook intoalloc: Move OOM handling to liballoc and remove theoomlang item #51607. The downside is some mandatory space overhead.