Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #68137

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7a46a0b
Inline catching panics into std::catch_unwind
Mark-Simulacrum Dec 26, 2019
e177b91
Avoid over-aligning the return value in the -Cpanic=abort case
Mark-Simulacrum Dec 26, 2019
85ec3ec
Test catch_unwind vanishing
Amanieu Dec 26, 2019
3109036
Ignore PAL lint for std::panicking
Mark-Simulacrum Dec 26, 2019
f3da0ea
Mark cleanup cold
Mark-Simulacrum Dec 26, 2019
5e320df
fixup! Inline catching panics into std::catch_unwind
Mark-Simulacrum Dec 26, 2019
4ad9a3c
Fix some minor issues
Amanieu Dec 26, 2019
5be658a
Ignore broken no-landing-pads test
Amanieu Dec 29, 2019
da5b1a4
Apply review feedback
Amanieu Jan 7, 2020
1ffb9cf
rustdoc: improve stability mark arrows
liigo Jan 7, 2020
ae3a53f
rustdoc: use another stability mark arrow, no rotate.
liigo Jan 9, 2020
088a180
Add suggestions when encountering chained comparisons
varkor Jan 11, 2020
7ba25ac
Revert "Rollup merge of #67727 - Dylan-DPC:stabilise/remove_item, r=a…
tesuji Jan 10, 2020
3a2af32
canonicalize some lint imports
Centril Jan 5, 2020
b93addb
move in_derive_expansion as Span method
Centril Jan 9, 2020
c151782
reduce diversity in linting methods
Centril Jan 9, 2020
6f1a79c
GlobalCtxt: Erase `LintStore` type.
Centril Jan 9, 2020
03bdfe9
move logic to LintLevelsBuilder
Centril Jan 9, 2020
f577b44
move LintSource to levels
Centril Jan 9, 2020
eee84fe
move struct_lint_level to levels.rs
Centril Jan 9, 2020
16bf278
inline maybe_lint_level_root
Centril Jan 9, 2020
03dfa64
lints: promote levels.rs to lint.rs & extract passes.rs
Centril Jan 9, 2020
8c12c42
{rustc::lint -> rustc_lint}::internal
Centril Jan 9, 2020
f58db20
move rustc::lint::{context, passes} to rustc_lint.
Centril Jan 9, 2020
b592359
lints: move a comment
Centril Jan 9, 2020
8be2a04
pacify the parallel compiler
Centril Jan 9, 2020
51078ce
fix ui-fulldeps & tests fallout
Centril Jan 10, 2020
74823fc
Diagnostics should start lowercase
varkor Jan 10, 2020
84c8849
Diagnostics should not end with a full stop
varkor Jan 10, 2020
7876fa6
Add backticks in appropriate places
varkor Jan 10, 2020
7d2c75d
Fix formatting ellipses at the end of some diagnostics
varkor Jan 10, 2020
a6924c7
Appease tidy
varkor Jan 10, 2020
6ea4dba
Update `output-default.json` and rustdoc test
varkor Jan 10, 2020
f5f2fa7
Rollup merge of #67502 - Mark-Simulacrum:opt-catch, r=alexcrichton
JohnTitor Jan 11, 2020
a1f4bb3
Rollup merge of #67959 - liigo:patch-13, r=GuillaumeGomez
JohnTitor Jan 11, 2020
97c5332
Rollup merge of #68045 - Centril:liberate-lints, r=Mark-Simulacrum
JohnTitor Jan 11, 2020
06688db
Rollup merge of #68089 - lzutao:revert-remote_item, r=sfackler
JohnTitor Jan 11, 2020
7dcb9eb
Rollup merge of #68096 - varkor:diagnostic-cleanup, r=Centril
JohnTitor Jan 11, 2020
a727425
Rollup merge of #68108 - varkor:chained-comparison-suggestions, r=Cen…
JohnTitor Jan 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,7 @@ dependencies = [
name = "panic_abort"
version = "0.0.0"
dependencies = [
"cfg-if",
"compiler_builtins",
"core",
"libc",
Expand Down Expand Up @@ -3663,6 +3664,7 @@ dependencies = [
"log",
"rustc",
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
"rustc_feature",
"rustc_hir",
Expand Down Expand Up @@ -3788,6 +3790,7 @@ dependencies = [
"rustc_error_codes",
"rustc_errors",
"rustc_hir",
"rustc_lint",
"rustc_metadata",
"rustc_span",
"syntax",
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![feature(associated_type_bounds)]
#![feature(binary_heap_into_iter_sorted)]
#![feature(binary_heap_drain_sorted)]
#![feature(vec_remove_item)]

use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,13 +1696,14 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(vec_remove_item)]
/// let mut vec = vec![1, 2, 3, 1];
///
/// vec.remove_item(&1);
///
/// assert_eq!(vec, vec![2, 3, 1]);
/// ```
#[stable(feature = "vec_remove_item", since = "1.42.0")]
#[unstable(feature = "vec_remove_item", reason = "recently added", issue = "40062")]
pub fn remove_item<V>(&mut self, item: &V) -> Option<T>
where
T: PartialEq<V>,
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// Here we explicitly #[cfg]-out this whole crate when testing. If we don't do
// this, both the generated test artifact and the linked libtest (which
// transitively includes libcore) will both define the same set of lang items,
// and this will cause the E0152 "duplicate lang item found" error. See
// and this will cause the E0152 "found duplicate lang item" error. See
// discussion in #50466 for details.
//
// This cfg won't affect doc tests.
Expand Down
1 change: 1 addition & 0 deletions src/libpanic_abort/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ doc = false
core = { path = "../libcore" }
libc = { version = "0.2", default-features = false }
compiler_builtins = "0.1.0"
cfg-if = "0.1.8"
17 changes: 7 additions & 10 deletions src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
#![feature(staged_api)]
#![feature(rustc_attrs)]

// Rust's "try" function, but if we're aborting on panics we just call the
// function as there's nothing else we need to do here.
use core::any::Any;

// We need the definition of TryPayload for __rust_panic_cleanup.
include!("../libpanic_unwind/payload.rs");

#[rustc_std_internal_symbol]
pub unsafe extern "C" fn __rust_maybe_catch_panic(
f: fn(*mut u8),
data: *mut u8,
_data_ptr: *mut usize,
_vtable_ptr: *mut usize,
) -> u32 {
f(data);
0
pub unsafe extern "C" fn __rust_panic_cleanup(_: TryPayload) -> *mut (dyn Any + Send + 'static) {
unreachable!()
}

// "Leak" the payload and shim to the relevant abort on the platform in
Expand Down
4 changes: 0 additions & 4 deletions src/libpanic_unwind/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ use alloc::boxed::Box;
use core::any::Any;
use core::intrinsics;

pub fn payload() -> *mut u8 {
core::ptr::null_mut()
}

pub unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> {
intrinsics::abort()
}
Expand Down
4 changes: 0 additions & 4 deletions src/libpanic_unwind/emcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ static EXCEPTION_TYPE_INFO: TypeInfo = TypeInfo {
name: b"rust_panic\0".as_ptr(),
};

pub fn payload() -> *mut u8 {
ptr::null_mut()
}

pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
assert!(!ptr.is_null());
let adjusted_ptr = __cxa_begin_catch(ptr as *mut libc::c_void);
Expand Down
5 changes: 0 additions & 5 deletions src/libpanic_unwind/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

use alloc::boxed::Box;
use core::any::Any;
use core::ptr;

use crate::dwarf::eh::{self, EHAction, EHContext};
use libc::{c_int, uintptr_t};
Expand Down Expand Up @@ -82,10 +81,6 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
}
}

pub fn payload() -> *mut u8 {
ptr::null_mut()
}

pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
let my_ep = ptr as *mut Exception;
let cause = (*my_ep).cause.take();
Expand Down
4 changes: 0 additions & 4 deletions src/libpanic_unwind/hermit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ use alloc::boxed::Box;
use core::any::Any;
use core::ptr;

pub fn payload() -> *mut u8 {
ptr::null_mut()
}

pub unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> {
extern "C" {
pub fn __rust_abort() -> !;
Expand Down
36 changes: 11 additions & 25 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@
#![feature(libc)]
#![feature(nll)]
#![feature(panic_unwind)]
#![feature(raw)]
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(unwind_attributes)]
#![feature(rustc_attrs)]
#![feature(raw)]
#![panic_runtime]
#![feature(panic_runtime)]

use alloc::boxed::Box;
use core::intrinsics;
use core::mem;
use core::any::Any;
use core::panic::BoxMeUp;
use core::raw;

// If adding to this list, you should also look at the list of TryPayload types
// defined in payload.rs and likely add to there as well.
cfg_if::cfg_if! {
if #[cfg(target_os = "emscripten")] {
#[path = "emcc.rs"]
Expand All @@ -60,30 +61,15 @@ cfg_if::cfg_if! {
}
}

include!("payload.rs");

mod dwarf;

// Entry point for catching an exception, implemented using the `try` intrinsic
// in the compiler.
//
// The interaction between the `payload` function and the compiler is pretty
// hairy and tightly coupled, for more information see the compiler's
// implementation of this.
#[no_mangle]
pub unsafe extern "C" fn __rust_maybe_catch_panic(
f: fn(*mut u8),
data: *mut u8,
data_ptr: *mut usize,
vtable_ptr: *mut usize,
) -> u32 {
let mut payload = imp::payload();
if intrinsics::r#try(f, data, &mut payload as *mut _ as *mut _) == 0 {
0
} else {
let obj = mem::transmute::<_, raw::TraitObject>(imp::cleanup(payload));
*data_ptr = obj.data as usize;
*vtable_ptr = obj.vtable as usize;
1
}
pub unsafe extern "C" fn __rust_panic_cleanup(
payload: TryPayload,
) -> *mut (dyn Any + Send + 'static) {
Box::into_raw(imp::cleanup(payload))
}

// Entry point for raising an exception, just delegates to the platform-specific
Expand Down
21 changes: 21 additions & 0 deletions src/libpanic_unwind/payload.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Type definition for the payload argument of the try intrinsic.
//
// This must be kept in sync with the implementations of the try intrinsic.
//
// This file is included by both panic runtimes and libstd. It is part of the
// panic runtime ABI.
cfg_if::cfg_if! {
if #[cfg(target_os = "emscripten")] {
type TryPayload = *mut u8;
} else if #[cfg(target_arch = "wasm32")] {
type TryPayload = *mut u8;
} else if #[cfg(target_os = "hermit")] {
type TryPayload = *mut u8;
} else if #[cfg(all(target_env = "msvc", target_arch = "aarch64"))] {
type TryPayload = *mut u8;
} else if #[cfg(target_env = "msvc")] {
type TryPayload = [u64; 2];
} else {
type TryPayload = *mut u8;
}
}
4 changes: 0 additions & 4 deletions src/libpanic_unwind/seh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
_CxxThrowException(throw_ptr, &mut THROW_INFO as *mut _ as *mut _);
}

pub fn payload() -> [u64; 2] {
[0; 2]
}

pub unsafe fn cleanup(payload: [u64; 2]) -> Box<dyn Any + Send> {
mem::transmute(raw::TraitObject { data: payload[0] as *mut _, vtable: payload[1] as *mut _ })
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! item.

use crate::hir::map::Map;
use crate::lint::builtin::UNUSED_ATTRIBUTES;
use crate::ty::query::Providers;
use crate::ty::TyCtxt;

Expand All @@ -16,6 +15,7 @@ use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::DUMMY_HIR_ID;
use rustc_hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind};
use rustc_session::lint::builtin::UNUSED_ATTRIBUTES;
use rustc_span::symbol::sym;
use rustc_span::Span;
use syntax::ast::Attribute;
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#![feature(thread_local)]
#![feature(trace_macros)]
#![feature(trusted_len)]
#![feature(vec_remove_item)]
#![feature(stmt_expr_attributes)]
#![feature(integer_atomics)]
#![feature(test)]
Expand All @@ -71,8 +72,6 @@ extern crate rustc_data_structures;
#[macro_use]
extern crate log;
#[macro_use]
extern crate syntax;
#[macro_use]
extern crate smallvec;

#[cfg(test)]
Expand Down
Loading