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 7 pull requests #109383

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
920435f
Windows: make Command prefer non-verbatim paths
ChrisDenton Dec 2, 2022
746331e
std: drop all messages in bounded channel when destroying the last re…
joboet Feb 17, 2023
642a324
std: add regression test for #107466
joboet Feb 17, 2023
4e9e465
std: disconnect senders before discarding messages
joboet Feb 26, 2023
e4ab642
Use match instead of if in codegen_attrs
Noratrieb Mar 13, 2023
1d70bd4
Further codegen_attrs cleanups
Noratrieb Mar 13, 2023
82297a5
expand: Pass `ast::Crate` by reference to AST transforming passes
petrochenkov Feb 18, 2023
0261d25
Add some tests for the current `#![cfg(FALSE)]` crate behavior
petrochenkov Mar 14, 2023
bf00e7d
rustc_interface: Add a new query `pre_configure`
petrochenkov Mar 14, 2023
34aa872
std: leak remaining messages in bounded channel if message destructor…
joboet Mar 14, 2023
f28f77f
resolve: Remove `item_generics_num_lifetimes`
petrochenkov Feb 21, 2023
d99e01f
resolve: Remove `item_attrs_untracked`
petrochenkov Feb 21, 2023
52c7397
resolve: Use `item_name` and `opt_parent` in `Resolver::get_module`
petrochenkov Mar 14, 2023
18b59f5
resolve: Minor cleanup to `Resolver::get_module`
petrochenkov Mar 14, 2023
1775722
fix: modify the condition that `resolve_imports` stops
bvanjoi Mar 19, 2023
1f67949
Lint ambiguous glob re-exports
jieyouxu Mar 19, 2023
184b0b8
Rollup merge of #96391 - ChrisDenton:command-non-verbatim, r=joshtrip…
matthiaskrgr Mar 20, 2023
c794dcd
Rollup merge of #107880 - jieyouxu:issue-107563, r=petrochenkov
matthiaskrgr Mar 20, 2023
7c961a3
Rollup merge of #108164 - joboet:discard_messages_mpmc_array, r=Amanieu
matthiaskrgr Mar 20, 2023
28fc7a7
Rollup merge of #108221 - petrochenkov:cratecfg, r=michaelwoerister
matthiaskrgr Mar 20, 2023
5abb423
Rollup merge of #108729 - bvanjoi:fix-issue-97534, r=petrochenkov
matthiaskrgr Mar 20, 2023
7f2eea3
Rollup merge of #109091 - Nilstrieb:match-on-attr, r=cjgillot
matthiaskrgr Mar 20, 2023
cc3f4c0
Rollup merge of #109137 - petrochenkov:qcstore2, r=cjgillot
matthiaskrgr Mar 20, 2023
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: 1 addition & 3 deletions compiler/rustc_builtin_macros/src/cmdline_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_ast::{self as ast, AttrItem, AttrStyle};
use rustc_session::parse::ParseSess;
use rustc_span::FileName;

pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -> ast::Crate {
pub fn inject(krate: &mut ast::Crate, parse_sess: &ParseSess, attrs: &[String]) {
for raw_attr in attrs {
let mut parser = rustc_parse::new_parser_from_source_str(
parse_sess,
Expand Down Expand Up @@ -36,6 +36,4 @@ pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -
start_span.to(end_span),
));
}

krate
}
12 changes: 5 additions & 7 deletions compiler/rustc_builtin_macros/src/proc_macro_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ struct CollectProcMacros<'a> {
}

pub fn inject(
krate: &mut ast::Crate,
sess: &Session,
resolver: &mut dyn ResolverExpand,
mut krate: ast::Crate,
is_proc_macro_crate: bool,
has_proc_macro_decls: bool,
is_test_crate: bool,
handler: &rustc_errors::Handler,
) -> ast::Crate {
) {
let ecfg = ExpansionConfig::default("proc_macro".to_string());
let mut cx = ExtCtxt::new(sess, ecfg, resolver, None);

Expand All @@ -66,22 +66,20 @@ pub fn inject(
};

if has_proc_macro_decls || is_proc_macro_crate {
visit::walk_crate(&mut collect, &krate);
visit::walk_crate(&mut collect, krate);
}
let macros = collect.macros;

if !is_proc_macro_crate {
return krate;
return;
}

if is_test_crate {
return krate;
return;
}

let decls = mk_decls(&mut cx, &macros);
krate.items.push(decls);

krate
}

impl<'a> CollectProcMacros<'a> {
Expand Down
17 changes: 9 additions & 8 deletions compiler/rustc_builtin_macros/src/standard_library_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ use rustc_span::DUMMY_SP;
use thin_vec::thin_vec;

pub fn inject(
mut krate: ast::Crate,
krate: &mut ast::Crate,
pre_configured_attrs: &[ast::Attribute],
resolver: &mut dyn ResolverExpand,
sess: &Session,
) -> ast::Crate {
) -> usize {
let orig_num_items = krate.items.len();
let edition = sess.parse_sess.edition;

// the first name in this list is the crate name of the crate with the prelude
let names: &[Symbol] = if sess.contains_name(&krate.attrs, sym::no_core) {
return krate;
} else if sess.contains_name(&krate.attrs, sym::no_std) {
if sess.contains_name(&krate.attrs, sym::compiler_builtins) {
let names: &[Symbol] = if sess.contains_name(pre_configured_attrs, sym::no_core) {
return 0;
} else if sess.contains_name(pre_configured_attrs, sym::no_std) {
if sess.contains_name(pre_configured_attrs, sym::compiler_builtins) {
&[sym::core]
} else {
&[sym::core, sym::compiler_builtins]
Expand Down Expand Up @@ -88,6 +90,5 @@ pub fn inject(
);

krate.items.insert(0, use_item);

krate
krate.items.len() - orig_num_items
}
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct TestCtxt<'a> {

/// Traverse the crate, collecting all the test functions, eliding any
/// existing main functions, and synthesizing a main test harness
pub fn inject(sess: &Session, resolver: &mut dyn ResolverExpand, krate: &mut ast::Crate) {
pub fn inject(krate: &mut ast::Crate, sess: &Session, resolver: &mut dyn ResolverExpand) {
let span_diagnostic = sess.diagnostic();
let panic_strategy = sess.panic_strategy();
let platform_panic_strategy = sess.target.panic_strategy;
Expand Down
Loading