Document why rubygems.rb requires BUNDLER_SETUP at the end - #9769
Merged
Conversation
The require makes bundler/setup run before error_highlight, did_you_mean and syntax_suggest are loaded, so the Gemfile controls their versions ([Bug #19089]). Ruby 4.1 autoloads them and unsets the variable while loading RubyGems, but rubygems-update still supports 3.2, so record the condition for dropping the line instead of dropping it now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The
require ENV["BUNDLER_SETUP"]at the bottom oflib/rubygems.rbcarries no explanation, so it looks removable. It makesbundler/setuprun beforeerror_highlight,did_you_meanandsyntax_suggestload, which is what lets the Gemfile pin their versions ([Bug #19089]).Ruby 4.1 autoloads those three ([Feature #21951]) and unsets
BUNDLER_SETUPwhile loading RubyGems, so the line is dead there. It is still live on 3.2 through 4.0, whichrequired_ruby_versionstill supports. Dropping it on 3.4 reproducesYou have already activated error_highlight 0.7.2, but your Gemfile requires 0.7.0. The comment records the condition for removing it later.Comment only, no behavior change.