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

Miri error messages: avoid try terminology #71206

Merged
merged 2 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
8 changes: 4 additions & 4 deletions src/librustc_middle/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl fmt::Debug for InvalidProgramInfo<'_> {
Layout(ref err) => write!(f, "{}", err),
TransmuteSizeDiff(from_ty, to_ty) => write!(
f,
"tried to transmute from {:?} to {:?}, but their sizes differed",
"transmuting from {:?} to {:?}, which do not have the same size",
RalfJung marked this conversation as resolved.
Show resolved Hide resolved
from_ty, to_ty
),
}
Expand Down Expand Up @@ -431,7 +431,7 @@ impl fmt::Debug for UndefinedBehaviorInfo {
"using uninitialized data, but this operation requires initialized memory"
),
DeadLocal => write!(f, "accessing a dead local variable"),
ReadFromReturnPlace => write!(f, "tried to read from the return place"),
ReadFromReturnPlace => write!(f, "reading from return place"),
}
}
}
Expand Down Expand Up @@ -462,9 +462,9 @@ impl fmt::Debug for UnsupportedOpInfo {
match self {
Unsupported(ref msg) => write!(f, "{}", msg),
ReadForeignStatic(did) => {
write!(f, "tried to read from foreign (extern) static {:?}", did)
write!(f, "cannot read from foreign (extern) static {:?}", did)
}
NoMirFor(did) => write!(f, "could not load MIR for {:?}", did),
NoMirFor(did) => write!(f, "cannot load MIR for {:?}", did),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while it's true that we can't, maybe it would be more helpful to the user if we told them that "no MIR exists for {:?}" or " there is no MIR Body associated with {:?}"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since rlibs can have partial MIR I think we should not say "there is no MIR", just that we cannot get it... see my latest commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, good point

ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",),
ReadBytesAsPointer => write!(f, "unable to turn bytes into a pointer"),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
| ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
| tried to transmute from usize to &[u8], but their sizes differed
| transmuting from usize to &[u8], which do not have the same size
|
= note: `#[deny(const_err)]` on by default

Expand Down