Skip to content

Commit f5e0b76

Browse files
committed
Stabilize default_alloc_error_handler
Closes #66741
1 parent ce1a7e4 commit f5e0b76

File tree

8 files changed

+5
-55
lines changed

8 files changed

+5
-55
lines changed

compiler/rustc_error_messages/locales/en-US/metadata.ftl

-6
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ metadata_conflicting_alloc_error_handler =
166166
metadata_global_alloc_required =
167167
no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
168168
169-
metadata_alloc_func_required =
170-
`#[alloc_error_handler]` function required, but not found
171-
172-
metadata_missing_alloc_error_handler =
173-
use `#![feature(default_alloc_error_handler)]` for a default error handler
174-
175169
metadata_no_transitive_needs_dep =
176170
the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`
177171

compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ declare_features! (
126126
(accepted, copy_closures, "1.26.0", Some(44490), None),
127127
/// Allows `crate` in paths.
128128
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
129+
/// Allows rustc to inject a default alloc_error_handler
130+
(accepted, default_alloc_error_handler, "CURRENT_RUSTC_VERSION", Some(66741), None),
129131
/// Allows using assigning a default type to type parameters in algebraic data type definitions.
130132
(accepted, default_type_params, "1.0.0", None, None),
131133
/// Allows `#[deprecated]` attribute.

compiler/rustc_feature/src/active.rs

-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,6 @@ declare_features! (
366366
(active, debugger_visualizer, "1.62.0", Some(95939), None),
367367
/// Allows declarative macros 2.0 (`macro`).
368368
(active, decl_macro, "1.17.0", Some(39412), None),
369-
/// Allows rustc to inject a default alloc_error_handler
370-
(active, default_alloc_error_handler, "1.48.0", Some(66741), None),
371369
/// Allows default type parameters to influence type inference.
372370
(active, default_type_parameter_fallback, "1.3.0", Some(27336), None),
373371
/// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait

compiler/rustc_metadata/src/creader.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
//! Validates all used crates and extern libraries and loads their metadata
22
33
use crate::errors::{
4-
AllocFuncRequired, ConflictingAllocErrorHandler, ConflictingGlobalAlloc, CrateNotPanicRuntime,
5-
GlobalAllocRequired, MissingAllocErrorHandler, NoMultipleAllocErrorHandler,
6-
NoMultipleGlobalAlloc, NoPanicStrategy, NoTransitiveNeedsDep, NotProfilerRuntime,
7-
ProfilerBuiltinsNeedsCore,
4+
ConflictingAllocErrorHandler, ConflictingGlobalAlloc, CrateNotPanicRuntime,
5+
GlobalAllocRequired, NoMultipleAllocErrorHandler, NoMultipleGlobalAlloc, NoPanicStrategy,
6+
NoTransitiveNeedsDep, NotProfilerRuntime, ProfilerBuiltinsNeedsCore,
87
};
98
use crate::locator::{CrateError, CrateLocator, CratePaths};
109
use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob};
@@ -892,10 +891,6 @@ impl<'a> CrateLoader<'a> {
892891
} else {
893892
// The alloc crate provides a default allocation error handler if
894893
// one isn't specified.
895-
if !self.sess.features_untracked().default_alloc_error_handler {
896-
self.sess.emit_err(AllocFuncRequired);
897-
self.sess.emit_note(MissingAllocErrorHandler);
898-
}
899894
self.cstore.alloc_error_handler_kind = Some(AllocatorKind::Default);
900895
}
901896
}

compiler/rustc_metadata/src/errors.rs

-8
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,6 @@ pub struct ConflictingAllocErrorHandler {
371371
#[diag(metadata_global_alloc_required)]
372372
pub struct GlobalAllocRequired;
373373

374-
#[derive(Diagnostic)]
375-
#[diag(metadata_alloc_func_required)]
376-
pub struct AllocFuncRequired;
377-
378-
#[derive(Diagnostic)]
379-
#[diag(metadata_missing_alloc_error_handler)]
380-
pub struct MissingAllocErrorHandler;
381-
382374
#[derive(Diagnostic)]
383375
#[diag(metadata_no_transitive_needs_dep)]
384376
pub struct NoTransitiveNeedsDep<'a> {

src/test/ui/allocator/no_std-alloc-error-handler-default.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
// only-linux
77
// compile-flags:-C panic=abort
88
// aux-build:helper.rs
9-
// gate-test-default_alloc_error_handler
109

1110
#![feature(start, rustc_private, new_uninit, panic_info_message, lang_items)]
12-
#![feature(default_alloc_error_handler)]
1311
#![no_std]
1412

1513
extern crate alloc;

src/test/ui/missing/missing-alloc_error_handler.rs

-23
This file was deleted.

src/test/ui/missing/missing-alloc_error_handler.stderr

-6
This file was deleted.

0 commit comments

Comments
 (0)