mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Auto merge of #32439 - jseyfried:visible_suggestions, r=nrc
diagnostics: make paths to external items more visible This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an `extern crate`, the path is guarenteed to use the `extern crate`. Fixes #23224, fixes #23355, fixes #26635, fixes #27165. r? @nrc
This commit is contained in:
commit
4583dc9b13
@ -32,7 +32,7 @@ use mir::repr::Mir;
|
||||
use mir::mir_map::MirMap;
|
||||
use session::Session;
|
||||
use session::search_paths::PathKind;
|
||||
use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
|
||||
use util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
|
||||
use std::any::Any;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
@ -169,6 +169,7 @@ pub trait CrateStore<'tcx> : Any {
|
||||
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
|
||||
-> ty::TypeScheme<'tcx>;
|
||||
fn relative_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
|
||||
fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>>;
|
||||
fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
|
||||
fn item_name(&self, def: DefId) -> ast::Name;
|
||||
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
|
||||
@ -347,6 +348,9 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
|
||||
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
|
||||
-> ty::TypeScheme<'tcx> { unimplemented!() }
|
||||
fn relative_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { unimplemented!() }
|
||||
fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
|
||||
unimplemented!()
|
||||
}
|
||||
fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { unimplemented!() }
|
||||
fn item_name(&self, def: DefId) -> ast::Name { unimplemented!() }
|
||||
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
use front::map::DefPathData;
|
||||
use middle::cstore::LOCAL_CRATE;
|
||||
use middle::def_id::DefId;
|
||||
use middle::def_id::{DefId, CRATE_DEF_INDEX};
|
||||
use ty::{self, Ty, TyCtxt};
|
||||
use syntax::ast;
|
||||
|
||||
@ -75,9 +75,51 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// If possible, this pushes a global path resolving to `external_def_id` that is visible
|
||||
/// from at least one local module and returns true. If the crate defining `external_def_id` is
|
||||
/// declared with an `extern crate`, the path is guarenteed to use the `extern crate`.
|
||||
pub fn try_push_visible_item_path<T>(&self, buffer: &mut T, external_def_id: DefId) -> bool
|
||||
where T: ItemPathBuffer
|
||||
{
|
||||
let visible_parent_map = self.sess.cstore.visible_parent_map();
|
||||
|
||||
let (mut cur_def, mut cur_path) = (external_def_id, Vec::<ast::Name>::new());
|
||||
loop {
|
||||
// If `cur_def` is a direct or injected extern crate, push the path to the crate
|
||||
// followed by the path to the item within the crate and return.
|
||||
if cur_def.index == CRATE_DEF_INDEX {
|
||||
match self.sess.cstore.extern_crate(cur_def.krate) {
|
||||
Some(extern_crate) if extern_crate.direct => {
|
||||
self.push_item_path(buffer, extern_crate.def_id);
|
||||
cur_path.iter().rev().map(|segment| buffer.push(&segment.as_str())).count();
|
||||
return true;
|
||||
}
|
||||
None => {
|
||||
buffer.push(&self.crate_name(cur_def.krate));
|
||||
cur_path.iter().rev().map(|segment| buffer.push(&segment.as_str())).count();
|
||||
return true;
|
||||
}
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
||||
cur_path.push(self.sess.cstore.item_name(cur_def));
|
||||
match visible_parent_map.get(&cur_def) {
|
||||
Some(&def) => cur_def = def,
|
||||
None => return false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_item_path<T>(&self, buffer: &mut T, def_id: DefId)
|
||||
where T: ItemPathBuffer
|
||||
{
|
||||
match *buffer.root_mode() {
|
||||
RootMode::Local if !def_id.is_local() =>
|
||||
if self.try_push_visible_item_path(buffer, def_id) { return },
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let key = self.def_key(def_id);
|
||||
match key.disambiguated_data.data {
|
||||
DefPathData::CrateRoot => {
|
||||
|
@ -13,17 +13,17 @@ use decoder;
|
||||
use encoder;
|
||||
use loader;
|
||||
|
||||
use middle::cstore::{CrateStore, CrateSource, ChildItem, ExternCrate, FoundAst};
|
||||
use middle::cstore::{CrateStore, CrateSource, ChildItem, ExternCrate, FoundAst, DefLike};
|
||||
use middle::cstore::{NativeLibraryKind, LinkMeta, LinkagePreference};
|
||||
use middle::def;
|
||||
use middle::lang_items;
|
||||
use rustc::ty::{self, Ty, TyCtxt, VariantKind};
|
||||
use middle::def_id::{DefId, DefIndex};
|
||||
use middle::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
|
||||
|
||||
use rustc::front::map as hir_map;
|
||||
use rustc::mir::repr::Mir;
|
||||
use rustc::mir::mir_map::MirMap;
|
||||
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet};
|
||||
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
@ -544,4 +544,60 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
||||
{
|
||||
encoder::metadata_encoding_version
|
||||
}
|
||||
|
||||
/// Returns a map from a sufficiently visible external item (i.e. an external item that is
|
||||
/// visible from at least one local module) to a sufficiently visible parent (considering
|
||||
/// modules that re-export the external item to be parents).
|
||||
fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
|
||||
let mut visible_parent_map = self.visible_parent_map.borrow_mut();
|
||||
if !visible_parent_map.is_empty() { return visible_parent_map; }
|
||||
|
||||
use rustc_front::hir;
|
||||
use rustc::middle::cstore::{CrateStore, ChildItem};
|
||||
use std::collections::vec_deque::VecDeque;
|
||||
use std::collections::hash_map::Entry;
|
||||
for cnum in 1 .. self.next_crate_num() {
|
||||
let cdata = self.get_crate_data(cnum);
|
||||
|
||||
match cdata.extern_crate.get() {
|
||||
// Ignore crates without a corresponding local `extern crate` item.
|
||||
Some(extern_crate) if !extern_crate.direct => continue,
|
||||
_ => {},
|
||||
}
|
||||
|
||||
let mut bfs_queue = &mut VecDeque::new();
|
||||
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: ChildItem, parent: DefId| {
|
||||
let child = match child.def {
|
||||
DefLike::DlDef(def) if child.vis == hir::Public => def.def_id(),
|
||||
_ => return,
|
||||
};
|
||||
|
||||
match visible_parent_map.entry(child) {
|
||||
Entry::Occupied(mut entry) => {
|
||||
// If `child` is defined in crate `cnum`, ensure
|
||||
// that it is mapped to a parent in `cnum`.
|
||||
if child.krate == cnum && entry.get().krate != cnum {
|
||||
entry.insert(parent);
|
||||
}
|
||||
}
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(parent);
|
||||
bfs_queue.push_back(child);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let croot = DefId { krate: cnum, index: CRATE_DEF_INDEX };
|
||||
for child in self.crate_top_level_items(cnum) {
|
||||
add_child(bfs_queue, child, croot);
|
||||
}
|
||||
while let Some(def) = bfs_queue.pop_front() {
|
||||
for child in self.item_children(def) {
|
||||
add_child(bfs_queue, child, def);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visible_parent_map
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ use loader;
|
||||
|
||||
use rustc::back::svh::Svh;
|
||||
use rustc::middle::cstore::{ExternCrate};
|
||||
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet};
|
||||
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
|
||||
use rustc::middle::def_id::DefId;
|
||||
|
||||
use std::cell::{RefCell, Ref, Cell};
|
||||
use std::rc::Rc;
|
||||
@ -92,6 +93,7 @@ pub struct CStore {
|
||||
used_link_args: RefCell<Vec<String>>,
|
||||
statically_included_foreign_items: RefCell<NodeSet>,
|
||||
pub intr: Rc<IdentInterner>,
|
||||
pub visible_parent_map: RefCell<DefIdMap<DefId>>,
|
||||
}
|
||||
|
||||
impl CStore {
|
||||
@ -104,6 +106,7 @@ impl CStore {
|
||||
used_link_args: RefCell::new(Vec::new()),
|
||||
intr: intr,
|
||||
statically_included_foreign_items: RefCell::new(NodeSet()),
|
||||
visible_parent_map: RefCell::new(FnvHashMap()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ trait Get {
|
||||
}
|
||||
|
||||
fn foo<T:Get>(t: T) {
|
||||
let x = t.get(); //~ ERROR the trait `core::marker::Sized` is not implemented
|
||||
let x = t.get(); //~ ERROR the trait `std::marker::Sized` is not implemented
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
static i: String = 10;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `collections::string::String`
|
||||
//~| expected `std::string::String`
|
||||
//~| found `_`
|
||||
//~| expected struct `collections::string::String`
|
||||
//~| expected struct `std::string::String`
|
||||
//~| found integral variable
|
||||
fn main() { println!("{}", i); }
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn foo<T:'static>() {
|
||||
1.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
|
||||
1.bar::<T>(); //~ ERROR `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
trait bar {
|
||||
|
@ -12,7 +12,7 @@ trait Trait {}
|
||||
|
||||
pub fn main() {
|
||||
let x: Vec<Trait + Sized> = Vec::new();
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented
|
||||
}
|
||||
|
@ -8,6 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:`^` cannot be applied to type `collections::string::String`
|
||||
// error-pattern:`^` cannot be applied to type `std::string::String`
|
||||
|
||||
fn main() { let x = "a".to_string() ^ "b".to_string(); }
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
trait Foo : Send+Sync { }
|
||||
|
||||
impl <T: Sync+'static> Foo for (T,) { } //~ ERROR the trait `core::marker::Send` is not implemented
|
||||
impl <T: Sync+'static> Foo for (T,) { } //~ ERROR the trait `std::marker::Send` is not implemented
|
||||
|
||||
impl <T: Send> Foo for (T,T) { } //~ ERROR the trait `core::marker::Sync` is not implemented
|
||||
impl <T: Send> Foo for (T,T) { } //~ ERROR the trait `std::marker::Sync` is not implemented
|
||||
|
||||
impl <T: Send+Sync> Foo for (T,T,T) { } // (ok)
|
||||
|
||||
|
@ -22,6 +22,6 @@ struct X<T>(T);
|
||||
impl <T:Sync> RequiresShare for X<T> { }
|
||||
|
||||
impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
|
||||
fn main() { }
|
||||
|
@ -14,6 +14,6 @@
|
||||
trait Foo : Send { }
|
||||
|
||||
impl Foo for std::rc::Rc<i8> { }
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
|
||||
fn main() { }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
trait Foo : Send { }
|
||||
|
||||
impl <T: Sync+'static> Foo for T { } //~ ERROR the trait `core::marker::Send` is not implemented
|
||||
impl <T: Sync+'static> Foo for T { } //~ ERROR the trait `std::marker::Send` is not implemented
|
||||
|
||||
fn main() { }
|
||||
|
@ -91,7 +91,7 @@ fn main()
|
||||
let _ = 42usize as *const [u8]; //~ ERROR casting
|
||||
let _ = v as *const [u8]; //~ ERROR cannot cast
|
||||
let _ = fat_v as *const Foo;
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `[u8]`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `[u8]`
|
||||
//~^^ HELP run `rustc --explain E0277` to see a detailed explanation
|
||||
//~^^^ NOTE `[u8]` does not have a constant size known at compile-time
|
||||
//~^^^^ NOTE required for the cast to the object type `Foo`
|
||||
@ -106,7 +106,7 @@ fn main()
|
||||
|
||||
let a : *const str = "hello";
|
||||
let _ = a as *const Foo;
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `str`
|
||||
//~^^ HELP run `rustc --explain E0277` to see a detailed explanation
|
||||
//~^^^ NOTE `str` does not have a constant size known at compile-time
|
||||
//~^^^^ NOTE required for the cast to the object type `Foo`
|
||||
|
@ -13,7 +13,7 @@ struct X<F> where F: FnOnce() + 'static + Send {
|
||||
}
|
||||
|
||||
fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented for the type
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented for the type
|
||||
return X { field: blk };
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ fn give_any<F>(f: F) where F: FnOnce() {
|
||||
|
||||
fn give_owned<F>(f: F) where F: FnOnce() + Send {
|
||||
take_any(f);
|
||||
take_const_owned(f); //~ ERROR the trait `core::marker::Sync` is not implemented for the type
|
||||
take_const_owned(f); //~ ERROR the trait `std::marker::Sync` is not implemented for the type
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -17,10 +17,10 @@ struct TestType<T>(::std::marker::PhantomData<T>);
|
||||
unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
|
||||
|
||||
impl<T: MyTrait> !Send for TestType<T> {}
|
||||
//~^ ERROR conflicting implementations of trait `core::marker::Send`
|
||||
//~^ ERROR conflicting implementations of trait `std::marker::Send`
|
||||
|
||||
unsafe impl<T:'static> Send for TestType<T> {}
|
||||
//~^ ERROR error: conflicting implementations of trait `core::marker::Send`
|
||||
//~^ ERROR error: conflicting implementations of trait `std::marker::Send`
|
||||
|
||||
impl !Send for TestType<i32> {}
|
||||
|
||||
|
@ -18,7 +18,7 @@ struct E {
|
||||
#[derive(Clone)]
|
||||
struct C {
|
||||
x: NoCloneOrEq
|
||||
//~^ ERROR the trait `core::clone::Clone` is not implemented for the type `NoCloneOrEq`
|
||||
//~^ ERROR the trait `std::clone::Clone` is not implemented for the type `NoCloneOrEq`
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ struct Error;
|
||||
|
||||
#[derive(Default)]
|
||||
struct Struct {
|
||||
x: Error //~ ERROR `core::default::Default` is not implemented
|
||||
x: Error //~ ERROR `std::default::Default` is not implemented
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -35,7 +35,7 @@ fn main() {
|
||||
// n == m
|
||||
let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced
|
||||
let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced
|
||||
let box x = box 1isize as Box<T>; //~ ERROR the trait `core::marker::Sized` is not implemented
|
||||
let box x = box 1isize as Box<T>; //~ ERROR the trait `std::marker::Sized` is not implemented
|
||||
|
||||
// n > m
|
||||
let &&x = &1isize as &T;
|
||||
|
@ -39,8 +39,8 @@ enum Wrapper<T:'static> {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let w = //~ ERROR overflow while adding drop-check rules for core::option
|
||||
let w = //~ ERROR overflow while adding drop-check rules for std::option
|
||||
Some(Wrapper::Simple::<u32>);
|
||||
//~^ ERROR overflow while adding drop-check rules for core::option::Option
|
||||
//~^ ERROR overflow while adding drop-check rules for std::option::Option
|
||||
//~| ERROR overflow while adding drop-check rules for Wrapper
|
||||
}
|
||||
|
@ -44,5 +44,5 @@ pub fn main() {
|
||||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
|
||||
f5.ptr = *z;
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
}
|
||||
|
@ -49,5 +49,5 @@ pub fn main() {
|
||||
//~| found `Bar1`
|
||||
//~| expected trait ToBar
|
||||
//~| found struct `Bar1`
|
||||
//~| ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar`
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented for the type `ToBar`
|
||||
}
|
||||
|
@ -21,5 +21,5 @@ pub fn main() {
|
||||
let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
|
||||
let g: &Fat<[isize]> = &f;
|
||||
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
}
|
||||
|
@ -16,22 +16,22 @@ impl Foo for [u8] {}
|
||||
|
||||
fn test1<T: ?Sized + Foo>(t: &T) {
|
||||
let u: &Foo = t;
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `T`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `T`
|
||||
}
|
||||
|
||||
fn test2<T: ?Sized + Foo>(t: &T) {
|
||||
let v: &Foo = t as &Foo;
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `T`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `T`
|
||||
}
|
||||
|
||||
fn test3() {
|
||||
let _: &[&Foo] = &["hi"];
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `str`
|
||||
}
|
||||
|
||||
fn test4(x: &[u8]) {
|
||||
let _: &Foo = x as &Foo;
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `[u8]`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `[u8]`
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -15,9 +15,9 @@
|
||||
trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized
|
||||
|
||||
impl Foo<[isize]> for usize { }
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[isize]`
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[isize]`
|
||||
|
||||
impl Foo<isize> for [usize] { }
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[usize]`
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[usize]`
|
||||
|
||||
pub fn main() { }
|
||||
|
@ -13,5 +13,5 @@
|
||||
fn check_bound<T:Copy>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
check_bound("nocopy".to_string()); //~ ERROR the trait `core::marker::Copy` is not implemented
|
||||
check_bound("nocopy".to_string()); //~ ERROR the trait `std::marker::Copy` is not implemented
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ fn main() {
|
||||
// extern functions are extern "C" fn
|
||||
let _x: extern "C" fn() = f; // OK
|
||||
is_fn(f);
|
||||
//~^ ERROR the trait `core::ops::Fn<()>` is not implemented for the type `extern "C" fn()
|
||||
//~| ERROR the trait `core::ops::FnOnce<()>` is not implemented for the type `extern "C" fn()
|
||||
//~^ ERROR the trait `std::ops::Fn<()>` is not implemented for the type `extern "C" fn()
|
||||
//~| ERROR the trait `std::ops::FnOnce<()>` is not implemented for the type `extern "C" fn()
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ fn main() {
|
||||
|
||||
eq(bar::<String>, bar::<Vec<u8>>);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `fn(isize) -> isize {bar::<collections::string::String>}`
|
||||
//~| found `fn(isize) -> isize {bar::<collections::vec::Vec<u8>>}`
|
||||
//~| expected struct `collections::string::String`
|
||||
//~| found struct `collections::vec::Vec`
|
||||
//~| expected `fn(isize) -> isize {bar::<std::string::String>}`
|
||||
//~| found `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
|
||||
//~| expected struct `std::string::String`
|
||||
//~| found struct `std::vec::Vec`
|
||||
|
||||
// Make sure we distinguish between trait methods correctly.
|
||||
eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
|
||||
|
@ -17,23 +17,23 @@ fn main() {
|
||||
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `Box<core::ops::FnOnce(isize)>`
|
||||
//~| found `Box<std::ops::FnOnce(isize)>`
|
||||
//~| expected ()
|
||||
//~| found box
|
||||
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `Box<core::ops::Fn(isize, isize)>`
|
||||
//~| found `Box<std::ops::Fn(isize, isize)>`
|
||||
//~| expected ()
|
||||
//~| found box
|
||||
let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `Box<core::ops::FnMut() -> isize>`
|
||||
//~| found `Box<std::ops::FnMut() -> isize>`
|
||||
//~| expected ()
|
||||
//~| found box
|
||||
|
||||
needs_fn(1);
|
||||
//~^ ERROR `core::ops::Fn<(isize,)>`
|
||||
//~| ERROR `core::ops::FnOnce<(isize,)>`
|
||||
//~^ ERROR `std::ops::Fn<(isize,)>`
|
||||
//~| ERROR `std::ops::FnOnce<(isize,)>`
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ pub fn main() {
|
||||
x: 1,
|
||||
y: 2,
|
||||
};
|
||||
for x in bogus { //~ ERROR `core::iter::Iterator` is not implemented for the type `MyStruct`
|
||||
for x in bogus { //~ ERROR `std::iter::Iterator` is not implemented for the type `MyStruct`
|
||||
drop(x);
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ fn main() {
|
||||
let x: Option<usize>;
|
||||
x = 5;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<usize>`
|
||||
//~| expected `std::option::Option<usize>`
|
||||
//~| found `_`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| expected enum `std::option::Option`
|
||||
//~| found integral variable
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ use std::option::Option;
|
||||
fn bar(x: usize) -> Option<usize> {
|
||||
return x;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<usize>`
|
||||
//~| expected `std::option::Option<usize>`
|
||||
//~| found `usize`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| expected enum `std::option::Option`
|
||||
//~| found usize
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,13 @@ fn main() {
|
||||
// Including cases where the default is using previous type params.
|
||||
let _: HashMap<String, isize> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `HashMap<collections::string::String, isize>`
|
||||
//~| expected `HashMap<std::string::String, isize>`
|
||||
//~| found `()`
|
||||
//~| expected struct `HashMap`
|
||||
//~| found ()
|
||||
let _: HashMap<String, isize, Hash<String>> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `HashMap<collections::string::String, isize>`
|
||||
//~| expected `HashMap<std::string::String, isize>`
|
||||
//~| found `()`
|
||||
//~| expected struct `HashMap`
|
||||
//~| found ()
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
fn main() {
|
||||
format!("{:X}", "3");
|
||||
//~^ ERROR: the trait `core::fmt::UpperHex` is not implemented
|
||||
//~^ ERROR: the trait `std::fmt::UpperHex` is not implemented
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
fn main() {
|
||||
fn bar<T>(_: T) {}
|
||||
[0][0u8]; //~ ERROR: the trait `core::ops::Index<u8>` is not implemented
|
||||
[0][0u8]; //~ ERROR: the trait `std::ops::Index<u8>` is not implemented
|
||||
|
||||
[0][0]; // should infer to be a usize
|
||||
|
||||
|
@ -31,7 +31,7 @@ impl<T:Clone> ToOpt for Option<T> {
|
||||
}
|
||||
|
||||
fn function<T:ToOpt + Clone>(counter: usize, t: T) {
|
||||
//~^ ERROR reached the recursion limit while instantiating `function::<core::option::Option<
|
||||
//~^ ERROR reached the recursion limit while instantiating `function::<std::option::Option<
|
||||
if counter > 0 {
|
||||
function(counter - 1, t.to_option());
|
||||
// FIXME(#4287) Error message should be here. It should be
|
||||
|
@ -13,14 +13,14 @@ pub fn main() {
|
||||
let s: String = "abcdef".to_string();
|
||||
v[3_usize];
|
||||
v[3];
|
||||
v[3u8]; //~ERROR the trait `core::ops::Index<u8>` is not implemented
|
||||
v[3i8]; //~ERROR the trait `core::ops::Index<i8>` is not implemented
|
||||
v[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented
|
||||
v[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented
|
||||
v[3u8]; //~ERROR the trait `std::ops::Index<u8>` is not implemented
|
||||
v[3i8]; //~ERROR the trait `std::ops::Index<i8>` is not implemented
|
||||
v[3u32]; //~ERROR the trait `std::ops::Index<u32>` is not implemented
|
||||
v[3i32]; //~ERROR the trait `std::ops::Index<i32>` is not implemented
|
||||
s.as_bytes()[3_usize];
|
||||
s.as_bytes()[3];
|
||||
s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index<u8>` is not implemented
|
||||
s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index<i8>` is not implemented
|
||||
s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented
|
||||
s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented
|
||||
s.as_bytes()[3u8]; //~ERROR the trait `std::ops::Index<u8>` is not implemented
|
||||
s.as_bytes()[3i8]; //~ERROR the trait `std::ops::Index<i8>` is not implemented
|
||||
s.as_bytes()[3u32]; //~ERROR the trait `std::ops::Index<u32>` is not implemented
|
||||
s.as_bytes()[3i32]; //~ERROR the trait `std::ops::Index<i32>` is not implemented
|
||||
}
|
||||
|
@ -17,16 +17,16 @@ pub fn main() {
|
||||
let _x: usize = match Some(1) {
|
||||
Ok(u) => u,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<_>`
|
||||
//~| found `core::result::Result<_, _>`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| found enum `core::result::Result`
|
||||
//~| expected `std::option::Option<_>`
|
||||
//~| found `std::result::Result<_, _>`
|
||||
//~| expected enum `std::option::Option`
|
||||
//~| found enum `std::result::Result`
|
||||
|
||||
Err(e) => panic!(e)
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<_>`
|
||||
//~| found `core::result::Result<_, _>`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| found enum `core::result::Result`
|
||||
//~| expected `std::option::Option<_>`
|
||||
//~| found `std::result::Result<_, _>`
|
||||
//~| expected enum `std::option::Option`
|
||||
//~| found enum `std::result::Result`
|
||||
};
|
||||
}
|
||||
|
@ -13,5 +13,5 @@
|
||||
|
||||
fn main() {
|
||||
() <- 0;
|
||||
//~^ ERROR: the trait `core::ops::Placer<_>` is not implemented
|
||||
//~^ ERROR: the trait `std::ops::Placer<_>` is not implemented
|
||||
}
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
fn main() {
|
||||
let _x = "test" as &::std::any::Any;
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `str`
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
|
||||
{
|
||||
for
|
||||
&mut something
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[T]`
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[T]`
|
||||
in arg2
|
||||
{
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ fn main() {
|
||||
let x = Some(&[name]);
|
||||
let msg = foo(x);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<&[&str]>`
|
||||
//~| found `core::option::Option<&[&str; 1]>`
|
||||
//~| expected `std::option::Option<&[&str]>`
|
||||
//~| found `std::option::Option<&[&str; 1]>`
|
||||
//~| expected slice
|
||||
//~| found array of 1 elements
|
||||
assert_eq!(msg, 3);
|
||||
|
@ -14,7 +14,7 @@ fn main() {
|
||||
let Slice { data: data, len: len } = "foo";
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&str`
|
||||
//~| found `core::raw::Slice<_>`
|
||||
//~| found `std::raw::Slice<_>`
|
||||
//~| expected &-ptr
|
||||
//~| found struct `core::raw::Slice`
|
||||
//~| found struct `std::raw::Slice`
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ fn main() {
|
||||
Slice { data: data, len: len } => (),
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `core::raw::Slice<_>`
|
||||
//~| found `std::raw::Slice<_>`
|
||||
//~| expected ()
|
||||
//~| found struct `core::raw::Slice`
|
||||
//~| found struct `std::raw::Slice`
|
||||
_ => unreachable!()
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ mod Y {
|
||||
}
|
||||
|
||||
static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
//~^ ERROR the trait `core::marker::Sync` is not implemented for the type
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented for the type
|
||||
//~| ERROR cannot refer to other statics by value, use the address-of operator or a constant instead
|
||||
//~| ERROR E0015
|
||||
|
||||
|
@ -15,11 +15,11 @@ fn main() {
|
||||
|
||||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||
let _bar = Box::new(1_usize) as std::fmt::Debug;
|
||||
//~^ ERROR cast to unsized type: `Box<usize>` as `core::fmt::Debug`
|
||||
//~^ ERROR cast to unsized type: `Box<usize>` as `std::fmt::Debug`
|
||||
//~^^ HELP try casting to a `Box` instead
|
||||
|
||||
let _baz = 1_usize as std::fmt::Debug;
|
||||
//~^ ERROR cast to unsized type: `usize` as `core::fmt::Debug`
|
||||
//~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug`
|
||||
//~^^ HELP consider using a box or reference as appropriate
|
||||
|
||||
let _quux = [1_usize, 2] as [usize];
|
||||
|
@ -14,5 +14,5 @@
|
||||
fn main() {
|
||||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||
(|| Box::new(*(&[0][..])))();
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[_]`
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[_]`
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ impl !Sync for Foo {}
|
||||
|
||||
static FOO: usize = 3;
|
||||
static BAR: Foo = Foo;
|
||||
//~^ ERROR: the trait `core::marker::Sync` is not implemented
|
||||
//~^ ERROR: the trait `std::marker::Sync` is not implemented
|
||||
|
||||
fn main() {}
|
||||
|
@ -12,7 +12,7 @@ pub trait AbstractRenderer {}
|
||||
|
||||
fn _create_render(_: &()) ->
|
||||
AbstractRenderer
|
||||
//~^ ERROR: the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR: the trait `std::marker::Sized` is not implemented
|
||||
{
|
||||
match 0 {
|
||||
_ => unimplemented!()
|
||||
|
@ -11,7 +11,7 @@
|
||||
type FuncType<'f> = Fn(&isize) -> isize + 'f;
|
||||
|
||||
fn ho_func(f: Option<FuncType>) {
|
||||
//~^ ERROR: the trait `core::marker::Sized` is not implemented for the type
|
||||
//~^ ERROR: the trait `std::marker::Sized` is not implemented for the type
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -15,7 +15,7 @@ trait From<Src> {
|
||||
}
|
||||
|
||||
trait To {
|
||||
fn to<Dst>( //~ ERROR the trait `core::marker::Sized` is not implemented
|
||||
fn to<Dst>( //~ ERROR the trait `std::marker::Sized` is not implemented
|
||||
self
|
||||
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
|
||||
From::from(self)
|
||||
|
@ -13,5 +13,5 @@ struct X { x: i32 }
|
||||
fn main() {
|
||||
let mut b: Vec<X> = vec![];
|
||||
b.sort();
|
||||
//~^ ERROR the trait `core::cmp::Ord` is not implemented for the type `X`
|
||||
//~^ ERROR the trait `std::cmp::Ord` is not implemented for the type `X`
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
|
||||
for item in *things { *item = 0 }
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `core::iter::Iterator
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `std::iter::Iterator
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -16,6 +16,6 @@ impl Bar {
|
||||
|
||||
#[derive(Hash)]
|
||||
struct Foo(Bar);
|
||||
//~^ error: the trait `core::hash::Hash` is not implemented for the type `Bar`
|
||||
//~^ error: the trait `std::hash::Hash` is not implemented for the type `Bar`
|
||||
|
||||
fn main() {}
|
||||
|
@ -14,8 +14,8 @@ impl Iterator for S {
|
||||
type Item = i32;
|
||||
fn next(&mut self) -> Result<i32, i32> { Ok(7) }
|
||||
//~^ ERROR method `next` has an incompatible type for trait
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| found enum `core::result::Result` [E0053]
|
||||
//~| expected enum `std::option::Option`
|
||||
//~| found enum `std::result::Result` [E0053]
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -17,5 +17,5 @@ fn foo<T: Send>() {}
|
||||
|
||||
fn main() {
|
||||
foo::<HashMap<Rc<()>, Rc<()>>>();
|
||||
//~^ ERROR: the trait `core::marker::Send` is not implemented for the type `alloc::rc::Rc<()>`
|
||||
//~^ ERROR: the trait `std::marker::Send` is not implemented for the type `std::rc::Rc<()>`
|
||||
}
|
||||
|
@ -16,5 +16,5 @@ fn main() {
|
||||
let x = &10 as
|
||||
&Add;
|
||||
//~^ ERROR the type parameter `RHS` must be explicitly specified in an object type because its default value `Self` references the type `Self`
|
||||
//~| ERROR the value of the associated type `Output` (from the trait `core::ops::Add`) must be specified
|
||||
//~| ERROR the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ fn main() {
|
||||
let ptr: *mut () = 0 as *mut _;
|
||||
let _: &mut Fn() = unsafe {
|
||||
&mut *(ptr as *mut Fn())
|
||||
//~^ ERROR the trait `core::ops::Fn<()>` is not implemented
|
||||
//~| ERROR the trait `core::ops::FnOnce<()>` is not implemented
|
||||
//~^ ERROR the trait `std::ops::Fn<()>` is not implemented
|
||||
//~| ERROR the trait `std::ops::FnOnce<()>` is not implemented
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use std::ops::{Add, Sub};
|
||||
|
||||
type Test = Add +
|
||||
//~^ ERROR the type parameter `RHS` must be explicitly specified in an object type because its default value `Self` references the type `Self`
|
||||
//~^^ ERROR the value of the associated type `Output` (from the trait `core::ops::Add`) must be specified [E0191]
|
||||
//~^^ ERROR the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified [E0191]
|
||||
Sub;
|
||||
//~^ ERROR only the builtin traits can be used as closure or object bounds
|
||||
|
||||
|
@ -19,5 +19,5 @@ fn main()
|
||||
println!("{:?}",(vfnfer[0] as Fn)(3));
|
||||
//~^ ERROR the precise format of `Fn`-family traits'
|
||||
//~| ERROR wrong number of type arguments: expected 1, found 0
|
||||
//~| ERROR the value of the associated type `Output` (from the trait `core::ops::FnOnce`)
|
||||
//~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`)
|
||||
}
|
||||
|
@ -11,9 +11,9 @@
|
||||
fn main() {
|
||||
static foo: Fn() -> u32 = || -> u32 {
|
||||
//~^ ERROR: mismatched types:
|
||||
//~| expected `core::ops::Fn() -> u32 + 'static`,
|
||||
//~| expected `std::ops::Fn() -> u32 + 'static`,
|
||||
//~| found closure
|
||||
//~| (expected trait core::ops::Fn,
|
||||
//~| (expected trait std::ops::Fn,
|
||||
//~| found closure)
|
||||
0
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ struct E {
|
||||
|
||||
impl A for E {
|
||||
fn b<F: Sync, G>(&self, _x: F) -> F { panic!() }
|
||||
//~^ ERROR `F : core::marker::Sync` appears on the impl method
|
||||
//~^ ERROR `F : std::marker::Sync` appears on the impl method
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
fn main() {
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `core::iter::Iterator` is not implemented
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
|
||||
for _ in false {}
|
||||
//~^ ERROR the trait `core::iter::Iterator` is not implemented
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `core::iter::Iterator` is not implemented
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
|
||||
other()
|
||||
}
|
||||
@ -25,11 +25,11 @@ pub fn other() {
|
||||
// check errors are still reported globally
|
||||
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `core::iter::Iterator` is not implemented
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `core::iter::Iterator` is not implemented
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
|
||||
for _ in false {}
|
||||
//~^ ERROR the trait `core::iter::Iterator` is not implemented
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ fn main() {
|
||||
match None {
|
||||
Err(_) => ()
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<_>`
|
||||
//~| found `core::result::Result<_, _>`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| found enum `core::result::Result`
|
||||
//~| expected `std::option::Option<_>`
|
||||
//~| found `std::result::Result<_, _>`
|
||||
//~| expected enum `std::option::Option`
|
||||
//~| found enum `std::result::Result`
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
trait I {}
|
||||
type K = I+'static;
|
||||
|
||||
fn foo(_x: K) {} //~ ERROR: the trait `core::marker::Sized` is not implemented
|
||||
fn foo(_x: K) {} //~ ERROR: the trait `std::marker::Sized` is not implemented
|
||||
|
||||
fn main() {}
|
||||
|
@ -15,8 +15,8 @@ struct Struct {
|
||||
}
|
||||
|
||||
fn new_struct(r: A+'static)
|
||||
-> Struct { //~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
-> Struct { //~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
Struct { r: r }
|
||||
}
|
||||
|
||||
|
@ -34,5 +34,5 @@ struct A {
|
||||
|
||||
fn main() {
|
||||
let a = A {v: box B{v: None} as Box<Foo+Send>};
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ fn foo(x: Whatever) {
|
||||
Some(field) =>
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `Whatever`
|
||||
//~| found `core::option::Option<_>`
|
||||
//~| found `std::option::Option<_>`
|
||||
//~| expected enum `Whatever`
|
||||
//~| found enum `core::option::Option`
|
||||
//~| found enum `std::option::Option`
|
||||
field.access(), //~ ERROR the type of this value must be known in this context
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ use std::cell::RefCell;
|
||||
// Regression test for issue 7364
|
||||
static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
||||
//~^ ERROR allocations are not allowed in statics
|
||||
//~| ERROR the trait `core::marker::Sync` is not implemented for the type
|
||||
//~| ERROR the trait `std::marker::Sync` is not implemented for the type
|
||||
|
||||
fn main() { }
|
||||
|
@ -26,15 +26,15 @@ fn main() {
|
||||
match &Some(42) {
|
||||
Some(x) => (),
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&core::option::Option<_>`
|
||||
//~| found `core::option::Option<_>`
|
||||
//~| expected `&std::option::Option<_>`
|
||||
//~| found `std::option::Option<_>`
|
||||
//~| expected &-ptr
|
||||
//~| found enum `core::option::Option`
|
||||
//~| found enum `std::option::Option`
|
||||
None => ()
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&core::option::Option<_>`
|
||||
//~| found `core::option::Option<_>`
|
||||
//~| expected `&std::option::Option<_>`
|
||||
//~| found `std::option::Option<_>`
|
||||
//~| expected &-ptr
|
||||
//~| found enum `core::option::Option`
|
||||
//~| found enum `std::option::Option`
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:reached the recursion limit while instantiating `generic::<core::option::Option<
|
||||
// error-pattern:reached the recursion limit while instantiating `generic::<std::option::Option<
|
||||
|
||||
// Verify the compiler fails with an error on infinite function
|
||||
// recursions.
|
||||
|
@ -34,14 +34,14 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
assert_copy::<&'a [isize]>();
|
||||
|
||||
// ...unless they are mutable
|
||||
assert_copy::<&'static mut isize>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<&'a mut isize>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<&'static mut isize>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<&'a mut isize>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
|
||||
// boxes are not ok
|
||||
assert_copy::<Box<isize>>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<String>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<Vec<isize> >(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<Box<&'a mut isize>>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<Box<isize>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<String>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Vec<isize> >(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Box<&'a mut isize>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
|
||||
// borrowed object types are generally ok
|
||||
assert_copy::<&'a Dummy>();
|
||||
@ -49,11 +49,11 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
assert_copy::<&'static (Dummy+Copy)>();
|
||||
|
||||
// owned object types are not ok
|
||||
assert_copy::<Box<Dummy>>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<Box<Dummy>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
|
||||
// mutable object types are not ok
|
||||
assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
|
||||
// unsafe ptrs are ok
|
||||
assert_copy::<*const isize>();
|
||||
@ -71,10 +71,10 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
assert_copy::<MyStruct>();
|
||||
|
||||
// structs containing non-POD are not ok
|
||||
assert_copy::<MyNoncopyStruct>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<MyNoncopyStruct>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
|
||||
// ref counted types are not ok
|
||||
assert_copy::<Rc<isize>>(); //~ ERROR `core::marker::Copy` is not implemented
|
||||
assert_copy::<Rc<isize>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -21,5 +21,5 @@ fn take_param<T:Foo>(foo: &T) { }
|
||||
fn main() {
|
||||
let x: Box<_> = box 3;
|
||||
take_param(&x);
|
||||
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
fn f<T>(val: T) {
|
||||
let t: S<T> = S(marker::PhantomData);
|
||||
let a = &t as &Gettable<T>;
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
fn g<T>(val: T) {
|
||||
let t: S<T> = S(marker::PhantomData);
|
||||
let a: &Gettable<T> = &t;
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
fn foo<'a>() {
|
||||
@ -44,7 +44,7 @@ fn foo<'a>() {
|
||||
fn foo2<'a>() {
|
||||
let t: Box<S<String>> = box S(marker::PhantomData);
|
||||
let a = t as Box<Gettable<String>>;
|
||||
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented
|
||||
}
|
||||
|
||||
fn foo3<'a>() {
|
||||
@ -52,7 +52,7 @@ fn foo3<'a>() {
|
||||
|
||||
let t: Box<S<Foo>> = box S(marker::PhantomData);
|
||||
let a: Box<Gettable<Foo>> = t;
|
||||
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -18,5 +18,5 @@ fn bar<F:FnOnce() + Send>(_: F) { }
|
||||
fn main() {
|
||||
let x = Rc::new(3);
|
||||
bar(move|| foo(x));
|
||||
//~^ ERROR `core::marker::Send` is not implemented
|
||||
//~^ ERROR `std::marker::Send` is not implemented
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ trait Message : Send { }
|
||||
|
||||
fn object_ref_with_static_bound_not_ok() {
|
||||
assert_send::<&'static (Dummy+'static)>();
|
||||
//~^ ERROR the trait `core::marker::Sync` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented
|
||||
}
|
||||
|
||||
fn box_object_with_no_bound_not_ok<'a>() {
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `core::marker::Send` is not implemented
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
fn object_with_send_bound_ok() {
|
||||
|
@ -18,7 +18,7 @@ trait Dummy { }
|
||||
// careful with object types, who knows what they close over...
|
||||
fn test51<'a>() {
|
||||
assert_send::<&'a Dummy>();
|
||||
//~^ ERROR the trait `core::marker::Sync` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented
|
||||
}
|
||||
fn test52<'a>() {
|
||||
assert_send::<&'a (Dummy+Sync)>();
|
||||
@ -37,7 +37,7 @@ fn test61() {
|
||||
// them not ok
|
||||
fn test_71<'a>() {
|
||||
assert_send::<Box<Dummy+'a>>();
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -14,11 +14,11 @@ fn assert_send<T:Send>() { }
|
||||
trait Dummy { }
|
||||
|
||||
fn test50() {
|
||||
assert_send::<&'static Dummy>(); //~ ERROR the trait `core::marker::Sync` is not implemented
|
||||
assert_send::<&'static Dummy>(); //~ ERROR the trait `std::marker::Sync` is not implemented
|
||||
}
|
||||
|
||||
fn test53() {
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `core::marker::Send` is not implemented
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
// ...unless they are properly bounded
|
||||
|
@ -19,7 +19,7 @@ fn test32() { assert_send::<Vec<isize> >(); }
|
||||
|
||||
// but not if they own a bad thing
|
||||
fn test40() {
|
||||
assert_send::<Box<*mut u8>>(); //~ ERROR `core::marker::Send` is not implemented
|
||||
assert_send::<Box<*mut u8>>(); //~ ERROR `std::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -13,6 +13,6 @@ struct Foo;
|
||||
fn main() {
|
||||
let a: Result<(), Foo> = Ok(());
|
||||
a.unwrap();
|
||||
//~^ ERROR no method named `unwrap` found for type `core::result::Result<(), Foo>`
|
||||
//~| NOTE the following trait bounds were not satisfied: `Foo : core::fmt::Debug`
|
||||
//~^ ERROR no method named `unwrap` found for type `std::result::Result<(), Foo>`
|
||||
//~| NOTE the following trait bounds were not satisfied: `Foo : std::fmt::Debug`
|
||||
}
|
||||
|
@ -8,6 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:cannot apply unary operator `-` to type `collections::string::String`
|
||||
// error-pattern:cannot apply unary operator `-` to type `std::string::String`
|
||||
|
||||
fn main() { -"foo".to_string(); }
|
||||
|
@ -15,5 +15,5 @@ fn f<T: Sync>(_: T) {}
|
||||
fn main() {
|
||||
let x = RefCell::new(0);
|
||||
f(x);
|
||||
//~^ ERROR `core::marker::Sync` is not implemented
|
||||
//~^ ERROR `std::marker::Sync` is not implemented
|
||||
}
|
||||
|
@ -24,5 +24,5 @@ fn bar<T: Sync>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
let x = Foo::A(NoSync);
|
||||
bar(&x); //~ ERROR the trait `core::marker::Sync` is not implemented
|
||||
bar(&x); //~ ERROR the trait `std::marker::Sync` is not implemented
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ fn main() {
|
||||
//~^^ HELP following traits define an item `method`, perhaps you need to implement one of them
|
||||
//~^^^ HELP `foo::Bar`
|
||||
//~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
||||
//~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported`
|
||||
//~^^^^^ HELP `no_method_suggested_traits::Reexported`
|
||||
//~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
|
||||
//~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
|
||||
//~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
|
||||
@ -74,7 +74,7 @@ fn main() {
|
||||
//~^^ HELP following traits define an item `method`, perhaps you need to implement one of them
|
||||
//~^^^ HELP `foo::Bar`
|
||||
//~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
||||
//~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported`
|
||||
//~^^^^^ HELP `no_method_suggested_traits::Reexported`
|
||||
//~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
|
||||
//~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
|
||||
//~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
|
||||
|
@ -33,7 +33,7 @@ fn main() {
|
||||
let x = foo(Port(Rc::new(())));
|
||||
|
||||
thread::spawn(move|| {
|
||||
//~^ ERROR `core::marker::Send` is not implemented
|
||||
//~^ ERROR `std::marker::Send` is not implemented
|
||||
let y = x;
|
||||
println!("{:?}", y);
|
||||
});
|
||||
|
@ -24,5 +24,5 @@ fn bar<T: Send>(_: T) {}
|
||||
fn main() {
|
||||
let x = Foo::A(NoSend);
|
||||
bar(x);
|
||||
//~^ ERROR `core::marker::Send` is not implemented
|
||||
//~^ ERROR `std::marker::Send` is not implemented
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ fn bar<T: Send>(_: T) {}
|
||||
fn main() {
|
||||
let x = Rc::new(5);
|
||||
bar(x);
|
||||
//~^ ERROR `core::marker::Send` is not implemented
|
||||
//~^ ERROR `std::marker::Send` is not implemented
|
||||
}
|
||||
|
@ -23,5 +23,5 @@ fn bar<T: Send>(_: T) {}
|
||||
fn main() {
|
||||
let x = Foo { a: 5 };
|
||||
bar(x);
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ fn bar<T: Sync>(_: T) {}
|
||||
fn main() {
|
||||
let x = Foo::A(NoSync);
|
||||
bar(x);
|
||||
//~^ ERROR the trait `core::marker::Sync` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented
|
||||
}
|
||||
|
@ -20,5 +20,5 @@ fn bar<T: Sync>(_: T) {}
|
||||
fn main() {
|
||||
let x = Foo { a: 5 };
|
||||
bar(x);
|
||||
//~^ ERROR the trait `core::marker::Sync` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ fn main() {
|
||||
let x: isize = noexporttypelib::foo();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `isize`
|
||||
//~| found `core::option::Option<isize>`
|
||||
//~| found `std::option::Option<isize>`
|
||||
//~| expected isize
|
||||
//~| found enum `core::option::Option`
|
||||
//~| found enum `std::option::Option`
|
||||
}
|
||||
|
@ -16,14 +16,14 @@ fn test<T: Sync>() {}
|
||||
|
||||
fn main() {
|
||||
test::<Cell<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `core::cell::Cell<i32>`
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::cell::Cell<i32>`
|
||||
test::<RefCell<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `core::cell::RefCell<i32>`
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::cell::RefCell<i32>`
|
||||
|
||||
test::<Rc<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `alloc::rc::Rc<i32>`
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::rc::Rc<i32>`
|
||||
test::<Weak<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `alloc::rc::Weak<i32>`
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::rc::Weak<i32>`
|
||||
|
||||
test::<Receiver<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::Receiver<i32>`
|
||||
|
@ -33,9 +33,9 @@ pub fn main() {
|
||||
let x = vec!(1u8, 2, 3, 4);
|
||||
let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect()
|
||||
//~^ ERROR
|
||||
//~^^ NOTE a collection of type `core::option::Option<collections::vec::Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
|
||||
//~^^ NOTE a collection of type `std::option::Option<std::vec::Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
|
||||
//~^^^ NOTE required by `collect`
|
||||
let x: String = foobar(); //~ ERROR
|
||||
//~^ NOTE test error `collections::string::String` with `u8` `_` `u32`
|
||||
//~^ NOTE test error `std::string::String` with `u8` `_` `u32`
|
||||
//~^^ NOTE required by `foobar`
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ struct Nested<T>(T);
|
||||
fn is_zen<T: Zen>(_: T) {}
|
||||
|
||||
fn not_sync<T>(x: Guard<T>) {
|
||||
is_zen(x) //~ error: the trait `core::marker::Sync` is not implemented for the type `T`
|
||||
is_zen(x) //~ error: the trait `std::marker::Sync` is not implemented for the type `T`
|
||||
}
|
||||
|
||||
fn nested_not_sync<T>(x: Nested<Guard<T>>) {
|
||||
is_zen(x) //~ error: the trait `core::marker::Sync` is not implemented for the type `T`
|
||||
is_zen(x) //~ error: the trait `std::marker::Sync` is not implemented for the type `T`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -22,6 +22,6 @@ pub fn main() {
|
||||
// Unsized type.
|
||||
let arr: &[_] = &[1, 2, 3];
|
||||
let range = *arr..;
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented
|
||||
}
|
||||
|
@ -25,5 +25,5 @@ impl Drop for Foo {
|
||||
fn main() {
|
||||
let a = Foo { x: 3 };
|
||||
let _ = [ a; 5 ];
|
||||
//~^ ERROR the trait `core::marker::Copy` is not implemented for the type `Foo`
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented for the type `Foo`
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ struct Baz { q: Option<Foo> }
|
||||
|
||||
struct Foo { q: Option<Baz> }
|
||||
//~^ ERROR recursive type `Foo` has infinite size
|
||||
//~| type `Foo` is embedded within `core::option::Option<Foo>`...
|
||||
//~| ...which in turn is embedded within `core::option::Option<Foo>`...
|
||||
//~| type `Foo` is embedded within `std::option::Option<Foo>`...
|
||||
//~| ...which in turn is embedded within `std::option::Option<Foo>`...
|
||||
//~| ...which in turn is embedded within `Baz`...
|
||||
//~| ...which in turn is embedded within `core::option::Option<Baz>`...
|
||||
//~| ...which in turn is embedded within `std::option::Option<Baz>`...
|
||||
//~| ...which in turn is embedded within `Foo`, completing the cycle.
|
||||
|
||||
impl Foo { fn bar(&self) {} }
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
pub fn main() {
|
||||
let s: &str = "hello";
|
||||
let c: u8 = s[4]; //~ ERROR the trait `core::ops::Index<_>` is not implemented
|
||||
let c: u8 = s[4]; //~ ERROR the trait `std::ops::Index<_>` is not implemented
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ fn bot<T>() -> T { loop {} }
|
||||
|
||||
fn mutate(s: &mut str) {
|
||||
s[1..2] = bot();
|
||||
//~^ ERROR `core::marker::Sized` is not implemented for the type `str`
|
||||
//~| ERROR `core::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `str`
|
||||
//~| ERROR `std::marker::Sized` is not implemented for the type `str`
|
||||
s[1usize] = bot();
|
||||
//~^ ERROR `core::ops::Index<usize>` is not implemented for the type `str`
|
||||
//~| ERROR `core::ops::IndexMut<usize>` is not implemented for the type `str`
|
||||
//~^ ERROR `std::ops::Index<usize>` is not implemented for the type `str`
|
||||
//~| ERROR `std::ops::IndexMut<usize>` is not implemented for the type `str`
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user