-
Notifications
You must be signed in to change notification settings - Fork 0
Dev Setup
ssh <username>@hfcs.csclub.uwaterloo.ca
ssh <username>@carbonated-water.csclub.uwaterloo.ca
git clone https://github.com/sexxi-goose/rust.git
or git@github.com:sexxi-goose/rust.git
Follow the instructions outlined in the rustc-dev-guide
Before building, format your code to Rust Community Standards:
./x.py fmt
To build using parallel processes:
./x.py build -j[#Number of parallel processes]
To do incremental builds (this might require more storage space):
./x.py build -i
Run the test suite
./x.py test
Suggestions for testing and debugging.
- Checkout master branch and pull latest changes
- Compile source code using
./x.py build -i -j32
- Create a new branch that includes your new changes
- Compile and test using
./x.py test -i -j32 --keep-stage 1
** - If needed, get backtrace using
RUST_BACKTRACE=1 ./x.py test -i -j32 --keep-stage 1
** - Instead of running all the tests, it might be easier to run certain tests or own tests, to do so look at using dev builds
** --keep-stage 1
will keep the initial compiler and use that compiler to compile your changes and perform testing. This is better for several reasons. In addition to being way faster to compile, the new compiler can fail compiling the new compiler as a result of behavioral changes but without providing useful insight. If you use the old compiler to compile the new compiler, the compilation will succeed and tests may fail, providing more useful insight!
If you are intending to ssh into a remote computer, you will likely face the problem of being disconnected. You can prevent this from happening by using tools such a tmux or screen. This means ssh then use the tool not the opposite.
To use tmux
# Create a named screen session
tmux new -s<name of the session>
# Do your work
# More work
# Oops connection disconnected!
# ssh again to the server
# List all active screen sessions
tmux ls
# Reattach to a screen session
tmux attach -t<session name>
To use screen
# Create a named screen session
screen -S <name of the session>
# Do your work
# More work
# Oops connection disconnected!
# ssh again to the server
# List all active screen sessions
screen -ls
# Reattach to a screen session
screen -r <session name>
ripgrep
is great.
Mac: brew install ripgrep
.
Ubuntu: sudo snap install ripgrep --classic
.
It is available on hfcs
.
rg <search string>
If the search string is regex or contains space, make sure to put them in double quotes.
By default ripgrep recursively searches all folders, but you can provide file pattern for current directory.
Eg:
rg <search string> *.txt
: to search txt files.
rg -A5 "<regex>" # prints 5 lines after your search result along with the matching line
rg -B5 "<regex>" # prints 5 lines before your search result along with the matching line
rg -C5 "<regex>" # prints 5 lines before and 5 line after your search result along with the matching line
Fun fact: rg
uses Rust's regex crate.