Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2cb460e
Use `saturating_sub` where applicable
AnthonyMikh Sep 25, 2019
e9a93be
Use `max` instead of `if`s
AnthonyMikh Sep 25, 2019
4fc5650
Simplify Unicode-aware trimming
AnthonyMikh Sep 25, 2019
d6327e8
Use map + sum instead of fold for computing Unicode width
AnthonyMikh Sep 25, 2019
aef169b
Use Option::map_or where applicable
AnthonyMikh Sep 25, 2019
9b447e2
Unify order of variables in chained comparison
AnthonyMikh Sep 25, 2019
f93827f
Simplify `Emitter::fix_multispan_in_std_macros`
AnthonyMikh Sep 25, 2019
ea32862
Use `sort_by_key` rather than `sort_by`
AnthonyMikh Sep 25, 2019
7a0725f
Simplify `style_or_override`
AnthonyMikh Sep 25, 2019
75a7c27
Revert "Simplify Unicode-aware trimming"
AnthonyMikh Sep 26, 2019
3eba6c1
syntax: recover trailing `|` in or-patterns.
Centril Sep 29, 2019
d938a80
Fixed grammar for some `time` fn calls and a diagnostic.
alexreg Sep 30, 2019
fdd1a62
Added backticks for one diagnostic message.
alexreg Sep 30, 2019
8a4af2f
Fixed weird non-sequential indices for serialisation of `SourceFile` …
alexreg Sep 30, 2019
13b61b5
Fixed grammar in one diagnostic and blessed tests.
alexreg Sep 29, 2019
49c6c86
Fixed stylistic convention for one diagnostic and blessed tests.
alexreg Sep 30, 2019
33ed03f
Cleaned up a few doc comments in libfmt_macros.
alexreg Sep 30, 2019
349259d
Stabilize macros in `extern` blocks
petrochenkov Aug 26, 2019
5ae38bb
Stabilize proc macros in type positions
petrochenkov Aug 27, 2019
b04d5f7
Upgrade Emscripten targets to use upstream LLVM backend
tlively Aug 17, 2019
535d474
syntax: Split `ast::Attribute` into container and inner parts
petrochenkov Aug 17, 2019
576c215
Add test for #50571
JohnTitor Sep 30, 2019
bc25746
Add test for #58022
JohnTitor Sep 30, 2019
9c73131
Add test for #58344
JohnTitor Sep 30, 2019
957986d
syntax: Support modern attribute syntax in the `meta` matcher
petrochenkov Aug 17, 2019
870b47f
typeck: silence unreachable code from await
davidtwco Sep 30, 2019
7dc953b
Simplify code for special case of annotation
AnthonyMikh Sep 30, 2019
6b6a79b
Simplify `EmitterWriter::get_multispan_max_line_num`
AnthonyMikh Sep 30, 2019
7b4c5c6
Simplify `EmitterWriter::get_max_line_num`
AnthonyMikh Sep 30, 2019
21724ed
Update doc comment for `style_or_override`
AnthonyMikh Sep 30, 2019
7a807c5
Simplify `EmitterWriter::emit_suggestion_default`
AnthonyMikh Sep 30, 2019
9d73176
Remove redundant `.iter_mut()`
AnthonyMikh Sep 30, 2019
55b5428
Simplify a conditional in `collect_annotations`
AnthonyMikh Sep 30, 2019
6ea4a52
Address review comments
petrochenkov Sep 30, 2019
bb44288
Use pattern matching instead of indexing tuples
AnthonyMikh Sep 30, 2019
e5db5b3
(fmt) remove trailing whitespaces
AnthonyMikh Sep 30, 2019
61bc38e
Fix errors
AnthonyMikh Sep 30, 2019
515262c
Ascript type explicitly
AnthonyMikh Sep 30, 2019
fdce416
Hint type for `.sum()`
AnthonyMikh Oct 1, 2019
50c2a58
Fix borrowck errors
AnthonyMikh Oct 1, 2019
13e9b3d
Deduplicate closure type errors
estebank Oct 1, 2019
2aafa46
Rollup merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexc…
Centril Oct 1, 2019
3ca5804
Rollup merge of #63674 - petrochenkov:meta2, r=Centril
Centril Oct 1, 2019
8bae91d
Rollup merge of #63931 - petrochenkov:stabmac, r=Centril
Centril Oct 1, 2019
8206e61
Rollup merge of #64887 - Centril:recover-trailing-vert, r=estebank
Centril Oct 1, 2019
857b2b9
Rollup merge of #64907 - alexreg:tidy-up, r=Mark-Simulacrum
Centril Oct 1, 2019
0aaab33
Rollup merge of #64928 - JohnTitor:add-some-tests, r=Centril
Centril Oct 1, 2019
cac592f
Rollup merge of #64930 - davidtwco:issue-61798-diverging-await, r=pet…
Centril Oct 1, 2019
3ff0f33
Rollup merge of #64935 - AnthonyMikh:librustc_errors/emmiter__code-cl…
Centril Oct 1, 2019
7ca64cc
Rollup merge of #64937 - estebank:dedup-closure-err, r=Centril
Centril Oct 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stabilize macros in extern blocks
Add some tests for macros in extern blocks, remove duplicate tests
  • Loading branch information
