diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-24 11:17:52 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-24 11:17:52 -0800 |
| commit | f3ec278e46e595a62a10e348db7077ed2dfc45df (patch) | |
| tree | ff6aa5122e9dbc92d8e937e7862f4b8d824dfadd | |
| parent | 25f9fa0359e35e6e55b841049598a6aff87fd668 (diff) | |
| parent | 4b2aa286d8448168e9077565ff17b7a6df4db105 (diff) | |
| download | rust-f3ec278e46e595a62a10e348db7077ed2dfc45df.tar.gz rust-f3ec278e46e595a62a10e348db7077ed2dfc45df.zip | |
Merge pull request #4609 from sonwow/keyword-super
Make `super` a keyword
| -rw-r--r-- | doc/rust.md | 2 | ||||
| -rw-r--r-- | src/librustc/middle/ty.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/keyword-super.rs | 3 |
4 files changed, 10 insertions, 7 deletions
diff --git a/doc/rust.md b/doc/rust.md index 697c395bc82..d4ec308df86 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -222,7 +222,7 @@ let log loop match mod move mut priv pub pure ref return -self static struct +self static struct super true trait type unsafe use while diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 5607e55d490..c8282579586 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1659,13 +1659,13 @@ fn subst(cx: ctxt, } } -// Performs substitutions on a set of substitutions (result = super(sub)) to +// Performs substitutions on a set of substitutions (result = sup(sub)) to // yield a new set of substitutions. This is used in trait inheritance. -fn subst_substs(cx: ctxt, super: &substs, sub: &substs) -> substs { +fn subst_substs(cx: ctxt, sup: &substs, sub: &substs) -> substs { { - self_r: super.self_r, - self_ty: super.self_ty.map(|typ| subst(cx, sub, *typ)), - tps: super.tps.map(|typ| subst(cx, sub, *typ)) + self_r: sup.self_r, + self_ty: sup.self_ty.map(|typ| subst(cx, sub, *typ)), + tps: sup.tps.map(|typ| subst(cx, sub, *typ)) } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2136499f8f0..a8c0c074588 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -493,7 +493,7 @@ fn strict_keyword_table() -> HashMap<~str, ()> { ~"once", ~"priv", ~"pub", ~"pure", ~"ref", ~"return", - ~"struct", + ~"struct", ~"super", ~"true", ~"trait", ~"type", ~"unsafe", ~"use", ~"while" diff --git a/src/test/compile-fail/keyword-super.rs b/src/test/compile-fail/keyword-super.rs new file mode 100644 index 00000000000..3c9c403e83d --- /dev/null +++ b/src/test/compile-fail/keyword-super.rs @@ -0,0 +1,3 @@ +fn main() { + let super: int; //~ ERROR found `super` in ident position +} |
