Skip to content

Let var hygiene #8103

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

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
df3dc14
disallow ident equality checks when contexts are not equal
jbclements Jul 10, 2013
d1cec3f
rename resolve to mtwt_resolve
jbclements Jul 9, 2013
5fa9fcb
ident->name
jbclements Jun 6, 2013
b3dfd26
compare macro tokens hygienically (commented out)
jbclements Jul 9, 2013
a2ede2d
try removing basically dead code in resolve
jbclements Jun 26, 2013
718dae8
add hygiene support fns, move them around.
jbclements Jun 25, 2013
7c7df2b
one-line comment
jbclements May 31, 2013
88fb3c0
update librustc to use name comparison in most cases, and mtwt_resolv…
jbclements Jun 26, 2013
d1d35c5
make ifn macro non-capturing
jbclements Jul 8, 2013
2638ecf
resolve test case
jbclements Jun 26, 2013
245f4c9
flip the switch on let renaming
jbclements Jun 6, 2013
5a9a3aa
renaming test cases
jbclements Jun 6, 2013
9c742a9
comments in ast.rs
jbclements Jun 6, 2013
64af970
removed unneccessary SyntaxExpander structs
jbclements May 28, 2013
cbd0674
separate ItemDecorator from ItemDecorator
jbclements May 28, 2013
1bf6981
refactor so tt_fold only requires an ident->ident fn
jbclements May 28, 2013
f33b706
adding test case to check marking/unmarking
jbclements Jun 25, 2013
085ef4a
comments only
jbclements May 29, 2013
785d6d7
remove FIXME #2888, now bug is fixed
jbclements Jun 7, 2013
5c4ba21
added FIXME comment
jbclements Jun 7, 2013
6ac5129
drop back to a simple gensym approach for fresh-name.
jbclements Jun 7, 2013
4bec5c5
comments
jbclements Jun 7, 2013
d062536
make comparison of special_idents non-hygienic
jbclements Jul 3, 2013
5d75868
use empty_ctxt to simplify downstream
jbclements Jun 7, 2013
ab72113
test case work
jbclements Jun 7, 2013
c819ed7
re-add debug version
jbclements Jun 7, 2013
37ef9b2
re-add lost call to expand_block_elts
jbclements Jun 7, 2013
e3c1cd1
test case work
jbclements Jun 7, 2013
2e8d6a7
test case support fns, remove debugging test case
jbclements Jul 9, 2013
7c9edf8
new test that uncovers bug in fold
jbclements Jun 8, 2013
e16e843
fixed bug in fold's traversal of cast exprs
jbclements Jun 8, 2013
bc603da
added test for ptr_eq on fresh_name-generated idents
jbclements Jun 25, 2013
2621899
added gensym_copy mechanism to ensure sharing of pointers in the inte…
jbclements Jun 26, 2013
bbe90c7
added IterBytes for 4-tuples
jbclements Jun 27, 2013
a3b918c
marking on both input and output from macros. nice shiny new test cas…
jbclements Jun 29, 2013
35d4c72
add test case for macro token comparison
jbclements Jul 9, 2013
a6d45e6
comments
jbclements Jul 3, 2013
5058ce7
add temporarily unused ctxt field to mac_invoc_tt
jbclements Jul 3, 2013
5b7a7f5
rework fold so that fold_tts takes an ast_fold rather than a thunk, s…
jbclements Jul 9, 2013
e1dc79a
WIP: adding context to macros
jbclements Jul 5, 2013
252a56f
add fold_mac field to fold.rs
jbclements Jul 5, 2013
87cc948
add fold_mac clause to fun_to_ctxt_folder
jbclements Jul 8, 2013
a2c97fa
capturing macros now implemented
jbclements Jul 8, 2013
03a1d76
comments
jbclements Jul 9, 2013
9d1f421
remove dead code
jbclements Jul 9, 2013
99507d4
fix one remaining token comparison, refactor token comparison to avoi…
jbclements Jul 10, 2013
e5ac12a
added utility function
jbclements Jul 10, 2013
d47303c
ident->name in NamedField, elsewhere
jbclements Jul 10, 2013
4efcfe5
uncomment mtwt_resolve calls
jbclements Jul 11, 2013
d2ff2a6
memoization for resolve
jbclements Jul 10, 2013
ae3bb6a
whitespace, reindentation, and comments only
jbclements Jul 12, 2013
b97b2b5
remove unneeded imports, clean up unused var warnings
jbclements Jul 12, 2013
34b1f85
ident->name
jbclements Jul 12, 2013
cc17a51
xfailed unhygienic test
jbclements Jul 12, 2013
b0c4676
ident->name
jbclements Jul 12, 2013
679d247
expose mtwt_marksof for testing
jbclements Jul 13, 2013
93d97c5
awesome new bug! added test case
jbclements Jul 13, 2013
f2ba71a
comment on hygienic context extension train fns
jbclements Jul 13, 2013
b0a9101
comments
jbclements Jul 14, 2013
6a29010
added string_to_tts
jbclements Jul 14, 2013
8b32e8f
WIP: adding mark-cancelling for macro_rules
jbclements Jul 14, 2013
0e05c12
fixed a bug that caused double-expand-traversal of macros that expand…
jbclements Jul 26, 2013
362b375
add display_sctable fn to ast_util
jbclements Jul 26, 2013
d950fd8
add test case, cleanup
jbclements Jul 26, 2013
67a3c1b
make macro hygienic
jbclements Jul 26, 2013
5196e85
add hygiene test, add copyright to another
jbclements Jul 26, 2013
348327d
comment fix
jbclements Jul 28, 2013
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/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ impl BorrowckCtxt {
match fname {
mc::NamedField(ref fname) => {
out.push_char('.');
out.push_str(token::ident_to_str(fname));
out.push_str(token::interner_get(*fname));
}
mc::PositionalField(idx) => {
out.push_char('#'); // invent a notation here
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map)
fn find_item(item: @item, ctxt: @mut EntryContext, visitor: EntryVisitor) {
match item.node {
item_fn(*) => {
if item.ident == special_idents::main {
if item.ident.name == special_idents::main.name {
match ctxt.ast_map.find(&item.id) {
Some(&ast_map::node_item(_, path)) => {
if path.len() == 0 {
Expand Down
7 changes: 4 additions & 3 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use syntax::ast::{m_imm, m_const, m_mutbl};
use syntax::ast;
use syntax::codemap::span;
use syntax::print::pprust;
use syntax::parse::token;

#[deriving(Eq)]
pub enum categorization {
Expand Down Expand Up @@ -101,7 +102,7 @@ pub enum InteriorKind {

#[deriving(Eq, IterBytes)]
pub enum FieldName {
NamedField(ast::ident),
NamedField(ast::Name),
PositionalField(uint)
}

Expand Down Expand Up @@ -626,7 +627,7 @@ impl mem_categorization_ctxt {
@cmt_ {
id: node.id(),
span: node.span(),
cat: cat_interior(base_cmt, InteriorField(NamedField(f_name))),
cat: cat_interior(base_cmt, InteriorField(NamedField(f_name.name))),
mutbl: base_cmt.mutbl.inherit(),
ty: f_ty
}
Expand Down Expand Up @@ -1241,7 +1242,7 @@ pub fn ptr_sigil(ptr: ptr_kind) -> ~str {
impl Repr for InteriorKind {
fn repr(&self, tcx: ty::ctxt) -> ~str {
match *self {
InteriorField(NamedField(fld)) => tcx.sess.str_of(fld).to_owned(),
InteriorField(NamedField(fld)) => token::interner_get(fld).to_owned(),
InteriorField(PositionalField(i)) => fmt!("#%?", i),
InteriorElement(_) => ~"[]",
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl VisitContext {
// specified and (2) have a type that
// moves-by-default:
let consume_with = with_fields.iter().any(|tf| {
!fields.iter().any(|f| f.ident == tf.ident) &&
!fields.iter().any(|f| f.ident.name == tf.ident.name) &&
ty::type_moves_by_default(self.tcx, tf.mt.ty)
});

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
|span, id, ident| {
let fields = ty::lookup_struct_fields(tcx, id);
for fields.iter().advance |field| {
if field.ident != ident { loop; }
if field.ident.name != ident.name { loop; }
if field.vis == private {
tcx.sess.span_err(span, fmt!("field `%s` is private",
token::ident_to_str(&ident)));
Expand Down
Loading