Skip to content

Commit

Permalink
Stabilize default_alloc_error_handler
Browse files Browse the repository at this point in the history
Closes #66741
  • Loading branch information
Amanieu committed Nov 3, 2022
1 parent ce1a7e4 commit f5e0b76
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 55 deletions.
6 changes: 0 additions & 6 deletions compiler/rustc_error_messages/locales/en-US/metadata.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ metadata_conflicting_alloc_error_handler =
metadata_global_alloc_required =
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
metadata_alloc_func_required =
`#[alloc_error_handler]` function required, but not found
metadata_missing_alloc_error_handler =
use `#![feature(default_alloc_error_handler)]` for a default error handler
metadata_no_transitive_needs_dep =
the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ declare_features! (
(accepted, copy_closures, "1.26.0", Some(44490), None),
/// Allows `crate` in paths.
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
/// Allows rustc to inject a default alloc_error_handler
(accepted, default_alloc_error_handler, "CURRENT_RUSTC_VERSION", Some(66741), None),
/// Allows using assigning a default type to type parameters in algebraic data type definitions.
(accepted, default_type_params, "1.0.0", None, None),
/// Allows `#[deprecated]` attribute.
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ declare_features! (
(active, debugger_visualizer, "1.62.0", Some(95939), None),
/// Allows declarative macros 2.0 (`macro`).
(active, decl_macro, "1.17.0", Some(39412), None),
/// Allows rustc to inject a default alloc_error_handler
(active, default_alloc_error_handler, "1.48.0", Some(66741), None),
/// Allows default type parameters to influence type inference.
(active, default_type_parameter_fallback, "1.3.0", Some(27336), None),
/// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait
Expand Down
11 changes: 3 additions & 8 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//! Validates all used crates and extern libraries and loads their metadata

use crate::errors::{
AllocFuncRequired, ConflictingAllocErrorHandler, ConflictingGlobalAlloc, CrateNotPanicRuntime,
GlobalAllocRequired, MissingAllocErrorHandler, NoMultipleAllocErrorHandler,
NoMultipleGlobalAlloc, NoPanicStrategy, NoTransitiveNeedsDep, NotProfilerRuntime,
ProfilerBuiltinsNeedsCore,
ConflictingAllocErrorHandler, ConflictingGlobalAlloc, CrateNotPanicRuntime,
GlobalAllocRequired, NoMultipleAllocErrorHandler, NoMultipleGlobalAlloc, NoPanicStrategy,
NoTransitiveNeedsDep, NotProfilerRuntime, ProfilerBuiltinsNeedsCore,
};
use crate::locator::{CrateError, CrateLocator, CratePaths};
use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob};
Expand Down Expand Up @@ -892,10 +891,6 @@ impl<'a> CrateLoader<'a> {
} else {
// The alloc crate provides a default allocation error handler if
// one isn't specified.
if !self.sess.features_untracked().default_alloc_error_handler {
self.sess.emit_err(AllocFuncRequired);
self.sess.emit_note(MissingAllocErrorHandler);
}
self.cstore.alloc_error_handler_kind = Some(AllocatorKind::Default);
}
}
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_metadata/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,6 @@ pub struct ConflictingAllocErrorHandler {
#[diag(metadata_global_alloc_required)]
pub struct GlobalAllocRequired;

#[derive(Diagnostic)]
#[diag(metadata_alloc_func_required)]
pub struct AllocFuncRequired;

#[derive(Diagnostic)]
#[diag(metadata_missing_alloc_error_handler)]
pub struct MissingAllocErrorHandler;

#[derive(Diagnostic)]
#[diag(metadata_no_transitive_needs_dep)]
pub struct NoTransitiveNeedsDep<'a> {
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/allocator/no_std-alloc-error-handler-default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
// only-linux
// compile-flags:-C panic=abort
// aux-build:helper.rs
// gate-test-default_alloc_error_handler

#![feature(start, rustc_private, new_uninit, panic_info_message, lang_items)]
#![feature(default_alloc_error_handler)]
#![no_std]

extern crate alloc;
Expand Down
23 changes: 0 additions & 23 deletions src/test/ui/missing/missing-alloc_error_handler.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/ui/missing/missing-alloc_error_handler.stderr

This file was deleted.

0 comments on commit f5e0b76

Please sign in to comment.