Auto merge of #51805 - pietroalbini:rollup, r=pietroalbini

Rollup of 11 pull requests

Successful merges:

 - #51104 (add `dyn ` to display of dynamic (trait) types)
 - #51153 (Link panic and compile_error docs)
 - #51642 (Fix unknown windows build)
 - #51730 (New safe associated functions for PinMut)
 - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions))
 - #51747 (Add error for using null characters in #[export_name])
 - #51769 (Update broken rustc-guide links)
 - #51786 (Remove unnecessary stat64 pointer casts)
 - #51788 (Fix typo)
 - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`)
 - #51791 (Minify css)

Failed merges:

r? @ghost
This commit is contained in:
bors 2018-06-26 11:20:18 +00:00
commit 764232cb2a
98 changed files with 397 additions and 244 deletions

View file

@ -1220,7 +1220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "minifier" name = "minifier"
version = "0.0.11" version = "0.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2426,7 +2426,7 @@ dependencies = [
name = "rustdoc" name = "rustdoc"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3263,7 +3263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f" "checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f"
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
"checksum minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "26f3e36a4db1981b16567e4abfd6ddc3641bc9b950bdc868701f656bf9b74bdd" "checksum minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "78cb57f9a385530d60f2d67f6e108050b478b7a0ffd0bb9c350803e1356535dd"
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" "checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
"checksum miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9224c91f82b3c47cf53dcf78dfaa20d6888fbcc5d272d5f2fcdf8a697f3c987d" "checksum miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9224c91f82b3c47cf53dcf78dfaa20d6888fbcc5d272d5f2fcdf8a697f3c987d"
"checksum nibble_vec 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c8d77f3db4bce033f4d04db08079b2ef1c3d02b44e86f25d08886fafa7756ffa" "checksum nibble_vec 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c8d77f3db4bce033f4d04db08079b2ef1c3d02b44e86f25d08886fafa7756ffa"

View file

@ -1119,6 +1119,12 @@ impl<'a, T: ?Sized + Unpin> PinMut<'a, T> {
pub fn new(reference: &'a mut T) -> PinMut<'a, T> { pub fn new(reference: &'a mut T) -> PinMut<'a, T> {
PinMut { inner: reference } PinMut { inner: reference }
} }
/// Get a mutable reference to the data inside of this `PinMut`.
#[unstable(feature = "pin", issue = "49150")]
pub fn get_mut(this: PinMut<'a, T>) -> &'a mut T {
this.inner
}
} }
@ -1150,21 +1156,21 @@ impl<'a, T: ?Sized> PinMut<'a, T> {
/// the data out of the mutable reference you receive when you call this /// the data out of the mutable reference you receive when you call this
/// function. /// function.
#[unstable(feature = "pin", issue = "49150")] #[unstable(feature = "pin", issue = "49150")]
pub unsafe fn get_mut(this: PinMut<'a, T>) -> &'a mut T { pub unsafe fn get_mut_unchecked(this: PinMut<'a, T>) -> &'a mut T {
this.inner this.inner
} }
/// Construct a new pin by mapping the interior value. /// Construct a new pin by mapping the interior value.
/// ///
/// For example, if you wanted to get a `PinMut` of a field of something, you /// For example, if you wanted to get a `PinMut` of a field of something,
/// could use this to get access to that field in one line of code. /// you could use this to get access to that field in one line of code.
/// ///
/// This function is unsafe. You must guarantee that the data you return /// This function is unsafe. You must guarantee that the data you return
/// will not move so long as the argument value does not move (for example, /// will not move so long as the argument value does not move (for example,
/// because it is one of the fields of that value), and also that you do /// because it is one of the fields of that value), and also that you do
/// not move out of the argument you receive to the interior function. /// not move out of the argument you receive to the interior function.
#[unstable(feature = "pin", issue = "49150")] #[unstable(feature = "pin", issue = "49150")]
pub unsafe fn map<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where pub unsafe fn map_unchecked<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
F: FnOnce(&mut T) -> &mut U F: FnOnce(&mut T) -> &mut U
{ {
PinMut { inner: f(this.inner) } PinMut { inner: f(this.inner) }

View file

@ -275,7 +275,7 @@ impl<T> Option<T> {
#[unstable(feature = "pin", issue = "49150")] #[unstable(feature = "pin", issue = "49150")]
pub fn as_pin_mut<'a>(self: PinMut<'a, Self>) -> Option<PinMut<'a, T>> { pub fn as_pin_mut<'a>(self: PinMut<'a, Self>) -> Option<PinMut<'a, T>> {
unsafe { unsafe {
PinMut::get_mut(self).as_mut().map(|x| PinMut::new_unchecked(x)) PinMut::get_mut_unchecked(self).as_mut().map(|x| PinMut::new_unchecked(x))
} }
} }

View file

@ -3536,12 +3536,22 @@ impl<'a> LoweringContext<'a> {
this.expr_block(block, ThinVec::new()) this.expr_block(block, ThinVec::new())
}) })
}) })
}, }
ExprKind::Closure( ExprKind::Closure(
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span) => capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span
{ ) => {
self.with_new_scopes(|this| { if let IsAsync::Async(async_closure_node_id) = asyncness {
if let IsAsync::Async(async_closure_node_id) = asyncness { let outer_decl = FnDecl {
inputs: decl.inputs.clone(),
output: FunctionRetTy::Default(fn_decl_span),
variadic: false,
};
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl = self.lower_fn_decl(&outer_decl, None, false, false);
self.with_new_scopes(|this| {
// FIXME(cramertj) allow `async` non-`move` closures with // FIXME(cramertj) allow `async` non-`move` closures with
if capture_clause == CaptureBy::Ref && if capture_clause == CaptureBy::Ref &&
!decl.inputs.is_empty() !decl.inputs.is_empty()
@ -3561,11 +3571,6 @@ impl<'a> LoweringContext<'a> {
// Transform `async |x: u8| -> X { ... }` into // Transform `async |x: u8| -> X { ... }` into
// `|x: u8| future_from_generator(|| -> X { ... })` // `|x: u8| future_from_generator(|| -> X { ... })`
let outer_decl = FnDecl {
inputs: decl.inputs.clone(),
output: FunctionRetTy::Default(fn_decl_span),
variadic: false,
};
let body_id = this.lower_body(Some(&outer_decl), |this| { let body_id = this.lower_body(Some(&outer_decl), |this| {
let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output { let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output {
Some(&**ty) Some(&**ty)
@ -3579,12 +3584,17 @@ impl<'a> LoweringContext<'a> {
}); });
hir::ExprClosure( hir::ExprClosure(
this.lower_capture_clause(capture_clause), this.lower_capture_clause(capture_clause),
this.lower_fn_decl(&outer_decl, None, false, false), fn_decl,
body_id, body_id,
fn_decl_span, fn_decl_span,
None, None,
) )
} else { })
} else {
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = self.lower_fn_decl(decl, None, false, false);
self.with_new_scopes(|this| {
let mut is_generator = false; let mut is_generator = false;
let body_id = this.lower_body(Some(decl), |this| { let body_id = this.lower_body(Some(decl), |this| {
let e = this.lower_expr(body); let e = this.lower_expr(body);
@ -3618,13 +3628,13 @@ impl<'a> LoweringContext<'a> {
}; };
hir::ExprClosure( hir::ExprClosure(
this.lower_capture_clause(capture_clause), this.lower_capture_clause(capture_clause),
this.lower_fn_decl(decl, None, false, false), fn_decl,
body_id, body_id,
fn_decl_span, fn_decl_span,
generator_option, generator_option,
) )
} })
}) }
} }
ExprKind::Block(ref blk, opt_label) => { ExprKind::Block(ref blk, opt_label) => {
hir::ExprBlock(self.lower_block(blk, hir::ExprBlock(self.lower_block(blk,

View file

@ -29,7 +29,7 @@
//! For a more detailed look at what is happening here, check //! For a more detailed look at what is happening here, check
//! out the [chapter in the rustc guide][c]. //! out the [chapter in the rustc guide][c].
//! //!
//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html //! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html
use infer::{InferCtxt, InferOk, InferResult, RegionVariableOrigin, TypeVariableOrigin}; use infer::{InferCtxt, InferOk, InferResult, RegionVariableOrigin, TypeVariableOrigin};
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
@ -274,7 +274,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// To get a good understanding of what is happening here, check /// To get a good understanding of what is happening here, check
/// out the [chapter in the rustc guide][c]. /// out the [chapter in the rustc guide][c].
/// ///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#processing-the-canonicalized-query-result /// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#processing-the-canonicalized-query-result
pub fn instantiate_query_result<R>( pub fn instantiate_query_result<R>(
&self, &self,
cause: &ObligationCause<'tcx>, cause: &ObligationCause<'tcx>,
@ -458,7 +458,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// To get a good understanding of what is happening here, check /// To get a good understanding of what is happening here, check
/// out the [chapter in the rustc guide][c]. /// out the [chapter in the rustc guide][c].
/// ///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#canonicalizing-the-query /// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query
pub fn canonicalize_query<V>(&self, value: &V) -> (V::Canonicalized, CanonicalVarValues<'tcx>) pub fn canonicalize_query<V>(&self, value: &V) -> (V::Canonicalized, CanonicalVarValues<'tcx>)
where where
V: Canonicalize<'gcx, 'tcx>, V: Canonicalize<'gcx, 'tcx>,
@ -497,7 +497,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// To get a good understanding of what is happening here, check /// To get a good understanding of what is happening here, check
/// out the [chapter in the rustc guide][c]. /// out the [chapter in the rustc guide][c].
/// ///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#canonicalizing-the-query-result /// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
pub fn canonicalize_response<V>( pub fn canonicalize_response<V>(
&self, &self,
value: &V, value: &V,

View file

@ -583,7 +583,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
/// For more information about how skolemization for HRTBs works, see /// For more information about how skolemization for HRTBs works, see
/// the [rustc guide]. /// the [rustc guide].
/// ///
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-hrtb.html /// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html
pub fn skolemize_late_bound_regions<T>(&self, pub fn skolemize_late_bound_regions<T>(&self,
binder: &ty::Binder<T>) binder: &ty::Binder<T>)
-> (T, SkolemizationMap<'tcx>) -> (T, SkolemizationMap<'tcx>)

View file

@ -3,7 +3,7 @@
> WARNING: This README is obsolete and will be removed soon! For > WARNING: This README is obsolete and will be removed soon! For
> more info on how the current borrowck works, see the [rustc guide]. > more info on how the current borrowck works, see the [rustc guide].
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
## Terminology ## Terminology

View file

@ -3,7 +3,7 @@
> WARNING: This README is obsolete and will be removed soon! For > WARNING: This README is obsolete and will be removed soon! For
> more info on how the current borrowck works, see the [rustc guide]. > more info on how the current borrowck works, see the [rustc guide].
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
## Terminology ## Terminology

View file

@ -14,7 +14,7 @@
//! For more information about how MIR-based region-checking works, //! For more information about how MIR-based region-checking works,
//! see the [rustc guide]. //! see the [rustc guide].
//! //!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html //! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
use ich::{StableHashingContext, NodeIdHashingMode}; use ich::{StableHashingContext, NodeIdHashingMode};
use util::nodemap::{FxHashMap, FxHashSet}; use util::nodemap::{FxHashMap, FxHashSet};

View file

@ -10,7 +10,7 @@
//! MIR datatypes and passes. See the [rustc guide] for more info. //! MIR datatypes and passes. See the [rustc guide] for more info.
//! //!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir.html //! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html
use graphviz::IntoCow; use graphviz::IntoCow;
use hir::def::CtorKind; use hir::def::CtorKind;

View file

@ -11,8 +11,8 @@
//! See rustc guide chapters on [trait-resolution] and [trait-specialization] for more info on how //! See rustc guide chapters on [trait-resolution] and [trait-specialization] for more info on how
//! this works. //! this works.
//! //!
//! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html //! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html
//! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/trait-specialization.html //! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html
use hir::def_id::{DefId, LOCAL_CRATE}; use hir::def_id::{DefId, LOCAL_CRATE};
use syntax_pos::DUMMY_SP; use syntax_pos::DUMMY_SP;

View file

@ -10,7 +10,7 @@
//! Trait Resolution. See [rustc guide] for more info on how this works. //! Trait Resolution. See [rustc guide] for more info on how this works.
//! //!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html //! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html
pub use self::SelectionError::*; pub use self::SelectionError::*;
pub use self::FulfillmentErrorCode::*; pub use self::FulfillmentErrorCode::*;

View file

@ -10,7 +10,7 @@
//! See [rustc guide] for more info on how this works. //! See [rustc guide] for more info on how this works.
//! //!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#selection //! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#selection
use self::SelectionCandidate::*; use self::SelectionCandidate::*;
use self::EvaluationResult::*; use self::EvaluationResult::*;
@ -1047,7 +1047,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// candidates. See [rustc guide] for more details. // candidates. See [rustc guide] for more details.
// //
// [rustc guide]: // [rustc guide]:
// https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#candidate-assembly // https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#candidate-assembly
fn candidate_from_obligation<'o>(&mut self, fn candidate_from_obligation<'o>(&mut self,
stack: &TraitObligationStack<'o, 'tcx>) stack: &TraitObligationStack<'o, 'tcx>)
@ -2415,7 +2415,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// type error. See [rustc guide] for more details. // type error. See [rustc guide] for more details.
// //
// [rustc guide]: // [rustc guide]:
// https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#confirmation // https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#confirmation
fn confirm_candidate(&mut self, fn confirm_candidate(&mut self,
obligation: &TraitObligation<'tcx>, obligation: &TraitObligation<'tcx>,

View file

@ -17,7 +17,7 @@
//! See the [rustc guide] for a bit more detail on how specialization //! See the [rustc guide] for a bit more detail on how specialization
//! fits together with the rest of the trait machinery. //! fits together with the rest of the trait machinery.
//! //!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-specialization.html //! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html
use super::{SelectionContext, FulfillmentContext}; use super::{SelectionContext, FulfillmentContext};
use super::util::impl_trait_ref_and_oblig; use super::util::impl_trait_ref_and_oblig;

View file

@ -1087,7 +1087,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
/// ///
/// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ /// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
/// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ /// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-hrtb.html /// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html
#[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)] #[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
pub enum RegionKind { pub enum RegionKind {
// Region bound in a type or fn declaration which will be // Region bound in a type or fn declaration which will be

View file

@ -1062,10 +1062,14 @@ define_print! {
TyParam(ref param_ty) => write!(f, "{}", param_ty), TyParam(ref param_ty) => write!(f, "{}", param_ty),
TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]), TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
TyDynamic(data, r) => { TyDynamic(data, r) => {
data.print(f, cx)?;
let r = r.print_to_string(cx); let r = r.print_to_string(cx);
if !r.is_empty() { if !r.is_empty() {
write!(f, " + {}", r) write!(f, "(")?;
}
write!(f, "dyn ")?;
data.print(f, cx)?;
if !r.is_empty() {
write!(f, " + {})", r)
} else { } else {
Ok(()) Ok(())
} }

View file

@ -3,7 +3,7 @@
> WARNING: This README is more or less obsolete, and will be removed > WARNING: This README is more or less obsolete, and will be removed
> soon! The new system is described in the [rustc guide]. > soon! The new system is described in the [rustc guide].
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
This pass has the job of enforcing memory safety. This is a subtle This pass has the job of enforcing memory safety. This is a subtle
topic. This docs aim to explain both the practice and the theory topic. This docs aim to explain both the practice and the theory

View file

@ -48,8 +48,3 @@ unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
"##, "##,
} }
register_diagnostics! {
E0558
}

View file

@ -540,12 +540,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// ============== // ==============
/// Finds the breakable scope for a given label. This is used for /// Finds the breakable scope for a given label. This is used for
/// resolving `break` and `continue`. /// resolving `break` and `continue`.
pub fn find_breakable_scope(&mut self, pub fn find_breakable_scope(&self,
span: Span, span: Span,
label: region::Scope) label: region::Scope)
-> &mut BreakableScope<'tcx> { -> &BreakableScope<'tcx> {
// find the loop-scope with the correct id // find the loop-scope with the correct id
self.breakable_scopes.iter_mut() self.breakable_scopes.iter()
.rev() .rev()
.filter(|breakable_scope| breakable_scope.region_scope == label) .filter(|breakable_scope| breakable_scope.region_scope == label)
.next() .next()

View file

@ -416,7 +416,6 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
} }
PatKind::Slice(ref prefix, ref slice, ref suffix) => { PatKind::Slice(ref prefix, ref slice, ref suffix) => {
let ty = self.tables.node_id_to_type(pat.hir_id);
match ty.sty { match ty.sty {
ty::TyRef(_, ty, _) => ty::TyRef(_, ty, _) =>
PatternKind::Deref { PatternKind::Deref {
@ -427,11 +426,12 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
pat.span, ty, prefix, slice, suffix)) pat.span, ty, prefix, slice, suffix))
}, },
}, },
ty::TySlice(..) | ty::TySlice(..) |
ty::TyArray(..) => ty::TyArray(..) =>
self.slice_or_array_pattern(pat.span, ty, prefix, slice, suffix), self.slice_or_array_pattern(pat.span, ty, prefix, slice, suffix),
ty::TyError => { // Avoid ICE
return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
}
ref sty => ref sty =>
span_bug!( span_bug!(
pat.span, pat.span,
@ -441,7 +441,6 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
} }
PatKind::Tuple(ref subpatterns, ddpos) => { PatKind::Tuple(ref subpatterns, ddpos) => {
let ty = self.tables.node_id_to_type(pat.hir_id);
match ty.sty { match ty.sty {
ty::TyTuple(ref tys) => { ty::TyTuple(ref tys) => {
let subpatterns = let subpatterns =
@ -455,7 +454,9 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
PatternKind::Leaf { subpatterns: subpatterns } PatternKind::Leaf { subpatterns: subpatterns }
} }
ty::TyError => { // Avoid ICE (#50577)
return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
}
ref sty => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", sty), ref sty => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", sty),
} }
} }
@ -464,6 +465,9 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let var_ty = self.tables.node_id_to_type(pat.hir_id); let var_ty = self.tables.node_id_to_type(pat.hir_id);
let region = match var_ty.sty { let region = match var_ty.sty {
ty::TyRef(r, _, _) => Some(r), ty::TyRef(r, _, _) => Some(r),
ty::TyError => { // Avoid ICE
return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
}
_ => None, _ => None,
}; };
let bm = *self.tables.pat_binding_modes().get(pat.hir_id) let bm = *self.tables.pat_binding_modes().get(pat.hir_id)
@ -505,12 +509,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let def = self.tables.qpath_def(qpath, pat.hir_id); let def = self.tables.qpath_def(qpath, pat.hir_id);
let adt_def = match ty.sty { let adt_def = match ty.sty {
ty::TyAdt(adt_def, _) => adt_def, ty::TyAdt(adt_def, _) => adt_def,
ty::TyError => { // Avoid ICE (#50585) ty::TyError => { // Avoid ICE (#50585)
return Pattern { return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
span: pat.span,
ty,
kind: Box::new(PatternKind::Wild),
};
} }
_ => span_bug!(pat.span, _ => span_bug!(pat.span,
"tuple struct pattern not applied to an ADT {:?}", "tuple struct pattern not applied to an ADT {:?}",

View file

@ -3846,7 +3846,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
} }
} }
hir::ExprContinue(_) => { tcx.types.never } hir::ExprContinue(destination) => {
if let Ok(_) = destination.target_id {
tcx.types.never
} else {
// There was an error, make typecheck fail
tcx.types.err
}
}
hir::ExprRet(ref expr_opt) => { hir::ExprRet(ref expr_opt) => {
if self.ret_coercion.is_none() { if self.ret_coercion.is_none() {
struct_span_err!(self.tcx.sess, expr.span, E0572, struct_span_err!(self.tcx.sess, expr.span, E0572,

View file

@ -1898,11 +1898,18 @@ fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> Codegen
} }
}); });
} else if attr.check_name("export_name") { } else if attr.check_name("export_name") {
if let s @ Some(_) = attr.value_str() { if let Some(s) = attr.value_str() {
codegen_fn_attrs.export_name = s; if s.as_str().contains("\0") {
// `#[export_name = ...]` will be converted to a null-terminated string,
// so it may not contain any null characters.
struct_span_err!(tcx.sess, attr.span, E0648,
"`export_name` may not contain null characters")
.emit();
}
codegen_fn_attrs.export_name = Some(s);
} else { } else {
struct_span_err!(tcx.sess, attr.span, E0558, struct_span_err!(tcx.sess, attr.span, E0558,
"export_name attribute has invalid format") "`export_name` attribute has invalid format")
.span_label(attr.span, "did you mean #[export_name=\"*\"]?") .span_label(attr.span, "did you mean #[export_name=\"*\"]?")
.emit(); .emit();
} }

