Skip to content

Commit

Permalink
Merge pull request #28457 from JuliaLang/jb/rm_even_more_deps
Browse files Browse the repository at this point in the history
remove more deprecations
  • Loading branch information
StefanKarpinski committed Aug 5, 2018
2 parents 7a03c8c + 34d1ec2 commit ebae779
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 1,290 deletions.
910 changes: 0 additions & 910 deletions base/deprecated.jl

Large diffs are not rendered by default.

68 changes: 1 addition & 67 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -837,72 +837,6 @@ next element and the new iteration state should be returned.
"""
function iterate end

# Compatibility with old iteration protocol
function iterate(x, state)
@_inline_meta
done(x, state) && return nothing
return next(x, state)
end
const old_iterate_line_prev = (@__LINE__)
function iterate(x)
r = iterate(x, start(x))
depwarn("The start/next/done iteration protocol is deprecated. Implement `iterate(::$(typeof(x)))`.", :start)
r
end

struct LegacyIterationCompat{I,T,S}
done::Bool
nextval::T
state::S
LegacyIterationCompat{I,T,S}() where {I,T,S} = new{I,T,S}(true)
LegacyIterationCompat{I,T,S}(nextval::T, state::S) where {I,T,S} = new{I,T,S}(false, nextval, state)
end

function has_non_default_iterate(T)
world = ccall(:jl_get_world_counter, UInt, ())
mt = Base._methods(iterate, Tuple{T}, -1, world)
# Check if this is the above method
if (mt[1][3].file == @__FILE_SYMBOL__) && (mt[1][3].line == old_iterate_line_prev + 2)
return false
end
return true
end

const compat_start_line_prev = (@__LINE__)
function start(itr::T) where {T}
has_non_default_iterate(T) || throw(MethodError(iterate, (itr,)))
depwarn("The start/next/done iteration protocol is deprecated. Use `iterate` instead.", :start)
y = iterate(itr)
y === nothing && return LegacyIterationCompat{T, Union{}, Union{}}()
val, state = y
LegacyIterationCompat{T, typeof(val), typeof(state)}(val, state)
end

function next(itr::I, state::LegacyIterationCompat{I,T,S}) where {I,T,S}
val, state = state.nextval, state.state
y = iterate(itr, state)
if y === nothing
return (val, LegacyIterationCompat{I,T,S}())
end
nextval, state = y
val, LegacyIterationCompat{I, typeof(nextval), typeof(state)}(nextval, state)
end

done(itr::I, state::LegacyIterationCompat{I,T,S}) where {I,T,S} = (@_inline_meta; state.done)
# This is necessary to support the above compatibility layer,
# eventually, this should just check for applicability of `iterate`
function isiterable(T)::Bool
if !has_non_default_iterate(T)
world = ccall(:jl_get_world_counter, UInt, ())
mt = Base._methods(start, Tuple{T}, -1, world)
# Check if this is the fallback start method
if (mt[1][3].file == @__FILE_SYMBOL__) && (mt[1][3].line == compat_start_line_prev + 2)
return false
end
end
return true
return hasmethod(iterate, Tuple{T})
end

# This is required to avoid massive performance problems
# due to the start(s::AbstractString) deprecation.
iterate(s::AbstractString) = iterate(s, firstindex(s))
2 changes: 0 additions & 2 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,6 @@ end

@propagate_inbounds iterate(i::Rest, st=i.st) = iterate(i.itr, st)
isdone(i::Rest, st...) = isdone(i.itr, st...)
@propagate_inbounds iterate(i::Rest{I,S}, st::S=i.st) where {I,S<:Base.LegacyIterationCompat{I}} =
done(i.itr, st) ? nothing : next(i.itr, st)

eltype(::Type{<:Rest{I}}) where {I} = eltype(I)
IteratorEltype(::Type{<:Rest{I}}) where {I} = IteratorEltype(I)
Expand Down
1 change: 1 addition & 0 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ function show(io::IO, tn::Core.TypeName)
end

show(io::IO, ::Nothing) = print(io, "nothing")
print(io::IO, ::Nothing) = throw(ArgumentError("`nothing` should not be printed; use `show`, `repr`, or custom output instead."))
show(io::IO, b::Bool) = print(io, b ? "true" : "false")
show(io::IO, n::Signed) = (write(io, string(n)); nothing)
show(io::IO, n::Unsigned) = print(io, "0x", string(n, pad = sizeof(n)<<1, base = 16))
Expand Down
2 changes: 1 addition & 1 deletion base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ..@__MODULE__, ..parentmodule
const Base = parentmodule(@__MODULE__)
using .Base.Order
using .Base: copymutable, LinearIndices, length, (:),
eachindex, axes, first, last, similar, start, next, done, zip, OrdinalRange,
eachindex, axes, first, last, similar, zip, OrdinalRange,
AbstractVector, @inbounds, AbstractRange, @eval, @inline, Vector, @noinline,
AbstractMatrix, AbstractUnitRange, isless, identity, eltype, >, <, <=, >=, |, +, -, *, !,
extrema, sub_with_overflow, add_with_overflow, oneunit, div, getindex, setindex!,
Expand Down
119 changes: 0 additions & 119 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,6 @@ function __init__()
ENV["OPENBLAS_NUM_THREADS"] = "8"
elseif haskey(ENV, "JULIA_CPU_THREADS") # or exactly as specified
ENV["OPENBLAS_NUM_THREADS"] = cpu_threads
elseif haskey(ENV, "JULIA_CPU_CORES") # TODO: delete in 1.0 (deprecation)
Core.print("JULIA_CPU_CORES is deprecated, use JULIA_CPU_THREADS instead.\n")
ENV["OPENBLAS_NUM_THREADS"] = cpu_threads
end # otherwise, trust that openblas will pick CPU_THREADS anyways, without any intervention
end
# for the few uses of Libc.rand in Base:
Expand Down Expand Up @@ -547,122 +544,6 @@ let
print_time("Stdlibs total", Base.tot_time_stdlib[])
end

@eval Base begin
@deprecate_binding Test root_module(Base, :Test) true ", run `using Test` instead"
@deprecate_binding Distributed root_module(Base, :Distributed) true ", run `using Distributed` instead"
@deprecate_binding Random root_module(Base, :Random) true ", run `using Random` instead"
@deprecate_binding Serializer root_module(Base, :Serialization) true ", run `using Serialization` instead"

# PR #25249
@deprecate_binding SparseArrays root_module(Base, :SparseArrays) true ", run `using SparseArrays` instead"
@deprecate_binding(AbstractSparseArray, root_module(Base, :SparseArrays).AbstractSparseArray, true,
", run `using SparseArrays` to load sparse array functionality")
@deprecate_binding(AbstractSparseMatrix, root_module(Base, :SparseArrays).AbstractSparseMatrix, true,
", run `using SparseArrays` to load sparse array functionality")
@deprecate_binding(AbstractSparseVector, root_module(Base, :SparseArrays).AbstractSparseVector, true,
", run `using SparseArrays` to load sparse array functionality")
@deprecate_binding(SparseMatrixCSC, root_module(Base, :SparseArrays).SparseMatrixCSC, true,
", run `using SparseArrays` to load sparse array functionality")
@deprecate_binding(SparseVector, root_module(Base, :SparseArrays).SparseVector, true,
", run `using SparseArrays` to load sparse array functionality")

# PR #25571
@deprecate_binding LinAlg root_module(Base, :LinearAlgebra) true ", run `using LinearAlgebra` instead"
@deprecate_binding(I, root_module(Base, :LinearAlgebra).I, true,
", run `using LinearAlgebra` to load linear algebra functionality.")

@deprecate_binding Pkg root_module(Base, :Pkg) true ", run `using Pkg` instead"
@deprecate_binding LibGit2 root_module(Base, :LibGit2) true ", run `import LibGit2` instead"

@eval @deprecate_stdlib $(Symbol("@spawn")) Distributed true
@eval @deprecate_stdlib $(Symbol("@spawnat")) Distributed true
@eval @deprecate_stdlib $(Symbol("@fetch")) Distributed true
@eval @deprecate_stdlib $(Symbol("@fetchfrom")) Distributed true
@eval @deprecate_stdlib $(Symbol("@everywhere")) Distributed true
@eval @deprecate_stdlib $(Symbol("@parallel")) Distributed true

@deprecate_stdlib addprocs Distributed true
@deprecate_stdlib CachingPool Distributed true
@deprecate_stdlib clear! Distributed true
@deprecate_stdlib ClusterManager Distributed true
@deprecate_stdlib default_worker_pool Distributed true
@deprecate_stdlib init_worker Distributed true
@deprecate_stdlib interrupt Distributed true
@deprecate_stdlib launch Distributed true
@deprecate_stdlib manage Distributed true
@deprecate_stdlib myid Distributed true
@deprecate_stdlib nprocs Distributed true
@deprecate_stdlib nworkers Distributed true
@deprecate_stdlib pmap Distributed true
@deprecate_stdlib procs Distributed true
@deprecate_stdlib remote Distributed true
@deprecate_stdlib remotecall Distributed true
@deprecate_stdlib remotecall_fetch Distributed true
@deprecate_stdlib remotecall_wait Distributed true
@deprecate_stdlib remote_do Distributed true
@deprecate_stdlib rmprocs Distributed true
@deprecate_stdlib workers Distributed true
@deprecate_stdlib WorkerPool Distributed true
@deprecate_stdlib RemoteChannel Distributed true
@deprecate_stdlib Future Distributed true
@deprecate_stdlib WorkerConfig Distributed true
@deprecate_stdlib RemoteException Distributed true
@deprecate_stdlib ProcessExitedException Distributed true

# PR #24874
@deprecate_stdlib rand! Random true
@deprecate_stdlib srand Random true
@deprecate_stdlib AbstractRNG Random true
@deprecate_stdlib randcycle Random true
@deprecate_stdlib randcycle! Random true
@deprecate_stdlib randperm Random true
@deprecate_stdlib randperm! Random true
@deprecate_stdlib shuffle Random true
@deprecate_stdlib shuffle! Random true
@deprecate_stdlib randsubseq Random true
@deprecate_stdlib randsubseq! Random true
@deprecate_stdlib randstring Random true
@deprecate_stdlib MersenneTwister Random true
@deprecate_stdlib RandomDevice Random true
@deprecate_stdlib randn! Random true
@deprecate_stdlib randexp Random true
@deprecate_stdlib randexp! Random true
@deprecate_stdlib bitrand Random true
@deprecate_stdlib randjump Random true
@deprecate_stdlib GLOBAL_RNG Random false

# PR #25249: SparseArrays to stdlib
## the Base.SparseArrays module itself and exported types are deprecated in base/sysimg.jl
## functions that were re-exported from Base
@deprecate_stdlib nonzeros SparseArrays true
@deprecate_stdlib permute SparseArrays true
@deprecate_stdlib blkdiag SparseArrays true blockdiag
@deprecate_stdlib dropzeros SparseArrays true
@deprecate_stdlib dropzeros! SparseArrays true
@deprecate_stdlib issparse SparseArrays true
@deprecate_stdlib sparse SparseArrays true
@deprecate_stdlib sparsevec SparseArrays true
@deprecate_stdlib spdiagm SparseArrays true
@deprecate_stdlib sprand SparseArrays true
@deprecate_stdlib sprandn SparseArrays true
@deprecate_stdlib spzeros SparseArrays true
@deprecate_stdlib rowvals SparseArrays true
@deprecate_stdlib nzrange SparseArrays true
@deprecate_stdlib nnz SparseArrays true
@deprecate_stdlib findnz SparseArrays true
## functions that were exported from Base.SparseArrays but not from Base
@deprecate_stdlib droptol! SparseArrays false
## deprecated functions that are moved to stdlib/SparseArrays/src/deprecated.jl
@deprecate_stdlib spones SparseArrays true
@deprecate_stdlib speye SparseArrays true

# PR #25571: LinearAlgebra to stdlib

# PR #25021
@deprecate_stdlib normalize_string Unicode true
@deprecate_stdlib graphemes Unicode true
@deprecate_stdlib is_assigned_char Unicode true
end
end

# Clear global state
Expand Down
4 changes: 0 additions & 4 deletions base/sysinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ function __init__()
env_threads = nothing
if haskey(ENV, "JULIA_CPU_THREADS")
env_threads = ENV["JULIA_CPU_THREADS"]
elseif haskey(ENV, "JULIA_CPU_CORES") # TODO: delete in 1.0 (deprecation)
Core.print("JULIA_CPU_CORES is deprecated, use JULIA_CPU_THREADS instead.\n")
env_threads = ENV["JULIA_CPU_CORES"]
end
global CPU_THREADS = if env_threads !== nothing
env_threads = tryparse(Int, env_threads)
Expand All @@ -106,7 +103,6 @@ function __init__()
else
Int(ccall(:jl_cpu_threads, Int32, ()))
end
global CPU_CORES = CPU_THREADS # TODO: delete in 1.0 (deprecation)
global SC_CLK_TCK = ccall(:jl_SC_CLK_TCK, Clong, ())
global CPU_NAME = ccall(:jl_get_cpu_name, Ref{String}, ())
global JIT = ccall(:jl_get_JIT, Ref{String}, ())
Expand Down
8 changes: 0 additions & 8 deletions stdlib/Distributed/src/Distributed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ include("pmap.jl")
include("managers.jl") # LocalManager and SSHManager
include("precompile.jl")

# Deprecations

@eval @deprecate $(Symbol("@parallel")) $(Symbol("@distributed"))

# PR 26783
@deprecate pmap(p::AbstractWorkerPool, f, c; kwargs...) pmap(f, p, c; kwargs...)
@deprecate pmap(p::AbstractWorkerPool, f, c1, c...; kwargs...) pmap(f, p, c1, c...; kwargs...)

function __init__()
init_parallel()
end
Expand Down
4 changes: 0 additions & 4 deletions stdlib/Distributed/src/cluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,6 @@ end
const PGRP = ProcessGroup([])

function topology(t)
if t == :master_slave
Base.depwarn("The topology :master_slave is deprecated, use :master_worker instead.", :topology)
t = :master_worker
end
@assert t in [:all_to_all, :master_worker, :custom]
if (PGRP.topology==t) || ((myid()==1) && (nprocs()==1)) || (myid() > 1)
PGRP.topology = t
Expand Down
5 changes: 1 addition & 4 deletions stdlib/InteractiveUtils/src/InteractiveUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ controlled with boolean keyword arguments:
- `verbose`: print all additional information
"""
function versioninfo(io::IO=stdout; verbose::Bool=false, packages::Union{Bool, Nothing}=nothing)
if packages !== nothing
depwarn("the packages keyword argument has been removed")
end
function versioninfo(io::IO=stdout; verbose::Bool=false)
println(io, "Julia Version $VERSION")
if !isempty(Base.GIT_VERSION_INFO.commit_short)
println(io, "Commit $(Base.GIT_VERSION_INFO.commit_short) ($(Base.GIT_VERSION_INFO.date_string))")
Expand Down
1 change: 0 additions & 1 deletion stdlib/LibGit2/src/LibGit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ include("status.jl")
include("tree.jl")
include("gitcredential.jl")
include("callbacks.jl")
include("deprecated.jl")

