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 11 pull requests #81660

Merged
merged 30 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
050643a
Add Frames iterator for Backtrace
seanchen1991 Jan 13, 2021
61f6fa7
move a bunch of tests
lcnr Jan 28, 2021
fe1fc36
Add some test for ATB issues
jackh726 Jan 28, 2021
6c14aad
Improve handling of spans around macro result parse errors
Aaron1011 Jan 31, 2021
7bc09f7
Remove the remains of the query categories.
Jan 31, 2021
988d93c
Indent the code correctly again after removing the query categories.
Jan 31, 2021
82010e8
rustdoc: Note why `rustdoc::html::markdown` is public
camelid Jan 28, 2021
bf4bdd9
Add lint for 2229 migrations
arora-aman Dec 28, 2020
9989334
Add SAFETY comment for the `TrustedRandomAccess` impl of `iter::Fuse`
sdroege Feb 1, 2021
12b605a
Implement `TrustedLen` for `iter::Fuse<I: TrustedLen>`
sdroege Jan 31, 2021
8e34522
Remove unneeded `mut` variable
LingMan Jan 20, 2021
899b0dd
Fix overflowing text on mobile when sidebar is displayed
GuillaumeGomez Feb 1, 2021
7f8530f
more things are const evaluatable *sparkles*
BoxyUwU Feb 1, 2021
d3e8501
Process mentioned upvars for analysis first pass after ExprUseVisitor
arora-aman Nov 21, 2020
cc5e6db
Migrations first pass
arora-aman Dec 15, 2020
3c71a7b
Tests for 2229 lint
arora-aman Dec 30, 2020
caf06bf
Mark the lint doc as compile_fail
arora-aman Jan 3, 2021
8f15cc1
PR fixup
arora-aman Jan 19, 2021
84f0a0a
New migration
arora-aman Jan 26, 2021
a188791
Rollup merge of #80629 - sexxi-goose:migrations_1, r=nikomatsakis
jonas-schievink Feb 2, 2021
f61ab58
Rollup merge of #81022 - seanchen1991:feat/frames-iter, r=KodrAus
jonas-schievink Feb 2, 2021
e6e76c7
Rollup merge of #81481 - lcnr:cast-tests, r=jackh726
jonas-schievink Feb 2, 2021
a61e6ab
Rollup merge of #81485 - jackh726:atb-issues, r=Mark-Simulacrum
jonas-schievink Feb 2, 2021
30f12a0
Rollup merge of #81492 - camelid:rustdoc-internal-mod-vis, r=Guillaum…
jonas-schievink Feb 2, 2021
efec2bb
Rollup merge of #81577 - BoxyUwU:subexpr_const_evaluatable, r=oli-obk
jonas-schievink Feb 2, 2021
86d0e6d
Rollup merge of #81599 - sdroege:fuse-trusted-len, r=m-ou-se
jonas-schievink Feb 2, 2021
255e076
Rollup merge of #81608 - Aaron1011:macro-res-parse-err, r=davidtwco
jonas-schievink Feb 2, 2021
285524f
Rollup merge of #81609 - Julian-Wollersberger:no-query-categories, r=…
jonas-schievink Feb 2, 2021
d2f96a9
Rollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, …
jonas-schievink Feb 2, 2021
73f859e
Rollup merge of #81631 - LingMan:rem_var, r=davidtwco
jonas-schievink Feb 2, 2021
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
4 changes: 3 additions & 1 deletion compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
fragment
}
Err(mut err) => {
err.set_span(span);
if err.span.is_dummy() {
err.set_span(span);
}
annotate_err_with_kind(&mut err, kind, span);
err.emit();
self.cx.trace_macros_diag();
Expand Down
46 changes: 46 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,7 @@ declare_lint_pass! {
UNSUPPORTED_NAKED_FUNCTIONS,
MISSING_ABI,
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
DISJOINT_CAPTURE_DROP_REORDER,
]
}

Expand All @@ -2994,6 +2995,51 @@ declare_lint! {
"detects doc comments that aren't used by rustdoc"
}

declare_lint! {
/// The `disjoint_capture_drop_reorder` lint detects variables that aren't completely
/// captured when the feature `capture_disjoint_fields` is enabled and it affects the Drop
/// order of at least one path starting at this variable.
///
/// ### Example
///
/// ```rust,compile_fail
/// # #![deny(disjoint_capture_drop_reorder)]
/// # #![allow(unused)]
/// struct FancyInteger(i32);
///
/// impl Drop for FancyInteger {
/// fn drop(&mut self) {
/// println!("Just dropped {}", self.0);
/// }
/// }
///
/// struct Point { x: FancyInteger, y: FancyInteger }
///
/// fn main() {
/// let p = Point { x: FancyInteger(10), y: FancyInteger(20) };
///
/// let c = || {
/// let x = p.x;
/// };
///
/// c();
///
/// // ... More code ...
/// }
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// In the above example `p.y` will be dropped at the end of `f` instead of with `c` if
/// the feature `capture_disjoint_fields` is enabled.
pub DISJOINT_CAPTURE_DROP_REORDER,
Allow,
"Drop reorder because of `capture_disjoint_fields`"

}