View file

@ -3709,7 +3709,7 @@ The `export_name` attribute was malformed.
Erroneous code example: Erroneous code example:
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail) ```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
#[export_name] // error: export_name attribute has invalid format #[export_name] // error: `export_name` attribute has invalid format
pub fn something() {} pub fn something() {}
fn main() {} fn main() {}
@ -4545,6 +4545,15 @@ fn start(_: isize, _: *const *const u8) -> isize where (): Copy {
``` ```
"##, "##,
E0648: r##"
`export_name` attributes may not contain null characters (`\0`).
```compile_fail,E0648
#[export_name="\0foo"] // error: `export_name` may not contain null characters
pub fn bar() {}
```
"##,
E0689: r##" E0689: r##"
This error indicates that the numeric value for the method being passed exists This error indicates that the numeric value for the method being passed exists
but the type of the numeric value or binding could not be identified. but the type of the numeric value or binding could not be identified.

View file

@ -9,5 +9,5 @@ path = "lib.rs"
[dependencies] [dependencies]
pulldown-cmark = { version = "0.1.2", default-features = false } pulldown-cmark = { version = "0.1.2", default-features = false }
minifier = "0.0.11" minifier = "0.0.14"
tempfile = "3" tempfile = "3"

View file

@ -42,6 +42,7 @@ use std::collections::{BTreeMap, HashSet, VecDeque};
use std::default::Default; use std::default::Default;
use std::error; use std::error;
use std::fmt::{self, Display, Formatter, Write as FmtWrite}; use std::fmt::{self, Display, Formatter, Write as FmtWrite};
use std::ffi::OsStr;
use std::fs::{self, File, OpenOptions}; use std::fs::{self, File, OpenOptions};
use std::io::prelude::*; use std::io::prelude::*;
use std::io::{self, BufWriter, BufReader}; use std::io::{self, BufWriter, BufReader};
@ -756,10 +757,12 @@ fn write_shared(cx: &Context,
// Add all the static files. These may already exist, but we just // Add all the static files. These may already exist, but we just
// overwrite them anyway to make sure that they're fresh and up-to-date. // overwrite them anyway to make sure that they're fresh and up-to-date.
write(cx.dst.join(&format!("rustdoc{}.css", cx.shared.resource_suffix)), write_minify(cx.dst.join(&format!("rustdoc{}.css", cx.shared.resource_suffix)),
include_bytes!("static/rustdoc.css"))?; include_str!("static/rustdoc.css"),
write(cx.dst.join(&format!("settings{}.css", cx.shared.resource_suffix)), enable_minification)?;
include_bytes!("static/settings.css"))?; write_minify(cx.dst.join(&format!("settings{}.css", cx.shared.resource_suffix)),
include_str!("static/settings.css"),
enable_minification)?;
// To avoid "light.css" to be overwritten, we'll first run over the received themes and only // To avoid "light.css" to be overwritten, we'll first run over the received themes and only
// then we'll run over the "official" styles. // then we'll run over the "official" styles.
@ -781,11 +784,13 @@ fn write_shared(cx: &Context,
include_bytes!("static/brush.svg"))?; include_bytes!("static/brush.svg"))?;
write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)), write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)),
include_bytes!("static/wheel.svg"))?; include_bytes!("static/wheel.svg"))?;
write(cx.dst.join(&format!("light{}.css", cx.shared.resource_suffix)), write_minify(cx.dst.join(&format!("light{}.css", cx.shared.resource_suffix)),
include_bytes!("static/themes/light.css"))?; include_str!("static/themes/light.css"),
enable_minification)?;
themes.insert("light".to_owned()); themes.insert("light".to_owned());
write(cx.dst.join(&format!("dark{}.css", cx.shared.resource_suffix)), write_minify(cx.dst.join(&format!("dark{}.css", cx.shared.resource_suffix)),
include_bytes!("static/themes/dark.css"))?; include_str!("static/themes/dark.css"),
enable_minification)?;
themes.insert("dark".to_owned()); themes.insert("dark".to_owned());
let mut themes: Vec<&String> = themes.iter().collect(); let mut themes: Vec<&String> = themes.iter().collect();
@ -857,10 +862,19 @@ themePicker.onblur = handleThemeButtonsBlur;
if let Some(ref css) = cx.shared.css_file_extension { if let Some(ref css) = cx.shared.css_file_extension {
let out = cx.dst.join(&format!("theme{}.css", cx.shared.resource_suffix)); let out = cx.dst.join(&format!("theme{}.css", cx.shared.resource_suffix));
try_err!(fs::copy(css, out), css); if !enable_minification {
try_err!(fs::copy(css, out), css);
} else {
let mut f = try_err!(File::open(css), css);
let mut buffer = String::with_capacity(1000);
try_err!(f.read_to_string(&mut buffer), css);
write_minify(out, &buffer, enable_minification)?;
}
} }
write(cx.dst.join(&format!("normalize{}.css", cx.shared.resource_suffix)), write_minify(cx.dst.join(&format!("normalize{}.css", cx.shared.resource_suffix)),
include_bytes!("static/normalize.css"))?; include_str!("static/normalize.css"),
enable_minification)?;
write(cx.dst.join("FiraSans-Regular.woff"), write(cx.dst.join("FiraSans-Regular.woff"),
include_bytes!("static/FiraSans-Regular.woff"))?; include_bytes!("static/FiraSans-Regular.woff"))?;
write(cx.dst.join("FiraSans-Medium.woff"), write(cx.dst.join("FiraSans-Medium.woff"),
@ -1051,7 +1065,12 @@ fn write(dst: PathBuf, contents: &[u8]) -> Result<(), Error> {
fn write_minify(dst: PathBuf, contents: &str, enable_minification: bool) -> Result<(), Error> { fn write_minify(dst: PathBuf, contents: &str, enable_minification: bool) -> Result<(), Error> {
if enable_minification { if enable_minification {
write(dst, minifier::js::minify(contents).as_bytes()) if dst.extension() == Some(&OsStr::new("css")) {
let res = try_none!(minifier::css::minify(contents).ok(), &dst);
write(dst, res.as_bytes())
} else {
write(dst, minifier::js::minify(contents).as_bytes())
}
} else { } else {
write(dst, contents.as_bytes()) write(dst, contents.as_bytes())
} }

View file

@ -43,7 +43,7 @@ impl<T: Generator<Yield = ()>> !Unpin for GenFuture<T> {}
impl<T: Generator<Yield = ()>> Future for GenFuture<T> { impl<T: Generator<Yield = ()>> Future for GenFuture<T> {
type Output = T::Return; type Output = T::Return;
fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> { fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
set_task_cx(cx, || match unsafe { PinMut::get_mut(self).0.resume() } { set_task_cx(cx, || match unsafe { PinMut::get_mut_unchecked(self).0.resume() } {
GeneratorState::Yielded(()) => Poll::Pending, GeneratorState::Yielded(()) => Poll::Pending,
GeneratorState::Complete(x) => Poll::Ready(x), GeneratorState::Complete(x) => Poll::Ready(x),
}) })

View file

@ -38,10 +38,13 @@
/// The multi-argument form of this macro panics with a string and has the /// The multi-argument form of this macro panics with a string and has the
/// [`format!`] syntax for building a string. /// [`format!`] syntax for building a string.
/// ///
/// See also the macro [`compile_error!`], for raising errors during compilation.
///
/// [runwrap]: ../std/result/enum.Result.html#method.unwrap /// [runwrap]: ../std/result/enum.Result.html#method.unwrap
/// [`Option`]: ../std/option/enum.Option.html#method.unwrap /// [`Option`]: ../std/option/enum.Option.html#method.unwrap
/// [`Result`]: ../std/result/enum.Result.html /// [`Result`]: ../std/result/enum.Result.html
/// [`format!`]: ../std/macro.format.html /// [`format!`]: ../std/macro.format.html
/// [`compile_error!`]: ../std/macro.compile_error.html
/// [book]: ../book/second-edition/ch09-01-unrecoverable-errors-with-panic.html /// [book]: ../book/second-edition/ch09-01-unrecoverable-errors-with-panic.html
/// ///
/// # Current implementation /// # Current implementation
@ -305,13 +308,16 @@ pub mod builtin {
/// Unconditionally causes compilation to fail with the given error message when encountered. /// Unconditionally causes compilation to fail with the given error message when encountered.
/// ///
/// This macro should be used when a crate uses a conditional compilation strategy to provide /// This macro should be used when a crate uses a conditional compilation strategy to provide
/// better error messages for erroneous conditions. /// better error messages for erroneous conditions. It's the compiler-level form of [`panic!`],
/// which emits an error at *runtime*, rather than during compilation.
/// ///
/// # Examples /// # Examples
/// ///
/// Two such examples are macros and `#[cfg]` environments. /// Two such examples are macros and `#[cfg]` environments.
/// ///
/// Emit better compiler error if a macro is passed invalid values. /// Emit better compiler error if a macro is passed invalid values. Without the final branch,
/// the compiler would still emit an error, but the error's message would not mention the two
/// valid values.
/// ///
/// ```compile_fail /// ```compile_fail
/// macro_rules! give_me_foo_or_bar { /// macro_rules! give_me_foo_or_bar {
@ -332,6 +338,8 @@ pub mod builtin {
/// #[cfg(not(any(feature = "foo", feature = "bar")))] /// #[cfg(not(any(feature = "foo", feature = "bar")))]
/// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.") /// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.")
/// ``` /// ```
///
/// [`panic!`]: ../std/macro.panic.html
#[stable(feature = "compile_error_macro", since = "1.20.0")] #[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export] #[macro_export]
macro_rules! compile_error { macro_rules! compile_error {

View file

@ -327,14 +327,9 @@ impl<T: fmt::Debug> fmt::Debug for AssertUnwindSafe<T> {
impl<'a, F: Future> Future for AssertUnwindSafe<F> { impl<'a, F: Future> Future for AssertUnwindSafe<F> {
type Output = F::Output; type Output = F::Output;
fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> { fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
unsafe { let pinned_field = unsafe { PinMut::map_unchecked(self, |x| &mut x.0) };
let pinned_field = PinMut::new_unchecked( pinned_field.poll(cx)
&mut PinMut::get_mut(self.reborrow()).0
);
pinned_field.poll(cx)
}
} }
} }

View file

@ -67,6 +67,7 @@ cfg_if! {
// (missing things in `libc` which is empty) so just omit everything // (missing things in `libc` which is empty) so just omit everything
// with an empty module // with an empty module
#[unstable(issue = "0", feature = "std_internals")] #[unstable(issue = "0", feature = "std_internals")]
#[allow(missing_docs)]
pub mod unix_ext {} pub mod unix_ext {}
} else { } else {
// On other platforms like Windows document the bare bones of unix // On other platforms like Windows document the bare bones of unix
@ -80,11 +81,13 @@ cfg_if! {
cfg_if! { cfg_if! {
if #[cfg(windows)] { if #[cfg(windows)] {
// On windows we'll just be documenting what's already available // On windows we'll just be documenting what's already available
#[allow(missing_docs)]
pub use self::ext as windows_ext; pub use self::ext as windows_ext;
} else if #[cfg(any(target_os = "cloudabi", target_arch = "wasm32"))] { } else if #[cfg(any(target_os = "cloudabi", target_arch = "wasm32"))] {
// On CloudABI and wasm right now the shim below doesn't compile, so // On CloudABI and wasm right now the shim below doesn't compile, so
// just omit it // just omit it
#[unstable(issue = "0", feature = "std_internals")] #[unstable(issue = "0", feature = "std_internals")]
#[allow(missing_docs)]
pub mod windows_ext {} pub mod windows_ext {}
} else { } else {
// On all other platforms (aka linux/osx/etc) then pull in a "minimal" // On all other platforms (aka linux/osx/etc) then pull in a "minimal"

View file

@ -803,7 +803,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p)?; let p = cstr(p)?;
let mut stat: stat64 = unsafe { mem::zeroed() }; let mut stat: stat64 = unsafe { mem::zeroed() };
cvt(unsafe { cvt(unsafe {
stat64(p.as_ptr(), &mut stat as *mut _ as *mut _) stat64(p.as_ptr(), &mut stat)
})?; })?;
Ok(FileAttr { stat: stat }) Ok(FileAttr { stat: stat })
} }
@ -812,7 +812,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p)?; let p = cstr(p)?;
let mut stat: stat64 = unsafe { mem::zeroed() }; let mut stat: stat64 = unsafe { mem::zeroed() };
cvt(unsafe { cvt(unsafe {
lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _) lstat64(p.as_ptr(), &mut stat)
})?; })?;
Ok(FileAttr { stat: stat }) Ok(FileAttr { stat: stat })
} }

