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 #69846

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7ca1b2f
Don't use static crt by default when build proc-macro.
12101111 Mar 3, 2020
7996df9
Run format.
12101111 Mar 3, 2020
89aebbd
Only run this test on musl
12101111 Mar 3, 2020
84349cc
Remove trailing whitespace.
12101111 Mar 3, 2020
a755d8d
Support type search for arguments and returned types
GuillaumeGomez Feb 23, 2020
612d375
Update JS results tester
GuillaumeGomez Feb 23, 2020
5892d0d
Add tests for new of variables
GuillaumeGomez Feb 23, 2020
71b9512
formatting
GuillaumeGomez Feb 23, 2020
6ffe9f3
Rename render::Type to improve naming
GuillaumeGomez Mar 3, 2020
f63b88c
Permit attributes on 'if' expressions
Aaron1011 Feb 16, 2020
e912d9d
Test #[allow(unused)] on `if` expression
Aaron1011 Feb 16, 2020
e9ec47b
Test that stmt_expr_attrs properly gates if-attrs
Aaron1011 Feb 19, 2020
9a299e4
Test trying to cfg-remove an `if` expression
Aaron1011 Feb 19, 2020
b00f674
Remove recovery test
Aaron1011 Feb 19, 2020
e11cdfd
Add run-pass test suggested by @joshtriplett
Aaron1011 Feb 19, 2020
7f19358
Move if-attr tests to their own directory
Aaron1011 Feb 19, 2020
1b681d6
Test that cfg-gated if-exprs are not type-checked
Aaron1011 Feb 19, 2020
37c2c38
Extent pretty-print test
Aaron1011 Feb 19, 2020
66b152c
Fix tabs
Aaron1011 Feb 19, 2020
e50fd5a
Update stderr
Aaron1011 Mar 4, 2020
dbed65a
Simplify checking of crt_static_feature()
12101111 Mar 8, 2020
7a89bf1
override flags from compiletest
12101111 Mar 8, 2020
0468929
move error allocation test to error.rs
RalfJung Mar 4, 2020
938f852
miri validation: debug-complain about unexpected errors
RalfJung Mar 4, 2020
4971d03
fix some cases of unexpected exceptions leaving validation
RalfJung Mar 5, 2020
85e1466
Fix typo
RalfJung Mar 6, 2020
ed3014a
use static strings instead of tcx
RalfJung Mar 6, 2020
75e6cfc
run crt-static test on all target
12101111 Mar 9, 2020
58303b7
Use slices in preference to 0-terminated strings
tmiasko Mar 6, 2020
e54a829
Avoid unnecessary interning of enum variant part id
tmiasko Mar 6, 2020
676b9bc
unix: Don't override existing SIGSEGV/BUS handlers
cuviper Mar 3, 2020
e5999e1
Rollup merge of #69201 - Aaron1011:feature/permit-if-attr, r=Centril
Centril Mar 9, 2020
b17a0f7
Rollup merge of #69402 - GuillaumeGomez:extend-search, r=kinnison
Centril Mar 9, 2020
d839cba
Rollup merge of #69519 - 12101111:remove-proc-macro-check, r=nagisa,s…
Centril Mar 9, 2020
d9a36ae
Rollup merge of #69685 - cuviper:soft-segv, r=sfackler
Centril Mar 9, 2020
e60915c
Rollup merge of #69762 - RalfJung:validity-errors, r=oli-obk
Centril Mar 9, 2020
6cf5a14
Rollup merge of #69779 - tmiasko:di-cstr, r=nagisa
Centril Mar 9, 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
27 changes: 23 additions & 4 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ fn print_backtrace(backtrace: &mut Backtrace) {
eprintln!("\n\nAn error occurred in miri:\n{:?}", backtrace);
}

impl From<ErrorHandled> for InterpErrorInfo<'tcx> {
impl From<ErrorHandled> for InterpErrorInfo<'_> {
fn from(err: ErrorHandled) -> Self {
match err {
ErrorHandled::Reported => err_inval!(ReferencedConstant),
Expand Down Expand Up @@ -291,7 +291,7 @@ pub enum InvalidProgramInfo<'tcx> {
Layout(layout::LayoutError<'tcx>),
}

impl fmt::Debug for InvalidProgramInfo<'tcx> {
impl fmt::Debug for InvalidProgramInfo<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use InvalidProgramInfo::*;
match self {
Expand Down Expand Up @@ -321,6 +321,8 @@ pub enum UndefinedBehaviorInfo {
RemainderByZero,
/// Overflowing inbounds pointer arithmetic.
PointerArithOverflow,
/// Invalid metadata in a wide pointer (using `str` to avoid allocations).
InvalidMeta(&'static str),
}

impl fmt::Debug for UndefinedBehaviorInfo {
Expand All @@ -338,6 +340,7 @@ impl fmt::Debug for UndefinedBehaviorInfo {
DivisionByZero => write!(f, "dividing by zero"),
RemainderByZero => write!(f, "calculating the remainder with a divisor of zero"),
PointerArithOverflow => write!(f, "overflowing in-bounds pointer arithmetic"),
InvalidMeta(msg) => write!(f, "invalid metadata in wide pointer: {}", msg),
}
}
}
Expand All @@ -354,8 +357,8 @@ pub enum UnsupportedOpInfo<'tcx> {
Unsupported(String),

/// When const-prop encounters a situation it does not support, it raises this error.
/// This must not allocate for performance reasons.
ConstPropUnsupported(&'tcx str),
/// This must not allocate for performance reasons (hence `str`, not `String`).
ConstPropUnsupported(&'static str),

// -- Everything below is not categorized yet --
FunctionAbiMismatch(Abi, Abi),
Expand Down Expand Up @@ -612,3 +615,19 @@ impl fmt::Debug for InterpError<'_> {
}
}
}

impl InterpError<'_> {
/// Some errors allocate to be created as they contain free-form strings.
/// And sometimes we want to be sure that did not happen as it is a
/// waste of resources.
pub fn allocates(&self) -> bool {
match self {
InterpError::MachineStop(_)
| InterpError::Unsupported(UnsupportedOpInfo::Unsupported(_))
| InterpError::Unsupported(UnsupportedOpInfo::ValidationFailure(_))
| InterpError::UndefinedBehavior(UndefinedBehaviorInfo::Ub(_))
| InterpError::UndefinedBehavior(UndefinedBehaviorInfo::UbExperimental(_)) => true,
_ => false,
}
}
}
Loading