| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Apply Clippy's `uninlined_format_args` lint (#7361) ## Description This PR improves the readability of `format!`, `write!`, etc. macros by rolling out the Clippy fixes for the `uninlined_format_args` lint. `cargo clippy` started showing this lint after locally switching to Cargo v1.88.0. Additionally, the PR: - replaces a few occurrences of `io::Error::new(std::io::ErrorKind::Other, <msg>)` with `io::Error::other(<msg>)`. - replaces a single occurrence of `if params.iter().any(|&p| p == "all")` with `if params.contains(&"all")`. ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. | 1 年前 | |
fix modified in optimisation passes so they converge (#7666) ## Description This PR fix the `modified` return of some optimisation passes, so we can run optimisations multiple times until they converge. To guarantee that they are correct, we now have an "env var" named "SWAY_VERIFY_FORCE" that forces IR verification and checks whether the modified flag is the same as the comparison of the IR before and after the pass. The flag is being set for all snapshot tests. As discussed, it makes sense to remove the "verify" CLI flag. For this last check, I had to write the "mut" of function and block arguments in the IR; otherwise, the "mutability-tagger" pass would return true, but without any visible change in the IR, the check would always fail. This triggered a LOT of changes, given that we assume everything is mutable by default. On the bright side is that it is now much easier to see improvements to the tagger pass. There are also other small improvements in the form of "TODO", because if Sway can guarantee that a value is never written, we can generate the initial IR already flagging something as immutable. Another big change was the removal of "file-checks" for some IR tests. We already have snapshot tests for them, and given that the snapshot shows the complete diff, it is much easier to see the exact difference of each pass. I left normal comments though. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. | 2 个月前 | |
Removing verify-ir from the CLI (#7672) ## Description This PR removes "verify-ir" from the CLI, because we now run verify after each optimization pass. The performance impact seems to be minimal and it is well worthy the extra security it brings. This brought to attention a problem that the pass "arg-demotion" had with blocks with "never" as arguments. A better fix will be pushed later, but for now, the pass does not generate a miscompilation anymore. Otehr smal fixes were "filter-fn" not working with contracts, and the IR printer not correctly printings storage key address with 64 characters when they start with zero. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. | 1 个月前 | |
Adds a DAP server with support for debugging sway unit tests (#5477) ## Description Related https://github.com/FuelLabs/sway-vscode-plugin/pull/166 Adds a [DAP](https://microsoft.github.io/debug-adapter-protocol//) server as a new forc plugin, `forc-debug`. This enables a UI debugging experience in IDEs such as VSCode. For now, only debugging forc tests is supported. Users can: - set breakpoints inside of forc tests - step through the test, one VM instruction at a time, or continue to the next breakpoint - debug through multiple tests sequentially - see the VM register values in the IDE while debugging - see the current VM opcode, its inputs, and/or immediate value when when the VM is stopped ### Screenshots https://github.com/FuelLabs/sway/assets/47993817/24e2016c-d96c-4ef6-931f-8a4ce4f1386b https://github.com/FuelLabs/sway/assets/47993817/5f0fed49-b278-4074-a1a1-d37de00776f8  ### Local testing 1. Install `forc-debug` 2. Copy this sample launch.json in the VSCode workspace with sway code to debug: ```json { "version": "0.2.0", "configurations": [ { "type": "sway", "request": "launch", "name": "Debug Sway", "program": "${file}" }] } ``` 3. Follow [the steps](https://github.com/FuelLabs/sway-vscode-plugin/blob/master/docs/testing.md) for testing the VSCode extension ### Limitations - Breakpoints only work inside of the project/workspace being debugged - Stack trace support is limited - Not every line has source maps. Once debugging, "verified" breakpoints will show red and "unverified" (no source maps) will be greyed out. - Watch/repl expressions are not yet supported - Step into/out of is not supported - If you click "step over" many times in rapid succession, the server takes a while to catch up. Closes https://github.com/FuelLabs/sway/issues/5394 ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: Vaivaswatha Nagaraj <vaivaswatha.nagaraj@fuel.sh> Co-authored-by: Vaivaswatha N <vaivaswatha@users.noreply.github.com> Co-authored-by: IGI-111 <igi-111@protonmail.com> Co-authored-by: João Matos <joao@tritao.eu> Co-authored-by: Joshua Batty <joshpbatty@gmail.com> Co-authored-by: Igor Rončević <ironcev@hotmail.com> Co-authored-by: Sudhakar Verma <10460978+sudhackar@users.noreply.github.com> Co-authored-by: Marcos Henrich <marcoshenrich@gmail.com> Co-authored-by: jjcnn <38888011+jjcnn@users.noreply.github.com> | 2 年前 |