View file

@ -540,7 +540,7 @@ impl CompilerDesugaringKind {
CompilerDesugaringKind::DotFill => "...", CompilerDesugaringKind::DotFill => "...",
CompilerDesugaringKind::QuestionMark => "?", CompilerDesugaringKind::QuestionMark => "?",
CompilerDesugaringKind::Catch => "do catch", CompilerDesugaringKind::Catch => "do catch",
CompilerDesugaringKind::ExistentialReturnType => "existental type", CompilerDesugaringKind::ExistentialReturnType => "existential type",
}) })
} }
} }

View file

@ -18,6 +18,6 @@ impl Trait for Foo {}
pub fn main() { pub fn main() {
let x: Box<Trait> = Box::new(Foo); let x: Box<Trait> = Box::new(Foo);
let _y: &Trait = x; //~ ERROR E0308 let _y: &Trait = x; //~ ERROR E0308
//~| expected type `&Trait` //~| expected type `&dyn Trait`
//~| found type `std::boxed::Box<Trait>` //~| found type `std::boxed::Box<dyn Trait>`
} }

View file

@ -33,23 +33,23 @@ fn main() {
let &&x = &&(&1isize as &T); let &&x = &&(&1isize as &T);
// n == m // n == m
let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced
let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced
let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<T>` cannot be dereferenced let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<dyn T>` cannot be dereferenced
// n > m // n > m
let &&x = &1isize as &T; let &&x = &1isize as &T;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `T` //~| expected type `dyn T`
//~| found type `&_` //~| found type `&_`
//~| expected trait T, found reference //~| expected trait T, found reference
let &&&x = &(&1isize as &T); let &&&x = &(&1isize as &T);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `T` //~| expected type `dyn T`
//~| found type `&_` //~| found type `&_`
//~| expected trait T, found reference //~| expected trait T, found reference
let box box x = box 1isize as Box<T>; let box box x = box 1isize as Box<T>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `T` //~| expected type `dyn T`
//~| found type `std::boxed::Box<_>` //~| found type `std::boxed::Box<_>`
} }

