Skip to content

This pull request activates hygiene for 'let' bindings. argument bindings come soon #7745

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
29accaf
disallow ident equality checks when contexts are not equal
jbclements Jul 10, 2013
3ca295c
rename resolve to mtwt_resolve
jbclements Jul 9, 2013
a5df81d
ident->name
jbclements Jun 6, 2013
85ef834
compare macro tokens hygienically (commented out)
jbclements Jul 9, 2013
f08967e
try removing basically dead code in resolve
jbclements Jun 26, 2013
844a303
add hygiene support fns, move them around.
jbclements Jun 25, 2013
77fe471
one-line comment
jbclements May 31, 2013
1f41b8e
update librustc to use name comparison in most cases, and mtwt_resolv…
jbclements Jun 26, 2013
0b85e4c
make ifn macro non-capturing
jbclements Jul 8, 2013
9511cad
resolve test case
jbclements Jun 26, 2013
868e032
flip the switch on let renaming
jbclements Jun 6, 2013
858b15c
renaming test cases
jbclements Jun 6, 2013
baab2e0
comments in ast.rs
jbclements Jun 6, 2013
5279ec6
removed unneccessary SyntaxExpander structs
jbclements May 28, 2013
29bb204
separate ItemDecorator from ItemDecorator
jbclements May 28, 2013
cff793f
refactor so tt_fold only requires an ident->ident fn
jbclements May 28, 2013
5c95645
adding test case to check marking/unmarking
jbclements Jun 25, 2013
03be3c8
comments only
jbclements May 29, 2013
e00fd37
remove FIXME #2888, now bug is fixed
jbclements Jun 7, 2013
6ebd2ef
added FIXME comment
jbclements Jun 7, 2013
754a858
drop back to a simple gensym approach for fresh-name.
jbclements Jun 7, 2013
0f4d24f
comments
jbclements Jun 7, 2013
4432f89
make comparison of special_idents non-hygienic
jbclements Jul 3, 2013
832f6ee
use empty_ctxt to simplify downstream
jbclements Jun 7, 2013
2b6de57
test case work
jbclements Jun 7, 2013
c616b66
re-add debug version
jbclements Jun 7, 2013
c0dda0f
re-add lost call to expand_block_elts
jbclements Jun 7, 2013
62112dd
test case work
jbclements Jun 7, 2013
e373801
test case support fns, remove debugging test case
jbclements Jul 9, 2013
e11a4f6
new test that uncovers bug in fold
jbclements Jun 8, 2013
da08150
fixed bug in fold's traversal of cast exprs
jbclements Jun 8, 2013
4c9f1b3
added test for ptr_eq on fresh_name-generated idents
jbclements Jun 25, 2013
5c5de2b
added gensym_copy mechanism to ensure sharing of pointers in the inte…
jbclements Jun 26, 2013
0994c3c
added IterBytes for 4-tuples
jbclements Jun 27, 2013
19971b4
marking on both input and output from macros. nice shiny new test cas…
jbclements Jun 29, 2013
ef6383e
add test case for macro token comparison
jbclements Jul 9, 2013
2acb0f4
comments
jbclements Jul 3, 2013
6cfdae0
add temporarily unused ctxt field to mac_invoc_tt
jbclements Jul 3, 2013
fe11845
rework fold so that fold_tts takes an ast_fold rather than a thunk, s…
jbclements Jul 9, 2013
6dc49cb
WIP: adding context to macros
jbclements Jul 5, 2013
649ed8b
add fold_mac field to fold.rs
jbclements Jul 5, 2013
b15ba1c
add fold_mac clause to fun_to_ctxt_folder
jbclements Jul 8, 2013
ed71739
capturing macros now implemented
jbclements Jul 8, 2013
025ae38
comments
jbclements Jul 9, 2013
d96481b
remove dead code
jbclements Jul 9, 2013
1435c51
fix one remaining token comparison, refactor token comparison to avoi…
jbclements Jul 10, 2013
b17d729
added utility function
jbclements Jul 10, 2013
7d2c627
ident->name in NamedField, elsewhere
jbclements Jul 10, 2013
f5f4d79
uncomment mtwt_resolve calls
jbclements Jul 11, 2013
c9a9cf7
memoization for resolve
jbclements Jul 10, 2013
203bbe0
whitespace, reindentation, and comments only
jbclements Jul 12, 2013
c0b5ab5
remove unneeded imports, clean up unused var warnings
jbclements Jul 12, 2013
13811b3
ident->name
jbclements Jul 12, 2013
77fe4e2
xfailed unhygienic test
jbclements Jul 12, 2013
5da521c
ident->name
jbclements Jul 12, 2013
46a15eb
expose mtwt_marksof for testing
jbclements Jul 13, 2013
a295e6e
awesome new bug! added test case
jbclements Jul 13, 2013
2863a79
comment on hygienic context extension train fns
jbclements Jul 13, 2013
8479d05
comments
jbclements Jul 14, 2013
f2cd518
added string_to_tts
jbclements Jul 14, 2013
af98983
WIP: adding mark-cancelling for macro_rules
jbclements Jul 14, 2013
b7c99ee
fixed a bug that caused double-expand-traversal of macros that expand…
jbclements Jul 26, 2013
16d6591
add display_sctable fn to ast_util
jbclements Jul 26, 2013
b1c3411
add test case, cleanup
jbclements Jul 26, 2013
efcfaeb
make macro hygienic
jbclements Jul 26, 2013
ed08749
add hygiene test, add copyright to another
jbclements Jul 26, 2013
da2ed92
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 @@ -624,7 +625,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 @@ -1239,7 +1240,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