Programming & Systems Guides
Empirical benchmarks and systems guides appear first, followed by the compiler and error-code reference archive. Browse by topic, jump to the error reference archive, or subscribe via RSS.
-
Fix Rust E0597 "`x` does not live long enough" — a Block Scope, a Stored Reference, a Struct Field, and a Closure Capture Rust · Error Reference
Rust error E0597, `x` does not live long enough, means a borrowed value was dropped while a reference to it was still going to be used. This guide...
-
Fix Rust E0515 "cannot return value referencing local variable" — a Local String, a Local Number, a Local Vec Slice, and a Struct Wrapping a Local Rust · Error Reference
Rust error E0515, cannot return value referencing local variable, means a function tried to return a reference to a value it created itself, and that value...
-
Fix Rust E0507 "cannot move out of ..." — Vec Index, HashMap Index, a Shared Reference, a Struct Field, and a Mutable Reference Rust · Error Reference
Rust error E0507, cannot move out of, means a value that does not implement Copy was moved out of a place the code does not own outright: an element reached...
-
Fix Rust E0499 "cannot borrow as mutable more than once at a time" — Two Bindings, a Function Call, Two Vec Elements, and a Method Call Rust · Error Reference
Rust error E0499, cannot borrow as mutable more than once at a time, means a second mutable borrow was created while a first mutable borrow of the same...
-
Fix Rust E0502 "cannot borrow as mutable because it is also borrowed as immutable" — End the First Borrow, Split the Work, or Restructure Rust · Error Reference
Rust error E0502, cannot borrow as mutable because it is also borrowed as immutable, means a shared borrow is still alive at the point where the code asks...
-
Fix Rust E0596 "cannot borrow as mutable" — a Vec Without mut, a Function Taking &Vec, a &self Method Pushing to a Field, and a Shared Reference in a Binding Rust · Error Reference
Rust error E0596, cannot borrow as mutable, means code tried to mutate a value without mutable permission — either the binding was not declared as mutable...
-
Fix Rust E0382 "borrow of moved value" — Borrow Instead of Moving, Return the Value, or Clone on Purpose Rust · Error Reference
Rust error E0382, borrow of moved value, means a value was moved — into a function, another binding, a loop, or a closure — and the code then tried to use...
-
Fix C++ "request for member in pointer type" — Use -> on Pointers, and Why -> Cannot Fix a Non-Class Type C++ · Error Reference
The GCC error request for member in a pointer type means the dot operator was used on a pointer: dot requires an object of class type, arrow requires a...
-
Fix C++ "no match for 'operator<<'" — Streaming a User-Defined Type and a std::vector of It to std::cout C++ · Error Reference
Streaming a user-defined type to std::cout fails with no match for 'operator<<' because std::basic_ostream provides overloads only for...
-
Fix C++ "invalid conversion from 'const char*' to 'char*'" — Add const, Copy the Text, or Own It in std::string C++ · Error Reference
The GCC error invalid conversion from 'const char*' to 'char*' means read-only text was handed to code that claims the right to modify...
-
Fix C++ "'cout' was not declared in this scope" — Missing
, Missing std::, and the using namespace std Trade-Off C++ · Error ReferenceThe error 'cout' was not declared in this scope has two different causes with the same first line: no
included at all, or... -
Fix C++ "cannot convert 'std::string' to 'const char*'" — c_str(), data(), and When the API Wants char* C++ · Error Reference
Passing a std::string where a const char* is expected fails because there is no implicit conversion from std::string to a character pointer. This guide...
-
Fix Go "panic: runtime error: slice bounds out of range" — A High Bound Past Capacity, a Low Bound Past the High Bound, a Full Slice Expression Past Capacity, a String Past Its Length, and a Negative Bound Go · Error Reference
Go panics with slice bounds out of range when a slice expression's bounds break the rule for its form. For a simple slice expression on a slice, the...
-
Fix Go "panic: sync: negative WaitGroup counter" — Extra Done Calls, Add(-1) Past Zero, and the Add-Before-Go Rule Go · Error Reference
A sync.WaitGroup counter that goes negative panics with panic: sync: negative WaitGroup counter, and every route to it is a counting mismatch: one Done too...
-
Fix Go "panic: runtime error: makeslice: len out of range" — Negative Length, Length Past Capacity, and Sizes That Overflow Go · Error Reference
A slice length that is negative, larger than its capacity, or so large that the runtime cannot allocate it makes make panic at the call itself: panic...
-
Fix Go "panic: interface conversion" — A String Asserted to Int, a Nil Interface, a Type That Does Not Implement the Target Interface, and a Typed Nil Go · Error Reference
A single-value type assertion that fails panics in Go. Write x.(T) for x of interface type and a type T, and Go asserts the type of the value stored in x is...
-
Fix Go "panic: runtime error: comparing uncomparable type []int" — Slice, Map and Function Values as Map Keys and in == Comparisons Go · Error Reference
Slice, map and function types are not comparable in Go: they can only be compared against nil. Written directly, comparing two slices or using a slice as a...
-
Fix Go "panic: close of nil channel" — the Unmade Channel, and How Nil Channels Block, Disable Select Cases, and Panic on Close Go · Error Reference
panic: close of nil channel means the channel variable was never made: a var declaration, a struct field nobody assigned, or a constructor that returned the...
-
Fix Go "panic: close of closed channel" — A Second Close, a Nil Channel, and the Receives That Stay Safe After Close Go · Error Reference
Closing a channel that is already closed panics in Go. Call close(ch) and Go records that no more values will be sent on ch. Call it a second time and the...
-
Fix 'No Matching Function for Call' in C++ — Reading GCC's Candidate List, Viable vs Not Viable, and Conversion Failures C++ · Error Reference
The error means overload resolution found candidates for the name but none of them was viable for the arguments given. This guide reads three real GCC...
-
Fix 'Passing const as this Argument Discards Qualifiers' in C++ — Const Objects, Const References, and Const Methods C++ · Error Reference
The error means a non-const member function was called on an object the compiler must treat as const. This guide reads three real GCC failures — a non-const...
-
Fix a Dangling std::string_view — Lifetime Rules for Views and References to Temporaries C++ · Error Reference
A std::string_view taken from a temporary std::string keeps the address and the length after the temporary is destroyed at the end of the statement: the...
-
Fix 'Cannot Bind Non-const Lvalue Reference to an Rvalue' in C++ — Temporaries, Function Arguments, and const& C++ · Error Reference
The error means a non-const lvalue reference was offered a temporary: a literal, an arithmetic result, or any other rvalue that has no lasting name to...
-
Fix 'Call of Overloaded Function Is Ambiguous' in C++ — Equally Good Conversions, and How Overload Ranking Breaks the Tie C++ · Error Reference
The error means overload resolution found two or more viable functions and none of them was better than all the others. This guide reads three real GCC...
-
Fix UBSan "Signed Integer Overflow" Runtime Errors — and Why the Optimizer Cares Sysadmin · Error Reference
UBSan stops a program with 'runtime error: signed integer overflow' when a signed addition, subtraction, or multiplication produces a value that...
-
Fix ThreadSanitizer "Data Race" Warnings — Read the Two Stacks, Fix the Shared Variable Sysadmin · Error Reference
ThreadSanitizer prints 'WARNING: ThreadSanitizer: data race' when two threads touch the same variable at the same time and at least one access...
-
Fix Go "panic: send on closed channel" — Close of Closed and Nil Channels, Receiving From a Closed Channel, and select Go · Error Reference
Go panics with send on closed channel when a program sends on a channel after close has been called on it: a sender that outlives the close, a loop that...
-
Fix Go "panic: runtime error: invalid memory address or nil pointer dereference" — Nil Receivers, Returned Nil Pointers, and Typed Nil Interfaces Go · Error Reference
Go panics with runtime error: invalid memory address or nil pointer dereference when a program uses a pointer whose value is nil: reading or writing through...
-
Fix Go "panic: runtime error: integer divide by zero" — Variable Divisors, the Constant-Divisor Compile Error, Modulo, and the Empty Average Go · Error Reference
Go panics with integer divide by zero when an integer division or remainder runs with a divisor that is zero at run time: a variable divisor that arrives as...
-
Fix Go "panic: runtime error: index out of range" — Slice, Array, String, and Slice-Bounds Panics Go · Error Reference
Go panics with runtime error: index out of range when a program indexes an array, slice, or string outside 0 <= x < len(a), and with slice bounds...