🐛 Fix critical borrow checker bug + 📚 Enhance README documentation#3
Open
🐛 Fix critical borrow checker bug + 📚 Enhance README documentation#3
Conversation
The previous code had a critical lifetime bug where `name2` would go out of scope before `bigger` is used, but `bigger` might contain a reference to `name2`. This caused a compilation error due to Rust's borrow checker. Fixed by moving both string declarations to the same scope level, ensuring both strings live long enough for the comparison result to be valid.
The previous README was very minimal with only a title and one line description. Enhanced it with: - Clear project description and learning objectives - Structured overview of all exercises with descriptions - Prerequisites and setup instructions - How to run each exercise - Learning progression path - Additional resources for Rust learning - Contributing guidelines This makes the repository much more accessible to newcomers and provides a clear roadmap for learning Rust concepts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔧 Critical Bug Fix + Documentation Enhancement
This PR addresses a critical compilation bug in the borrow checker exercise and significantly improves the project's documentation.
🐛 Bug Fix: Borrow Checker Lifetime Issue
The Problem
The
3-borrow-checker/src/main.rsfile contained a fatal lifetime bug that prevented compilation:The Root Cause
Rust's borrow checker detected that:
name2goes out of scope at the end of the inner blockbiggervariable might contain a reference toname2biggeraftername2is dropped violates memory safety rules✅ The Fix
Moved both string declarations to the same scope level:
Impact
📚 Documentation Enhancement: README Overhaul
The Problem
The original README was extremely minimal:
# Rust Bootcamp Learning rust to build substreams.This provided no guidance for learners and made the repository hard to navigate.
✅ The Enhancement
Created a comprehensive, professional README with:
🎯 Clear Learning Objectives
📚 Structured Course Overview
🚀 Getting Started Guide
🔧 Development Setup
📖 Additional Resources
🤝 Contributing Guidelines
Impact
🧪 Testing Done
✅ Compilation Test: Verified the fixed borrow checker code compiles and runs correctly
✅ Documentation Review: Ensured all links work and formatting is consistent
✅ Structure Validation: Confirmed all mentioned directories and files exist
📈 Benefits
Ready for review! This PR makes the rust-bootcamp repository significantly more valuable for Rust learners. 🚀