Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
29d28f8
Make `cargo run` always available for binaries
joshka Mar 29, 2024
3a4a69a
Add config hover_show_adtFieldsOrVariants to handle hovering limitati…
roife Apr 6, 2024
3994fcb
Update tests and docs for hover_show_adtFieldsOrVariants
roife Apr 6, 2024
2b38652
fix: the fields or variants of ADT was not restricted by limitations …
roife Apr 6, 2024
a113612
fix: adjust the limitation for ADTs' fields to 5
roife Apr 7, 2024
a8e50cf
Handle panicking like rustc CTFE does
Noratrieb Mar 24, 2024
b6751b7
Fix missing function body in minicore
Veykril Mar 25, 2024
4a33c5f
Fixup some issues with minicore
Veykril Mar 26, 2024
ca53651
Fix #[rustc_const_panic_str] functions not actually being hooked
Veykril Apr 18, 2024
2efaa44
Implement BeginPanic for mir eval
Veykril Apr 19, 2024
c1a4ba5
fix: add a separate setting for enum variants
roife Apr 19, 2024
0e9d845
Add hovering limitations support for variants
roife Apr 19, 2024
f7f02c0
fix: remove space within `{}` when no fields in struct
roife Apr 20, 2024
570c725
try to generate more meaningful names
leviska Apr 20, 2024
846f804
add test with multiple names
leviska Apr 20, 2024
04de0ff
Peek for panic message in test output
Veykril Apr 19, 2024
8f21381
Use josh for subtree syncs
lnicola Apr 7, 2024
7c39263
Allow rust files to be used linkedProjects
Veykril Apr 21, 2024
3c0f2db
Auto merge of #17118 - Veykril:linked-rust-files, r=Veykril
bors Apr 21, 2024
92ace4b
Extract common fields out of ProjectWorkspace variants
Veykril Apr 21, 2024
0a29e6f
Support flychecking for cargo scripts
Veykril Apr 21, 2024
23f19a2
Auto merge of #17119 - Veykril:linked-rust-files, r=Veykril
bors Apr 21, 2024
7a3ad03
Auto merge of #17115 - leviska:json_is_not_rust_better_names, r=Veykril
bors Apr 21, 2024
8ea8c74
Auto merge of #16938 - Nilstrieb:dont-panic-tests, r=Veykril
bors Apr 21, 2024
a200391
Auto merge of #17025 - lnicola:josh, r=lnicola
bors Apr 21, 2024
2d4723b
chore: add some `tracing` to project loading
davidbarsky Apr 18, 2024
afa2a89
Auto merge of #17102 - davidbarsky:david/add-some-tracing-to-project-…
bors Apr 22, 2024
9e212e0
different error code based on variant
Apr 23, 2024
5a315da
Auto merge of #17131 - bzy-debug:issue-17107, r=lnicola
bors Apr 24, 2024
410f71f
fix: move no_std check out of loop
joshka Apr 24, 2024
ec1a29b
Drop unknown lifetimes when rendering generic args
Veykril Apr 24, 2024
1709e37
Auto merge of #16972 - joshka:cargo-run-runnable, r=Veykril
bors Apr 25, 2024
10e82da
Add inlay hints lifetime arg tests
Veykril Apr 24, 2024
d00de38
Auto merge of #17021 - roife:add-hover-limits-for-adts, r=Veykril
bors Apr 25, 2024
a2259bb
Auto merge of #17134 - Veykril:lt-err-display, r=Veykril
bors Apr 25, 2024
7dd3a16
fix: Fix expression scopes not being calculated for inline consts
Veykril Apr 25, 2024
b2c3774
Auto merge of #17135 - Veykril:inline-const-scope, r=Veykril
bors Apr 25, 2024
3bc103a
Show workspace info in the status bar
Veykril Apr 26, 2024
cb12dbb
Auto merge of #17143 - Veykril:status-info, r=Veykril
bors Apr 26, 2024
2b6f198
fix: Fix source roots not always being created when necessary
Veykril Apr 26, 2024
0d33960
Auto merge of #17145 - Veykril:fix-missing-source-root, r=Veykril
bors Apr 26, 2024
0274d34
add no-new-root check to josh pull
RalfJung Apr 27, 2024
70fb039
empty rust-version file, since no pull has happened yet
RalfJung Apr 27, 2024
30b02be
experiment
RalfJung Apr 27, 2024
95b27b9
Preparing for merge from rust-lang/rust
RalfJung Apr 27, 2024
2a404a3
Merge from rust-lang/rust
RalfJung Apr 27, 2024
2d80667
Merge remote-tracking branch 'origin/master'
RalfJung Apr 27, 2024
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
Prev Previous commit
Next Next commit
Implement BeginPanic for mir eval
  • Loading branch information