using .Error

Expand Down
55 changes: 0 additions & 55 deletions stdlib/LibGit2/src/deprecated.jl

This file was deleted.

21 changes: 0 additions & 21 deletions stdlib/LibGit2/src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1202,16 +1202,6 @@ mutable struct UserPasswordCredential <: AbstractCredential
function UserPasswordCredential(user::AbstractString="", pass::Union{AbstractString, Base.SecretBuffer}="")
new(user, pass)
end

# Deprecated constructors
function UserPasswordCredential(u::AbstractString,p::AbstractString,prompt_if_incorrect::Bool)
Base.depwarn(string(
"`UserPasswordCredential` no longer supports the `prompt_if_incorrect` parameter. ",
"Use the `allow_prompt` keyword in supported by `LibGit2.CredentialPayload` ",
"instead."), :UserPasswordCredential)
UserPasswordCredential(u, p)
end
UserPasswordCredential(prompt_if_incorrect::Bool) = UserPasswordCredential("","",prompt_if_incorrect)
end

function Base.setproperty!(cred::UserPasswordCredential, name::Symbol, value)
Expand Down Expand Up @@ -1247,17 +1237,6 @@ mutable struct SSHCredential <: AbstractCredential
prvkey="", pubkey="")
new(user, pass, prvkey, pubkey)
end