View file

@ -42,7 +42,7 @@ pub fn main() {
let z: Box<ToBar> = Box::new(Bar1 {f: 36}); let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.2 = Bar1 {f: 36}; f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `ToBar` //~| expected type `dyn ToBar`
//~| found type `Bar1` //~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1` //~| expected trait ToBar, found struct `Bar1`
//~| ERROR the size for value values of type //~| ERROR the size for value values of type

View file

@ -44,7 +44,7 @@ pub fn main() {
let z: Box<ToBar> = Box::new(Bar1 {f: 36}); let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36}; f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `ToBar` //~| expected type `dyn ToBar`
//~| found type `Bar1` //~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1` //~| expected trait ToBar, found struct `Bar1`
//~| ERROR the size for value values of type //~| ERROR the size for value values of type

View file

@ -16,15 +16,15 @@ fn main() {
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>; let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `std::boxed::Box<std::ops::FnOnce(isize)>` //~| found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>; let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `std::boxed::Box<std::ops::Fn(isize, isize)>` //~| found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>; let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected type `()` //~| expected type `()`
//~| found type `std::boxed::Box<std::ops::FnMut() -> isize>` //~| found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
needs_fn(1); needs_fn(1);
//~^ ERROR : std::ops::Fn<(isize,)>` //~^ ERROR : std::ops::Fn<(isize,)>`

View file

@ -17,8 +17,8 @@ struct Baz;
impl Foo for Baz { impl Foo for Baz {
fn bar(&mut self, other: &Foo) {} fn bar(&mut self, other: &Foo) {}
//~^ ERROR method `bar` has an incompatible type for trait //~^ ERROR method `bar` has an incompatible type for trait
//~| expected type `fn(&mut Baz, &mut Foo)` //~| expected type `fn(&mut Baz, &mut dyn Foo)`
//~| found type `fn(&mut Baz, &Foo)` //~| found type `fn(&mut Baz, &dyn Foo)`
} }
fn main() {} fn main() {}

View file

@ -11,6 +11,6 @@
trait Foo {} trait Foo {}
impl<'a> Foo for Foo+'a {} impl<'a> Foo for Foo+'a {}
//~^ ERROR the object type `Foo + 'a` automatically implements the trait `Foo` //~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo`
fn main() {} fn main() {}

View file

@ -17,5 +17,5 @@ fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
fn main() { fn main() {
size_of_copy::<Misc+Copy>(); size_of_copy::<Misc+Copy>();
//~^ ERROR only auto traits can be used as additional traits in a trait object //~^ ERROR only auto traits can be used as additional traits in a trait object
//~| ERROR the trait bound `Misc: std::marker::Copy` is not satisfied //~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied
} }

View file

@ -14,5 +14,5 @@ fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }
fn main() { fn main() {
let t : &Trait = &get_function()(); let t : &Trait = &get_function()();
//~^ ERROR cannot move a value of type Trait + 'static //~^ ERROR cannot move a value of type (dyn Trait + 'static)
} }

View file

@ -18,5 +18,5 @@ impl Foo for isize {
fn main() { fn main() {
(&5isize as &Foo).foo(); (&5isize as &Foo).foo();
//~^ ERROR: no method named `foo` found for type `&Foo` in the current scope //~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope
} }

View file

@ -20,12 +20,12 @@ trait Message : Send { }
fn object_ref_with_static_bound_not_ok() { fn object_ref_with_static_bound_not_ok() {
assert_send::<&'static (Dummy+'static)>(); assert_send::<&'static (Dummy+'static)>();
//~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277] //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
} }
fn box_object_with_no_bound_not_ok<'a>() { fn box_object_with_no_bound_not_ok<'a>() {
assert_send::<Box<Dummy>>(); assert_send::<Box<Dummy>>();
//~^ ERROR `Dummy` cannot be sent between threads safely //~^ ERROR `dyn Dummy` cannot be sent between threads safely
} }
fn object_with_send_bound_ok() { fn object_with_send_bound_ok() {

View file

@ -18,7 +18,7 @@ trait Dummy { }
// careful with object types, who knows what they close over... // careful with object types, who knows what they close over...
fn test51<'a>() { fn test51<'a>() {
assert_send::<&'a Dummy>(); assert_send::<&'a Dummy>();
//~^ ERROR `Dummy + 'a` cannot be shared between threads safely [E0277] //~^ ERROR `(dyn Dummy + 'a)` cannot be shared between threads safely [E0277]
} }
fn test52<'a>() { fn test52<'a>() {
assert_send::<&'a (Dummy+Sync)>(); assert_send::<&'a (Dummy+Sync)>();
@ -37,7 +37,7 @@ fn test61() {
// them not ok // them not ok
fn test_71<'a>() { fn test_71<'a>() {
assert_send::<Box<Dummy+'a>>(); assert_send::<Box<Dummy+'a>>();
//~^ ERROR `Dummy + 'a` cannot be sent between threads safely //~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely
} }
fn main() { } fn main() { }

View file

@ -15,12 +15,12 @@ trait Dummy { }
fn test50() { fn test50() {
assert_send::<&'static Dummy>(); assert_send::<&'static Dummy>();
//~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277] //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
} }
fn test53() { fn test53() {
assert_send::<Box<Dummy>>(); assert_send::<Box<Dummy>>();
//~^ ERROR `Dummy` cannot be sent between threads safely //~^ ERROR `dyn Dummy` cannot be sent between threads safely
} }
// ...unless they are properly bounded // ...unless they are properly bounded

View file

@ -25,5 +25,5 @@ fn main() {
let x: Box<HashMap<isize, isize>> = box HashMap::new(); let x: Box<HashMap<isize, isize>> = box HashMap::new();
let x: Box<Map<isize, isize>> = x; let x: Box<Map<isize, isize>> = x;
let y: Box<Map<usize, isize>> = Box::new(x); let y: Box<Map<usize, isize>> = Box::new(x);
//~^ ERROR `std::boxed::Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied //~^ ERROR `std::boxed::Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
} }

View file

@ -61,22 +61,22 @@ pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
intrinsics::atomic_load(p); intrinsics::atomic_load(p);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()` //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
} }
pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
intrinsics::atomic_store(p, v); intrinsics::atomic_store(p, v);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()` //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
} }
pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
intrinsics::atomic_xchg(p, v); intrinsics::atomic_xchg(p, v);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()` //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
} }
pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
intrinsics::atomic_cxchg(p, v, v); intrinsics::atomic_cxchg(p, v, v);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()` //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
} }
pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {

View file

@ -14,5 +14,5 @@
trait Foo {} trait Foo {}
fn take_foo<F:Foo>(f: F) {} fn take_foo<F:Foo>(f: F) {}
fn take_object(f: Box<Foo>) { take_foo(f); } fn take_object(f: Box<Foo>) { take_foo(f); }
//~^ ERROR `std::boxed::Box<Foo>: Foo` is not satisfied //~^ ERROR `std::boxed::Box<dyn Foo>: Foo` is not satisfied
fn main() {} fn main() {}

View file

@ -22,7 +22,7 @@ trait Baz {
} }
fn use_bar(t: Box<Bar>) { fn use_bar(t: Box<Bar>) {
t.bar() //~ ERROR cannot move a value of type Bar t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static)
} }
fn main() { } fn main() { }

