aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
Commit message (Collapse)AuthorAgeFilesLines
* Remove track_parent and parent_map, replace with simple walk in missign ↵Paul Daniel Faria2020-06-271-19/+23
| | | | unsafe validator
* unsafe: Clean up, improve tracking, add debug_assertPaul Daniel Faria2020-06-272-72/+74
| | | | | | Move unsafe_expressions to unsafe_validation.rs, replace vec tracking of child exprs with inline macro, add debug assert to ensure tracked children match walked children exactly
* Add HighlightTag::Operator, use it for unsafe deref. Move unsafe validation ↵Paul Daniel Faria2020-06-274-48/+69
| | | | to its own file
* Track expr parents during lowering, use parent map when checking if unsafe ↵Paul Daniel Faria2020-06-272-12/+12
| | | | exprs are within unsafe blocks
* Address review comments, have MissingUnsafe diagnostic point to each unsafe ↵Paul Daniel Faria2020-06-273-25/+19
| | | | use, update tests
* Rename Expr::UnsafeBlock to Expr::UnsafePaul Daniel Faria2020-06-272-2/+2
|
* Track unsafe blocks, don't trigger missing unsafe diagnostic when unsafe ↵Paul Daniel Faria2020-06-274-16/+72
| | | | exprs within unsafe block
* Add missing self param to testPaul Daniel Faria2020-06-271-1/+1
|
* Remove UnnecessaryUnsafe diagnostic, Fix Expr::Call unsafe analysisPaul Daniel Faria2020-06-273-69/+21
|
* Add tests covering unsafe blocks, more attempts to get call expr tests passingPaul Daniel Faria2020-06-272-1/+86
|
* Move diagnostics back into expr, add tests for diagnostics, fix logic to ↵Paul Daniel Faria2020-06-274-20/+154
| | | | account for derefs of raw ptrs
* Add unsafe diagnostics and unsafe highlightingPaul Daniel Faria2020-06-272-1/+81
|
* Merge #4982bors[bot]2020-06-276-41/+109
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4982: Bump chalk r=matklad a=lnicola This passes the tests, but fails in a weird way on `analysis-stats`: ``` thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-solve-0.14.0/src/clauses/builtin_traits/fn_family.rs:96:20 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:78 3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt at src/libstd/sys_common/backtrace.rs:59 4: core::fmt::write at src/libcore/fmt/mod.rs:1076 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1537 6: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:62 7: std::sys_common::backtrace::print at src/libstd/sys_common/backtrace.rs:49 8: std::panicking::default_hook::{{closure}} at src/libstd/panicking.rs:198 9: std::panicking::default_hook at src/libstd/panicking.rs:218 10: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:477 11: rust_begin_unwind at src/libstd/panicking.rs:385 12: core::panicking::panic_fmt at src/libcore/panicking.rs:86 13: core::panicking::panic at src/libcore/panicking.rs:51 14: chalk_solve::clauses::builtin_traits::fn_family::add_fn_trait_program_clauses 15: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders 16: chalk_solve::clauses::program_clauses_that_could_match 17: chalk_solve::clauses::program_clauses_for_goal 18: chalk_solve::recursive::Solver<I>::solve_new_subgoal 19: <chalk_solve::recursive::Solver<I> as chalk_solve::recursive::solve::SolveDatabase<I>>::solve_goal 20: chalk_solve::recursive::Solver<I>::solve_root_goal 21: chalk_solve::solve::Solver<I>::solve_limited 22: ra_hir_ty::traits::trait_solve_query 23: salsa::runtime::Runtime<DB>::execute_query_implementation 24: salsa::derived::slot::Slot<DB,Q,MP>::read_upgrade 25: salsa::derived::slot::Slot<DB,Q,MP>::read 26: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch 27: salsa::QueryTable<DB,Q>::get 28: <T as ra_hir_ty::db::HirDatabase>::trait_solve 29: ra_hir_ty::infer::InferenceContext::resolve_ty_as_possible 30: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner 31: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce 32: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::check_call_arguments 33: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_method_call 34: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner 35: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr 36: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_method_call 37: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner 38: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce 39: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner 40: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner 41: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce 42: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner 43: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce 44: ra_hir_ty::infer::infer_query 45: salsa::runtime::Runtime<DB>::execute_query_implementation 46: salsa::derived::slot::Slot<DB,Q,MP>::read_upgrade 47: salsa::derived::slot::Slot<DB,Q,MP>::read 48: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch 49: ra_hir_ty::db::infer_wait 50: rust_analyzer::cli::analysis_stats::analysis_stats 51: rust_analyzer::main 52: std::rt::lang_start::{{closure}} 53: std::rt::lang_start_internal::{{closure}} at src/libstd/rt.rs:52 54: std::panicking::try::do_call at src/libstd/panicking.rs:297 55: std::panicking::try at src/libstd/panicking.rs:274 56: std::panic::catch_unwind at src/libstd/panic.rs:394 57: std::rt::lang_start_internal at src/libstd/rt.rs:51 58: main 59: __libc_start_main 60: _start note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ``` It's as if we're returning `None` for a well-known trait that `chalk` asks about. That seems to happen for `Deref`, `CoerceUnsized` and `Try`. r? @flodiebold Co-authored-by: Laurențiu Nicola <[email protected]>
| * Bump chalkLaurențiu Nicola2020-06-266-41/+109
| |
* | Merge #5033bors[bot]2020-06-271-0/+46
|\ \ | | | | | | | | | | | | | | | | | | | | | 5033: Order of glob imports should not affect import shadowing r=Nashenas88 a=Nashenas88 Fixes #5032 Co-authored-by: Paul Daniel Faria <[email protected]>
| * | Split glob import map to per-ns, switch ExprCollector to use a simpler push_resPaul Daniel Faria2020-06-261-0/+46
| | |
* | | Address review commentsJonas Schievink2020-06-261-1/+2
| |/ |/|
* | Infer type for slice wildcard patternsadamrk2020-06-253-2/+34
|/
* Make `iterate_method_candidates` non-genericJonas Schievink2020-06-241-56/+73
|
* Remove file id from item treeJonas Schievink2020-06-241-3/+3
| | | | It's not needed, and `source` is only used by tests anyways
* draw the rest of the owlJonas Schievink2020-06-241-5/+11
|
* Fix string literal inference in matchLaurențiu Nicola2020-06-242-13/+77
|
* Use only one code-path for parsing fixturesAleksey Kladov2020-06-238-2692/+2692
| | | | | This removes leading newlines everywhere, shifting all ranges in tests by one
* Remove RelativePathBuf from fixtureAleksey Kladov2020-06-221-1/+1
| | | | | The paths in fixture are not really relative (the default one is `/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.
* Merge #4947bors[bot]2020-06-204-56/+87
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4947: Replace `impls_in_trait` query with smarter use of `CrateImplDefs` r=matklad a=jonas-schievink `impls_in_trait` was allocating a whopping ~400 MB of RAM when running analysis-stats on r-a itself. Remove it, instead adding a query that computes a summary `CrateImplDefs` map for all transitive dependencies. This can probably still be made more efficient, but this already reduces the peak memory usage by 25% without much performance impact on analysis-stats. **Before**: ``` Total: 34.962107188s, 2083mb allocated 2141mb resident 422mb ImplsForTraitQuery (deps) 250mb CrateDefMapQueryQuery 147mb MacroArgQuery 140mb TraitSolveQuery (deps) 68mb InferQueryQuery (deps) 62mb ImplDatumQuery (deps) ``` **After**: ``` Total: 35.261100358s, 1520mb allocated 1569mb resident 250mb CrateDefMapQueryQuery 147mb MacroArgQuery 144mb TraitSolveQuery (deps) 68mb InferQueryQuery (deps) 61mb ImplDatumQuery (deps) 45mb BodyQuery 45mb ImplDatumQuery ``` Co-authored-by: Jonas Schievink <[email protected]>
| * Recursively compute impl setsJonas Schievink2020-06-191-13/+26
| |
| * Don't include downstream crate in queryJonas Schievink2020-06-191-1/+2
| |
| * Replace `impls_in_trait` with `CrateImplDefs`Jonas Schievink2020-06-194-57/+74
| |
* | Merge #4958bors[bot]2020-06-204-24/+312
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 4958: Infer FnSig via Fn traits r=flodiebold a=adamrk Addresses https://github.com/rust-analyzer/rust-analyzer/issues/4481. When inferring types check if the callee implements one of the builtin `Fn` traits. Also autoderef the callee before trying to figure out it's `FnSig`. Co-authored-by: adamrk <[email protected]>
| * | Push obligation instead of matching on solutionadamrk2020-06-202-45/+40
| | |
| * | Get Output assoc type by nameadamrk2020-06-201-13/+3
| | |
| * | Add test for dyn Fn Outputadamrk2020-06-201-0/+68
| | |
| * | move tests to ra_hir_tyadamrk2020-06-201-0/+155
| | |
| * | Fixes to callable_sig_from_fn_traitadamrk2020-06-201-65/+65
| | |
| * | Make get_fn_trait a method of FnTraitadamrk2020-06-203-21/+21
| | |
| * | Switch back callable_sig for known fn typesadamrk2020-06-202-4/+4
| | |
| * | Infer FnSig from Fn traitsadamrk2020-06-194-18/+98
| | |
* | | Shift bound variables correctly when using assoc type shorthandFlorian Diebold2020-06-192-0/+94
| | | | | | | | | | | | | | | Fixes #4885. Fixes #4800.
* | | Use correct substs for super trait assoc typesFlorian Diebold2020-06-193-17/+47
|/ / | | | | | | | | | | | | | | When referring to an associated type of a super trait, we used the substs of the subtrait. That led to the #4931 crash if the subtrait had less parameters, but it could also lead to other incorrectness if just the order was different. Fixes #4931.
* | Fix substs in resolve_value_path for ImplSelfVincent Rouillé2020-06-192-1/+33
| | | | | | | | Fixes #4953.
* | Merge #4851bors[bot]2020-06-191-1/+11
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4851: Add quickfix to add a struct field r=TimoFreiberg a=TimoFreiberg Related to #4563 I created a quickfix for record literals first because the NoSuchField diagnostic was already there. To offer that quickfix for FieldExprs with unknown fields I'd need to add a new diagnostic (or create a `NoSuchField` diagnostic for those cases) I think it'd make sense to make this a snippet completion (to select the generated type), but this would require changing the `Analysis` API and I'd like some feedback before I touch that. Co-authored-by: Timo Freiberg <[email protected]>
| * | Add quickfix to add a struct fieldTimo Freiberg2020-06-121-1/+11
| | |
* | | Merge #4839bors[bot]2020-06-191-7/+56
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | 4839: `Go to Type Definition` hover action. r=matklad a=vsrs ![hover_actions_goto](https://user-images.githubusercontent.com/62505555/83335671-0122e380-a2b7-11ea-9922-fbdcfb11a7f3.gif) This implementation supports things like `dyn Trait<SomeType>`, `-> impl Trait`, etc. Co-authored-by: vsrs <[email protected]>
| * | Apply suggestions from code reviewvsrs2020-06-181-28/+25
| | |
| * | Add Type::walk methodvsrs2020-06-181-0/+52
| | |
| * | Add `Go to Type Definition` hover action.vsrs2020-06-181-3/+3
| | |
* | | Avoid all unchecked indexing in match checkingJonas Schievink2020-06-171-28/+49
|/ /
* | Use ra_fixture and reformat testsJonas Schievink2020-06-161-387/+385
| |
* | Fix index-out-of-bounds panic in match checkingJonas Schievink2020-06-161-2/+26
| |
* | _match.rs: improve comment formattingJonas Schievink2020-06-141-113/+142
|/