# Deprecated constructors
function SSHCredential(u::AbstractString,p::AbstractString,prvkey::AbstractString,pubkey::AbstractString,prompt_if_incorrect::Bool)
Base.depwarn(string(
"`SSHCredential` no longer supports the `prompt_if_incorrect` parameter. ",
"Use the `allow_prompt` keyword in supported by `LibGit2.CredentialPayload` ",
"instead."), :SSHCredential)
SSHCredential(u, p, prvkey, pubkey)
end
SSHCredential(u::AbstractString, p::AbstractString, prompt_if_incorrect::Bool) = SSHCredential(u,p,"","",prompt_if_incorrect)
SSHCredential(prompt_if_incorrect::Bool) = SSHCredential("","","","",prompt_if_incorrect)
end

function Base.setproperty!(cred::SSHCredential, name::Symbol, value)
Expand Down
4 changes: 2 additions & 2 deletions stdlib/Pkg/src/resolve/FieldValues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ Base.copy(a::FieldValue) = FieldValue(a.l0, copy(a.l1), copy(a.l2), a.l3)
# some hard constraint is being violated
validmax(a::FieldValue) = a.l0 >= 0

# like usual indmax, but favors the highest indices
# like usual argmax, but favors the highest indices
# in case of a tie
function Base.indmax(f::Field)
function Base.argmax(f::Field)
m = typemin(FieldValue)
mi = 0
for j = length(f):-1:1
Expand Down
Loading

0 comments on commit ebae779

Please sign in to comment.