View file

@ -19,19 +19,19 @@ mod priv_trait {
pub macro mac1() { pub macro mac1() {
let _: Box<PubTr<AssocTy = u8>>; let _: Box<PubTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PubTr<AssocTy=u8> + '<empty>` is private //~^ ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
//~| ERROR type `priv_trait::PubTr<AssocTy=u8> + '<empty>` is private //~| ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
type InSignatureTy2 = Box<PubTr<AssocTy = u8>>; type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PubTr<AssocTy=u8> + 'static` is private //~^ ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + 'static)` is private
trait InSignatureTr2: PubTr<AssocTy = u8> {} trait InSignatureTr2: PubTr<AssocTy = u8> {}
//~^ ERROR trait `priv_trait::PrivTr` is private //~^ ERROR trait `priv_trait::PrivTr` is private
} }
pub macro mac2() { pub macro mac2() {
let _: Box<PrivTr<AssocTy = u8>>; let _: Box<PrivTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PrivTr<AssocTy=u8> + '<empty>` is private //~^ ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
//~| ERROR type `priv_trait::PrivTr<AssocTy=u8> + '<empty>` is private //~| ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>; type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PrivTr<AssocTy=u8> + 'static` is private //~^ ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + 'static)` is private
trait InSignatureTr1: PrivTr<AssocTy = u8> {} trait InSignatureTr1: PrivTr<AssocTy = u8> {}
//~^ ERROR trait `priv_trait::PrivTr` is private //~^ ERROR trait `priv_trait::PrivTr` is private
} }

View file

@ -129,7 +129,7 @@ fn main() {
m::leak_anon2(); //~ ERROR type `m::Priv` is private m::leak_anon2(); //~ ERROR type `m::Priv` is private
m::leak_anon3(); //~ ERROR type `m::Priv` is private m::leak_anon3(); //~ ERROR type `m::Priv` is private
m::leak_dyn1(); //~ ERROR type `m::Trait + 'static` is private m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private
m::leak_dyn2(); //~ ERROR type `m::Priv` is private m::leak_dyn2(); //~ ERROR type `m::Priv` is private
m::leak_dyn3(); //~ ERROR type `m::Priv` is private m::leak_dyn3(); //~ ERROR type `m::Priv` is private

View file

@ -110,9 +110,9 @@ fn check_assoc_const() {
// A, B, C are resolved as inherent items, their traits don't need to be in scope // A, B, C are resolved as inherent items, their traits don't need to be in scope
C::A; //~ ERROR associated constant `A` is private C::A; //~ ERROR associated constant `A` is private
//~^ ERROR the trait `assoc_const::C` cannot be made into an object //~^ ERROR the trait `assoc_const::C` cannot be made into an object
//~| ERROR the trait bound `assoc_const::C: assoc_const::A` is not satisfied //~| ERROR the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied
C::B; // ERROR the trait `assoc_const::C` cannot be made into an object C::B; // ERROR the trait `assoc_const::C` cannot be made into an object
//~^ ERROR the trait bound `assoc_const::C: assoc_const::B` is not satisfied //~^ ERROR the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied
C::C; // OK C::C; // OK
} }

View file

@ -33,7 +33,7 @@ impl CompareTo<u64> for i64 {
impl CompareToInts for i64 { } impl CompareToInts for i64 { }
fn with_obj(c: &CompareToInts) -> bool { fn with_obj(c: &CompareToInts) -> bool {
c.same_as(22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
} }
fn with_trait<C:CompareToInts>(c: &C) -> bool { fn with_trait<C:CompareToInts>(c: &C) -> bool {
@ -41,7 +41,7 @@ fn with_trait<C:CompareToInts>(c: &C) -> bool {
} }
fn with_ufcs1<C:CompareToInts>(c: &C) -> bool { fn with_ufcs1<C:CompareToInts>(c: &C) -> bool {
CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
} }
fn with_ufcs2<C:CompareToInts>(c: &C) -> bool { fn with_ufcs2<C:CompareToInts>(c: &C) -> bool {

View file

@ -59,25 +59,25 @@ pub fn main() {
// unsize trait // unsize trait
let x: &Bar = &Bar; let x: &Bar = &Bar;
let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&Foo` let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo`
let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const Foo` let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo`
let _: &Foo = x; let _: &Foo = x;
let _: *const Foo = x; let _: *const Foo = x;
let x: &mut Bar = &mut Bar; let x: &mut Bar = &mut Bar;
let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut Foo` let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo`
let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut Foo` let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo`
let _: &mut Foo = x; let _: &mut Foo = x;
let _: *mut Foo = x; let _: *mut Foo = x;
let x: Box<Bar> = Box::new(Bar); let x: Box<Bar> = Box::new(Bar);
let _ = x as Box<Foo>; //~ERROR trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<Foo>` let _ = x as Box<Foo>; //~ERROR `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
let x: Box<Bar> = Box::new(Bar); let x: Box<Bar> = Box::new(Bar);
let _: Box<Foo> = x; let _: Box<Foo> = x;
// functions // functions
fn baz(_x: i32) {} fn baz(_x: i32) {}
let _ = &baz as &Fn(i32); //~ERROR trivial cast: `&fn(i32) {main::baz}` as `&std::ops::Fn(i32)` let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
let _: &Fn(i32) = &baz; let _: &Fn(i32) = &baz;
let x = |_x: i32| {}; let x = |_x: i32| {};
let _ = &x as &Fn(i32); //~ERROR trivial cast let _ = &x as &Fn(i32); //~ERROR trivial cast

View file

@ -33,7 +33,7 @@ fn main() {
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| Perhaps two different versions of crate `crate_a1` //~| Perhaps two different versions of crate `crate_a1`
//~| expected trait `main::a::Bar` //~| expected trait `main::a::Bar`
//~| expected type `std::boxed::Box<main::a::Bar + 'static>` //~| expected type `std::boxed::Box<(dyn main::a::Bar + 'static)>`
//~| found type `std::boxed::Box<main::a::Bar>` //~| found type `std::boxed::Box<dyn main::a::Bar>`
} }
} }

View file

@ -23,5 +23,5 @@ fn main() {
let x: i32 = 5; let x: i32 = 5;
let y = x as MyAdd<i32>; let y = x as MyAdd<i32>;
//~^ ERROR E0038 //~^ ERROR E0038
//~| ERROR cast to unsized type: `i32` as `MyAdd<i32>` //~| ERROR cast to unsized type: `i32` as `dyn MyAdd<i32>`
} }

View file

@ -68,17 +68,17 @@ fn foo<F>(f: F) where F: FnOnce() -> i32 {
// fn main::{{closure}}(_1: [closure@NodeId(22) d:&'19s D]) -> i32 { // fn main::{{closure}}(_1: [closure@NodeId(22) d:&'19s D]) -> i32 {
// let mut _0: i32; // let mut _0: i32;
// ... // ...
// let _2: &'15_0rs D; // let _2: &'16_0rs D;
// ... // ...
// let mut _3: i32; // let mut _3: i32;
// bb0: { // bb0: {
// StorageLive(_2); // StorageLive(_2);
// _2 = &'15_0rs (*(_1.0: &'19s D)); // _2 = &'16_0rs (*(_1.0: &'19s D));
// StorageLive(_3); // StorageLive(_3);
// _3 = ((*_2).0: i32); // _3 = ((*_2).0: i32);
// _0 = move _3; // _0 = move _3;
// StorageDead(_3); // StorageDead(_3);
// EndRegion('15_0rs); // EndRegion('16_0rs);
// StorageDead(_2); // StorageDead(_2);
// return; // return;
// } // }

View file

@ -76,17 +76,17 @@ fn foo<F>(f: F) where F: FnOnce() -> i32 {
// fn main::{{closure}}(_1: [closure@NodeId(22) d:D]) -> i32 { // fn main::{{closure}}(_1: [closure@NodeId(22) d:D]) -> i32 {
// let mut _0: i32; // let mut _0: i32;
// ... // ...
// let _2: &'15_0rs D; // let _2: &'16_0rs D;
// ... // ...
// let mut _3: i32; // let mut _3: i32;
// bb0: { // bb0: {
// StorageLive(_2); // StorageLive(_2);
// _2 = &'15_0rs (_1.0: D); // _2 = &'16_0rs (_1.0: D);
// StorageLive(_3); // StorageLive(_3);
// _3 = ((*_2).0: i32); // _3 = ((*_2).0: i32);
// _0 = move _3; // _0 = move _3;
// StorageDead(_3); // StorageDead(_3);
// EndRegion('15_0rs); // EndRegion('16_0rs);
// StorageDead(_2); // StorageDead(_2);
// drop(_1) -> [return: bb2, unwind: bb1]; // drop(_1) -> [return: bb2, unwind: bb1];
// } // }

View file

@ -64,14 +64,14 @@ fn main() {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId(0/1:11 ~ validate_1[317d]::main[0]::{{closure}}[0]), BrEnv) [closure@NodeId(50)], _2: &ReFree(DefId(0/1:11 ~ validate_1[317d]::main[0]::{{closure}}[0]), BrAnon(0)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId(0/1:11 ~ validate_1[317d]::main[0]::{{closure}}[0]), BrEnv) [closure@NodeId(50)], _2: &ReFree(DefId(0/1:11 ~ validate_1[317d]::main[0]::{{closure}}[0]), BrAnon(0)) mut i32]);
// StorageLive(_3); // StorageLive(_3);
// Validate(Suspend(ReScope(Remainder(BlockRemainder { block: ItemLocalId(22), first_statement_index: 0 }))), [(*_2): i32]); // Validate(Suspend(ReScope(Remainder(BlockRemainder { block: ItemLocalId(25), first_statement_index: 0 }))), [(*_2): i32]);
// _3 = &ReErased (*_2); // _3 = &ReErased (*_2);
// Validate(Acquire, [(*_3): i32/ReScope(Remainder(BlockRemainder { block: ItemLocalId(22), first_statement_index: 0 })) (imm)]); // Validate(Acquire, [(*_3): i32/ReScope(Remainder(BlockRemainder { block: ItemLocalId(25), first_statement_index: 0 })) (imm)]);
// StorageLive(_4); // StorageLive(_4);
// _4 = (*_3); // _4 = (*_3);
// _0 = move _4; // _0 = move _4;
// StorageDead(_4); // StorageDead(_4);
// EndRegion(ReScope(Remainder(BlockRemainder { block: ItemLocalId(22), first_statement_index: 0 }))); // EndRegion(ReScope(Remainder(BlockRemainder { block: ItemLocalId(25), first_statement_index: 0 })));
// StorageDead(_3); // StorageDead(_3);
// return; // return;
// } // }

View file

@ -53,12 +53,12 @@ fn main() {
// StorageLive(_3); // StorageLive(_3);
// StorageLive(_4); // StorageLive(_4);
// StorageLive(_5); // StorageLive(_5);
// Validate(Suspend(ReScope(Node(ItemLocalId(9)))), [(*_2): i32]); // Validate(Suspend(ReScope(Node(ItemLocalId(12)))), [(*_2): i32]);
// _5 = &ReErased mut (*_2); // _5 = &ReErased mut (*_2);
// Validate(Acquire, [(*_5): i32/ReScope(Node(ItemLocalId(9)))]); // Validate(Acquire, [(*_5): i32/ReScope(Node(ItemLocalId(12)))]);
// _4 = move _5 as *mut i32 (Misc); // _4 = move _5 as *mut i32 (Misc);
// _3 = move _4; // _3 = move _4;
// EndRegion(ReScope(Node(ItemLocalId(9)))); // EndRegion(ReScope(Node(ItemLocalId(12))));
// StorageDead(_4); // StorageDead(_4);
// StorageDead(_5); // StorageDead(_5);
// Validate(Release, [_0: bool, _3: *mut i32]); // Validate(Release, [_0: bool, _3: *mut i32]);

View file

@ -26,5 +26,5 @@ fn main() {
std::intrinsics::type_name::<NT>(), std::intrinsics::type_name::<NT>(),
// DST // DST
std::intrinsics::type_name::<DST>() std::intrinsics::type_name::<DST>()
)}, ("[u8]", "str", "std::marker::Send", "NT", "DST")); )}, ("[u8]", "str", "dyn std::marker::Send", "NT", "DST"));
} }

