Skip to content

Register snapshots #8050

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 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn parse_trait_store(st: &mut PState) -> ty::TraitStore {
}

fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
let regions = parse_region_substs(st, |x,y| conv(x,y));
let regions = parse_region_substs(st);

let self_ty = parse_opt(st, |st| parse_ty(st, |x,y| conv(x,y)) );

Expand All @@ -202,7 +202,7 @@ fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
};
}

fn parse_region_substs(st: &mut PState, conv: conv_did) -> ty::RegionSubsts {
fn parse_region_substs(st: &mut PState) -> ty::RegionSubsts {
match next(st) {
'e' => ty::ErasedRegions,
'n' => {
Expand Down
19 changes: 11 additions & 8 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,23 +827,26 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) {
!ident.contains_char('_')
}

fn check_case(cx: &Context, ident: ast::ident, span: span) {
fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: span) {
if !is_camel_case(cx.tcx, ident) {
cx.span_lint(non_camel_case_types, span,
"type, variant, or trait should have \
a camel case identifier");
cx.span_lint(
non_camel_case_types, span,
fmt!("%s `%s` should have a camel case identifier",
sort, cx.tcx.sess.str_of(ident)));
}
}

match it.node {
ast::item_ty(*) | ast::item_struct(*) |
ast::item_ty(*) | ast::item_struct(*) => {
check_case(cx, "type", it.ident, it.span)
}
ast::item_trait(*) => {
check_case(cx, it.ident, it.span)
check_case(cx, "trait", it.ident, it.span)
}
ast::item_enum(ref enum_definition, _) => {
check_case(cx, it.ident, it.span);
check_case(cx, "type", it.ident, it.span);
for enum_definition.variants.iter().advance |variant| {
check_case(cx, variant.node.name, variant.span);
check_case(cx, "variant", variant.node.name, variant.span);
}
}
_ => ()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl CoherenceChecker {
-> UniversalQuantificationResult {
let regions = match polytype.generics.region_param {
None => opt_vec::Empty,
Some(r) => {
Some(_) => {
opt_vec::with(
self.inference_context.next_region_var(
infer::BoundRegionInCoherence))
Expand Down
8 changes: 8 additions & 0 deletions src/snapshots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
S 2013-07-25 4cf3072
macos-i386 f682d6e9ca0d56768bd36a0c05b7e58e12694dff
macos-x86_64 2f4e85c9756ba31a04fa8dd1c999fbaf8e1d3d1a
winnt-i386 6360e61fb5c432ad1511cb28af8e44cc0106f1aa
freebsd-x86_64 5e76c40a64b76e0a065d5b8d51c85dfe38ea833a
linux-i386 46961cef9d4efccf5df23a8389d63cf35d35c1d6
linux-x86_64 b416ca2644b14403818f0219673f6f8fe189e8b4

S 2013-07-21 e336cbf
macos-i386 d9666dccc1040ebe298a54acb378902a7472ad0f
macos-x86_64 808f68916444e3857ef2aab20f8db9db8f4b0b4a
Expand Down
12 changes: 6 additions & 6 deletions src/test/compile-fail/lint-non-camel-case-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@

#[forbid(non_camel_case_types)];

struct foo { //~ ERROR type, variant, or trait should have a camel case identifier
struct foo { //~ ERROR type `foo` should have a camel case identifier
bar: int,
}

enum foo2 { //~ ERROR type, variant, or trait should have a camel case identifier
enum foo2 { //~ ERROR type `foo2` should have a camel case identifier
Bar
}

struct foo3 { //~ ERROR type, variant, or trait should have a camel case identifier
struct foo3 { //~ ERROR type `foo3` should have a camel case identifier
bar: int
}

type foo4 = int; //~ ERROR type, variant, or trait should have a camel case identifier
type foo4 = int; //~ ERROR type `foo4` should have a camel case identifier

enum Foo5 {
bar //~ ERROR type, variant, or trait should have a camel case identifier
bar //~ ERROR variant `bar` should have a camel case identifier
}

trait foo6 { //~ ERROR type, variant, or trait should have a camel case identifier
trait foo6 { //~ ERROR trait `foo6` should have a camel case identifier
}

fn main() { }