Skip to content

Commit e210af3

Browse files
committed
---
yaml --- r: 91970 b: refs/heads/auto c: b50b162 h: refs/heads/master v: v3
1 parent a5e090c commit e210af3

File tree

8 files changed

+25
-36
lines changed

8 files changed

+25
-36
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: d662820b297f0ecda17126577571fcf886bdac81
16+
refs/heads/auto: b50b1628840daf849e548c83372f85bc13092314
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/doc/rust.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,19 @@ Some productions are defined by exclusion of particular Unicode characters:
153153
~~~~ {.ebnf .gram}
154154
comment : block_comment | line_comment ;
155155
block_comment : "/*" block_comment_body * '*' + '/' ;
156-
block_comment_body : non_star * | '*' + non_slash_or_star ;
156+
block_comment_body : (block_comment | character) * ;
157157
line_comment : "//" non_eol * ;
158158
~~~~
159159

160160
Comments in Rust code follow the general C++ style of line and block-comment forms,
161161
with no nesting of block-comment delimiters.
162162

163-
Line comments beginning with _three_ slashes (`///`),
164-
and block comments beginning with a repeated asterisk in the block-open sequence (`/**`),
165-
are interpreted as a special syntax for `doc` [attributes](#attributes).
166-
That is, they are equivalent to writing `#[doc "..."]` around the comment's text.
163+
Line comments beginning with exactly _three_ slashes (`///`), and block
164+
comments beginning with a exactly one repeated asterisk in the block-open
165+
sequence (`/**`), are interpreted as a special syntax for `doc`
166+
[attributes](#attributes). That is, they are equivalent to writing
167+
`#[doc="..."]` around the body of the comment (this includes the comment
168+
characters themselves, ie `/// Foo` turns into `#[doc="/// Foo"]`).
167169

168170
Non-doc comments are interpreted as a form of whitespace.
169171

branches/auto/src/etc/vim/syntax/rust.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ syn match rustCharacter /'\([^'\\]\|\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8
187187

188188
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
189189
syn region rustComment start="//" end="$" contains=rustTodo keepend
190-
syn region rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo
191-
syn region rustCommentDoc start="//[/!]" end="$" contains=rustTodo keepend
190+
syn region rustCommentMLDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo
191+
syn region rustCommentDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo keepend
192192

193193
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
194194

branches/auto/src/librustc/front/feature_gate.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
//! Features are enabled in programs via the crate-level attributes of
1919
//! #[feature(...)] with a comma-separated list of features.
2020
21-
use middle::lint;
22-
2321
use syntax::ast;
2422
use syntax::attr::AttrMetaMethods;
2523
use syntax::codemap::Span;
@@ -211,10 +209,7 @@ pub fn check_crate(sess: Session, crate: &ast::Crate) {
211209
directive not necessary");
212210
}
213211
None => {
214-
sess.add_lint(lint::unknown_features,
215-
ast::CRATE_NODE_ID,
216-
mi.span,
217-
~"unknown feature");
212+
sess.span_err(mi.span, "unknown feature");
218213
}
219214
}
220215
}

branches/auto/src/librustc/middle/lint.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ use syntax::codemap::Span;
5959
use syntax::codemap;
6060
use syntax::parse::token;
6161
use syntax::{ast, ast_util, visit};
62-
use syntax::ast_util::IdVisitingOperation;
6362
use syntax::visit::Visitor;
6463

6564
#[deriving(Clone, Eq)]
@@ -78,7 +77,6 @@ pub enum lint {
7877
unused_unsafe,
7978
unsafe_block,
8079
attribute_usage,
81-
unknown_features,
8280

8381
managed_heap_memory,
8482
owned_heap_memory,
@@ -323,13 +321,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
323321
desc: "mass-change the level for lints which produce warnings",
324322
default: warn
325323
}),
326-
327-
("unknown_features",
328-
LintSpec {
329-
lint: unknown_features,
330-
desc: "unknown features found in create-level #[feature] directives",
331-
default: deny,
332-
}),
333324
];
334325

335326
/*
@@ -1329,7 +1320,7 @@ impl<'self> Visitor<()> for Context<'self> {
13291320
}
13301321
}
13311322

1332-
impl<'self> IdVisitingOperation for Context<'self> {
1323+
impl<'self> ast_util::IdVisitingOperation for Context<'self> {
13331324
fn visit_id(&self, id: ast::NodeId) {
13341325
match self.tcx.sess.lints.pop(&id) {
13351326
None => {}
@@ -1365,7 +1356,6 @@ pub fn check_crate(tcx: ty::ctxt,
13651356
cx.set_level(lint, level, CommandLine);
13661357
}
13671358
cx.with_lint_attrs(crate.attrs, |cx| {
1368-
cx.visit_id(ast::CRATE_NODE_ID);
13691359
cx.visit_ids(|v| {
13701360
v.visited_outermost = true;
13711361
visit::walk_crate(v, crate, ());

branches/auto/src/libsyntax/parse/lexer.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ fn consume_whitespace_and_comments(rdr: @mut StringReader)
317317
}
318318

319319
pub fn is_line_non_doc_comment(s: &str) -> bool {
320-
let s = s.trim_right();
321-
s.len() > 3 && s.chars().all(|ch| ch == '/')
320+
s.starts_with("////")
322321
}
323322

324323
// PRECONDITION: rdr.curr is not whitespace
@@ -378,8 +377,7 @@ fn consume_any_line_comment(rdr: @mut StringReader)
378377
}
379378

380379
pub fn is_block_non_doc_comment(s: &str) -> bool {
381-
assert!(s.len() >= 1u);
382-
s.slice(1u, s.len() - 1u).chars().all(|ch| ch == '*')
380+
s.starts_with("/***")
383381
}
384382

385383
// might return a sugared-doc-attr

branches/auto/src/test/compile-fail/gated-bad-feature.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
foo(bar),
1414
foo = "baz"
1515
)];
16-
//~^^^ ERROR: malformed feature
17-
//~^^^ ERROR: malformed feature
16+
//~^^^^ ERROR: unknown feature
17+
//~^^^^ ERROR: malformed feature
18+
//~^^^^ ERROR: malformed feature
1819

1920
#[feature]; //~ ERROR: malformed feature
2021
#[feature = "foo"]; //~ ERROR: malformed feature

branches/auto/src/test/compile-fail/lint-unknown-feature.rs renamed to branches/auto/src/test/run-pass/issue-10638.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[deny(unknown_features)];
12-
13-
#[feature(this_is_not_a_feature)]; //~ ERROR: unknown feature
14-
15-
fn main() {}
11+
pub fn main() {
12+
//// I am not a doc comment!
13+
////////////////// still not a doc comment
14+
/////**** nope, me neither */
15+
/*** And neither am I! */
16+
5;
17+
/*****! certainly not I */
18+
}

0 commit comments

Comments
 (0)