View file

@ -74,7 +74,7 @@ error[E0631]: type mismatch in closure arguments
LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch
| ^^ -------------- found signature of `fn((), ()) -> _` | ^^ -------------- found signature of `fn((), ()) -> _`
| | | |
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _` | expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _`
| |
note: required by `g1` note: required by `g1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:33:1 --> $DIR/anonymous-higher-ranked-lifetime.rs:33:1
@ -102,7 +102,7 @@ error[E0631]: type mismatch in closure arguments
LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch
| ^^ -------------- found signature of `fn((), ()) -> _` | ^^ -------------- found signature of `fn((), ()) -> _`
| | | |
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _` | expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _`
| |
note: required by `g3` note: required by `g3`
--> $DIR/anonymous-higher-ranked-lifetime.rs:35:1 --> $DIR/anonymous-higher-ranked-lifetime.rs:35:1
@ -130,7 +130,7 @@ error[E0631]: type mismatch in closure arguments
LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
| ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
| | | |
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` | expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
| |
note: required by `h1` note: required by `h1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:39:1 --> $DIR/anonymous-higher-ranked-lifetime.rs:39:1
@ -144,7 +144,7 @@ error[E0631]: type mismatch in closure arguments
LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
| ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
| | | |
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` | expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
| |
note: required by `h2` note: required by `h2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:40:1 --> $DIR/anonymous-higher-ranked-lifetime.rs:40:1

View file

@ -13,7 +13,7 @@ LL | let x = Box::new(5usize) as Box<Foo>;
| ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
| |
= note: method `foo` has a non-standard `self` type = note: method `foo` has a non-standard `self` type
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>` = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Foo>>` for `std::boxed::Box<usize>`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -1,4 +1,4 @@
error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send` error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send`
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5 --> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5
| |
LL | &1 as Send; //~ ERROR cast to unsized LL | &1 as Send; //~ ERROR cast to unsized
@ -6,7 +6,7 @@ LL | &1 as Send; //~ ERROR cast to unsized
| | | |
| help: try casting to a reference instead: `&Send` | help: try casting to a reference instead: `&Send`
error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send` error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send`
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5 --> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5
| |
LL | Box::new(1) as Send; //~ ERROR cast to unsized LL | Box::new(1) as Send; //~ ERROR cast to unsized

View file

@ -0,0 +1,17 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
|_: [_; continue]| {}; //~ ERROR: `continue` outside of loop
while |_: [_; continue]| {} {} //~ ERROR: `break` or `continue` with no label
while |_: [_; break]| {} {} //~ ERROR: `break` or `continue` with no label
}

View file

@ -0,0 +1,22 @@
error[E0268]: `continue` outside of loop
--> $DIR/closure-array-break-length.rs:12:13
|
LL | |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop
| ^^^^^^^^ cannot break outside of a loop
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
--> $DIR/closure-array-break-length.rs:14:19
|
LL | while |_: [_; continue]| {} {} //~ ERROR: `break` or `continue` with no label
| ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
--> $DIR/closure-array-break-length.rs:16:19
|
LL | while |_: [_; break]| {} {} //~ ERROR: `break` or `continue` with no label
| ^^^^^ unlabeled `break` in the condition of a `while` loop
error: aborting due to 3 previous errors
Some errors occurred: E0268, E0590.
For more information about an error, try `rustc --explain E0268`.

View file

@ -1,10 +1,10 @@
error[E0277]: the size for value values of type `std::fmt::Debug + std::marker::Sync + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
--> $DIR/const-unsized.rs:13:29 --> $DIR/const-unsized.rs:13:29
| |
LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: constant expressions must have a statically known size = note: constant expressions must have a statically known size
@ -18,13 +18,13 @@ LL | const CONST_FOO: str = *"foo";
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: constant expressions must have a statically known size = note: constant expressions must have a statically known size
error[E0277]: the size for value values of type `std::fmt::Debug + std::marker::Sync + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
--> $DIR/const-unsized.rs:19:31 --> $DIR/const-unsized.rs:19:31
| |
LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync));
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: constant expressions must have a statically known size = note: constant expressions must have a statically known size

View file

@ -92,7 +92,7 @@ error[E0223]: ambiguous associated type
LL | type G = 'static + (Send)::AssocTy; LL | type G = 'static + (Send)::AssocTy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type | ^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
| |
= note: specify the type using the syntax `<std::marker::Send + 'static as Trait>::AssocTy` = note: specify the type using the syntax `<(dyn std::marker::Send + 'static) as Trait>::AssocTy`
error[E0223]: ambiguous associated type error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:43:10 --> $DIR/bad-assoc-ty.rs:43:10
@ -100,7 +100,7 @@ error[E0223]: ambiguous associated type
LL | type H = Fn(u8) -> (u8)::Output; LL | type H = Fn(u8) -> (u8)::Output;
| ^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type | ^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
| |
= note: specify the type using the syntax `<std::ops::Fn(u8) -> u8 + 'static as Trait>::Output` = note: specify the type using the syntax `<(dyn std::ops::Fn(u8) -> u8 + 'static) as Trait>::Output`
error: aborting due to 15 previous errors error: aborting due to 15 previous errors

View file

@ -12,11 +12,11 @@ LL | let trait_obj: &SomeTrait = SomeTrait;
| |
= note: method `foo` has no receiver = note: method `foo` has no receiver
error[E0033]: type `&SomeTrait` cannot be dereferenced error[E0033]: type `&dyn SomeTrait` cannot be dereferenced
--> $DIR/E0033-teach.rs:23:9 --> $DIR/E0033-teach.rs:23:9
| |
LL | let &invalid = trait_obj; LL | let &invalid = trait_obj;
| ^^^^^^^^ type `&SomeTrait` cannot be dereferenced | ^^^^^^^^ type `&dyn SomeTrait` cannot be dereferenced
| |
= note: This error indicates that a pointer to a trait type cannot be implicitly dereferenced by a pattern. Every trait defines a type, but because the size of trait implementors isn't fixed, this type has no compile-time size. Therefore, all accesses to trait types must be through pointers. If you encounter this error you should try to avoid dereferencing the pointer. = note: This error indicates that a pointer to a trait type cannot be implicitly dereferenced by a pattern. Every trait defines a type, but because the size of trait implementors isn't fixed, this type has no compile-time size. Therefore, all accesses to trait types must be through pointers. If you encounter this error you should try to avoid dereferencing the pointer.

View file

@ -12,11 +12,11 @@ LL | let trait_obj: &SomeTrait = SomeTrait;
| |
= note: method `foo` has no receiver = note: method `foo` has no receiver
error[E0033]: type `&SomeTrait` cannot be dereferenced error[E0033]: type `&dyn SomeTrait` cannot be dereferenced
--> $DIR/E0033.rs:21:9 --> $DIR/E0033.rs:21:9
| |
LL | let &invalid = trait_obj; LL | let &invalid = trait_obj;
| ^^^^^^^^ type `&SomeTrait` cannot be dereferenced | ^^^^^^^^ type `&dyn SomeTrait` cannot be dereferenced
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -1,4 +1,4 @@
error[E0558]: export_name attribute has invalid format error[E0558]: `export_name` attribute has invalid format
--> $DIR/E0558.rs:11:1 --> $DIR/E0558.rs:11:1
| |
LL | #[export_name] LL | #[export_name]

View file

@ -0,0 +1,14 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[export_name="\0foo"] //~ ERROR E0648
pub fn bar() {}
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0648]: `export_name` may not contain null characters
--> $DIR/E0648.rs:11:1
|
LL | #[export_name="/0foo"] //~ ERROR E0648
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0648`.

View file

@ -16,7 +16,7 @@ error[E0308]: mismatched types
LL | () //~ ERROR mismatched types LL | () //~ ERROR mismatched types
| ^^ expected struct `std::boxed::Box`, found () | ^^ expected struct `std::boxed::Box`, found ()
| |
= note: expected type `std::boxed::Box<Id<_> + 'static>` = note: expected type `std::boxed::Box<(dyn Id<_> + 'static)>`
found type `()` found type `()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -25,7 +25,7 @@ error[E0308]: mismatched types
LL | () //~ ERROR mismatched types LL | () //~ ERROR mismatched types
| ^^ expected struct `std::boxed::Box`, found () | ^^ expected struct `std::boxed::Box`, found ()
| |
= note: expected type `std::boxed::Box<Id<_> + 'static>` = note: expected type `std::boxed::Box<(dyn Id<_> + 'static)>`
found type `()` found type `()`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -52,7 +52,7 @@ error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]
LL | q as *const [i32]; //~ ERROR cannot cast LL | q as *const [i32]; //~ ERROR cannot cast
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error[E0606]: casting `usize` as `*mut Trait + 'static` is invalid error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
--> $DIR/fat-ptr-cast.rs:32:37 --> $DIR/fat-ptr-cast.rs:32:37
| |
LL | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting LL | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting

View file

