rust/tests/ui/resolve/extern-prelude.rs
许杰友 Jieyou Xu (Joe) edafbaffb2
Adjust UI tests for unit_bindings
- Either explicitly annotate `let x: () = expr;` where `x` has unit
  type, or remove the unit binding to leave only `expr;` instead.
- Fix disjoint-capture-in-same-closure test
2023-06-12 20:24:48 +08:00

32 lines
649 B
Rust

// build-pass (FIXME(62277): could be check-pass?)
// compile-flags:--extern extern_prelude --extern Vec
// aux-build:extern-prelude.rs
// aux-build:extern-prelude-vec.rs
fn basic() {
// It works
let s = extern_prelude::S;
s.external();
}
fn shadow_mod() {
// Local module shadows `extern_prelude` from extern prelude
mod extern_prelude {
pub struct S;
impl S {
pub fn internal(&self) {}
}
}
let s = extern_prelude::S;
s.internal(); // OK
}
fn shadow_prelude() {
// Extern prelude shadows standard library prelude
let x: () = Vec::new(0f32, ()); // OK
}
fn main() {}