From: bors Date: Mon, 3 Oct 2016 08:30:32 +0000 (-0700) Subject: Auto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrc X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=f3745653e10e366e7e119a12c178a59ab6394007;p=rust.git Auto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrc Enforce the shadowing restrictions from RFC 1560 for today's macros This PR enforces a weakened version of the shadowing restrictions from RFC 1560. More specifically, - If a macro expansion contains a `macro_rules!` macro definition that is used outside of the expansion, the defined macro may not shadow an existing macro. - If a macro expansion contains a `#[macro_use] extern crate` macro import that is used outside of the expansion, the imported macro may not shadow an existing macro. This is a [breaking-change]. For example, ```rust macro_rules! m { () => {} } macro_rules! n { () => { macro_rules! m { () => {} } //< This shadows an existing macro. m!(); //< This is inside the expansion that generated `m`'s definition, so it is OK. } } n!(); m!(); //< This use of `m` is outside the expansion, so it causes the shadowing to be an error. ``` r? @nrc --- f3745653e10e366e7e119a12c178a59ab6394007