Addressed points raised in review.
This commit is contained in:
parent
4310ba2c98
commit
a71d55701e
@ -1382,12 +1382,12 @@ impl<'a> LoweringContext<'a> {
|
||||
if existential_desugaring {
|
||||
// Desugar `AssocTy: Bounds` into `AssocTy = impl Bounds`.
|
||||
|
||||
let impl_ty_node_id = self.sess.next_node_id();
|
||||
let impl_trait_node_id = self.sess.next_node_id();
|
||||
let parent_def_index = self.current_hir_id_owner.last().unwrap().0;
|
||||
self.resolver.definitions().create_def_with_parent(
|
||||
parent_def_index,
|
||||
impl_ty_node_id,
|
||||
DefPathData::Misc,
|
||||
impl_trait_node_id,
|
||||
DefPathData::ImplTrait,
|
||||
DefIndexAddressSpace::High,
|
||||
Mark::root(),
|
||||
DUMMY_SP
|
||||
@ -1397,7 +1397,7 @@ impl<'a> LoweringContext<'a> {
|
||||
this.lower_ty(
|
||||
&Ty {
|
||||
id: this.sess.next_node_id(),
|
||||
node: TyKind::ImplTrait(impl_ty_node_id, bounds.clone()),
|
||||
node: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
|
||||
span: DUMMY_SP,
|
||||
},
|
||||
itctx,
|
||||
@ -1410,9 +1410,8 @@ impl<'a> LoweringContext<'a> {
|
||||
let bounds = self.lower_param_bounds(bounds, itctx);
|
||||
|
||||
let id = self.sess.next_node_id();
|
||||
let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id);
|
||||
P(hir::Ty {
|
||||
hir_id,
|
||||
hir_id: self.lower_node_id(id),
|
||||
node: hir::TyKind::AssocTyExistential(bounds),
|
||||
span: DUMMY_SP,
|
||||
})
|
||||
@ -1423,7 +1422,7 @@ impl<'a> LoweringContext<'a> {
|
||||
hir::TypeBinding {
|
||||
hir_id: self.lower_node_id(c.id),
|
||||
ident: c.ident,
|
||||
ty
|
||||
ty,
|
||||
span: c.span,
|
||||
}
|
||||
}
|
||||
@ -1647,7 +1646,7 @@ impl<'a> LoweringContext<'a> {
|
||||
// Not tracking it makes lints in rustc and clippy very fragile, as
|
||||
// frequently opened issues show.
|
||||
let exist_ty_span = self.mark_span_with_reason(
|
||||
CompilerDesugaringKind::ExistentialReturnType,
|
||||
CompilerDesugaringKind::ExistentialType,
|
||||
span,
|
||||
None,
|
||||
);
|
||||
|
@ -276,7 +276,7 @@ pub enum DefPathData {
|
||||
// they are treated specially by the `def_path` function.
|
||||
/// The crate root (marker)
|
||||
CrateRoot,
|
||||
// Catch-all for random DefId things like DUMMY_NODE_ID
|
||||
// Catch-all for random DefId things like `DUMMY_NODE_ID`
|
||||
Misc,
|
||||
// Different kinds of items and item-like things:
|
||||
/// An impl
|
||||
@ -298,9 +298,9 @@ pub enum DefPathData {
|
||||
AnonConst,
|
||||
/// An `impl Trait` type node
|
||||
ImplTrait,
|
||||
/// GlobalMetaData identifies a piece of crate metadata that is global to
|
||||
/// a whole crate (as opposed to just one item). GlobalMetaData components
|
||||
/// are only supposed to show up right below the crate root.
|
||||
/// Identifies a piece of crate metadata that is global to a whole crate
|
||||
/// (as opposed to just one item). `GlobalMetaData` components are only
|
||||
/// supposed to show up right below the crate root.
|
||||
GlobalMetaData(InternedString),
|
||||
}
|
||||
|
||||
|
@ -842,7 +842,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
/// Returns the nearest enclosing scope. A scope is roughly an item or block.
|
||||
pub fn get_enclosing_scope(&self, id: HirId) -> Option<HirId> {
|
||||
pub fn get_enclosing_scope(&self, hir_id: HirId) -> Option<HirId> {
|
||||
self.walk_parent_nodes(hir_id, |node| match *node {
|
||||
Node::Item(i) => {
|
||||
match i.node {
|
||||
@ -880,14 +880,14 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
/// Returns the defining scope for an existential type definition.
|
||||
pub fn get_defining_scope(&self, id: NodeId) -> Option<NodeId> {
|
||||
pub fn get_defining_scope(&self, id: HirId) -> Option<HirId> {
|
||||
let mut scope = id;
|
||||
loop {
|
||||
scope = self.get_enclosing_scope(scope)?;
|
||||
if scope == CRATE_NODE_ID {
|
||||
return Some(CRATE_NODE_ID);
|
||||
if scope == CRATE_HIR_ID {
|
||||
return Some(CRATE_HIR_ID);
|
||||
}
|
||||
match self.get(scope) {
|
||||
match self.get_by_hir_id(scope) {
|
||||
Node::Item(i) => {
|
||||
match i.node {
|
||||
ItemKind::Existential(ExistTy { impl_trait_fn: None, .. }) => {}
|
||||
|
@ -1780,7 +1780,7 @@ pub struct ImplItem {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
/// Represents different contents within `impl`s
|
||||
/// Represents different contents within `impl`s.
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||
pub enum ImplItemKind {
|
||||
/// An associated constant of the given type, set to the constant result
|
||||
@ -1794,7 +1794,7 @@ pub enum ImplItemKind {
|
||||
Existential(GenericBounds),
|
||||
}
|
||||
|
||||
// Bind a type to an associated type: `A=Foo`.
|
||||
// Bind a type to an associated type (`A = Foo`).
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||
pub struct TypeBinding {
|
||||
pub hir_id: HirId,
|
||||
|
@ -408,7 +408,7 @@ impl_stable_hash_for!(enum ::syntax_pos::hygiene::CompilerDesugaringKind {
|
||||
Async,
|
||||
Await,
|
||||
QuestionMark,
|
||||
ExistentialReturnType,
|
||||
ExistentialType,
|
||||
ForLoop,
|
||||
TryBlock
|
||||
});
|
||||
|
@ -953,14 +953,13 @@ pub fn may_define_existential_type(
|
||||
);
|
||||
|
||||
// Named existential types can be defined by any siblings or children of siblings.
|
||||
let scope_node_id = tcx.hir()
|
||||
.get_defining_scope(tcx.hir().hir_to_node_id(opaque_hir_id))
|
||||
let scope = tcx.hir()
|
||||
.get_defining_scope(opaque_hir_id)
|
||||
.expect("could not get defining scope");
|
||||
let scope_id = tcx.hir().node_to_hir_id(scope_node_id);
|
||||
// We walk up the node tree until we hit the root or the scope of the opaque type.
|
||||
while hir_id != scope_id && hir_id != hir::CRATE_HIR_ID {
|
||||
while hir_id != scope && hir_id != hir::CRATE_HIR_ID {
|
||||
hir_id = tcx.hir().get_parent_item(hir_id);
|
||||
}
|
||||
// Syntactically, we are allowed to define the concrete type if:
|
||||
hir_id == scope_id
|
||||
hir_id == scope
|
||||
}
|
||||
|
@ -716,23 +716,14 @@ impl<'a> ReplaceBodyWithLoop<'a> {
|
||||
ast::GenericArg::Type(ty) => Some(ty),
|
||||
_ => None,
|
||||
});
|
||||
let any_assoc_ty_bounds = data.constraints.iter().any(|c| {
|
||||
if let ast::AssocTyConstraintKind::Bound { .. } = c.kind {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
});
|
||||
any_assoc_ty_bounds ||
|
||||
any_involves_impl_trait(types.into_iter()) ||
|
||||
any_involves_impl_trait(data.constraints.iter().filter_map(|c| {
|
||||
if let ast::AssocTyConstraintKind::Equality { ref ty }
|
||||
= c.kind {
|
||||
Some(ty)
|
||||
} else {
|
||||
None
|
||||
data.constraints.iter().any(|c| {
|
||||
match c.kind {
|
||||
ast::AssocTyConstraintKind::Bound { .. } => true,
|
||||
ast::AssocTyConstraintKind::Equality { ref ty } =>
|
||||
involves_impl_trait(ty),
|
||||
}
|
||||
}))
|
||||
})
|
||||
},
|
||||
Some(&ast::GenericArgs::Parenthesized(ref data)) => {
|
||||
any_involves_impl_trait(data.inputs.iter()) ||
|
||||
|
@ -2533,7 +2533,7 @@ impl<'a> Resolver<'a> {
|
||||
self.with_current_self_item(item, |this| {
|
||||
this.with_generic_param_rib(HasGenericParams(generics, ItemRibKind), |this| {
|
||||
let item_def_id = this.definitions.local_def_id(item.id);
|
||||
this.with_self_rib(Def::SelfTy(Some(item_def_id), None), |this| {
|
||||
this.with_self_rib(Res::SelfTy(Some(item_def_id), None), |this| {
|
||||
visit::walk_item(this, item)
|
||||
})
|
||||
})
|
||||
|
@ -764,7 +764,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
||||
let mut dup_bindings = FxHashMap::default();
|
||||
for binding in &assoc_bindings {
|
||||
// Specify type to assert that error was already reported in `Err` case.
|
||||
let _ =
|
||||
let _: Result<_, ErrorReported> =
|
||||
self.add_predicates_for_ast_type_binding(
|
||||
trait_ref.hir_ref_id,
|
||||
poly_trait_ref,
|
||||
@ -933,8 +933,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
||||
}
|
||||
|
||||
/// Translates the AST's notion of ty param bounds (which are an enum consisting of a newtyped
|
||||
/// `Ty` or a region) to ty's notion of ty param bounds, which can either be user-defined traits
|
||||
/// or the built-in trait `Send`.
|
||||
/// `Ty` or a region) to ty's notion of ty param bounds (which can either be user-defined traits
|
||||
/// or the built-in trait `Sized`).
|
||||
pub fn compute_bounds(&self,
|
||||
param_ty: Ty<'tcx>,
|
||||
ast_bounds: &[hir::GenericBound],
|
||||
|
@ -1650,24 +1650,23 @@ fn find_existential_constraints<'a, 'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
let node_id = tcx.hir().as_local_node_id(def_id).unwrap();
|
||||
let scope_node_id = tcx.hir()
|
||||
.get_defining_scope(node_id)
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let scope = tcx.hir()
|
||||
.get_defining_scope(hir_id)
|
||||
.expect("could not get defining scope");
|
||||
let scope_id = tcx.hir().node_to_hir_id(scope_node_id);
|
||||
let mut locator = ConstraintLocator {
|
||||
def_id,
|
||||
tcx,
|
||||
found: None,
|
||||
};
|
||||
|
||||
debug!("find_existential_constraints: scope_id={:?}", scope_id);
|
||||
debug!("find_existential_constraints: scope={:?}", scope);
|
||||
|
||||
if scope_id == hir::CRATE_HIR_ID {
|
||||
if scope == hir::CRATE_HIR_ID {
|
||||
intravisit::walk_crate(&mut locator, tcx.hir().krate());
|
||||
} else {
|
||||
debug!("find_existential_constraints: scope={:?}", tcx.hir().get_by_hir_id(scope_id));
|
||||
match tcx.hir().get_by_hir_id(scope_id) {
|
||||
debug!("find_existential_constraints: scope={:?}", tcx.hir().get_by_hir_id(scope));
|
||||
match tcx.hir().get_by_hir_id(scope) {
|
||||
Node::Item(ref it) => intravisit::walk_item(&mut locator, it),
|
||||
Node::ImplItem(ref it) => intravisit::walk_impl_item(&mut locator, it),
|
||||
Node::TraitItem(ref it) => intravisit::walk_trait_item(&mut locator, it),
|
||||
|
@ -2445,7 +2445,7 @@ pub struct PolyTrait {
|
||||
|
||||
/// A representation of a type suitable for hyperlinking purposes. Ideally, one can get the original
|
||||
/// type out of the AST/`TyCtxt` given one of these, if more information is needed. Most
|
||||
/// importanntly, it does not preserve mutability or boxes.
|
||||
/// importantly, it does not preserve mutability or boxes.
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
|
||||
pub enum Type {
|
||||
/// Structs/enums/traits (most that would be an `hir::TyKind::Path`).
|
||||
|
@ -714,7 +714,7 @@ pub enum CompilerDesugaringKind {
|
||||
/// Desugaring of an `impl Trait` in return type position
|
||||
/// to an `existential type Foo: Trait;` and replacing the
|
||||
/// `impl Trait` with `Foo`.
|
||||
ExistentialReturnType,
|
||||
ExistentialType,
|
||||
Async,
|
||||
Await,
|
||||
ForLoop,
|
||||
@ -728,7 +728,7 @@ impl CompilerDesugaringKind {
|
||||
CompilerDesugaringKind::Await => "await",
|
||||
CompilerDesugaringKind::QuestionMark => "?",
|
||||
CompilerDesugaringKind::TryBlock => "try block",
|
||||
CompilerDesugaringKind::ExistentialReturnType => "existential type",
|
||||
CompilerDesugaringKind::ExistentialType => "existential type",
|
||||
CompilerDesugaringKind::ForLoop => "for loop",
|
||||
})
|
||||
}
|
||||
|
@ -6,4 +6,3 @@ LL | for<'a> <_2 as Iterator>::Item: for<'b> Lam<&'a &'b u8, App = _0>,
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0316`.
|
||||
|
@ -49,7 +49,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let _: i32 = f2(2i32);
|
||||
| ^^^^^^^^ expected i32, found u32
|
||||
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let _: i32 = f2(2i32).try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,5 +1,80 @@
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-closures-two-mut.rs:12:24
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:14:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 4);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
LL | let c2 = to_fn_mut(|| x = 5);
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:26:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut x));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
LL | let c2 = to_fn_mut(|| set(&mut x));
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
LL | let c2 = to_fn_mut(|| set(&mut x));
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:55:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
LL | let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:14:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 4);
|
||||
| -- - first borrow occurs due to use of `x` in closure
|
||||
@ -9,11 +84,12 @@ LL | let c2 = to_fn_mut(|| x = 5);
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL |
|
||||
LL | drop((c1, c2));
|
||||
| -- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-closures-two-mut.rs:23:24
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:26:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut x));
|
||||
| -- - first borrow occurs due to use of `x` in closure
|
||||
@ -23,11 +99,12 @@ LL | let c2 = to_fn_mut(|| set(&mut x));
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL |
|
||||
LL | drop((c1, c2));
|
||||
| -- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-closures-two-mut.rs:30:24
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - first borrow occurs due to use of `x` in closure
|
||||
@ -37,11 +114,12 @@ LL | let c2 = to_fn_mut(|| set(&mut x));
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL |
|
||||
LL | drop((c1, c2));
|
||||
| -- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-closures-two-mut.rs:37:24
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - first borrow occurs due to use of `x` in closure
|
||||
@ -51,12 +129,12 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL |
|
||||
...
|
||||
LL | drop((c1, c2));
|
||||
| -- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-closures-two-mut.rs:49:24
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:55:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
| -- - first borrow occurs due to use of `x` in closure
|
||||
@ -66,10 +144,10 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL |
|
||||
...
|
||||
LL | drop((c1, c2));
|
||||
| -- first borrow later used here
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
@ -1,5 +1,15 @@
|
||||
error[E0382]: use of moved value: `x`
|
||||
--> $DIR/borrowck-reinit.rs:6:16
|
||||
error[E0382]: use of moved value: `x` (Ast)
|
||||
--> $DIR/borrowck-reinit.rs:8:16
|
||||
|
|
||||
LL | drop(x);
|
||||
| - value moved here
|
||||
LL | let _ = (1,x);
|
||||
| ^ value used here after move
|
||||
|
|
||||
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `x` (Mir)
|
||||
--> $DIR/borrowck-reinit.rs:8:16
|
||||
|
|
||||
LL | let mut x = Box::new(0);
|
||||
| ----- move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
|
||||
@ -9,6 +19,6 @@ LL | drop(x);
|
||||
LL | let _ = (1,x);
|
||||
| ^ value used here after move
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
|
@ -1,9 +1,15 @@
|
||||
error[E0381]: use of possibly uninitialized variable: `x`
|
||||
--> $DIR/borrowck-storage-dead.rs:16:17
|
||||
error[E0381]: use of possibly uninitialized variable: `x` (Ast)
|
||||
--> $DIR/borrowck-storage-dead.rs:18:17
|
||||
|
|
||||
LL | let _ = x + 1;
|
||||
| ^ use of possibly uninitialized `x`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0381]: use of possibly uninitialized variable: `x` (Mir)
|
||||
--> $DIR/borrowck-storage-dead.rs:18:17
|
||||
|
|
||||
LL | let _ = x + 1;
|
||||
| ^ use of possibly uninitialized `x`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0381`.
|
||||
|
@ -1,11 +1,19 @@
|
||||
error[E0384]: cannot assign to immutable argument `_x`
|
||||
--> $DIR/immutable-arg.rs:2:5
|
||||
error[E0384]: cannot assign twice to immutable variable `_x` (Ast)
|
||||
--> $DIR/immutable-arg.rs:4:5
|
||||
|
|
||||
LL | fn foo(_x: u32) {
|
||||
| -- first assignment to `_x`
|
||||
LL | _x = 4;
|
||||
| ^^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign to immutable argument `_x` (Mir)
|
||||
--> $DIR/immutable-arg.rs:4:5
|
||||
|
|
||||
LL | fn foo(_x: u32) {
|
||||
| -- help: make this binding mutable: `mut _x`
|
||||
LL | _x = 4;
|
||||
| ^^^^^^ cannot assign to immutable argument
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0384`.
|
||||
|
@ -1,11 +1,29 @@
|
||||
error[E0382]: use of moved value
|
||||
--> $DIR/issue-41962.rs:5:21
|
||||
error[E0382]: use of partially moved value: `maybe` (Ast)
|
||||
--> $DIR/issue-41962.rs:7:30
|
||||
|
|
||||
LL | if let Some(thing) = maybe {
|
||||
| ----- ^^^^^ value used here after move
|
||||
| |
|
||||
| value moved here
|
||||
|
|
||||
= note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast)
|
||||
--> $DIR/issue-41962.rs:7:21
|
||||
|
|
||||
LL | if let Some(thing) = maybe {
|
||||
| ^^^^^ value moved here in previous iteration of loop
|
||||
|
|
||||
= note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value (Mir)
|
||||
--> $DIR/issue-41962.rs:7:21
|
||||
|
|
||||
LL | if let Some(thing) = maybe {
|
||||
| ^^^^^ value moved here, in previous iteration of loop
|
||||
|
|
||||
= note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
|
@ -4,17 +4,17 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: lifetime parameters must be declared prior to const parameters
|
||||
--> $DIR/const-param-before-other-params.rs:4:21
|
||||
|
|
||||
LL | fn bar<const X: (), 'a>(_: &'a ()) {
|
||||
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`
|
||||
|
||||
error: type parameters must be declared prior to const parameters
|
||||
--> $DIR/const-param-before-other-params.rs:8:21
|
||||
--> $DIR/const-param-before-other-params.rs:4:21
|
||||
|
|
||||
LL | fn foo<const X: (), T>(_: &T) {
|
||||
| --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>`
|
||||
|
||||
error: lifetime parameters must be declared prior to const parameters
|
||||
--> $DIR/const-param-before-other-params.rs:8:21
|
||||
|
|
||||
LL | fn bar<const X: (), 'a>(_: &'a ()) {
|
||||
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// #[deprecated] can't be used in staged api
|
||||
// #[deprecated] cannot be used in staged API
|
||||
|
||||
#![feature(staged_api)]
|
||||
|
||||
#![stable(feature = "stable_test_feature", since = "1.0.0")]
|
||||
|
||||
#[deprecated]
|
||||
fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api
|
||||
fn main() { } //~ ERROR `#[deprecated]` cannot be used in staged API
|
||||
|
@ -10,61 +10,62 @@ impl Tr1 for S1 { type As1 = S2; }
|
||||
|
||||
trait _Tr3 {
|
||||
type A: Iterator<Item: Copy>;
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
|
||||
type B: Iterator<Item: 'static>;
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
}
|
||||
|
||||
struct _St1<T: Tr1<As1: Tr2>> {
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
outest: T,
|
||||
outer: T::As1,
|
||||
inner: <T::As1 as Tr2>::As2,
|
||||
}
|
||||
|
||||
enum _En1<T: Tr1<As1: Tr2>> {
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
Outest(T),
|
||||
Outer(T::As1),
|
||||
Inner(<T::As1 as Tr2>::As2),
|
||||
}
|
||||
|
||||
union _Un1<T: Tr1<As1: Tr2>> {
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
outest: T,
|
||||
outer: T::As1,
|
||||
inner: <T::As1 as Tr2>::As2,
|
||||
}
|
||||
|
||||
type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
|
||||
fn _apit(_: impl Tr1<As1: Copy>) {}
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
|
||||
fn _rpit() -> impl Tr1<As1: Copy> { S1 }
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
|
||||
fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
|
||||
const _cdef: impl Tr1<As1: Copy> = S1;
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
|
||||
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
|
||||
// const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;
|
||||
|
||||
static _sdef: impl Tr1<As1: Copy> = S1;
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
|
||||
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
|
||||
// static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;
|
||||
|
||||
fn main() {
|
||||
let _: impl Tr1<As1: Copy> = S1;
|
||||
//~^ ERROR associated type bounds are unstable (see issue #52662) [E0658]
|
||||
//~^ ERROR associated type bounds are unstable
|
||||
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
|
||||
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
|
||||
// let _: &dyn Tr1<As1: Copy> = &S1;
|
||||
|
@ -1,109 +1,122 @@
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:12:22
|
||||
|
|
||||
LL | type A: Iterator<Item: Copy>;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:15:22
|
||||
|
|
||||
LL | type B: Iterator<Item: 'static>;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:19:20
|
||||
|
|
||||
LL | struct _St1<T: Tr1<As1: Tr2>> {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:26:18
|
||||
|
|
||||
LL | enum _En1<T: Tr1<As1: Tr2>> {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:33:19
|
||||
|
|
||||
LL | union _Un1<T: Tr1<As1: Tr2>> {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:40:37
|
||||
|
|
||||
LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:43:22
|
||||
|
|
||||
LL | fn _apit(_: impl Tr1<As1: Copy>) {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:45:26
|
||||
|
|
||||
LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:48:24
|
||||
|
|
||||
LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:50:31
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:51:31
|
||||
|
|
||||
LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:53:23
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:54:23
|
||||
|
|
||||
LL | const _cdef: impl Tr1<As1: Copy> = S1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:59:24
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:60:24
|
||||
|
|
||||
LL | static _sdef: impl Tr1<As1: Copy> = S1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable (see issue #52662)
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:66:21
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:67:21
|
||||
|
|
||||
LL | let _: impl Tr1<As1: Copy> = S1;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/52662
|
||||
= help: add #![feature(associated_type_bounds)] to the crate attributes to enable
|
||||
|
||||
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:53:14
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:54:14
|
||||
|
|
||||
LL | const _cdef: impl Tr1<As1: Copy> = S1;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -111,7 +124,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
|
||||
= help: add #![feature(impl_trait_in_bindings)] to the crate attributes to enable
|
||||
|
||||
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:59:15
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:60:15
|
||||
|
|
||||
LL | static _sdef: impl Tr1<As1: Copy> = S1;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -119,7 +132,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
|
||||
= help: add #![feature(impl_trait_in_bindings)] to the crate attributes to enable
|
||||
|
||||
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:66:12
|
||||
--> $DIR/feature-gate-associated_type_bounds.rs:67:12
|
||||
|
|
||||
LL | let _: impl Tr1<As1: Copy> = S1;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -128,5 +141,5 @@ LL | let _: impl Tr1<As1: Copy> = S1;
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
Some errors occurred: E0562, E0658.
|
||||
Some errors have detailed explanations: E0562, E0658.
|
||||
For more information about an error, try `rustc --explain E0562`.
|
||||
|
@ -1,21 +1,39 @@
|
||||
error[E0626]: borrow may still be in use when generator yields
|
||||
--> $DIR/yield-while-local-borrowed.rs:13:17
|
||||
error[E0626]: borrow may still be in use when generator yields (Ast)
|
||||
--> $DIR/yield-while-local-borrowed.rs:15:22
|
||||
|
|
||||
LL | let a = &mut 3;
|
||||
| ^^^^^^
|
||||
LL |
|
||||
| ^
|
||||
...
|
||||
LL | yield();
|
||||
| ------- possible yield occurs here
|
||||
|
||||
error[E0626]: borrow may still be in use when generator yields
|
||||
--> $DIR/yield-while-local-borrowed.rs:40:21
|
||||
error[E0626]: borrow may still be in use when generator yields (Ast)
|
||||
--> $DIR/yield-while-local-borrowed.rs:43:22
|
||||
|
|
||||
LL | let b = &a;
|
||||
| ^^
|
||||
LL |
|
||||
| ^
|
||||
...
|
||||
LL | yield();
|
||||
| ------- possible yield occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0626]: borrow may still be in use when generator yields (Mir)
|
||||
--> $DIR/yield-while-local-borrowed.rs:15:17
|
||||
|
|
||||
LL | let a = &mut 3;
|
||||
| ^^^^^^
|
||||
...
|
||||
LL | yield();
|
||||
| ------- possible yield occurs here
|
||||
|
||||
error[E0626]: borrow may still be in use when generator yields (Mir)
|
||||
--> $DIR/yield-while-local-borrowed.rs:43:21
|
||||
|
|
||||
LL | let b = &a;
|
||||
| ^^
|
||||
...
|
||||
LL | yield();
|
||||
| ------- possible yield occurs here
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0626`.
|
||||
|
@ -12,7 +12,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | bar::<isize>(i); // i should not be re-coerced back to an isize
|
||||
| ^ expected isize, found usize
|
||||
help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i8(a16);
|
||||
| ^^^ expected i8, found i16
|
||||
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i8(a16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i8(a32);
|
||||
| ^^^ expected i8, found i32
|
||||
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i8(a32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -23,7 +23,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i8(a64);
|
||||
| ^^^ expected i8, found i64
|
||||
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i8(a64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -42,7 +42,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i16(a32);
|
||||
| ^^^ expected i16, found i32
|
||||
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i16(a32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -52,7 +52,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i16(a64);
|
||||
| ^^^ expected i16, found i64
|
||||
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i16(a64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -80,7 +80,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i32(a64);
|
||||
| ^^^ expected i32, found i64
|
||||
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i32(a64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -117,7 +117,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i8(c16);
|
||||
| ^^^ expected i8, found i16
|
||||
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i8(c16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -127,7 +127,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i8(c32);
|
||||
| ^^^ expected i8, found i32
|
||||
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i8(c32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -137,7 +137,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i8(c64);
|
||||
| ^^^ expected i8, found i64
|
||||
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i8(c64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -156,7 +156,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i16(c32);
|
||||
| ^^^ expected i16, found i32
|
||||
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i16(c32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -166,7 +166,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i16(c64);
|
||||
| ^^^ expected i16, found i64
|
||||
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i16(c64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -194,7 +194,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_i32(c64);
|
||||
| ^^^ expected i32, found i64
|
||||
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_i32(c64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -231,7 +231,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_u8(b16);
|
||||
| ^^^ expected u8, found u16
|
||||
help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_u8(b16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -241,7 +241,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_u8(b32);
|
||||
| ^^^ expected u8, found u32
|
||||
help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_u8(b32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -251,7 +251,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_u8(b64);
|
||||
| ^^^ expected u8, found u64
|
||||
help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_u8(b64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -270,7 +270,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_u16(b32);
|
||||
| ^^^ expected u16, found u32
|
||||
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_u16(b32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -280,7 +280,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_u16(b64);
|
||||
| ^^^ expected u16, found u64
|
||||
help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_u16(b64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -308,7 +308,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | id_u32(b64);
|
||||
| ^^^ expected u32, found u64
|
||||
help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | id_u32(b64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo(1*(1 as isize));
|
||||
| ^^^^^^^^^^^^^^ expected i16, found isize
|
||||
help: you can convert an `isize` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo((1*(1 as isize)).try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | bar(1*(1 as usize));
|
||||
| ^^^^^^^^^^^^^^ expected u32, found usize
|
||||
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | bar((1*(1 as usize)).try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | X = Trait::Number,
|
||||
| ^^^^^^^^^^^^^ expected isize, found i32
|
||||
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | X = Trait::Number.try_into().unwrap(),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,4 +1,12 @@
|
||||
error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast)
|
||||
--> $DIR/issue-45697-1.rs:20:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
| - borrow of `*y.pointer` occurs here
|
||||
LL | *y.pointer += 1;
|
||||
| ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
|
||||
|
||||
error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir)
|
||||
--> $DIR/issue-45697-1.rs:20:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
@ -9,7 +17,7 @@ LL | *y.pointer += 1;
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
|
||||
--> $DIR/issue-45697-1.rs:20:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
@ -20,7 +28,7 @@ LL | *y.pointer += 1;
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0503, E0506.
|
||||
For more information about an error, try `rustc --explain E0503`.
|
||||
|
@ -1,4 +1,12 @@
|
||||
error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast)
|
||||
--> $DIR/issue-45697.rs:20:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
| - borrow of `*y.pointer` occurs here
|
||||
LL | *y.pointer += 1;
|
||||
| ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
|
||||
|
||||
error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir)
|
||||
--> $DIR/issue-45697.rs:20:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
@ -9,7 +17,7 @@ LL | *y.pointer += 1;
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
|
||||
--> $DIR/issue-45697.rs:20:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
@ -20,7 +28,7 @@ LL | *y.pointer += 1;
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0503, E0506.
|
||||
For more information about an error, try `rustc --explain E0503`.
|
||||
|
@ -1,5 +1,16 @@
|
||||
error[E0597]: `z` does not live long enough
|
||||
--> $DIR/issue-46471-1.rs:4:9
|
||||
error[E0597]: `z` does not live long enough (Ast)
|
||||
--> $DIR/issue-46471-1.rs:6:14
|
||||
|
|
||||
LL | &mut z
|
||||
| ^ borrowed value does not live long enough
|
||||
LL | };
|
||||
| - `z` dropped here while still borrowed
|
||||
...
|
||||
LL | }
|
||||
| - borrowed value needs to live until here
|
||||
|
||||
error[E0597]: `z` does not live long enough (Mir)
|
||||
--> $DIR/issue-46471-1.rs:6:9
|
||||
|
|
||||
LL | &mut z
|
||||
| ^^^^^^
|
||||
@ -9,6 +20,6 @@ LL | &mut z
|
||||
LL | };
|
||||
| - `z` dropped here while still borrowed
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
||||
|
@ -1,9 +1,21 @@
|
||||
error[E0515]: cannot return reference to local variable `x`
|
||||
--> $DIR/issue-46471.rs:3:5
|
||||
error[E0597]: `x` does not live long enough (Ast)
|
||||
--> $DIR/issue-46471.rs:5:6
|
||||
|
|
||||
LL | &x
|
||||
| ^ borrowed value does not live long enough
|
||||
...
|
||||
LL | }
|
||||
| - borrowed value only lives until here
|
||||
|
|
||||
= note: borrowed value must be valid for the static lifetime...
|
||||
|
||||
error[E0515]: cannot return reference to local variable `x` (Mir)
|
||||
--> $DIR/issue-46471.rs:5:5
|
||||
|
|
||||
LL | &x
|
||||
| ^^ returns a reference to data owned by the current function
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0515`.
|
||||
Some errors have detailed explanations: E0515, E0597.
|
||||
For more information about an error, try `rustc --explain E0515`.
|
||||
|
@ -1,5 +1,20 @@
|
||||
error[E0515]: cannot return reference to temporary value
|
||||
--> $DIR/issue-46472.rs:2:5
|
||||
error[E0597]: borrowed value does not live long enough (Ast)
|
||||
--> $DIR/issue-46472.rs:4:10
|
||||
|
|
||||
LL | &mut 4
|
||||
| ^ temporary value does not live long enough
|
||||
...
|
||||
LL | }
|
||||
| - temporary value only lives until here
|
||||
|
|
||||
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 3:8...
|
||||
--> $DIR/issue-46472.rs:3:8
|
||||
|
|
||||
LL | fn bar<'a>() -> &'a mut u32 {
|
||||
| ^^
|
||||
|
||||
error[E0515]: cannot return reference to temporary value (Mir)
|
||||
--> $DIR/issue-46472.rs:4:5
|
||||
|
|
||||
LL | &mut 4
|
||||
| ^^^^^-
|
||||
@ -7,6 +22,7 @@ LL | &mut 4
|
||||
| | temporary value created here
|
||||
| returns a reference to data owned by the current function
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0515`.
|
||||
Some errors have detailed explanations: E0515, E0597.
|
||||
For more information about an error, try `rustc --explain E0515`.
|
||||
|
@ -1,5 +1,36 @@
|
||||
error[E0384]: cannot assign twice to immutable variable `x`
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:10:9
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Ast)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:13:9
|
||||
|
|
||||
LL | x = 2;
|
||||
| ----- first assignment to `x`
|
||||
LL | x = 3;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Ast)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:25:13
|
||||
|
|
||||
LL | x = 2;
|
||||
| ----- first assignment to `x`
|
||||
LL | x = 3;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Ast)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:35:13
|
||||
|
|
||||
LL | x = 1;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Ast)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:38:13
|
||||
|
|
||||
LL | x = 1;
|
||||
| ----- first assignment to `x`
|
||||
...
|
||||
LL | x = 2;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:13:9
|
||||
|
|
||||
LL | let x;
|
||||
| - help: make this binding mutable: `mut x`
|
||||
@ -9,8 +40,8 @@ LL | x = 2;
|
||||
LL | x = 3;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x`
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:21:13
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:25:13
|
||||
|
|
||||
LL | let x;
|
||||
| - help: make this binding mutable: `mut x`
|
||||
@ -20,8 +51,8 @@ LL | x = 2;
|
||||
LL | x = 3;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x`
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:30:13
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:35:13
|
||||
|
|
||||
LL | let x;
|
||||
| - help: make this binding mutable: `mut x`
|
||||
@ -29,18 +60,18 @@ LL | let x;
|
||||
LL | x = 1;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x`
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:32:13
|
||||
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:38:13
|
||||
|
|
||||
LL | let x;
|
||||
| - help: make this binding mutable: `mut x`
|
||||
...
|
||||
LL | x = 1;
|
||||
| ----- first assignment to `x`
|
||||
LL | } else {
|
||||
...
|
||||
LL | x = 2;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0384`.
|
||||
|
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let y: usize = x.foo();
|
||||
| ^^^^^^^ expected usize, found isize
|
||||
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let y: usize = x.foo().try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -6,7 +6,7 @@ LL | $arr.len() * size_of($arr[0]));
|
||||
...
|
||||
LL | write!(hello);
|
||||
| -------------- in this macro invocation
|
||||
help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,5 +1,15 @@
|
||||
error[E0382]: use of moved value: `x`
|
||||
--> $DIR/moves-based-on-type-tuple.rs:4:13
|
||||
error[E0382]: use of moved value: `x` (Ast)
|
||||
--> $DIR/moves-based-on-type-tuple.rs:6:13
|
||||
|
|
||||
LL | box (x, x)
|
||||
| - ^ value used here after move
|
||||
| |
|
||||
| value moved here
|
||||
|
|
||||
= note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
|
||||
|
||||
error[E0382]: use of moved value: `x` (Mir)
|
||||
--> $DIR/moves-based-on-type-tuple.rs:6:13
|
||||
|
|
||||
LL | fn dup(x: Box<isize>) -> Box<(Box<isize>,Box<isize>)> {
|
||||
| - move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
|
||||
@ -8,6 +18,6 @@ LL | box (x, x)
|
||||
| |
|
||||
| value moved here
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
|
@ -1,5 +1,41 @@
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/get_default.rs:21:17
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
|
||||
--> $DIR/get_default.rs:23:17
|
||||
|
|
||||
LL | match map.get() {
|
||||
| --- immutable borrow occurs here
|
||||
...
|
||||
LL | map.set(String::new()); // Ideally, this would not error.
|
||||
| ^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - immutable borrow ends here
|
||||
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
|
||||
--> $DIR/get_default.rs:35:17
|
||||
|
|
||||
LL | match map.get() {
|
||||
| --- immutable borrow occurs here
|
||||
LL | Some(v) => {
|
||||
LL | map.set(String::new()); // Both AST and MIR error here
|
||||
| ^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - immutable borrow ends here
|
||||
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
|
||||
--> $DIR/get_default.rs:41:17
|
||||
|
|
||||
LL | match map.get() {
|
||||
| --- immutable borrow occurs here
|
||||
...
|
||||
LL | map.set(String::new()); // Ideally, just AST would error here
|
||||
| ^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - immutable borrow ends here
|
||||
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
|
||||
--> $DIR/get_default.rs:23:17
|
||||
|
|
||||
LL | fn ok(map: &mut Map) -> &String {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
@ -11,10 +47,10 @@ LL | return v;
|
||||
| - returning this value requires that `*map` is borrowed for `'1`
|
||||
...
|
||||
LL | map.set(String::new()); // Ideally, this would not error.
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
| ^^^ mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/get_default.rs:32:17
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
|
||||
--> $DIR/get_default.rs:35:17
|
||||
|
|
||||
LL | fn err(map: &mut Map) -> &String {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
@ -23,13 +59,13 @@ LL | match map.get() {
|
||||
| --- immutable borrow occurs here
|
||||
LL | Some(v) => {
|
||||
LL | map.set(String::new()); // Both AST and MIR error here
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
LL |
|
||||
| ^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | return v;
|
||||
| - returning this value requires that `*map` is borrowed for `'1`
|
||||
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/get_default.rs:37:17
|
||||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
|
||||
--> $DIR/get_default.rs:41:17
|
||||
|
|
||||
LL | fn err(map: &mut Map) -> &String {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
@ -41,8 +77,8 @@ LL | return v;
|
||||
| - returning this value requires that `*map` is borrowed for `'1`
|
||||
...
|
||||
LL | map.set(String::new()); // Ideally, just AST would error here
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
| ^^^ mutable borrow occurs here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
@ -1,5 +1,59 @@
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:12:5
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:14:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ------ borrow of `data.0` occurs here
|
||||
LL | capitalize(c);
|
||||
LL | data.0 = 'e';
|
||||
| ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:17:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ------ borrow of `data.0` occurs here
|
||||
...
|
||||
LL | data.0 = 'f';
|
||||
| ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:19:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ------ borrow of `data.0` occurs here
|
||||
...
|
||||
LL | data.0 = 'g';
|
||||
| ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:28:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ------ borrow of `data.0` occurs here
|
||||
LL | capitalize(c);
|
||||
LL | data.0 = 'e';
|
||||
| ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:30:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ------ borrow of `data.0` occurs here
|
||||
...
|
||||
LL | data.0 = 'f';
|
||||
| ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:32:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ------ borrow of `data.0` occurs here
|
||||
...
|
||||
LL | data.0 = 'g';
|
||||
| ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `data.0` because it is borrowed (Mir)
|
||||
--> $DIR/loan_ends_mid_block_pair.rs:14:5
|
||||
|
|
||||
LL | let c = &mut data.0;
|
||||
| ----------- borrow of `data.0` occurs here
|
||||
@ -10,6 +64,6 @@ LL | data.0 = 'e';
|
||||
LL | capitalize(c);
|
||||
| - borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0506`.
|
||||
|
@ -1,5 +1,77 @@
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:11:5
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:13:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| ---- first mutable borrow occurs here
|
||||
LL | capitalize(slice);
|
||||
LL | data.push('d');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:16:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| ---- first mutable borrow occurs here
|
||||
...
|
||||
LL | data.push('e');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:19:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| ---- first mutable borrow occurs here
|
||||
...
|
||||
LL | data.push('f');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:29:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| ---- first mutable borrow occurs here
|
||||
LL | capitalize(slice);
|
||||
LL | data.push('d');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:31:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| ---- first mutable borrow occurs here
|
||||
...
|
||||
LL | data.push('e');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:33:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| ---- first mutable borrow occurs here
|
||||
...
|
||||
LL | data.push('f');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
LL |
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:13:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| --------- first mutable borrow occurs here
|
||||
@ -10,8 +82,8 @@ LL | data.push('d');
|
||||
LL | capitalize(slice);
|
||||
| ----- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:13:5
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:16:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| --------- first mutable borrow occurs here
|
||||
@ -22,18 +94,18 @@ LL | data.push('e');
|
||||
LL | capitalize(slice);
|
||||
| ----- first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:15:5
|
||||
error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir)
|
||||
--> $DIR/loan_ends_mid_block_vec.rs:19:5
|
||||
|
|
||||
LL | let slice = &mut data;
|
||||
| --------- first mutable borrow occurs here
|
||||
...
|
||||
LL | data.push('f');
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
LL |
|
||||
...
|
||||
LL | capitalize(slice);
|
||||
| ----- first borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
@ -1,15 +1,39 @@
|
||||
error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/region-ends-after-if-condition.rs:26:9
|
||||
error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast)
|
||||
--> $DIR/region-ends-after-if-condition.rs:19:9
|
||||
|
|
||||
LL | let value = &my_struct.field;
|
||||
| --------------- immutable borrow occurs here
|
||||
LL | if value.is_empty() {
|
||||
LL | my_struct.field.push_str("Hello, world!");
|
||||
| ^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - immutable borrow ends here
|
||||
|
||||
error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast)
|
||||
--> $DIR/region-ends-after-if-condition.rs:29:9
|
||||
|
|
||||
LL | let value = &my_struct.field;
|
||||
| --------------- immutable borrow occurs here
|
||||
LL | if value.is_empty() {
|
||||
LL | my_struct.field.push_str("Hello, world!");
|
||||
| ^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - immutable borrow ends here
|
||||
|
||||
error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir)
|
||||
--> $DIR/region-ends-after-if-condition.rs:29:9
|
||||
|
|
||||
LL | let value = &my_struct.field;
|
||||
| ---------------- immutable borrow occurs here
|
||||
LL | if value.is_empty() {
|
||||
LL | my_struct.field.push_str("Hello, world!");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
| ^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | drop(value);
|
||||
| ----- immutable borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
@ -1,15 +1,39 @@
|
||||
error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time
|
||||
--> $DIR/return_from_loop.rs:20:9
|
||||
error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Ast)
|
||||
--> $DIR/return_from_loop.rs:22:9
|
||||
|
|
||||
LL | let value = &mut my_struct.field;
|
||||
| --------------- first mutable borrow occurs here
|
||||
LL | loop {
|
||||
LL | my_struct.field.push_str("Hello, world!");
|
||||
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Ast)
|
||||
--> $DIR/return_from_loop.rs:35:9
|
||||
|
|
||||
LL | let value = &mut my_struct.field;
|
||||
| --------------- first mutable borrow occurs here
|
||||
LL | loop {
|
||||
LL | my_struct.field.push_str("Hello, world!");
|
||||
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Mir)
|
||||
--> $DIR/return_from_loop.rs:22:9
|
||||
|
|
||||
LL | let value = &mut my_struct.field;
|
||||
| -------------------- first mutable borrow occurs here
|
||||
LL | loop {
|
||||
LL | my_struct.field.push_str("Hello, world!");
|
||||
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
LL |
|
||||
...
|
||||
LL | value.len();
|
||||
| ----- first borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
@ -37,7 +37,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let d: i8 = c;
|
||||
| ^ expected i8, found i32
|
||||
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let d: i8 = c.try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | test(array.len());
|
||||
| ^^^^^^^^^^^ expected u32, found usize
|
||||
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | test(array.len().try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let x: u16 = foo();
|
||||
| ^^^^^ expected u16, found i32
|
||||
help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let x: u16 = foo().try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let y: i64 = x + x;
|
||||
| ^^^^^ expected i64, found u16
|
||||
help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let y: i64 = (x + x).try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -23,7 +23,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let z: i32 = x + x;
|
||||
| ^^^^^ expected i32, found u16
|
||||
help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let z: i32 = (x + x).try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_u64);
|
||||
| ^^^^^ expected usize, found u64
|
||||
help: you can convert an `u64` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_u32);
|
||||
| ^^^^^ expected usize, found u32
|
||||
help: you can convert an `u32` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -23,7 +23,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_u16);
|
||||
| ^^^^^ expected usize, found u16
|
||||
help: you can convert an `u16` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_u8);
|
||||
| ^^^^ expected usize, found u8
|
||||
help: you can convert an `u8` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u8` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_u8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -43,7 +43,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_isize);
|
||||
| ^^^^^^^ expected usize, found isize
|
||||
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -53,7 +53,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_i64);
|
||||
| ^^^^^ expected usize, found i64
|
||||
help: you can convert an `i64` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -63,7 +63,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_i32);
|
||||
| ^^^^^ expected usize, found i32
|
||||
help: you can convert an `i32` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_i16);
|
||||
| ^^^^^ expected usize, found i16
|
||||
help: you can convert an `i16` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -83,7 +83,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<usize>(x_i8);
|
||||
| ^^^^ expected usize, found i8
|
||||
help: you can convert an `i8` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i8` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<usize>(x_i8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -93,7 +93,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_usize);
|
||||
| ^^^^^^^ expected isize, found usize
|
||||
help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -103,7 +103,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_u64);
|
||||
| ^^^^^ expected isize, found u64
|
||||
help: you can convert an `u64` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -113,7 +113,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_u32);
|
||||
| ^^^^^ expected isize, found u32
|
||||
help: you can convert an `u32` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -123,7 +123,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_u16);
|
||||
| ^^^^^ expected isize, found u16
|
||||
help: you can convert an `u16` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -133,7 +133,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_u8);
|
||||
| ^^^^ expected isize, found u8
|
||||
help: you can convert an `u8` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u8` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_u8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -143,7 +143,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_i64);
|
||||
| ^^^^^ expected isize, found i64
|
||||
help: you can convert an `i64` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -153,7 +153,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_i32);
|
||||
| ^^^^^ expected isize, found i32
|
||||
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -163,7 +163,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_i16);
|
||||
| ^^^^^ expected isize, found i16
|
||||
help: you can convert an `i16` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -173,7 +173,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<isize>(x_i8);
|
||||
| ^^^^ expected isize, found i8
|
||||
help: you can convert an `i8` to `isize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i8` to `isize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<isize>(x_i8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -183,7 +183,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u64>(x_usize);
|
||||
| ^^^^^^^ expected u64, found usize
|
||||
help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u64>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -220,7 +220,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u64>(x_isize);
|
||||
| ^^^^^^^ expected u64, found isize
|
||||
help: you can convert an `isize` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u64>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -230,7 +230,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u64>(x_i64);
|
||||
| ^^^^^ expected u64, found i64
|
||||
help: you can convert an `i64` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u64>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -240,7 +240,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u64>(x_i32);
|
||||
| ^^^^^ expected u64, found i32
|
||||
help: you can convert an `i32` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u64>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -250,7 +250,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u64>(x_i16);
|
||||
| ^^^^^ expected u64, found i16
|
||||
help: you can convert an `i16` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u64>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -260,7 +260,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u64>(x_i8);
|
||||
| ^^^^ expected u64, found i8
|
||||
help: you can convert an `i8` to `u64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i8` to `u64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u64>(x_i8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -270,7 +270,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i64>(x_usize);
|
||||
| ^^^^^^^ expected i64, found usize
|
||||
help: you can convert an `usize` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i64>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -280,7 +280,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i64>(x_u64);
|
||||
| ^^^^^ expected i64, found u64
|
||||
help: you can convert an `u64` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i64>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -290,7 +290,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i64>(x_u32);
|
||||
| ^^^^^ expected i64, found u32
|
||||
help: you can convert an `u32` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i64>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -300,7 +300,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i64>(x_u16);
|
||||
| ^^^^^ expected i64, found u16
|
||||
help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i64>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -310,7 +310,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i64>(x_u8);
|
||||
| ^^^^ expected i64, found u8
|
||||
help: you can convert an `u8` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u8` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i64>(x_u8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -320,7 +320,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i64>(x_isize);
|
||||
| ^^^^^^^ expected i64, found isize
|
||||
help: you can convert an `isize` to `i64` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `i64` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i64>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -357,7 +357,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_usize);
|
||||
| ^^^^^^^ expected u32, found usize
|
||||
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -367,7 +367,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_u64);
|
||||
| ^^^^^ expected u32, found u64
|
||||
help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -395,7 +395,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_isize);
|
||||
| ^^^^^^^ expected u32, found isize
|
||||
help: you can convert an `isize` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -405,7 +405,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_i64);
|
||||
| ^^^^^ expected u32, found i64
|
||||
help: you can convert an `i64` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -415,7 +415,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_i32);
|
||||
| ^^^^^ expected u32, found i32
|
||||
help: you can convert an `i32` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -425,7 +425,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_i16);
|
||||
| ^^^^^ expected u32, found i16
|
||||
help: you can convert an `i16` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -435,7 +435,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u32>(x_i8);
|
||||
| ^^^^ expected u32, found i8
|
||||
help: you can convert an `i8` to `u32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i8` to `u32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u32>(x_i8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -445,7 +445,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_usize);
|
||||
| ^^^^^^^ expected i32, found usize
|
||||
help: you can convert an `usize` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -455,7 +455,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_u64);
|
||||
| ^^^^^ expected i32, found u64
|
||||
help: you can convert an `u64` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -465,7 +465,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_u32);
|
||||
| ^^^^^ expected i32, found u32
|
||||
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -475,7 +475,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_u16);
|
||||
| ^^^^^ expected i32, found u16
|
||||
help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -485,7 +485,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_u8);
|
||||
| ^^^^ expected i32, found u8
|
||||
help: you can convert an `u8` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u8` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_u8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -495,7 +495,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_isize);
|
||||
| ^^^^^^^ expected i32, found isize
|
||||
help: you can convert an `isize` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -505,7 +505,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i32>(x_i64);
|
||||
| ^^^^^ expected i32, found i64
|
||||
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i32>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -533,7 +533,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_usize);
|
||||
| ^^^^^^^ expected u16, found usize
|
||||
help: you can convert an `usize` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -543,7 +543,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_u64);
|
||||
| ^^^^^ expected u16, found u64
|
||||
help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -553,7 +553,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_u32);
|
||||
| ^^^^^ expected u16, found u32
|
||||
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -572,7 +572,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_isize);
|
||||
| ^^^^^^^ expected u16, found isize
|
||||
help: you can convert an `isize` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -582,7 +582,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_i64);
|
||||
| ^^^^^ expected u16, found i64
|
||||
help: you can convert an `i64` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -592,7 +592,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_i32);
|
||||
| ^^^^^ expected u16, found i32
|
||||
help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -602,7 +602,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_i16);
|
||||
| ^^^^^ expected u16, found i16
|
||||
help: you can convert an `i16` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -612,7 +612,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u16>(x_i8);
|
||||
| ^^^^ expected u16, found i8
|
||||
help: you can convert an `i8` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i8` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u16>(x_i8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -622,7 +622,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_usize);
|
||||
| ^^^^^^^ expected i16, found usize
|
||||
help: you can convert an `usize` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -632,7 +632,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_u64);
|
||||
| ^^^^^ expected i16, found u64
|
||||
help: you can convert an `u64` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -642,7 +642,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_u32);
|
||||
| ^^^^^ expected i16, found u32
|
||||
help: you can convert an `u32` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -652,7 +652,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_u16);
|
||||
| ^^^^^ expected i16, found u16
|
||||
help: you can convert an `u16` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -662,7 +662,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_u8);
|
||||
| ^^^^ expected i16, found u8
|
||||
help: you can convert an `u8` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u8` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_u8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -672,7 +672,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_isize);
|
||||
| ^^^^^^^ expected i16, found isize
|
||||
help: you can convert an `isize` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -682,7 +682,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_i64);
|
||||
| ^^^^^ expected i16, found i64
|
||||
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -692,7 +692,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i16>(x_i32);
|
||||
| ^^^^^ expected i16, found i32
|
||||
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i16>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -711,7 +711,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_usize);
|
||||
| ^^^^^^^ expected u8, found usize
|
||||
help: you can convert an `usize` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -721,7 +721,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_u64);
|
||||
| ^^^^^ expected u8, found u64
|
||||
help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -731,7 +731,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_u32);
|
||||
| ^^^^^ expected u8, found u32
|
||||
help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -741,7 +741,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_u16);
|
||||
| ^^^^^ expected u8, found u16
|
||||
help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -751,7 +751,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_isize);
|
||||
| ^^^^^^^ expected u8, found isize
|
||||
help: you can convert an `isize` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -761,7 +761,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_i64);
|
||||
| ^^^^^ expected u8, found i64
|
||||
help: you can convert an `i64` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -771,7 +771,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_i32);
|
||||
| ^^^^^ expected u8, found i32
|
||||
help: you can convert an `i32` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -781,7 +781,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_i16);
|
||||
| ^^^^^ expected u8, found i16
|
||||
help: you can convert an `i16` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -791,7 +791,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<u8>(x_i8);
|
||||
| ^^^^ expected u8, found i8
|
||||
help: you can convert an `i8` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i8` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<u8>(x_i8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -801,7 +801,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_usize);
|
||||
| ^^^^^^^ expected i8, found usize
|
||||
help: you can convert an `usize` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `usize` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_usize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -811,7 +811,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_u64);
|
||||
| ^^^^^ expected i8, found u64
|
||||
help: you can convert an `u64` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u64` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_u64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -821,7 +821,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_u32);
|
||||
| ^^^^^ expected i8, found u32
|
||||
help: you can convert an `u32` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u32` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_u32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -831,7 +831,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_u16);
|
||||
| ^^^^^ expected i8, found u16
|
||||
help: you can convert an `u16` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u16` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_u16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -841,7 +841,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_u8);
|
||||
| ^^^^ expected i8, found u8
|
||||
help: you can convert an `u8` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `u8` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_u8.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -851,7 +851,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_isize);
|
||||
| ^^^^^^^ expected i8, found isize
|
||||
help: you can convert an `isize` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_isize.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -861,7 +861,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_i64);
|
||||
| ^^^^^ expected i8, found i64
|
||||
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_i64.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -871,7 +871,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_i32);
|
||||
| ^^^^^ expected i8, found i32
|
||||
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_i32.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -881,7 +881,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | foo::<i8>(x_i16);
|
||||
| ^^^^^ expected i8, found i16
|
||||
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i16` to `i8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | foo::<i8>(x_i16.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -21,18 +21,7 @@ LL | pub (b) fn bfn() {}
|
||||
`pub(in path::to::module)`: visible only on the specified path
|
||||
|
||||
error[E0704]: incorrect visibility restriction
|
||||
--> $DIR/pub-restricted.rs:7:6
|
||||
|
|
||||
LL | pub (crate::a) fn cfn() {}
|
||||
| ^^^^^^^^ help: make this visible only to module `crate::a` with `in`: `in crate::a`
|
||||
|
|
||||
= help: some possible visibility restrictions are:
|
||||
`pub(crate)`: visible only on the current crate
|
||||
`pub(super)`: visible only in the current module's parent
|
||||
`pub(in path::to::module)`: visible only on the specified path
|
||||
|
||||
error[E0704]: incorrect visibility restriction
|
||||
--> $DIR/pub-restricted.rs:24:14
|
||||
--> $DIR/pub-restricted.rs:22:14
|
||||
|
|
||||
LL | pub (a) invalid: usize,
|
||||
| ^ help: make this visible only to module `a` with `in`: `in a`
|
||||
@ -43,7 +32,7 @@ LL | pub (a) invalid: usize,
|
||||
`pub(in path::to::module)`: visible only on the specified path
|
||||
|
||||
error[E0704]: incorrect visibility restriction
|
||||
--> $DIR/pub-restricted.rs:33:6
|
||||
--> $DIR/pub-restricted.rs:31:6
|
||||
|
|
||||
LL | pub (xyz) fn xyz() {}
|
||||
| ^^^ help: make this visible only to module `xyz` with `in`: `in xyz`
|
||||
@ -54,11 +43,11 @@ LL | pub (xyz) fn xyz() {}
|
||||
`pub(in path::to::module)`: visible only on the specified path
|
||||
|
||||
error: visibilities can only be restricted to ancestor modules
|
||||
--> $DIR/pub-restricted.rs:25:17
|
||||
--> $DIR/pub-restricted.rs:23:17
|
||||
|
|
||||
LL | pub (in x) non_parent_invalid: usize,
|
||||
| ^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0704`.
|
||||
|
@ -42,7 +42,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let f = [0; -4_isize];
|
||||
| ^^^^^^^^ expected usize, found isize
|
||||
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let f = [0; (-4_isize).try_into().unwrap()];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -52,7 +52,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let f = [0_usize; -1_isize];
|
||||
| ^^^^^^^^ expected usize, found isize
|
||||
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `usize` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let f = [0_usize; (-1_isize).try_into().unwrap()];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -27,7 +27,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let _: i32 = 22_i64 >> 1_i32;
|
||||
| ^^^^^^^^^^^^^^^ expected i32, found i64
|
||||
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i64` to `i32` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | let _: i32 = (22_i64 >> 1_i32).try_into().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
14
src/test/ui/symbol-names/basic.stderr
Normal file
14
src/test/ui/symbol-names/basic.stderr
Normal file
@ -0,0 +1,14 @@
|
||||
error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E)
|
||||
--> $DIR/basic.rs:3:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(main)
|
||||
--> $DIR/basic.rs:4:1
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
26
src/test/ui/symbol-names/impl1.stderr
Normal file
26
src/test/ui/symbol-names/impl1.stderr
Normal file
@ -0,0 +1,26 @@
|
||||
error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E)
|
||||
--> $DIR/impl1.rs:8:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(foo::Foo::bar)
|
||||
--> $DIR/impl1.rs:9:9
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E)
|
||||
--> $DIR/impl1.rs:18:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(bar::<impl foo::Foo>::baz)
|
||||
--> $DIR/impl1.rs:19:9
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -6,7 +6,7 @@ LL | fn global_bound_is_hidden() -> u8
|
||||
...
|
||||
LL | B::get_x()
|
||||
| ^^^^^^^^^^ expected u8, found i32
|
||||
help: you can convert an `i32` to `u8` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u8` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | B::get_x().try_into().unwrap()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -12,7 +12,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | identity_u16(y);
|
||||
| ^ expected u16, found i32
|
||||
help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `i32` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | identity_u16(y.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -22,7 +22,7 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | identity_u16(a);
|
||||
| ^ expected u16, found isize
|
||||
help: you can convert an `isize` to `u16` and panic if the converted value wouldn't fit
|
||||
help: you can convert an `isize` to `u16` or panic if it the converted value wouldn't fit
|
||||
|
|
||||
LL | identity_u16(a.try_into().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user