Skip to content

Commit

Permalink
nightly-2024-12-26 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanventer authored Dec 27, 2024
1 parent 0baad63 commit f08968e
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 97 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified binaries/summary_store.tar
Binary file not shown.
57 changes: 6 additions & 51 deletions checker/src/block_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1736,9 +1736,6 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
mir::Rvalue::ThreadLocalRef(def_id) => {
self.visit_thread_local_ref(path, *def_id);
}
mir::Rvalue::Len(place) => {
self.visit_len(path, place);
}
mir::Rvalue::Cast(cast_kind, operand, ty) => {
let specialized_ty = self
.type_visitor()
Expand Down Expand Up @@ -2044,54 +2041,6 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
.update_value_at(path, AbstractValue::make_reference(static_var));
}

/// path = length of a [X] or [X;n] value.
#[logfn_inputs(TRACE)]
fn visit_len(&mut self, path: Rc<Path>, place: &mir::Place<'tcx>) {
let place_ty = self
.type_visitor()
.get_rustc_place_type(place, self.bv.current_span);
let len_value = if let TyKind::Array(_, len) = place_ty.kind() {
// We only get here if "-Z mir-opt-level=0" was specified.
// With more optimization the len instruction becomes a constant.
self.visit_const(len)
} else {
// In this case place type must be a slice.
let mut value_path = self.visit_lh_place(place);
if let PathEnum::QualifiedPath {
qualifier,
selector,
..
} = &value_path.value
{
if let PathSelector::Deref = selector.as_ref() {
// De-referencing a slice pointer is normally the same as de-referencing its
// thin pointer, so self.visit_lh_place above assumed that much and will have
// added in a field 0 selector before the deref.
// In this context, however, we want the length of the slice pointer,
// so we need to drop the thin pointer field selector.
if let PathEnum::QualifiedPath {
qualifier,
selector,
..
} = &qualifier.value
{
if matches!(selector.as_ref(), PathSelector::Field(0)) {
value_path = qualifier.clone();
}
}
} else {
// qualifier is an unsized struct type and selector selects the last field,
// which is an unsized array
}
}
let length_path =
Path::new_length(value_path).canonicalize(&self.bv.current_environment);
self.bv
.lookup_path_and_refine_result(length_path, self.bv.tcx.types.usize)
};
self.bv.update_value_at(path, len_value);
}

