diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2018-04-30 10:55:24 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2018-06-03 13:46:19 +0200 |
| commit | e44ad61a2d8e3bac1d2cbf2467a7202250b8a77e (patch) | |
| tree | e9b2eede0e5f2703640bb76f3e7f1b1c8e23fbd2 /src/librustc/middle | |
| parent | 3575be60eab140e69e5a75fe5c3b4119c2a17179 (diff) | |
| download | rust-e44ad61a2d8e3bac1d2cbf2467a7202250b8a77e.tar.gz rust-e44ad61a2d8e3bac1d2cbf2467a7202250b8a77e.zip | |
implement #[panic_implementation]
Diffstat (limited to 'src/librustc/middle')
| -rw-r--r-- | src/librustc/middle/dead.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/lang_items.rs | 5 | ||||
| -rw-r--r-- | src/librustc/middle/weak_lang_items.rs | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index e3b20789714..7ebc0d4a4de 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -284,7 +284,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt, id: ast::NodeId, attrs: &[ast::Attribute]) -> bool { - if attr::contains_name(attrs, "lang") { + if attr::contains_name(attrs, "lang") || attr::contains_name(attrs, "panic_implementation") { return true; } diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index d70f994e87b..fe676919a7d 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -185,6 +185,8 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> { if let Some(value) = attribute.value_str() { return Some((value, attribute.span)); } + } else if attribute.check_name("panic_implementation") { + return Some((Symbol::intern("panic_impl"), attribute.span)) } } @@ -299,7 +301,8 @@ language_item_table! { // lang item, but do not have it defined. PanicFnLangItem, "panic", panic_fn; PanicBoundsCheckFnLangItem, "panic_bounds_check", panic_bounds_check_fn; - PanicFmtLangItem, "panic_fmt", panic_fmt; + PanicInfoLangItem, "panic_info", panic_info; + PanicImplLangItem, "panic_impl", panic_impl; ExchangeMallocFnLangItem, "exchange_malloc", exchange_malloc_fn; BoxFreeFnLangItem, "box_free", box_free_fn; diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 42e4d3861ba..3c2ea047218 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -148,7 +148,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> { ) } weak_lang_items! { - panic_fmt, PanicFmtLangItem, rust_begin_unwind; + panic_impl, PanicImplLangItem, rust_begin_unwind; eh_personality, EhPersonalityLangItem, rust_eh_personality; eh_unwind_resume, EhUnwindResumeLangItem, rust_eh_unwind_resume; oom, OomLangItem, rust_oom; |
