rust/src/libcore
Mazdak Farrokhzad 96b58301a3
Rollup merge of #61629 - petrochenkov:stdmac, r=alexcrichton
Hygienize macros in the standard library

Same as https://github.com/rust-lang/rust/pull/55597, but for all macros in the standard library.
Nested macro calls will now call what they are intended to call rather than whatever is in the closest scope at call site.
Technically this is a breaking change, so crater run would probably be useful.

---

One exception that is not hygienized is calls to `panic!(...)`.
Macros defined in libcore do not want to call `core::panic`.
What they really want to call is either `std::panic` or `core::panic` depending on `no_std` settings.
EDIT: After some thought, recursive calls to `panic` from `panic` itself probably do want to use `$crate` (UPDATE: done).

Calling `std::panic` from macros defined in std and "whatever `panic` is in scope" from macros defined in libcore is probably even worse than always calling "whatever `panic` is in scope", so I kept the existing code.

The only way to do the std/core switch correctly that I'm aware of is to define a built-in panic macro that would dispatch to `std::panic` or `core::panic` using compiler magic.
Then standard library macros could delegate to this built-in macro.
The macro could be named `panic` too, that would fix https://github.com/rust-lang/rust/issues/61567.
(This PR doesn't do that.)

---
cc https://github.com/rust-lang/rust/issues/56389
cc https://github.com/rust-lang/rust/issues/61567
Fixes https://github.com/rust-lang/rust/issues/61699
r? @alexcrichton
2019-06-13 01:49:27 +02:00
..
benches libcore => 2018 2019-04-18 14:47:35 +09:00
char libcore: deny more... 2019-04-19 01:37:12 +02:00
fmt Fix data types indication 2019-05-19 13:51:46 +00:00
future Use .await syntax instead of await! 2019-05-27 07:27:13 +02:00
hash libcore: deny more... 2019-04-19 01:37:12 +02:00
iter Rollup merge of #61671 - koalatux:nth-back-range, r=KodrAus 2019-06-12 04:22:51 +02:00
mem Auto merge of #61130 - jonhoo:mem-take, r=SimonSapin 2019-06-07 18:26:15 +00:00
num Make i*::signum a const fn. 2019-06-07 15:37:03 -07:00
ops Rollup merge of #61376 - czipperz:bound-cloned, r=sfackler 2019-06-06 22:39:09 +02:00
prelude libcore => 2018 2019-04-18 14:47:35 +09:00
ptr Utilize cfg(bootstrap) over cfg(stage0) 2019-06-05 17:57:58 -06:00
slice Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapin 2019-06-13 01:49:26 +02:00
str make sure to_ascii_lowercase actually leaves upper-case non-ASCII characters alone 2019-06-10 12:42:43 +02:00
sync Remove unneeded feature attr from atomic integers doctests 2019-06-04 13:24:39 +00:00
task bump nightly to 1.37.0 2019-05-23 12:27:58 +02:00
tests Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapin 2019-06-13 01:49:26 +02:00
unicode libcore => 2018 2019-04-18 14:47:35 +09:00
alloc.rs Rollup merge of #60947 - blkerby:global_alloc_typo, r=jonas-schievink 2019-05-19 02:31:46 +02:00
any.rs libcore: deny more... 2019-04-19 01:37:12 +02:00
array.rs Auto merge of #60318 - jethrogb:jb/try-from-slice-to-infallible, r=sfackler 2019-05-11 19:13:12 +00:00
ascii.rs Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators." 2019-05-22 14:09:34 -07:00
borrow.rs be more direct about borrow requirenments 2019-04-03 11:41:24 +03:00
Cargo.toml libcore => 2018 2019-04-18 14:47:35 +09:00
cell.rs Stabilize Cell::from_mut and as_slice_of_cells 2019-06-07 16:25:41 +02:00
clone.rs libcore => 2018 2019-04-18 14:47:35 +09:00
cmp.rs libcore => 2018 2019-04-18 14:47:35 +09:00
convert.rs Fix typo in AsRef doc 2019-06-02 14:12:06 +02:00
default.rs libs: doc comments 2019-02-10 23:57:25 +00:00
ffi.rs libcore: deny more... 2019-04-19 01:37:12 +02:00
hint.rs libcore => 2018 2019-04-18 14:47:35 +09:00
internal_macros.rs libcore => 2018 2019-04-18 14:47:35 +09:00
intrinsics.rs Rollup merge of #61501 - RalfJung:intrinsics, r=rkruppe 2019-06-10 13:14:28 +02:00
iter_private.rs Remove licenses 2018-12-25 21:08:33 -07:00
lib.rs Remove unused #![feature(custom_attribute)]s 2019-06-08 23:55:24 +03:00
macros.rs Hygienize macros in the standard library 2019-06-12 20:27:29 +03:00
marker.rs libcore => 2018 2019-04-18 14:47:35 +09:00
option.rs Rollup merge of #60376 - lzutao:stabilize-option_xor, r=SimonSapin 2019-06-13 01:49:24 +02:00
panic.rs libcore: deny more... 2019-04-19 01:37:12 +02:00
panicking.rs libcore: deny more... 2019-04-19 01:37:12 +02:00
pin.rs libcore/pin: Minor grammar corrections for module documentation 2019-06-07 11:03:01 +02:00
raw.rs Remove licenses 2018-12-25 21:08:33 -07:00
result.rs Implement Clone::clone_from for Result. 2019-06-01 09:14:59 +02:00
time.rs libcore: deny more... 2019-04-19 01:37:12 +02:00
tuple.rs libcore => 2018 2019-04-18 14:47:35 +09:00
unit.rs libcore => 2018 2019-04-18 14:47:35 +09:00