declare_lint_pass!(UnusedDocComment => [UNUSED_DOC_COMMENTS]);

declare_lint! {
Expand Down
125 changes: 52 additions & 73 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,6 @@ impl<T: Parse> Parse for List<T> {
}
}

/// A named group containing queries.
///
/// For now, the name is not used any more, but the capability remains interesting for future
/// developments of the query system.
struct Group {
#[allow(unused)]
name: Ident,
queries: List<Query>,
}

impl Parse for Group {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let name: Ident = input.parse()?;
let content;
braced!(content in input);
Ok(Group { name, queries: content.parse()? })
}
}

struct QueryModifiers {
/// The description of the query.
desc: (Option<Ident>, Punctuated<Expr, Token![,]>),
Expand Down Expand Up @@ -450,72 +431,70 @@ fn add_query_description_impl(
}

pub fn rustc_queries(input: TokenStream) -> TokenStream {
let groups = parse_macro_input!(input as List<Group>);
let queries = parse_macro_input!(input as List<Query>);

let mut query_stream = quote! {};
let mut query_description_stream = quote! {};
let mut dep_node_def_stream = quote! {};
let mut cached_queries = quote! {};

for group in groups.0 {
for mut query in group.queries.0 {
let modifiers = process_modifiers(&mut query);
let name = &query.name;
let arg = &query.arg;
let result_full = &query.result;
let result = match query.result {
ReturnType::Default => quote! { -> () },
_ => quote! { #result_full },
};
for mut query in queries.0 {
let modifiers = process_modifiers(&mut query);
let name = &query.name;
let arg = &query.arg;
let result_full = &query.result;
let result = match query.result {
ReturnType::Default => quote! { -> () },
_ => quote! { #result_full },
};

if modifiers.cache.is_some() {
cached_queries.extend(quote! {
#name,
});
}
if modifiers.cache.is_some() {
cached_queries.extend(quote! {
#name,
});
}

let mut attributes = Vec::new();
let mut attributes = Vec::new();

// Pass on the fatal_cycle modifier
if modifiers.fatal_cycle {
attributes.push(quote! { fatal_cycle });
};
// Pass on the storage modifier
if let Some(ref ty) = modifiers.storage {
attributes.push(quote! { storage(#ty) });
};
// Pass on the cycle_delay_bug modifier
if modifiers.cycle_delay_bug {
attributes.push(quote! { cycle_delay_bug });
};
// Pass on the no_hash modifier
if modifiers.no_hash {
attributes.push(quote! { no_hash });
};
// Pass on the anon modifier
if modifiers.anon {
attributes.push(quote! { anon });
};
// Pass on the eval_always modifier
if modifiers.eval_always {
attributes.push(quote! { eval_always });
};
// Pass on the fatal_cycle modifier
if modifiers.fatal_cycle {
attributes.push(quote! { fatal_cycle });
};
// Pass on the storage modifier
if let Some(ref ty) = modifiers.storage {
attributes.push(quote! { storage(#ty) });
};
// Pass on the cycle_delay_bug modifier
if modifiers.cycle_delay_bug {
attributes.push(quote! { cycle_delay_bug });
};
// Pass on the no_hash modifier
if modifiers.no_hash {
attributes.push(quote! { no_hash });
};
// Pass on the anon modifier
if modifiers.anon {
attributes.push(quote! { anon });
};
// Pass on the eval_always modifier
if modifiers.eval_always {
attributes.push(quote! { eval_always });
};

let attribute_stream = quote! {#(#attributes),*};
let doc_comments = query.doc_comments.iter();
// Add the query to the group
query_stream.extend(quote! {
#(#doc_comments)*
[#attribute_stream] fn #name(#arg) #result,
});
let attribute_stream = quote! {#(#attributes),*};
let doc_comments = query.doc_comments.iter();
// Add the query to the group
query_stream.extend(quote! {
#(#doc_comments)*
[#attribute_stream] fn #name(#arg) #result,
});

// Create a dep node for the query
dep_node_def_stream.extend(quote! {
[#attribute_stream] #name(#arg),
});
// Create a dep node for the query
dep_node_def_stream.extend(quote! {
[#attribute_stream] #name(#arg),
});

add_query_description_impl(&query, modifiers, &mut query_description_stream);
}
add_query_description_impl(&query, modifiers, &mut query_description_stream);
}

TokenStream::from(quote! {
Expand Down
Loading