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

tweaks to move NLL bootstrap along #48372

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build_helper = { path = "../build_helper" }
cmake = "0.1.23"
filetime = "0.1"
num_cpus = "1.0"
getopts = "0.2"
getopts = "0.2.17"
cc = "1.0.1"
libc = "0.2"
serde = "1.0.8"
Expand Down
17 changes: 10 additions & 7 deletions src/liballoc/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
fn clone(&self) -> BTreeMap<K, V> {
fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
K,
V,
marker::LeafOrInternal>)
-> BTreeMap<K, V> {

fn clone_subtree<'a, K: Clone, V: Clone>(
node: node::NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
) -> BTreeMap<K, V>
where K: 'a, V: 'a,
{
match node.force() {
Leaf(leaf) => {
let mut out_tree = BTreeMap {
Expand Down Expand Up @@ -1040,7 +1039,11 @@ impl<K: Ord, V> BTreeMap<K, V> {

/// Calculates the number of elements if it is incorrect.
fn recalc_length(&mut self) {
fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
fn dfs<'a, K, V>(
node: NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
) -> usize
where K: 'a, V: 'a
{
let mut res = node.len();

if let Internal(node) = node.force() {
Expand Down
9 changes: 5 additions & 4 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,16 @@ impl<'a> LintLevelsBuilder<'a> {
forbidden_lint_name);
diag_builder.span_label(lint_attr_span, "overruled by previous forbid");
match forbid_src {
LintSource::Default => &mut diag_builder,
LintSource::Default => { }
LintSource::Node(_, forbid_source_span) => {
diag_builder.span_label(forbid_source_span,
"`forbid` level set here")
"`forbid` level set here");
},
LintSource::CommandLine(_) => {
diag_builder.note("`forbid` lint level was set on command line")
diag_builder.note("`forbid` lint level was set on command line");
}
}.emit();
}
diag_builder.emit();
// don't set a separate error for every lint in the group
break
}
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_passes/rvalue_promotion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckCrateVisitor<'a, 'tcx> {
let tcx = self.tcx;
let param_env = self.param_env;
let region_scope_tree = self.tcx.region_scope_tree(item_def_id);
euv::ExprUseVisitor::new(self, tcx, param_env, &region_scope_tree, self.tables, None)
let tables = self.tables; // FIXME(#48598)
euv::ExprUseVisitor::new(self, tcx, param_env, &region_scope_tree, tables, None)
.consume_body(body);

self.visit_body(body);
Expand Down
64 changes: 32 additions & 32 deletions src/libsyntax/ext/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,68 +480,68 @@ pub fn expand_quote_pat<'cx>(cx: &'cx mut ExtCtxt,
base::MacEager::expr(expanded)
}

pub fn expand_quote_arm(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_arm<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_arm_panic", vec![], tts);
base::MacEager::expr(expanded)
}

pub fn expand_quote_ty(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_ty<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_ty_panic", vec![], tts);
base::MacEager::expr(expanded)
}

pub fn expand_quote_stmt(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_stmt<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_stmt_panic", vec![], tts);
base::MacEager::expr(expanded)
}

pub fn expand_quote_attr(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_attr<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_attribute_panic",
vec![cx.expr_bool(sp, true)], tts);

base::MacEager::expr(expanded)
}

pub fn expand_quote_arg(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_arg<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_arg_panic", vec![], tts);
base::MacEager::expr(expanded)
}

pub fn expand_quote_block(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_block<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_block_panic", vec![], tts);
base::MacEager::expr(expanded)
}

pub fn expand_quote_meta_item(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_meta_item<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let expanded = expand_parse_call(cx, sp, "parse_meta_item_panic", vec![], tts);
base::MacEager::expr(expanded)
}

pub fn expand_quote_path(cx: &mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_quote_path<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[TokenTree])
-> Box<base::MacResult+'cx> {
let mode = mk_parser_path(cx, sp, &["PathStyle", "Type"]);
let expanded = expand_parse_call(cx, sp, "parse_path_panic", vec![mode], tts);
base::MacEager::expr(expanded)
Expand Down
32 changes: 16 additions & 16 deletions src/libsyntax/ext/source_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use rustc_data_structures::sync::Lrc;
// a given file into the current one.

/// line!(): expands to the current line number
pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_line<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
base::check_zero_tts(cx, sp, tts, "line!");

let topmost = cx.expansion_cause().unwrap_or(sp);
Expand All @@ -42,8 +42,8 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
}

/* column!(): expands to the current column number */
pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_column<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
base::check_zero_tts(cx, sp, tts, "column!");

let topmost = cx.expansion_cause().unwrap_or(sp);
Expand All @@ -53,8 +53,8 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
}

/* __rust_unstable_column!(): expands to the current column number */
pub fn expand_column_gated(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_column_gated<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
if sp.allows_unstable() {
expand_column(cx, sp, tts)
} else {
Expand All @@ -65,23 +65,23 @@ pub fn expand_column_gated(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Token
/// file!(): expands to the current filename */
/// The filemap (`loc.file`) contains a bunch more information we could spit
/// out if we wanted.
pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_file<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
base::check_zero_tts(cx, sp, tts, "file!");

let topmost = cx.expansion_cause().unwrap_or(sp);
let loc = cx.codemap().lookup_char_pos(topmost.lo());
base::MacEager::expr(cx.expr_str(topmost, Symbol::intern(&loc.file.name.to_string())))
}

pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_stringify<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
let s = pprust::tts_to_string(tts);
base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&s)))
}

pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_mod<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
base::check_zero_tts(cx, sp, tts, "module_path!");
let mod_path = &cx.current_expansion.module.mod_path;
let string = mod_path.iter().map(|x| x.to_string()).collect::<Vec<String>>().join("::");
Expand Down Expand Up @@ -130,8 +130,8 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T
}

// include_str! : read the given file, insert it as a literal string expr
pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_include_str<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
let file = match get_single_str_from_tts(cx, sp, tts, "include_str!") {
Some(f) => f,
None => return DummyResult::expr(sp)
Expand Down Expand Up @@ -165,8 +165,8 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenT
}
}

pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
pub fn expand_include_bytes<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'cx> {
let file = match get_single_str_from_tts(cx, sp, tts, "include_bytes!") {
Some(f) => f,
None => return DummyResult::expr(sp)
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax_ext/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ use syntax::tokenstream;
use syntax::parse::token;
use syntax_pos::Span;

pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
pub fn expand_cfg<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[tokenstream::TokenTree])
-> Box<base::MacResult + 'static> {
-> Box<base::MacResult + 'cx> {
let sp = sp.with_ctxt(sp.ctxt().apply_mark(cx.current_expansion.mark));
let mut p = cx.new_parser_from_tts(tts);
let cfg = panictry!(p.parse_meta_item());
Expand Down
9 changes: 5 additions & 4 deletions src/libsyntax_ext/concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ use syntax::tokenstream;

use std::string::String;

pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
sp: syntax_pos::Span,
tts: &[tokenstream::TokenTree])
-> Box<base::MacResult + 'static> {
pub fn expand_syntax_ext<'cx>(
cx: &'cx mut base::ExtCtxt,
sp: syntax_pos::Span,
tts: &[tokenstream::TokenTree]
) -> Box<base::MacResult + 'cx> {
let es = match base::get_exprs_from_tts(cx, sp, tts) {
Some(e) => e,
None => return base::DummyResult::expr(sp),
Expand Down
9 changes: 5 additions & 4 deletions src/libsyntax_ext/trace_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ use syntax::symbol::keywords;
use syntax_pos::Span;
use syntax::tokenstream::TokenTree;

pub fn expand_trace_macros(cx: &mut ExtCtxt,
sp: Span,
tt: &[TokenTree])
-> Box<base::MacResult + 'static> {
pub fn expand_trace_macros<'cx>(
cx: &'cx mut ExtCtxt,
sp: Span,
tt: &[TokenTree]
) -> Box<base::MacResult + 'cx> {
if !cx.ecfg.enable_trace_macros() {
feature_gate::emit_feature_err(&cx.parse_sess,
"trace_macros",
Expand Down
2 changes: 1 addition & 1 deletion src/libtest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ path = "lib.rs"
crate-type = ["dylib", "rlib"]

[dependencies]
getopts = "0.2"
getopts = "0.2.17"
term = { path = "../libterm" }
4 changes: 2 additions & 2 deletions src/test/run-pass-fulldeps/auxiliary/issue-16723.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("multiple_items", expand)
}

fn expand(cx: &mut ExtCtxt, _: syntax_pos::Span, _: &[tokenstream::TokenTree])
-> Box<MacResult+'static> {
fn expand<'cx>(cx: &'cx mut ExtCtxt, _: syntax_pos::Span, _: &[tokenstream::TokenTree])
-> Box<MacResult+'cx> {
MacEager::items(SmallVector::many(vec![
quote_item!(cx, struct Struct1;).unwrap(),
quote_item!(cx, struct Struct2;).unwrap()
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ pub fn plugin_registrar(reg: &mut Registry) {
MultiDecorator(Box::new(expand_caller)));
}

fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacResult + 'static> {
fn expand_make_a_1<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacResult + 'cx> {
if !tts.is_empty() {
cx.span_fatal(sp, "make_a_1 takes no arguments");
}
MacEager::expr(quote_expr!(cx, 1))
}

// See Issue #15750
fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult + 'static> {
fn expand_identity<'cx>(cx: &'cx mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult + 'cx> {
// Parse an expression and emit it unchanged.
let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec());
let expr = parser.parse_expr().unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ use rustc_plugin::Registry;

use std::cell::RefCell;

fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
-> Box<MacResult + 'static> {
fn expand_mbe_matches<'cx>(cx: &'cx mut ExtCtxt, _: Span, args: &[TokenTree])
-> Box<MacResult + 'cx> {

let mbe_matcher = quote_tokens!(cx, $$matched:expr, $$($$pat:pat)|+);
let mbe_matcher = quoted::parse(mbe_matcher.into_iter().collect(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("foo", expand_foo);
}

fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
-> Box<MacResult+'static> {
fn expand_foo(cx: &'cx mut ExtCtxt, sp: Span, tts: &[TokenTree])
-> Box<MacResult+'cx> {
let answer = other::the_answer();
MacEager::expr(quote_expr!(cx, $answer))
}
2 changes: 1 addition & 1 deletion src/tools/compiletest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "0.0.0"
diff = "0.1.10"
env_logger = { version = "0.5", default-features = false }
filetime = "0.1"
getopts = "0.2"
getopts = "0.2.17"
log = "0.4"
regex = "0.2"
serde = "1.0"
Expand Down