Veykril committed Apr 19, 2024
commit 2efaa44acf6f912c3f5841fa7d3ff5f506cf0841
5 changes: 5 additions & 0 deletions src/tools/rust-analyzer/crates/hir-ty/src/chalk_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub trait TyExt {
fn is_scalar(&self) -> bool;
fn is_floating_point(&self) -> bool;
fn is_never(&self) -> bool;
fn is_str(&self) -> bool;
fn is_unknown(&self) -> bool;
fn contains_unknown(&self) -> bool;
fn is_ty_var(&self) -> bool;
Expand Down Expand Up @@ -87,6 +88,10 @@ impl TyExt for Ty {
matches!(self.kind(Interner), TyKind::Never)
}

fn is_str(&self) -> bool {
matches!(self.kind(Interner), TyKind::Str)
}

fn is_unknown(&self) -> bool {
matches!(self.kind(Interner), TyKind::Error)
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ impl Evaluator<'_> {
let mut ty = self.operand_ty(lhs, locals)?;
while let TyKind::Ref(_, _, z) = ty.kind(Interner) {
ty = z.clone();
let size = if ty.kind(Interner) == &TyKind::Str {
let size = if ty.is_str() {
if *op != BinOp::Eq {
never!("Only eq is builtin for `str`");
}
Expand Down
43 changes: 38 additions & 5 deletions src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ impl Evaluator<'_> {
return Ok(true);
}
if let Some(it) = self.detect_lang_function(def) {
let arg_bytes =
args.iter().map(|it| Ok(it.get(self)?.to_owned())).collect::<Result<Vec<_>>>()?;
let result = self.exec_lang_item(it, generic_args, &arg_bytes, locals, span)?;
let result = self.exec_lang_item(it, generic_args, args, locals, span)?;
destination.write_from_bytes(self, &result)?;
return Ok(true);
}
Expand Down Expand Up @@ -333,18 +331,52 @@ impl Evaluator<'_> {
&mut self,
it: LangItem,
generic_args: &Substitution,
args: &[Vec<u8>],
args: &[IntervalAndTy],
locals: &Locals,
span: MirSpan,
) -> Result<Vec<u8>> {
use LangItem::*;
let mut args = args.iter();
match it {
BeginPanic => Err(MirEvalError::Panic("<unknown-panic-payload>".to_owned())),
BeginPanic => {
let mut arg = args
.next()
.ok_or(MirEvalError::InternalError(
"argument of BeginPanic is not provided".into(),
))?
.clone();
while let TyKind::Ref(_, _, ty) = arg.ty.kind(Interner) {
if ty.is_str() {
let (pointee, metadata) = arg.interval.get(self)?.split_at(self.ptr_size());
let len = from_bytes!(usize, metadata);

return {
Err(MirEvalError::Panic(
std::str::from_utf8(
self.read_memory(Address::from_bytes(pointee)?, len)?,
)
.unwrap()
.to_owned(),
))
};
}
let size = self.size_of_sized(&ty, locals, "begin panic arg")?;
let pointee = arg.interval.get(self)?;
arg = IntervalAndTy {
interval: Interval::new(Address::from_bytes(pointee)?, size),
ty: ty.clone(),
};
}
Err(MirEvalError::Panic(format!(
"unknown-panic-payload: {:?}",
arg.ty.kind(Interner)
)))
}
SliceLen => {
let arg = args.next().ok_or(MirEvalError::InternalError(
"argument of <[T]>::len() is not provided".into(),
))?;
let arg = arg.get(self)?;
let ptr_size = arg.len() / 2;
Ok(arg[ptr_size..].into())
}
Expand All @@ -358,6 +390,7 @@ impl Evaluator<'_> {
let arg = args.next().ok_or(MirEvalError::InternalError(
"argument of drop_in_place is not provided".into(),
))?;
let arg = arg.interval.get(self)?.to_owned();
self.run_drop_glue_deep(
ty.clone(),
locals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ fn main() {
}
"#,
);
panic!("a");
}

#[test]
Expand Down