/// path = operand as ty.
#[logfn_inputs(TRACE)]
fn visit_cast(
Expand Down Expand Up @@ -3762,6 +3711,12 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
let discr_ty_layout = self.type_visitor().layout_of(discr_ty).unwrap();
trace!("discr_ty_layout {:?}", discr_ty_layout);
match enum_ty_layout.variants {
Variants::Empty => {
discr_signed = false;
discr_bits = 0;
discr_index = VariantIdx::new(0);
discr_has_data = false;
}
Variants::Single { index } => {
// The enum only contains one variant.

Expand Down
2 changes: 1 addition & 1 deletion checker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
extern crate log;
extern crate rustc_abi;
extern crate rustc_ast;
extern crate rustc_attr;
extern crate rustc_attr_parsing;
extern crate rustc_data_structures;
extern crate rustc_driver;
extern crate rustc_errors;
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ commit;
],
"callables": [
{
"name": "/fnptr/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr[35c1]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr[129f]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 9,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ commit;
],
"callables": [
{
"name": "/fnptr_clean/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_clean[fae2]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_clean/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_clean[6fb3]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 14,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_deduplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ commit;
],
"callables": [
{
"name": "/fnptr_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_deduplicate[7eb2]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_deduplicate[2e12]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 10,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ commit;
],
"callables": [
{
"name": "/fnptr_dom/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_dom[755f]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:8 ~ fnptr_dom[755f]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_dom/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_dom[a141]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:8 ~ fnptr_dom[a141]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 9,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_dom_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ commit;
],
"callables": [
{
"name": "/fnptr_dom_loop/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop[8d00]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop[8d00]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_dom_loop/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop[088e]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop[088e]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 9,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_dom_loop_souffle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ digraph {
],
"callables": [
{
"name": "/fnptr_dom_loop_souffle/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop_souffle[fa21]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop_souffle[fa21]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_dom_loop_souffle/fn1(u32,&'^0.Named(DefId(0:8 ~ fnptr_dom_loop_souffle[2ce5]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] },&'^1.Named(DefId(0:9 ~ fnptr_dom_loop_souffle[2ce5]::fn1::'_#1), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 10,
"local": true
Expand Down
6 changes: 3 additions & 3 deletions checker/tests/call_graph/fnptr_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ commit;
],
"callables": [
{
"name": "/fnptr_fold/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_fold[b66d]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_fold/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_fold[40a0]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 10,
"local": true
Expand All @@ -97,15 +97,15 @@ commit;
"local": true
},
{
"name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14015 ~ std[a47b]::io::stdio::_print::'_), \"'_\")>)->()",
"name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14032 ~ std[82fa]::io::stdio::_print::'_), \"'_\")>)->()",
"file_index": 1,
"first_line": 1232,
"local": false
},
{
"name": "/core/std::fmt::Arguments::<'a>::new_const(&'a/#0 [&'static str; N/#1])->std::fmt::Arguments<'a/#0>",
"file_index": 2,
"first_line": 588,
"first_line": 591,
"local": true
}
],
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ commit;
"local": true
},
{
"name": "/fnptr_loop/fn2(u32,&'^0.Named(DefId(0:7 ~ fnptr_loop[ee63]::fn2::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_loop/fn2(u32,&'^0.Named(DefId(0:7 ~ fnptr_loop[d246]::fn2::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 12,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/fnptr_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ commit;
],
"callables": [
{
"name": "/fnptr_slice/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_slice[a8c5]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"name": "/fnptr_slice/fn1(u32,&'^0.Named(DefId(0:7 ~ fnptr_slice[7299]::fn1::'_), \"'_\") Binder { value: fn(u32) -> u32, bound_vars: [] })->u32",
"file_index": 0,
"first_line": 10,
"local": true
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/call_graph/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ commit;
"local": true
},
{
"name": "/generic/Gen::<T>::bar(&'^0.Named(DefId(0:12 ~ generic[c38b]::{impl#0}::bar::'_), \"'_\") Gen<T/#0>,T/#0)->()",
"name": "/generic/Gen::<T>::bar(&'^0.Named(DefId(0:12 ~ generic[9900]::{impl#0}::bar::'_), \"'_\") Gen<T/#0>,T/#0)->()",
"file_index": 0,
"first_line": 14,
"local": true
Expand Down
6 changes: 3 additions & 3 deletions checker/tests/call_graph/static_deduplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ commit;
],
"callables": [
{
"name": "/static_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ static_deduplicate[7b14]::fn1::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:7 ~ static_deduplicate[7b14]::fn1::'_), \"'_\") str)",
"name": "/static_deduplicate/fn1(u32,&'^0.Named(DefId(0:7 ~ static_deduplicate[eaa9]::fn1::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:7 ~ static_deduplicate[eaa9]::fn1::'_), \"'_\") str)",
"file_index": 0,
"first_line": 10,
"local": true
},
{
"name": "/static_deduplicate/fn2(u32,&'^0.Named(DefId(0:8 ~ static_deduplicate[7b14]::fn2::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:8 ~ static_deduplicate[7b14]::fn2::'_), \"'_\") str)",
"name": "/static_deduplicate/fn2(u32,&'^0.Named(DefId(0:8 ~ static_deduplicate[eaa9]::fn2::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:8 ~ static_deduplicate[eaa9]::fn2::'_), \"'_\") str)",
"file_index": 0,
"first_line": 13,
"local": true
},
{
"name": "/static_deduplicate/fn3(u32,&'^0.Named(DefId(0:9 ~ static_deduplicate[7b14]::fn3::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:9 ~ static_deduplicate[7b14]::fn3::'_), \"'_\") str)",
"name": "/static_deduplicate/fn3(u32,&'^0.Named(DefId(0:9 ~ static_deduplicate[eaa9]::fn3::'_), \"'_\") str)->(u32, &'^0.Named(DefId(0:9 ~ static_deduplicate[eaa9]::fn3::'_), \"'_\") str)",
"file_index": 0,
"first_line": 16,
"local": true
Expand Down
4 changes: 2 additions & 2 deletions checker/tests/call_graph/static_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ commit;
"local": true
},
{
"name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14015 ~ std[a47b]::io::stdio::_print::'_), \"'_\")>)->()",
"name": "/std/std::io::_print(std::fmt::Arguments<'^0.Named(DefId(1:14032 ~ std[82fa]::io::stdio::_print::'_), \"'_\")>)->()",
"file_index": 1,
"first_line": 1232,
"local": false
},
{
"name": "/core/std::fmt::Arguments::<'a>::new_const(&'a/#0 [&'static str; N/#1])->std::fmt::Arguments<'a/#0>",
"file_index": 2,
"first_line": 588,
"first_line": 591,
"local": false
}
],
Expand Down
Loading

0 comments on commit f08968e

Please sign in to comment.