-
Notifications
You must be signed in to change notification settings - Fork 13.3k
File not found for module error #39765
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,74 @@ where appropriate is ongoing. Try using an unquoted name instead: | |
pub fn something() {} | ||
``` | ||
"##, | ||
|
||
E0583: r##" | ||
A file wasn't found for an out-of-line module. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0583 | ||
mod file_that_doesnt_exist; // error: file not found for module | ||
|
||
fn main() {} | ||
``` | ||
|
||
Please be sure that a file corresponding to the module exists. If you | ||
want to use a module named `file_that_doesnt_exist`, you need to have a file | ||
named `file_that_doesnt_exist.rs` or `file_that_doesnt_exist/mod.rs` in the | ||
same directory. | ||
"##, | ||
|
||
E0585: r##" | ||
A documentation comment that doesn't document anything was found. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0585 | ||
fn main() { | ||
// The following doc comment will fail: | ||
/// This is a useless doc comment! | ||
} | ||
``` | ||
|
||
Documentation comments need to be followed by items, including functions, | ||
types, modules, etc. Examples: | ||
|
||
``` | ||
/// I'm documenting the following struct: | ||
struct Foo; | ||
|
||
/// I'm documenting the following function: | ||
fn foo() {} | ||
``` | ||
"##, | ||
|
||
E0586: r##" | ||
An inclusive range was used with no end. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0586 | ||
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; | ||
let x = &tmp[1...]; // error: inclusive range was used with no end | ||
``` | ||
|
||
An inclusive range needs an end in order to *include* it. If you just need a | ||
start and no end, use a non-inclusive range (with `..`): | ||
|
||
``` | ||
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; | ||
let x = &tmp[1..]; // ok! | ||
``` | ||
|
||
Or put an end to your inclusive range: | ||
|
||
``` | ||
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; | ||
let x = &tmp[1...3]; // ok! | ||
``` | ||
"##, | ||
|
||
} | ||
|
||
register_diagnostics! { | ||
|
@@ -224,4 +292,5 @@ register_diagnostics! { | |
E0555, // malformed feature attribute, expected #![feature(...)] | ||
E0556, // malformed feature, expected just one word | ||
E0557, // feature has been removed | ||
E0584, // file for module `..` found at both .. and .. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the other newly added errors be registered as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't know how to trigger this one and not enough time to investigate. Someone will do it later on if I don't myself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This error occurs for |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
mod module_that_doesnt_exist; //~ ERROR E0583 | ||
|
||
fn main() { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
/// Hello! I'm useless... | ||
//~^ ERROR E0585 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; | ||
let x = &tmp[1...]; //~ ERROR E0586 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: no trailing new newline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature flags will be needed in these examples, also the cfail tests for inclusive ranges.