Skip to content

Bump to rustc nightly 2019-04-08 #49

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

Merged
merged 66 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
5b169cb
Updates to build c2rust-ast-builder with latest nightly toolchain
thedataking Mar 7, 2019
e06eca9
Updates to build c2rust-transpile with latest nightly toolchain
thedataking Mar 7, 2019
37f07e1
Get rid of ThinTokenStream in c2rust-refactor
thedataking Mar 7, 2019
d68ef6a
Use libc from crates.io in dynamic-dlsym and zstd-logging cross-check…
ahomescu Mar 8, 2019
3a003ae
Merge branch 'master' into feature/bump-nightly
rinon Mar 9, 2019
496c949
Temporary commit during c2rust-refactor update
rinon Mar 9, 2019
3a31288
Merge remote-tracking branch 'origin/feature/bump-nightly' into featu…
rinon Mar 9, 2019
5ff9333
WIP: Rewrite fold nodes API
rinon Mar 10, 2019
410ee37
WIP: Finished making the type checker happy
rinon Mar 12, 2019
dd44bfa
avoid using deprecated APIs
thedataking Mar 13, 2019
27829df
Remove need for access to rustc interner
rinon Mar 13, 2019
6b6d7a9
Finish updating refactoring to use MutVisit
rinon Mar 13, 2019
2c6d1a8
Pin nightly toolchain version
thedataking Mar 13, 2019
d2c5e57
Fix refactoring tool AST uses for new nightly
rinon Mar 22, 2019
7ba83ef
Update refactoring to use new nightly compiler driver interface
rinon Mar 22, 2019
dfa4cda
Make RefactorState own its Compiler and rebuild it on re-running
rinon Mar 27, 2019
06dfe62
Don't reuse parser instances for string parsing
rinon Mar 27, 2019
63bde2a
Fix illtyped folder calling node_def_id for nodes without def ids
rinon Mar 28, 2019
5992a42
Don't reuse parsers for anonymous strings
rinon Mar 28, 2019
09401c8
Implement MutVisit::visit invocations for flat_map types
rinon Mar 29, 2019
cd59efc
Clean up crate collapsing and make sure it matches previous behavior
rinon Mar 29, 2019
cf0946b
Add back in the dummy source file at offset 0
rinon Mar 29, 2019
060416c
Use the correct replacement for CrateRoot (PathRoot)
rinon Mar 29, 2019
2357512
Add Debug trait for easier debug invocations
rinon Mar 29, 2019
5f2e8c9
Add dump_crate debug command
rinon Mar 29, 2019
8a8543a
Use unique FileNames for more string parsers
rinon Mar 29, 2019
d15c8bc
Reinitialize entire compiler on `load_crate()`
rinon Mar 30, 2019
aa06aed
Handle variadic functions during retyping
rinon Mar 30, 2019
b04e44c
Merge branch 'master' into feature/nightly-2019-03-13
rinon Apr 8, 2019
15048f2
Update rustc version in common.py
rinon Apr 8, 2019
d01e4c0
Unconditionally emit dependency on libc in Cargo.toml
thedataking Mar 13, 2019
3c5e47d
Emit rust-toolchain file until c_variadics feature is stabilized
thedataking Mar 13, 2019
aa5743a
Conditionally emit rust-toolchain and feature flag for c variadics
thedataking Mar 13, 2019
0a3e98e
Revert "Unconditionally emit dependency on libc in Cargo.toml"
thedataking Mar 13, 2019
a3b43ab
Conditionally emit c_variadics feature
thedataking Mar 13, 2019
5e65ce2
Revert "Revert "Unconditionally emit dependency on libc in Cargo.toml""
thedataking Mar 13, 2019
fdb994d
Silence variadic function warning in AstExporter.cpp
thedataking Mar 13, 2019
1bee92e
Emit variadic Rust function signatures
thedataking Mar 13, 2019
e5abbea
Fix version of libc dependency; stop emitting libc feature
thedataking Mar 13, 2019
098255d
Remove libc feature from lib.rs template
thedataking Mar 13, 2019
b9917eb
Update known limitations
thedataking Mar 14, 2019
c19943f
Emit calls to raw_copy and raw_end for copied va_lists
thedataking Mar 22, 2019
ef1261f
Add function context to track information related to variadic argumen…
thedataking Mar 23, 2019
db6a5c9
Translate va_copy as function returning a VaList
thedataking Mar 24, 2019
b471393
Improve comment re. statement expressions
thedataking Mar 25, 2019
b7204f9
Update calls to va_list, stop calling va_end
thedataking Mar 26, 2019
fdeb7f8
Work around https://github.com/rust-lang/rust/issues/54482 when trans…
thedataking Mar 26, 2019
8a2299a
call set_feature for c_variadics
thedataking Mar 26, 2019
04229a2
fix typo in prev commit
thedataking Mar 26, 2019
2f3d727
Emit template build.rs
thedataking Mar 26, 2019
a133ddd
Emit error message when encountering unsupported, indirect gotos
thedataking Mar 27, 2019
54afb32
Clean up transpiler error messages
thedataking Mar 27, 2019
0e4394d
Update rust nightly version
thedataking Mar 27, 2019
ff53cee
Emit calls to va_end intrinsic
thedataking Mar 29, 2019
e1572fe
Rename panic to panic_or_err and introduce 'real' panic function
thedataking Mar 29, 2019
c1acd9f
Resolve field names in bitfield_zero_initializer
thedataking Mar 30, 2019
7b02c22
Request 2018 edition in Cargo.toml template
thedataking Mar 30, 2019
6d48244
Improve handling of variadic functions and functions with va_list arg…
thedataking Apr 2, 2019
6d3422d
Cleanup and simplify last commit
thedataking Apr 2, 2019
3f36a9b
Merge branch 'variadics_with_refactoring' into feature/nightly-2019-0…
rinon Apr 8, 2019
defb74a
Update test Cargo.toml files to include a libc dependency
rinon Apr 8, 2019
aac547b
Merge branch 'master' into feature/nightly-2019-03-13
rinon Apr 9, 2019
50889af
Merge branch 'master' into feature/nightly-2019-03-13
rinon Apr 9, 2019
f706876
Update to nightly-2019-04-08
rinon Apr 10, 2019
4313b23
Merge branch 'master' into feature/nightly-2019-03-13
rinon Apr 10, 2019
cd65682
Merge branch 'master' into feature/nightly-2019-03-13
rinon Apr 10, 2019
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
12 changes: 12 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"c2rust-ast-exporter",
"manual/preprocessors",
"c2rust-bitfields",
"c2rust-macros",
]
exclude = [
"cross-checks/pointer-tracer",
Expand Down
64 changes: 32 additions & 32 deletions c2rust-ast-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use syntax::source_map::{DUMMY_SP, Spanned, Span, dummy_spanned};
use syntax::parse::token::{self, Token, DelimToken};
use syntax::attr::{mk_attr_inner};
use syntax::ptr::P;
use syntax::tokenstream::{TokenTree, TokenStream, TokenStreamBuilder, ThinTokenStream};
use syntax::tokenstream::{TokenTree, TokenStream, TokenStreamBuilder};
use syntax::symbol::keywords;
use std::rc::Rc;
use rustc_target::spec::abi::{self, Abi};
Expand Down Expand Up @@ -183,14 +183,14 @@ impl<S: Make<PathSegment>> Make<Path> for Vec<S> {
}


impl Make<ThinTokenStream> for TokenStream {
fn make(self, _mk: &Builder) -> ThinTokenStream {
self.into()
}
}
//impl Make<TokenStream> for TokenStream {
// fn make(self, _mk: &Builder) -> TokenStream {
// self.into()
// }
//}

impl Make<ThinTokenStream> for Vec<TokenTree> {
fn make(self, _mk: &Builder) -> ThinTokenStream {
impl Make<TokenStream> for Vec<TokenTree> {
fn make(self, _mk: &Builder) -> TokenStream {
self.into_iter().collect::<TokenStream>().into()
}
}
Expand All @@ -207,7 +207,7 @@ impl Make<GenericArgs> for AngleBracketedArgs {
}
}

impl Make<GenericArgs> for ParenthesisedArgs {
impl Make<GenericArgs> for ParenthesizedArgs {
fn make(self, _mk: &Builder) -> GenericArgs {
Parenthesized(self)
}
Expand All @@ -225,15 +225,15 @@ impl Make<GenericArg> for Lifetime {
}
}

impl Make<NestedMetaItemKind> for MetaItem {
fn make(self, _mk: &Builder) -> NestedMetaItemKind {
NestedMetaItemKind::MetaItem(self)
impl Make<NestedMetaItem> for MetaItem {
fn make(self, _mk: &Builder) -> NestedMetaItem {
NestedMetaItem::MetaItem(self)
}
}

impl Make<NestedMetaItemKind> for Lit {
fn make(self, _mk: &Builder) -> NestedMetaItemKind {
NestedMetaItemKind::Literal(self)
impl Make<NestedMetaItem> for Lit {
fn make(self, _mk: &Builder) -> NestedMetaItem {
NestedMetaItem::Literal(self)
}
}

Expand Down Expand Up @@ -448,11 +448,11 @@ impl Builder {
}
}

pub fn parenthesized_args<Ts>(self, tys: Ts) -> ParenthesisedArgs
pub fn parenthesized_args<Ts>(self, tys: Ts) -> ParenthesizedArgs
where Ts: Make<Vec<P<Ty>>> {

let tys = tys.make(&self);
ParenthesisedArgs {
ParenthesizedArgs {
span: self.span,
inputs: tys,
output: None,
Expand Down Expand Up @@ -495,8 +495,8 @@ impl Builder {
pub fn abs_path<Pa>(self, path: Pa) -> Path
where Pa: Make<Path> {
let mut p = path.make(&self);
if !p.segments.get(0).map_or(false, |s| s.ident.name == keywords::CrateRoot.name()) {
p.segments.insert(0, keywords::CrateRoot.ident().make(&self));
if !p.segments.get(0).map_or(false, |s| s.ident.name == keywords::PathRoot.name()) {
p.segments.insert(0, keywords::PathRoot.ident().make(&self));
}
p
}
Expand Down Expand Up @@ -1284,7 +1284,7 @@ impl Builder {
let block = block.make(&self);
let header = FnHeader {
unsafety: self.unsafety,
asyncness: IsAsync::NotAsync,
asyncness: dummy_spanned(IsAsync::NotAsync),
constness: dummy_spanned(self.constness),
abi: self.abi,
};
Expand All @@ -1295,28 +1295,28 @@ impl Builder {
block))
}

pub fn fn_decl(self, inputs: Vec<Arg>, output: FunctionRetTy, variadic: bool) -> P<FnDecl>
pub fn fn_decl(self, inputs: Vec<Arg>, output: FunctionRetTy, c_variadic: bool) -> P<FnDecl>
{
P(FnDecl {
inputs,
output,
variadic,
c_variadic,
})
}

pub fn struct_item<I>(self, name: I, fields: Vec<StructField>) -> P<Item>
where I: Make<Ident> {
let name = name.make(&self);
Self::item(name, self.attrs, self.vis, self.span, self.id,
ItemKind::Struct(VariantData::Struct(fields, DUMMY_NODE_ID),
ItemKind::Struct(VariantData::Struct(fields, false),
self.generics))
}

pub fn union_item<I>(self, name: I, fields: Vec<StructField>) -> P<Item>
where I: Make<Ident> {
let name = name.make(&self);
Self::item(name, self.attrs, self.vis, self.span, self.id,
ItemKind::Union(VariantData::Struct(fields, DUMMY_NODE_ID),
ItemKind::Union(VariantData::Struct(fields, false),
self.generics))
}

Expand Down Expand Up @@ -1367,6 +1367,7 @@ impl Builder {
node: Variant_ {
ident: name,
attrs: self.attrs,
id: DUMMY_NODE_ID,
data: dat,
disr_expr: None,
},
Expand All @@ -1382,6 +1383,7 @@ impl Builder {
node: Variant_ {
ident: name,
attrs: self.attrs,
id: DUMMY_NODE_ID,
data: VariantData::Unit(self.id),
disr_expr: disc,
},
Expand Down Expand Up @@ -1577,7 +1579,6 @@ impl Builder {
Unsafety::Normal => BlockCheckMode::Default,
},
span: self.span,
recovered: false,
})
}

Expand Down Expand Up @@ -1637,7 +1638,7 @@ impl Builder {
}

pub fn attribute<Pa, Ts>(self, style: AttrStyle, path: Pa, tokens: Ts) -> Attribute
where Pa: Make<Path>, Ts: Make<ThinTokenStream>
where Pa: Make<Path>, Ts: Make<TokenStream>
{
let path = path.make(&self);
let tokens = tokens.make(&self).into();
Expand Down Expand Up @@ -1665,17 +1666,16 @@ impl Builder {
let path = path.make(&self);
let kind = kind.make(&self);
MetaItem {
ident: path,
path: path,
node: kind,
span: DUMMY_SP,
}
}

pub fn nested_meta_item<K>(self, kind: K) -> NestedMetaItem
where K: Make<NestedMetaItemKind>
{
let kind = kind.make(&self);
dummy_spanned(kind)
where K: Make<NestedMetaItem>
{
kind.make(&self)
}

// Convert the current internal list of outer attributes
Expand All @@ -1691,7 +1691,7 @@ impl Builder {
}

pub fn mac<Pa, Ts>(self, path: Pa, tts: Ts, delim: MacDelimiter) -> Mac
where Pa: Make<Path>, Ts: Make<ThinTokenStream> {
where Pa: Make<Path>, Ts: Make<TokenStream> {
let path = path.make(&self);
let tts = tts.make(&self);
Spanned {
Expand Down
6 changes: 3 additions & 3 deletions c2rust-ast-exporter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ variable or make sure `llvm-config` is on $PATH then re-build. For example:
.or(invoke_command(llvm_config.as_ref(), &["--system-libs", "--link-static"]))
.unwrap_or(String::new())
.split_whitespace()
.map(|lib| String::from(lib.trim_left_matches("-l")))
.map(|lib| String::from(lib.trim_start_matches("-l")))
.collect();

let llvm_dylib = invoke_command(llvm_config.as_ref(), &["--libs", "--link-shared"]);
Expand All @@ -314,7 +314,7 @@ variable or make sure `llvm-config` is on $PATH then re-build. For example:
} // Windows is not supported
};
let mut dylib_file = String::from("lib");
dylib_file.push_str(llvm_dylib.trim_left_matches("-l"));
dylib_file.push_str(llvm_dylib.trim_start_matches("-l"));
dylib_file.push_str(dylib_suffix);
let sysroot = invoke_command(
env::var("RUSTC").ok().as_ref(),
Expand Down Expand Up @@ -353,7 +353,7 @@ variable or make sure `llvm-config` is on $PATH then re-build. For example:
])
.unwrap_or(String::new())
.split_whitespace()
.map(|lib| String::from(lib.trim_left_matches("-l")))
.map(|lib| String::from(lib.trim_start_matches("-l")))
.collect();

Self {
Expand Down
21 changes: 13 additions & 8 deletions c2rust-ast-exporter/src/AstExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,13 @@ class TranslateASTVisitor final
return true;
}

bool VisitIndirectGotoStmt(IndirectGotoStmt *IGS) {
std:: string msg = "the GNU C labels-as-values extension is not supported. Aborting.";

printError(msg, IGS);
abort();
}

bool VisitLabelStmt(LabelStmt *LS) {

std::vector<void*> childIds = { LS->getSubStmt() };
Expand All @@ -645,7 +652,6 @@ class TranslateASTVisitor final
return true;
}


bool VisitNullStmt(NullStmt *NS) {
std::vector<void*> childIds;
encode_entry(NS, TagNullStmt, childIds);
Expand Down Expand Up @@ -724,8 +730,7 @@ class TranslateASTVisitor final
Expr::EvalResult eval_result;
#endif // CLANG_VERSION_MAJOR
if (!expr->EvaluateAsInt(eval_result, *Context)) {
std:: string msg = "Aborting due to the expression in `CaseStmt`\
not being an integer.";
std:: string msg = "Expression in case statement is not an integer. Aborting.";
printError(msg, CS);
abort();
}
Expand Down Expand Up @@ -1218,10 +1223,10 @@ class TranslateASTVisitor final
if (!FD->isCanonicalDecl())
return true;

if (FD->hasBody() && FD->isVariadic()) {
// auto fname = FD->getNameString();
printWarning("variadic functions are not fully supported.", FD);
}
// if (FD->hasBody() && FD->isVariadic()) {
// // auto fname = FD->getNameString();
// printWarning("variadic functions are not fully supported.", FD);
// }

// Use the parameters from the function declaration
// the defines the body, if one exists.
Expand Down Expand Up @@ -1517,7 +1522,7 @@ class TranslateASTVisitor final
if (warnOnFlexibleArrayDecl(D)) {
printWarning("this may be an unsupported flexible array member with size of 1, "
"omit the size if this field is intended to be a flexible array member. "
"Note that you must be sure to fix any struct size calculations after "
"Note that you must fix any struct size calculations after "
"doing so or else it will likely be off (by one). "
"See section 6.7.2.1 of the C99 standard.", D);
}
Expand Down
13 changes: 13 additions & 0 deletions c2rust-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "c2rust-macros"
version = "0.9.0"
authors = ["Stephen Crane <[email protected]>", "The C2Rust Project Developers <[email protected]>"]
edition = "2018"

[lib]
proc-macro = true

[dependencies]
proc-macro2 = { version = "0.4", features = ["nightly"] }
quote = "0.6"
syn = { version = "0.15", features = ["full", "extra-traits", "visit"] }
Loading