diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 3bf5dbc1153cf7..d98dbd4759e922 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -411,7 +411,13 @@ def normalize_options(name, version, opts) next if VALID_PLATFORMS.include?(p) raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}" end - deprecate_legacy_windows_platforms(platforms) + + windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) } + if windows_platforms.any? + windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ") + removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead." + Bundler::SharedHelpers.feature_removed! removed_message + end # Save sources passed in a key if opts.key?("source") @@ -492,16 +498,6 @@ def normalize_source(source) end end - def deprecate_legacy_windows_platforms(platforms) - windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) } - return if windows_platforms.empty? - - windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ") - message = "Platform #{windows_platforms} is deprecated. Please use platform :windows instead." - removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead." - Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message - end - def check_path_source_safety return if @sources.global_path_source.nil? diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index 9ab9d73ae26d3c..07b5bd75147cf9 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -141,18 +141,8 @@ def initialize(lockfile, strict: false) @pos.advance!(line) end - if !Bundler.frozen_bundle? && @platforms.include?(Gem::Platform::X64_MINGW_LEGACY) - if @platforms.include?(Gem::Platform::X64_MINGW) - @platforms.delete(Gem::Platform::X64_MINGW_LEGACY) - SharedHelpers.major_deprecation(2, - "Found x64-mingw32 in lockfile, which is deprecated. Removing it. Support for x64-mingw32 will be removed in Bundler 4.0.", - removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.") - else - @platforms[@platforms.index(Gem::Platform::X64_MINGW_LEGACY)] = Gem::Platform::X64_MINGW - SharedHelpers.major_deprecation(2, - "Found x64-mingw32 in lockfile, which is deprecated. Using x64-mingw-ucrt, the replacement for x64-mingw32 in modern rubies, instead. Support for x64-mingw32 will be removed in Bundler 4.0.", - removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.") - end + if @platforms.include?(Gem::Platform::X64_MINGW_LEGACY) + SharedHelpers.feature_removed!("Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.") end @most_specific_locked_platform = @platforms.min_by do |bundle_platform| diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 4ae03171dc5813..f9179e7a069334 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -11,16 +11,11 @@ def initialize(specs) @specs = specs end - def for(dependencies, platforms_or_legacy_check = [nil], legacy_platforms = [nil], skips: []) - platforms = if [true, false].include?(platforms_or_legacy_check) - Bundler::SharedHelpers.major_deprecation 2, + def for(dependencies, platforms = [nil], legacy_platforms = [nil], skips: []) + if [true, false].include?(platforms) + Bundler::SharedHelpers.feature_removed! \ "SpecSet#for received a `check` parameter, but that's no longer used and deprecated. " \ - "SpecSet#for always implicitly performs validation. Please remove this parameter", - print_caller_location: true - - legacy_platforms - else - platforms_or_legacy_check + "SpecSet#for always implicitly performs validation. Please remove this parameter" end materialize_dependencies(dependencies, platforms, skips: skips) diff --git a/lib/rubygems/specification_record.rb b/lib/rubygems/specification_record.rb index 195a35549670ed..d08410096facdd 100644 --- a/lib/rubygems/specification_record.rb +++ b/lib/rubygems/specification_record.rb @@ -73,7 +73,7 @@ def stubs_for_pattern(pattern, match_platform = true) end ## - # Adds +spec+ to the the record, keeping the collection properly sorted. + # Adds +spec+ to the record, keeping the collection properly sorted. def add_spec(spec) return if all.include? spec diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb index ac28aea4d7da0d..e88033e9554240 100644 --- a/spec/bundler/bundler/dsl_spec.rb +++ b/spec/bundler/bundler/dsl_spec.rb @@ -221,8 +221,8 @@ to raise_error(Bundler::GemfileError, /is not a valid platform/) end - it "raises a deprecation warning for legacy windows platforms" do - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, /\APlatform :mswin, :x64_mingw is deprecated/, removed_message: /\APlatform :mswin, :x64_mingw has been removed/) + it "raises an error for legacy windows platforms" do + expect(Bundler::SharedHelpers).to receive(:feature_removed!).with(/\APlatform :mswin, :x64_mingw has been removed/) subject.gem("foo", platforms: [:mswin, :jruby, :x64_mingw]) end @@ -291,8 +291,8 @@ end describe "#platforms" do - it "raises a deprecation warning for legacy windows platforms" do - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, /\APlatform :mswin64, :mingw is deprecated/, removed_message: /\APlatform :mswin64, :mingw has been removed/) + it "raises an error for legacy windows platforms" do + expect(Bundler::SharedHelpers).to receive(:feature_removed!).with(/\APlatform :mswin64, :mingw has been removed/) subject.platforms(:mswin64, :jruby, :mingw) do subject.gem("foo") end diff --git a/spec/bundler/bundler/lockfile_parser_spec.rb b/spec/bundler/bundler/lockfile_parser_spec.rb index 54aa6a0bfe37e7..f38da2c9932183 100644 --- a/spec/bundler/bundler/lockfile_parser_spec.rb +++ b/spec/bundler/bundler/lockfile_parser_spec.rb @@ -95,134 +95,6 @@ end end - describe "X64_MINGW_LEGACY platform handling" do - before { allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app("gems.rb")) } - - describe "when X64_MINGW_LEGACY is present alone" do - let(:lockfile_with_legacy_platform) { <<~L } - GEM - remote: https://rubygems.org/ - specs: - rake (10.3.2) - - PLATFORMS - ruby - x64-mingw32 - - DEPENDENCIES - rake - - BUNDLED WITH - 3.6.9 - L - - context "when bundle is not frozen" do - before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) } - subject { described_class.new(lockfile_with_legacy_platform) } - - it "replaces X64_MINGW_LEGACY with X64_MINGW" do - allow(Bundler::SharedHelpers).to receive(:major_deprecation) - expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt") - expect(subject.platforms.map(&:to_s)).not_to include("x64-mingw32") - end - - it "shows deprecation warning for replacement" do - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with( - 2, - "Found x64-mingw32 in lockfile, which is deprecated. Using x64-mingw-ucrt, the replacement for x64-mingw32 in modern rubies, instead. Support for x64-mingw32 will be removed in Bundler 4.0.", - removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0." - ) - subject - end - end - - context "when bundle is frozen" do - before { allow(Bundler).to receive(:frozen_bundle?).and_return(true) } - subject { described_class.new(lockfile_with_legacy_platform) } - - it "preserves X64_MINGW_LEGACY platform without replacement" do - expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw32") - end - - it "does not show any deprecation warnings" do - expect(Bundler::SharedHelpers).not_to receive(:major_deprecation) - subject - end - end - end - - describe "when both X64_MINGW_LEGACY and X64_MINGW are present" do - let(:lockfile_with_both_platforms) { <<~L } - GEM - remote: https://rubygems.org/ - specs: - rake (10.3.2) - - PLATFORMS - ruby - x64-mingw32 - x64-mingw-ucrt - - DEPENDENCIES - rake - - BUNDLED WITH - 3.6.9 - L - - context "when bundle is not frozen" do - before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) } - subject { described_class.new(lockfile_with_both_platforms) } - - it "removes X64_MINGW_LEGACY and keeps X64_MINGW" do - allow(Bundler::SharedHelpers).to receive(:major_deprecation) - expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt") - expect(subject.platforms.map(&:to_s)).not_to include("x64-mingw32") - end - - it "shows deprecation warning for removing legacy platform" do - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with( - 2, - "Found x64-mingw32 in lockfile, which is deprecated. Removing it. Support for x64-mingw32 will be removed in Bundler 4.0.", - removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0." - ) - subject - end - end - end - - describe "when no X64_MINGW_LEGACY platform is present" do - let(:lockfile_with_modern_platforms) { <<~L } - GEM - remote: https://rubygems.org/ - specs: - rake (10.3.2) - - PLATFORMS - ruby - x64-mingw-ucrt - - DEPENDENCIES - rake - - BUNDLED WITH - 3.6.9 - L - - before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) } - subject { described_class.new(lockfile_with_modern_platforms) } - - it "preserves all modern platforms without changes" do - expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt") - end - - it "does not show any deprecation warnings" do - expect(Bundler::SharedHelpers).not_to receive(:major_deprecation) - subject - end - end - end - describe "#initialize" do before { allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app("gems.rb")) } subject { described_class.new(lockfile_contents) } diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index 1e90f01ce7f8c9..283719bedf53b7 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -207,17 +207,6 @@ expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end - it "prints an error when using legacy windows rubies" do - gemfile <<-D - source "https://gem.repo1" - gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20] - D - - bundle "cache --all-platforms", raise_on_error: false - expect(err).to include("removed") - expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).not_to exist - end - it "does not attempt to install gems in without groups" do build_repo4 do build_gem "uninstallable", "2.0" do |s| diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index f81c5578841dca..299285ba8b01ce 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -1571,12 +1571,12 @@ end it "does not claim to update to Bundler version to a wrong version when cached gems are present" do - pristine_system_gems "bundler-2.99.0" + pristine_system_gems "bundler-4.99.0" build_repo4 do build_gem "myrack", "3.0.9.1" - build_bundler "2.99.0" + build_bundler "4.99.0" end gemfile <<~G diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index f61dc1bc8859bc..d701c4008dbf4c 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -573,6 +573,38 @@ end end + context "bundle install with a lockfile including X64_MINGW_LEGACY platform" do + before do + gemfile <<~G + source "https://gem.repo1" + gem "rake" + G + + lockfile <<~L + GEM + remote: https://rubygems.org/ + specs: + rake (10.3.2) + + PLATFORMS + ruby + x64-mingw32 + + DEPENDENCIES + rake + + BUNDLED WITH + #{Bundler::VERSION} + L + end + + it "raises a helpful error" do + bundle "install", raise_on_error: false + + expect(err).to include("Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.") + end + end + context "when Bundler.setup is run in a ruby script" do before do create_file "gems.rb", "source 'https://gem.repo1'" diff --git a/yjit/src/core.rs b/yjit/src/core.rs index 2999f151bfb73e..0a14c44ae4d97e 100644 --- a/yjit/src/core.rs +++ b/yjit/src/core.rs @@ -2427,7 +2427,7 @@ impl<'a> JITState<'a> { // SAFETY: allocated with Box above unsafe { ptr::write(blockref, block) }; - // Block is initialized now. Note that MaybeUnint has the same layout as T. + // Block is initialized now. Note that MaybeUninit has the same layout as T. let blockref = NonNull::new(blockref as *mut Block).expect("no null from Box"); // Track all the assumptions the block makes as invariants @@ -3797,7 +3797,7 @@ pub fn gen_branch_stub_hit_trampoline(ocb: &mut OutlinedCb) -> Option { let mut asm = Assembler::new_without_iseq(); // For `branch_stub_hit(branch_ptr, target_idx, ec)`, - // `branch_ptr` and `target_idx` is different for each stub, + // `branch_ptr` and `target_idx` are different for each stub, // but the call and what's after is the same. This trampoline // is the unchanging part. // Since this trampoline is static, it allows code GC inside