@ -98,7 +98,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR
= help: see issue #48214 = help: see issue #48214
= help: add #![feature(trivial_bounds)] to the crate attributes to enable = help: add #![feature(trivial_bounds)] to the crate attributes to enable
error[E0277]: the size for value values of type `A + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn A + 'static)` cannot be known at compilation time
--> $DIR/feature-gate-trivial_bounds.rs:65:1 --> $DIR/feature-gate-trivial_bounds.rs:65:1
| |
LL | / fn unsized_local() where Dst<A>: Sized { //~ ERROR LL | / fn unsized_local() where Dst<A>: Sized { //~ ERROR
@ -106,9 +106,9 @@ LL | | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
LL | | } LL | | }
| |_^ doesn't have a size known at compile-time | |_^ doesn't have a size known at compile-time
| |
= help: within `Dst<A + 'static>`, the trait `std::marker::Sized` is not implemented for `A + 'static` = help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Dst<A + 'static>` = note: required because it appears within the type `Dst<(dyn A + 'static)>`
= help: see issue #48214 = help: see issue #48214
= help: add #![feature(trivial_bounds)] to the crate attributes to enable = help: add #![feature(trivial_bounds)] to the crate attributes to enable

View file

@ -1,11 +1,11 @@
error[E0277]: `*mut std::ops::Fn() + 'static` cannot be shared between threads safely error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
--> $DIR/send-sync.rs:18:5 --> $DIR/send-sync.rs:18:5
| |
LL | send(format_args!("{:?}", c)); //~ ERROR E0277 LL | send(format_args!("{:?}", c)); //~ ERROR E0277
| ^^^^ `*mut std::ops::Fn() + 'static` cannot be shared between threads safely | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
| |
= help: within `[std::fmt::ArgumentV1<'_>]`, the trait `std::marker::Sync` is not implemented for `*mut std::ops::Fn() + 'static` = help: within `[std::fmt::ArgumentV1<'_>]`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)`
= note: required because it appears within the type `std::marker::PhantomData<*mut std::ops::Fn() + 'static>` = note: required because it appears within the type `std::marker::PhantomData<*mut (dyn std::ops::Fn() + 'static)>`
= note: required because it appears within the type `core::fmt::Void` = note: required because it appears within the type `core::fmt::Void`
= note: required because it appears within the type `&core::fmt::Void` = note: required because it appears within the type `&core::fmt::Void`
= note: required because it appears within the type `std::fmt::ArgumentV1<'_>` = note: required because it appears within the type `std::fmt::ArgumentV1<'_>`
@ -18,14 +18,14 @@ note: required by `send`
LL | fn send<T: Send>(_: T) {} LL | fn send<T: Send>(_: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `*mut std::ops::Fn() + 'static` cannot be shared between threads safely error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
--> $DIR/send-sync.rs:19:5 --> $DIR/send-sync.rs:19:5
| |
LL | sync(format_args!("{:?}", c)); //~ ERROR E0277 LL | sync(format_args!("{:?}", c)); //~ ERROR E0277
| ^^^^ `*mut std::ops::Fn() + 'static` cannot be shared between threads safely | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely
| |
= help: within `std::fmt::Arguments<'_>`, the trait `std::marker::Sync` is not implemented for `*mut std::ops::Fn() + 'static` = help: within `std::fmt::Arguments<'_>`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)`
= note: required because it appears within the type `std::marker::PhantomData<*mut std::ops::Fn() + 'static>` = note: required because it appears within the type `std::marker::PhantomData<*mut (dyn std::ops::Fn() + 'static)>`
= note: required because it appears within the type `core::fmt::Void` = note: required because it appears within the type `core::fmt::Void`
= note: required because it appears within the type `&core::fmt::Void` = note: required because it appears within the type `&core::fmt::Void`
= note: required because it appears within the type `std::fmt::ArgumentV1<'_>` = note: required because it appears within the type `std::fmt::ArgumentV1<'_>`

View file

@ -10,8 +10,8 @@ note: first, the lifetime cannot outlive the lifetime 'a as defined on the funct
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) { LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...so that the expression is assignable: = note: ...so that the expression is assignable:
expected std::boxed::Box<std::fmt::Debug> expected std::boxed::Box<dyn std::fmt::Debug>
found std::boxed::Box<std::fmt::Debug + 'a> found std::boxed::Box<(dyn std::fmt::Debug + 'a)>
= note: but, the lifetime must be valid for the static lifetime... = note: but, the lifetime must be valid for the static lifetime...
= note: ...so that the types are compatible: = note: ...so that the types are compatible:
expected StaticTrait expected StaticTrait

View file

@ -13,8 +13,8 @@ LL | | }
| |_____^ | |_____^
= note: ...but the lifetime must also be valid for the static lifetime... = note: ...but the lifetime must also be valid for the static lifetime...
= note: ...so that the method type is compatible with trait: = note: ...so that the method type is compatible with trait:
expected fn(&Struct) -> &Trait + 'static expected fn(&Struct) -> &(dyn Trait + 'static)
found fn(&Struct) -> &Trait found fn(&Struct) -> &dyn Trait
error: aborting due to previous error error: aborting due to previous error

View file

@ -13,10 +13,10 @@ fn main() {
//~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]`
let _bar = Box::new(1_usize) as std::fmt::Debug; let _bar = Box::new(1_usize) as std::fmt::Debug;
//~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug` //~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `dyn std::fmt::Debug`
let _baz = 1_usize as std::fmt::Debug; let _baz = 1_usize as std::fmt::Debug;
//~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug` //~^ ERROR cast to unsized type: `usize` as `dyn std::fmt::Debug`
let _quux = [1_usize, 2] as [usize]; let _quux = [1_usize, 2] as [usize];
//~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]`

View file

@ -10,7 +10,7 @@ help: consider using an implicit coercion to `&[usize]` instead
LL | let _foo = &[1_usize, 2] as [usize]; LL | let _foo = &[1_usize, 2] as [usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0620]: cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug` error[E0620]: cast to unsized type: `std::boxed::Box<usize>` as `dyn std::fmt::Debug`
--> $DIR/issue-17441.rs:15:16 --> $DIR/issue-17441.rs:15:16
| |
LL | let _bar = Box::new(1_usize) as std::fmt::Debug; LL | let _bar = Box::new(1_usize) as std::fmt::Debug;
@ -18,7 +18,7 @@ LL | let _bar = Box::new(1_usize) as std::fmt::Debug;
| | | |
| help: try casting to a `Box` instead: `Box<std::fmt::Debug>` | help: try casting to a `Box` instead: `Box<std::fmt::Debug>`
error[E0620]: cast to unsized type: `usize` as `std::fmt::Debug` error[E0620]: cast to unsized type: `usize` as `dyn std::fmt::Debug`
--> $DIR/issue-17441.rs:18:16 --> $DIR/issue-17441.rs:18:16
| |
LL | let _baz = 1_usize as std::fmt::Debug; LL | let _baz = 1_usize as std::fmt::Debug;

View file

@ -13,7 +13,7 @@ LL | let _ = x
| ^ the trait `Array` cannot be made into an object | ^ the trait `Array` cannot be made into an object
| |
= note: the trait cannot require that `Self : Sized` = note: the trait cannot require that `Self : Sized`
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&Array>` for `&T` = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Array>` for `&T`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -0,0 +1,15 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
enum Foo {
Drop = assert_eq!(1, 1)
}
}

View file

@ -0,0 +1,13 @@
error[E0317]: if may be missing an else clause
--> $DIR/issue-50577.rs:13:16
|
LL | Drop = assert_eq!(1, 1)
| ^^^^^^^^^^^^^^^^ expected (), found isize
|
= note: expected type `()`
found type `isize`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
For more information about this error, try `rustc --explain E0317`.

View file

@ -59,7 +59,7 @@ extern {
pub fn char_type(p: char); //~ ERROR uses type `char` pub fn char_type(p: char); //~ ERROR uses type `char`
pub fn i128_type(p: i128); //~ ERROR uses type `i128` pub fn i128_type(p: i128); //~ ERROR uses type `i128`
pub fn u128_type(p: u128); //~ ERROR uses type `u128` pub fn u128_type(p: u128); //~ ERROR uses type `u128`
pub fn trait_type(p: &Clone); //~ ERROR uses type `std::clone::Clone` pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone`
pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)`
pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)`
pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields

View file

@ -73,10 +73,10 @@ error: `extern` block uses type `u128` which is not FFI-safe: 128-bit integers d
LL | pub fn u128_type(p: u128); //~ ERROR uses type `u128` LL | pub fn u128_type(p: u128); //~ ERROR uses type `u128`
| ^^^^ | ^^^^
error: `extern` block uses type `std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent error: `extern` block uses type `dyn std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent
--> $DIR/lint-ctypes.rs:62:26 --> $DIR/lint-ctypes.rs:62:26
| |
LL | pub fn trait_type(p: &Clone); //~ ERROR uses type `std::clone::Clone` LL | pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone`
| ^^^^^^ | ^^^^^^
error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout

View file

@ -9,8 +9,8 @@ LL | | _ => y,
LL | | }; LL | | };
| |_____^ expected bound lifetime parameter 'a, found concrete lifetime | |_____^ expected bound lifetime parameter 'a, found concrete lifetime
| |
= note: expected type `&for<'a, 'b> Foo<&'a u8, &'b u8>` = note: expected type `&dyn for<'a, 'b> Foo<&'a u8, &'b u8>`
found type `&for<'a> Foo<&'a u8, &'a u8>` found type `&dyn for<'a> Foo<&'a u8, &'a u8>`
= note: this was previously accepted by the compiler but has been phased out = note: this was previously accepted by the compiler but has been phased out
= note: for more information, see https://github.com/rust-lang/rust/issues/45852 = note: for more information, see https://github.com/rust-lang/rust/issues/45852

View file

