about summary refs log tree commit diff
path: root/src/test/ui/thinlto
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-13 01:49:27 +0200
committerGitHub <noreply@github.com>2019-06-13 01:49:27 +0200
commit96b58301a38e1c7bbcb2accfcdfea4132e52f3f3 (patch)
treefc77bc107a5845a01f09227951231d267162c32c /src/test/ui/thinlto
parenta1ff450a68e115e884f3ced8ba17fe5971202da4 (diff)
parenteb09daa762c37c743584ec3b5c05a2d181960ced (diff)
downloadrust-96b58301a38e1c7bbcb2accfcdfea4132e52f3f3.tar.gz
rust-96b58301a38e1c7bbcb2accfcdfea4132e52f3f3.zip
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
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions