This also changes stdenv's substitute --replace-fail to error out when
the replacement is the same as the search pattern, but can't be found.
This should not cause any problems in existing code, from what I can
tell from grepping nixpkgs.
The exception for pattern==replacement was previously introduced all the
way back in 5ff872aa24, but this was
apparently only used to make the check for the warning "simpler".
Takes the extended features of nix substituteAll to a replaceVars
variant to get rid of those cases that use substituteAll to build a full
package with meta information etc.
replaceVars has a checkPhase to confirm that no left-over @...@ patterns
remain. Since it's not possible to use "placeholder" with replaceVars,
the substitution of some patterns must be delayed to a later step.
By passing "null" for those keys explicitly, replaceVars can make an
exemption *just for this case*, but keep checking all other references.