2013-07-16 23:23:17 -05:00
|
|
|
// Test that things from the prelude aren't in scope. Use many of them
|
|
|
|
// so that renaming some things won't magically make this test fail
|
2018-11-26 20:59:49 -06:00
|
|
|
// for the wrong reason (e.g., if `Add` changes to `Addition`, and
|
2013-07-16 23:23:17 -05:00
|
|
|
// `no_implicit_prelude` stops working, then the `impl Add` will still
|
|
|
|
// fail with the same error message).
|
|
|
|
|
|
|
|
#[no_implicit_prelude]
|
|
|
|
mod foo {
|
|
|
|
mod baz {
|
|
|
|
struct Test;
|
2017-01-11 16:18:08 -06:00
|
|
|
impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
|
2019-07-14 19:28:17 -05:00
|
|
|
impl Clone for Test {} //~ ERROR expected trait, found derive macro `Clone`
|
2017-01-11 16:18:08 -06:00
|
|
|
impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
|
|
|
|
impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
|
|
|
|
impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
|
2013-07-16 23:23:17 -05:00
|
|
|
|
|
|
|
fn foo() {
|
2017-01-11 16:18:08 -06:00
|
|
|
drop(2) //~ ERROR cannot find function `drop` in this scope
|
2013-07-16 23:23:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Test;
|
2017-01-11 16:18:08 -06:00
|
|
|
impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
|
2019-07-14 19:28:17 -05:00
|
|
|
impl Clone for Test {} //~ ERROR expected trait, found derive macro `Clone`
|
2017-01-11 16:18:08 -06:00
|
|
|
impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
|
|
|
|
impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
|
|
|
|
impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
|
2013-07-16 23:23:17 -05:00
|
|
|
|
|
|
|
fn foo() {
|
2017-01-11 16:18:08 -06:00
|
|
|
drop(2) //~ ERROR cannot find function `drop` in this scope
|
2013-07-16 23:23:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn qux() {
|
|
|
|
#[no_implicit_prelude]
|
|
|
|
mod qux_inner {
|
|
|
|
struct Test;
|
2017-01-11 16:18:08 -06:00
|
|
|
impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
|
2019-07-14 19:28:17 -05:00
|
|
|
impl Clone for Test {} //~ ERROR expected trait, found derive macro `Clone`
|
2017-01-11 16:18:08 -06:00
|
|
|
impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
|
|
|
|
impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
|
|
|
|
impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
|
2013-07-16 23:23:17 -05:00
|
|
|
|
|
|
|
fn foo() {
|
2017-01-11 16:18:08 -06:00
|
|
|
drop(2) //~ ERROR cannot find function `drop` in this scope
|
2013-07-16 23:23:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// these should work fine
|
2014-01-09 04:06:55 -06:00
|
|
|
drop(2)
|
2013-07-16 23:23:17 -05:00
|
|
|
}
|