@ -162,13 +162,13 @@ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
LL | let _ = v as *const [u8]; //~ ERROR cannot cast LL | let _ = v as *const [u8]; //~ ERROR cannot cast
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error[E0606]: casting `&Foo` as `*const str` is invalid error[E0606]: casting `&dyn Foo` as `*const str` is invalid
--> $DIR/cast-rfc0401.rs:64:13 --> $DIR/cast-rfc0401.rs:64:13
| |
LL | let _ = foo as *const str; //~ ERROR is invalid LL | let _ = foo as *const str; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error[E0606]: casting `&Foo` as `*mut str` is invalid error[E0606]: casting `&dyn Foo` as `*mut str` is invalid
--> $DIR/cast-rfc0401.rs:65:13 --> $DIR/cast-rfc0401.rs:65:13
| |
LL | let _ = foo as *mut str; //~ ERROR is invalid LL | let _ = foo as *mut str; //~ ERROR is invalid
@ -200,7 +200,7 @@ LL | let _ = fat_sv as usize; //~ ERROR is invalid
| |
= help: cast through a thin pointer first = help: cast through a thin pointer first
error[E0606]: casting `*const Foo` as `*const [u16]` is invalid error[E0606]: casting `*const dyn Foo` as `*const [u16]` is invalid
--> $DIR/cast-rfc0401.rs:78:13 --> $DIR/cast-rfc0401.rs:78:13
| |
LL | let _ = cf as *const [u16]; //~ ERROR is invalid LL | let _ = cf as *const [u16]; //~ ERROR is invalid
@ -208,7 +208,7 @@ LL | let _ = cf as *const [u16]; //~ ERROR is invalid
| |
= note: vtable kinds may not match = note: vtable kinds may not match
error[E0606]: casting `*const Foo` as `*const Bar` is invalid error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid
--> $DIR/cast-rfc0401.rs:79:13 --> $DIR/cast-rfc0401.rs:79:13
| |
LL | let _ = cf as *const Bar; //~ ERROR is invalid LL | let _ = cf as *const Bar; //~ ERROR is invalid
@ -224,7 +224,7 @@ LL | let _ = fat_v as *const Foo; //~ ERROR the size for value values of typ
| |
= help: the trait `std::marker::Sized` is not implemented for `[u8]` = help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required for the cast to the object type `Foo` = note: required for the cast to the object type `dyn Foo`
error[E0277]: the size for value values of type `str` cannot be known at compilation time error[E0277]: the size for value values of type `str` cannot be known at compilation time
--> $DIR/cast-rfc0401.rs:72:13 --> $DIR/cast-rfc0401.rs:72:13
@ -234,7 +234,7 @@ LL | let _ = a as *const Foo; //~ ERROR the size for value values of type
| |
= help: the trait `std::marker::Sized` is not implemented for `str` = help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required for the cast to the object type `Foo` = note: required for the cast to the object type `dyn Foo`
error[E0606]: casting `&{float}` as `f32` is invalid error[E0606]: casting `&{float}` as `f32` is invalid
--> $DIR/cast-rfc0401.rs:81:30 --> $DIR/cast-rfc0401.rs:81:30

View file

@ -2,12 +2,12 @@ error[E0308]: mismatched types
--> $DIR/issue-19109.rs:14:5 --> $DIR/issue-19109.rs:14:5
| |
LL | fn function(t: &mut Trait) { LL | fn function(t: &mut Trait) {
| - help: try adding a return type: `-> *mut Trait` | - help: try adding a return type: `-> *mut dyn Trait`
LL | t as *mut Trait LL | t as *mut Trait
| ^^^^^^^^^^^^^^^ expected (), found *-ptr | ^^^^^^^^^^^^^^^ expected (), found *-ptr
| |
= note: expected type `()` = note: expected type `()`
found type `*mut Trait` found type `*mut dyn Trait`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0308]: mismatched types
LL | a(x); //~ ERROR mismatched types [E0308] LL | a(x); //~ ERROR mismatched types [E0308]
| ^ expected trait `Foo + std::marker::Send`, found trait `Foo` | ^ expected trait `Foo + std::marker::Send`, found trait `Foo`
| |
= note: expected type `std::boxed::Box<Foo + std::marker::Send + 'static>` = note: expected type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>`
found type `std::boxed::Box<Foo + 'static>` found type `std::boxed::Box<(dyn Foo + 'static)>`
error: aborting due to previous error error: aborting due to previous error

View file

@ -20,7 +20,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
'_#1r, '_#1r,
T, T,
i32, i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#2r> extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>
] ]
= note: number of external vids: 3 = note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '_#2r = note: where <T as std::iter::Iterator>::Item: '_#2r
@ -60,7 +60,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
'_#1r, '_#1r,
T, T,
i32, i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#2r> extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>
] ]
= note: number of external vids: 3 = note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '_#2r = note: where <T as std::iter::Iterator>::Item: '_#2r
@ -92,7 +92,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
'_#2r, '_#2r,
T, T,
i32, i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r> extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>
] ]
= note: number of external vids: 4 = note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r = note: where <T as std::iter::Iterator>::Item: '_#3r
@ -134,7 +134,7 @@ LL | with_signature(x, |mut y| Box::new(y.next()))
'_#2r, '_#2r,
T, T,
i32, i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r> extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>
] ]
= note: number of external vids: 4 = note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r = note: where <T as std::iter::Iterator>::Item: '_#3r

View file

@ -20,7 +20,7 @@ LL | with_signature(x, |y| y)
'_#1r, '_#1r,
T, T,
i32, i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<std::fmt::Debug + '_#2r> extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>
] ]
= note: number of external vids: 3 = note: number of external vids: 3
= note: where T: '_#2r = note: where T: '_#2r

View file

@ -1,10 +1,10 @@
error[E0277]: the size for value values of type `I + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn I + 'static)` cannot be known at compilation time
--> $DIR/issue-5035-2.rs:14:8 --> $DIR/issue-5035-2.rs:14:8
| |
LL | fn foo(_x: K) {} LL | fn foo(_x: K) {}
| ^^ doesn't have a size known at compile-time | ^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `I + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: all local variables must have a statically known size = note: all local variables must have a statically known size

View file

@ -2,7 +2,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
--> $DIR/borrowck-object-mutability.rs:19:5 --> $DIR/borrowck-object-mutability.rs:19:5
| |
LL | fn borrowed_receiver(x: &Foo) { LL | fn borrowed_receiver(x: &Foo) {
| ---- help: consider changing this to be a mutable reference: `&mut Foo` | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo`
LL | x.borrowed(); LL | x.borrowed();
LL | x.borrowed_mut(); //~ ERROR cannot borrow LL | x.borrowed_mut(); //~ ERROR cannot borrow
| ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable

View file

@ -75,7 +75,7 @@ LL | w.wrap.not_closure();
| |
= help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`? = help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`?
error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<std::boxed::FnBox<(), Output=u32> + 'static>>` in the current scope error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<(dyn std::boxed::FnBox<(), Output=u32> + 'static)>>` in the current scope
--> $DIR/issue-2392.rs:72:24 --> $DIR/issue-2392.rs:72:24
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {

View file

@ -6,7 +6,7 @@ LL | struct S(str, str) where str: Sized;
| |
= note: #[warn(trivial_bounds)] on by default = note: #[warn(trivial_bounds)] on by default
warning: Trait bound for<'a> T<A + 'a>: std::marker::Sized does not depend on any type or lifetime parameters warning: Trait bound for<'a> T<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent-sized.rs:26:1 --> $DIR/trivial-bounds-inconsistent-sized.rs:26:1
| |
LL | / fn unsized_local() where for<'a> T<A + 'a>: Sized { LL | / fn unsized_local() where for<'a> T<A + 'a>: Sized {

View file

@ -78,7 +78,7 @@ warning: Trait bound str: std::marker::Sized does not depend on any type or life
LL | struct TwoStrs(str, str) where str: Sized; LL | struct TwoStrs(str, str) where str: Sized;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: Trait bound for<'a> Dst<A + 'a>: std::marker::Sized does not depend on any type or lifetime parameters warning: Trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent.rs:65:1 --> $DIR/trivial-bounds-inconsistent.rs:65:1
| |
LL | / fn unsized_local() where for<'a> Dst<A + 'a>: Sized { LL | / fn unsized_local() where for<'a> Dst<A + 'a>: Sized {

View file

@ -19,8 +19,8 @@ LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
| ^^^^^ | ^^^^^
= note: but, the lifetime must be valid for the static lifetime... = note: but, the lifetime must be valid for the static lifetime...
= note: ...so that the expression is assignable: = note: ...so that the expression is assignable:
expected std::boxed::Box<std::iter::Iterator<Item=&T> + 'static> expected std::boxed::Box<(dyn std::iter::Iterator<Item=&T> + 'static)>
found std::boxed::Box<std::iter::Iterator<Item=&T>> found std::boxed::Box<dyn std::iter::Iterator<Item=&T>>
error: aborting due to previous error error: aborting due to previous error

View file

@ -82,43 +82,43 @@ LL | VH{u: isize, x: [u32]},
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `Foo + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn Foo + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:63:8 --> $DIR/unsized-enum2.rs:63:8
| |
LL | VM(Foo), LL | VM(Foo),
| ^^^ doesn't have a size known at compile-time | ^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `Bar + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn Bar + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:65:8 --> $DIR/unsized-enum2.rs:65:8
| |
LL | VN{x: Bar}, LL | VN{x: Bar},
| ^^^^^^ doesn't have a size known at compile-time | ^^^^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `FooBar + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn FooBar + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:67:15 --> $DIR/unsized-enum2.rs:67:15
| |
LL | VO(isize, FooBar), LL | VO(isize, FooBar),
| ^^^^^^ doesn't have a size known at compile-time | ^^^^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `BarFoo + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn BarFoo + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:69:18 --> $DIR/unsized-enum2.rs:69:18
| |
LL | VP{u: isize, x: BarFoo}, LL | VP{u: isize, x: BarFoo},
| ^^^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
@ -162,46 +162,46 @@ LL | VT{u: isize, x: <&'static [i32] as Deref>::Target},
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `PathHelper1 + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:53:8 --> $DIR/unsized-enum2.rs:53:8
| |
LL | VI(Path1), LL | VI(Path1),
| ^^^^^ doesn't have a size known at compile-time | ^^^^^ doesn't have a size known at compile-time
| |
= help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static` = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper1 + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Path1` = note: required because it appears within the type `Path1`
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `PathHelper2 + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:55:8 --> $DIR/unsized-enum2.rs:55:8
| |
LL | VJ{x: Path2}, LL | VJ{x: Path2},
| ^^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^^ doesn't have a size known at compile-time
| |
= help: within `Path2`, the trait `std::marker::Sized` is not implemented for `PathHelper2 + 'static` = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper2 + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Path2` = note: required because it appears within the type `Path2`
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `PathHelper3 + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:57:15 --> $DIR/unsized-enum2.rs:57:15
| |
LL | VK(isize, Path3), LL | VK(isize, Path3),
| ^^^^^ doesn't have a size known at compile-time | ^^^^^ doesn't have a size known at compile-time
| |
= help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static` = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper3 + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Path3` = note: required because it appears within the type `Path3`
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type
error[E0277]: the size for value values of type `PathHelper4 + 'static` cannot be known at compilation time error[E0277]: the size for value values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time
--> $DIR/unsized-enum2.rs:59:18 --> $DIR/unsized-enum2.rs:59:18
| |
LL | VL{u: isize, x: Path4}, LL | VL{u: isize, x: Path4},
| ^^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^^ doesn't have a size known at compile-time
| |
= help: within `Path4`, the trait `std::marker::Sized` is not implemented for `PathHelper4 + 'static` = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper4 + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Path4` = note: required because it appears within the type `Path4`
= note: no field of an enum variant may have a dynamically sized type = note: no field of an enum variant may have a dynamically sized type