petrochenkov committed Sep 30, 2019
commit 349259d55f9b006fe871a26eaa2481b4103dc9d7
13 changes: 1 addition & 12 deletions src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
}

fn expand_invoc(&mut self, invoc: Invocation, ext: &SyntaxExtensionKind) -> AstFragment {
let (fragment_kind, span) = (invoc.fragment_kind, invoc.span());
if fragment_kind == AstFragmentKind::ForeignItems && !self.cx.ecfg.macros_in_extern() {
if let SyntaxExtensionKind::NonMacroAttr { .. } = ext {} else {
emit_feature_err(&self.cx.parse_sess, sym::macros_in_extern,
span, GateIssue::Language,
"macro invocations in `extern {}` blocks are experimental");
}
}

if self.cx.current_expansion.depth > self.cx.ecfg.recursion_limit {
let expn_data = self.cx.current_expansion.id.expn_data();
let suggested_limit = self.cx.ecfg.recursion_limit * 2;
Expand All @@ -578,6 +569,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
FatalError.raise();
}

let (fragment_kind, span) = (invoc.fragment_kind, invoc.span());
match invoc.kind {
InvocationKind::Bang { mac, .. } => match ext {
SyntaxExtensionKind::Bang(expander) => {
Expand Down Expand Up @@ -1578,9 +1570,6 @@ impl<'feat> ExpansionConfig<'feat> {
}
}

fn macros_in_extern(&self) -> bool {
self.features.map_or(false, |features| features.macros_in_extern)
}
fn proc_macro_hygiene(&self) -> bool {
self.features.map_or(false, |features| features.proc_macro_hygiene)
}
Expand Down
2 changes: 2 additions & 0 deletions src/libsyntax/feature_gate/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ declare_features! (
(accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287), None),
/// Allows attributes in formal function parameters.
(accepted, param_attrs, "1.39.0", Some(60406), None),
// Allows macro invocations in `extern {}` blocks.
(accepted, macros_in_extern, "1.40.0", Some(49476), None),

// -------------------------------------------------------------------------
// feature-group-end: accepted features
Expand Down
3 changes: 0 additions & 3 deletions src/libsyntax/feature_gate/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,6 @@ declare_features! (
/// Allows infering `'static` outlives requirements (RFC 2093).
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),

/// Allows macro invocations in `extern {}` blocks.
(active, macros_in_extern, "1.27.0", Some(49476), None),

/// Allows accessing fields of unions inside `const` functions.
(active, const_fn_union, "1.27.0", Some(51909), None),

Expand Down
30 changes: 0 additions & 30 deletions src/test/ui/abi/macros/macros-in-extern.stderr

This file was deleted.

112 changes: 0 additions & 112 deletions src/test/ui/abi/proc-macro/auxiliary/test-macros.rs

This file was deleted.

30 changes: 0 additions & 30 deletions src/test/ui/abi/proc-macro/macros-in-extern.stderr

This file was deleted.

27 changes: 0 additions & 27 deletions src/test/ui/feature-gates/feature-gate-macros_in_extern.rs

This file was deleted.

30 changes: 0 additions & 30 deletions src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr

This file was deleted.

2 changes: 0 additions & 2 deletions src/test/ui/macros/issue-54441.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(macros_in_extern)]

macro_rules! m {
() => {
let //~ ERROR expected
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/macros/issue-54441.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected one of `crate`, `fn`, `pub`, `static`, or `type`, found `let`
--> $DIR/issue-54441.rs:5:9
--> $DIR/issue-54441.rs:3:9
|
LL | let
| ^^^ unexpected token
Expand Down
30 changes: 0 additions & 30 deletions src/test/ui/macros/macros-in-extern-rpass.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// run-pass
// ignore-wasm32

#![feature(decl_macro)]
Expand All @@ -16,17 +17,29 @@ macro_rules! emits_nothing(
() => ()
);

macro_rules! emits_multiple(
() => {
fn f1() -> u32;
fn f2() -> u32;
}
);

mod defs {
#[no_mangle] extern fn f1() -> u32 { 1 }
#[no_mangle] extern fn f2() -> u32 { 2 }
}

fn main() {
assert_eq!(unsafe { rust_get_test_int() }, 0isize);
assert_eq!(unsafe { rust_get_test_int() }, 1);
assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEFu32);
assert_eq!(unsafe { f1() }, 1);
assert_eq!(unsafe { f2() }, 2);
}

#[link(name = "rust_test_helpers", kind = "static")]
extern {
returns_isize!(rust_get_test_int);
//~^ ERROR macro invocations in `extern {}` blocks are experimental
takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
//~^ ERROR macro invocations in `extern {}` blocks are experimental
emits_nothing!();
//~^ ERROR macro invocations in `extern {}` blocks are experimental
emits_multiple!();
}
26 changes: 0 additions & 26 deletions src/test/ui/proc-macro/auxiliary/test-macros-rpass.rs

This file was deleted.

Loading