Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #69144

Merged
merged 36 commits into from
Feb 14, 2020
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
953f6ec
fix lifetime shadowing check in GATs
basil-cow Feb 7, 2020
91b4a24
Enable use after scope detection in the new LLVM pass manager
tmiasko Feb 13, 2020
57a62f5
Add comment to SGX entry code
Feb 13, 2020
4f17dce
StripUnconfigured::in_cfg: simplify with slice patterns
Centril Dec 31, 2019
b8b32a9
simplify config::features
Centril Dec 31, 2019
64ea295
expand: extract error_derive_forbidden_on_non_adt
Centril Dec 31, 2019
10f342a
miri: fix exact_div
RalfJung Feb 13, 2020
acad033
expand: extract error_recursion_limit_reached
Centril Dec 31, 2019
7518492
expand: extract error_wrong_fragment_kind
Centril Dec 31, 2019
fcce5fa
expand: simplify classify_*
Centril Dec 31, 2019
dc6bd6a
expand: simplify flat_map_item
Centril Dec 31, 2019
ec43450
expand: simplify flat_map_item wrt. inline module detection
Centril Dec 31, 2019
9fed2d5
parser: extract common foreign item code for each kind
Centril Jan 31, 2020
7737d0f
parser: unify item list parsing.
Centril Jan 31, 2020
511dfdb
parser: extract `recover_missing_kw_before_item`
Centril Jan 31, 2020
73d5970
parser: introduce `parse_item_kind` as central `ItemInfo` logic.
Centril Jan 31, 2020
20ba687
parser_item_mod: avoid cloning outer attributes
Centril Jan 31, 2020
c202603
parser: remove `Option<Vec<Attribute>>` in `ItemInfo`.
Centril Jan 31, 2020
fd64b3b
parser: make `eat_macro_def` redundant.
Centril Jan 31, 2020
15e07a6
parser: fuse `trait` parsing & layer with `is_path_start_item`
Centril Jan 31, 2020
46d3ef5
parser: extract `recover_const_mut`.
Centril Jan 31, 2020
aaaf0ba
parser: misc small item related improvements & cleanups.
Centril Feb 1, 2020
ad72c3a
parser: inline parse_assoc_macro_invoc
Centril Feb 1, 2020
4706c38
Use HirId in TraitCandidate.
cjgillot Feb 12, 2020
2a899e2
Make TraitCandidate generic.
cjgillot Feb 13, 2020
026dec5
Spelling error "represening" to "representing"
drewrip Feb 13, 2020
23cb749
don't error on network failures
mark-i-m Feb 13, 2020
89f5dcf
Rollup merge of #68728 - Centril:towards-fn-merge, r=petrochenkov
Dylan-DPC Feb 13, 2020
998daf3
Rollup merge of #68938 - Areredify:gat_lifetime_shadowing, r=estebank
Dylan-DPC Feb 13, 2020
fc51170
Rollup merge of #69057 - Centril:clean-expand, r=petrochenkov
Dylan-DPC Feb 13, 2020
b5ee867
Rollup merge of #69108 - cjgillot:trait_candidate, r=Zoxc
Dylan-DPC Feb 13, 2020
8e2772c
Rollup merge of #69125 - jethrogb:jb/cleanup-sgx-entry, r=Dylan-DPC
Dylan-DPC Feb 13, 2020
c8343b8
Rollup merge of #69126 - RalfJung:exact-div, r=oli-obk
Dylan-DPC Feb 13, 2020
a8a2c14
Rollup merge of #69127 - tmiasko:new-pass-manager-use-after-scope, r=…
Dylan-DPC Feb 13, 2020
0bdf568
Rollup merge of #69135 - drewrip:drewrip-spelling, r=jonas-schievink
Dylan-DPC Feb 13, 2020
7704e59
Rollup merge of #69141 - mark-i-m:proper-linkcheck-2, r=Dylan-DPC
Dylan-DPC Feb 13, 2020
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
expand: extract error_wrong_fragment_kind
  • Loading branch information
Centril committed Feb 13, 2020
commit 7518492315346ac3821ad9264e08721a571742c8
20 changes: 13 additions & 7 deletions src/librustc_expand/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,18 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
FatalError.raise();
}

/// A macro's expansion does not fit in this fragment kind.
/// For example, a non-type macro in a type position.
fn error_wrong_fragment_kind(&mut self, kind: AstFragmentKind, mac: &ast::Mac, span: Span) {
let msg = format!(
"non-{kind} macro in {kind} position: {path}",
kind = kind.name(),
path = pprust::path_to_string(&mac.path),
);
self.cx.span_err(span, &msg);
self.cx.trace_macros_diag();
}

fn expand_invoc(&mut self, invoc: Invocation, ext: &SyntaxExtensionKind) -> AstFragment {
if self.cx.current_expansion.depth > self.cx.ecfg.recursion_limit {
self.error_recursion_limit_reached();
Expand All @@ -643,13 +655,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
let result = if let Some(result) = fragment_kind.make_from(tok_result) {
result
} else {
let msg = format!(
"non-{kind} macro in {kind} position: {path}",
kind = fragment_kind.name(),
path = pprust::path_to_string(&mac.path),
);
self.cx.span_err(span, &msg);
self.cx.trace_macros_diag();
self.error_wrong_fragment_kind(fragment_kind, &mac, span);
fragment_kind.dummy(span)
};
self.cx.current_expansion.prior_type_ascription = prev;
Expand Down