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

fixing compiler warning of newest rust version #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
175 changes: 133 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub struct DbOptions {

/// Wraps a heap-allocated closure with a difficulty score which can be used for
/// sorting; this might belong in the standard library as `CompareFirst` or such.
struct Job(usize, Box<FnMut() + Send>);
struct Job(usize, Box<dyn FnMut() + Send>);
impl PartialEq for Job {
fn eq(&self, other: &Job) -> bool {
self.0 == other.0
Expand Down Expand Up @@ -187,7 +187,7 @@ impl fmt::Debug for Executor {
}
}

fn queue_work(exec: &Executor, estimate: usize, mut f: Box<FnMut() + Send>) {
fn queue_work(exec: &Executor, estimate: usize, mut f: Box<dyn FnMut() + Send>) {
if exec.concurrency <= 1 {
f();
return;
Expand Down Expand Up @@ -228,8 +228,8 @@ impl Executor {
}

Executor {
concurrency: concurrency,
mutex: mutex,
concurrency,
mutex,
work_cv: cv,
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ impl Executor {
/// computation to a thread pool. There are several other methods to attach
/// code to promises; these do **not** parallelize, and are intended to do very
/// cheap tasks for interface consistency purposes only.
pub struct Promise<T>(Box<FnMut() -> T + Send>);
pub struct Promise<T>(Box<dyn FnMut() -> T + Send>);

impl<T> Promise<T> {
/// Wait for a value to be available and return it, rethrowing any panic.
Expand Down Expand Up @@ -389,7 +389,7 @@ impl Database {
let exec = Executor::new(options.jobs);
Database {
segments: Some(Arc::new(SegmentSet::new(options.clone(), &exec))),
options: options,
options,
nameset: None,
scopes: None,
verify: None,
Expand Down Expand Up @@ -454,7 +454,7 @@ impl Database {
}
let pr = self.parse_result().clone();
{
let mut ns = Arc::make_mut(self.prev_nameset.as_mut().unwrap());
let ns = Arc::make_mut(self.prev_nameset.as_mut().unwrap());
ns.update(&pr);
}
self.nameset = self.prev_nameset.clone();
Expand All @@ -480,7 +480,7 @@ impl Database {
let parse = self.parse_result().clone();
let name = self.name_result().clone();
{
let mut ns = Arc::make_mut(self.prev_scopes.as_mut().unwrap());
let ns = Arc::make_mut(self.prev_scopes.as_mut().unwrap());
scopeck::scope_check(ns, &parse, &name);
}
self.scopes = self.prev_scopes.clone();
Expand All @@ -507,7 +507,7 @@ impl Database {
let scope = self.scope_result().clone();
let name = self.name_result().clone();
{
let mut ver = Arc::make_mut(self.prev_verify.as_mut().unwrap());
let ver = Arc::make_mut(self.prev_verify.as_mut().unwrap());
verify::verify(ver, &parse, &name, &scope);
}
self.verify = self.prev_verify.clone();
Expand Down
8 changes: 4 additions & 4 deletions src/diag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fn annotate_diagnostic(notes: &mut Vec<Notation>,
info.notes.push(Notation {
source: info.sset.source_info(info.stmt.segment().id).clone(),
message: info.s,
span: span,
span,
level: info.level,
args: mem::replace(&mut info.args, Vec::new()),
})
Expand All @@ -192,9 +192,9 @@ fn annotate_diagnostic(notes: &mut Vec<Notation>,
}

let mut info = AnnInfo {
notes: notes,
sset: sset,
stmt: stmt,
notes,
sset,
stmt,
level: Error,
s: "",
args: Vec::new(),
Expand Down
Loading