Auto merge of #65209 - Centril:rollup-tzc0j87, r=Centril
Rollup of 8 pull requests Successful merges: - #64404 (Add long error explanation for E0495) - #64918 (Add long error explanation for E0551) - #65102 (Disable stack probe when thread sanitizer is enabled) - #65120 (Correctly estimate the required space for string in `StyledBuffer::prepend`) - #65145 (When suggesting assoc function with type params, include turbofish) - #65162 (Remove loaded_from_cache map from DepGraph) - #65176 (Remove query-related macros) - #65179 (Add long error explanation for E0567) Failed merges: r? @ghost
This commit is contained in:
commit
2748a9fd93
60 changed files with 267 additions and 92 deletions
|
|
@ -75,9 +75,6 @@ struct DepGraphData {
|
|||
previous_work_products: FxHashMap<WorkProductId, WorkProduct>,
|
||||
|
||||
dep_node_debug: Lock<FxHashMap<DepNode, String>>,
|
||||
|
||||
// Used for testing, only populated when -Zquery-dep-graph is specified.
|
||||
loaded_from_cache: Lock<FxHashMap<DepNodeIndex, bool>>,
|
||||
}
|
||||
|
||||
pub fn hash_result<R>(hcx: &mut StableHashingContext<'_>, result: &R) -> Option<Fingerprint>
|
||||
|
|
@ -104,7 +101,6 @@ impl DepGraph {
|
|||
emitting_diagnostics_cond_var: Condvar::new(),
|
||||
previous: prev_graph,
|
||||
colors: DepNodeColorMap::new(prev_graph_node_count),
|
||||
loaded_from_cache: Default::default(),
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
|
@ -874,25 +870,6 @@ impl DepGraph {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mark_loaded_from_cache(&self, dep_node_index: DepNodeIndex, state: bool) {
|
||||
debug!("mark_loaded_from_cache({:?}, {})",
|
||||
self.data.as_ref().unwrap().current.borrow().data[dep_node_index].node,
|
||||
state);
|
||||
|
||||
self.data
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.loaded_from_cache
|
||||
.borrow_mut()
|
||||
.insert(dep_node_index, state);
|
||||
}
|
||||
|
||||
pub fn was_loaded_from_cache(&self, dep_node: &DepNode) -> Option<bool> {
|
||||
let data = self.data.as_ref().unwrap();
|
||||
let dep_node_index = data.current.borrow().node_to_node_index[dep_node];
|
||||
data.loaded_from_cache.borrow().get(&dep_node_index).cloned()
|
||||
}
|
||||
}
|
||||
|
||||
/// A "work product" is an intermediate result that we save into the
|
||||
|
|
|
|||
|
|
@ -1520,6 +1520,47 @@ where
|
|||
```
|
||||
"##,
|
||||
|
||||
E0495: r##"
|
||||
A lifetime cannot be determined in the given situation.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0495
|
||||
fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
|
||||
match (&t,) { // error!
|
||||
((u,),) => u,
|
||||
}
|
||||
}
|
||||
|
||||
let y = Box::new((42,));
|
||||
let x = transmute_lifetime(&y);
|
||||
```
|
||||
|
||||
In this code, you have two ways to solve this issue:
|
||||
1. Enforce that `'a` lives at least as long as `'b`.
|
||||
2. Use the same lifetime requirement for both input and output values.
|
||||
|
||||
So for the first solution, you can do it by replacing `'a` with `'a: 'b`:
|
||||
|
||||
```
|
||||
fn transmute_lifetime<'a: 'b, 'b, T>(t: &'a (T,)) -> &'b T {
|
||||
match (&t,) { // ok!
|
||||
((u,),) => u,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the second you can do it by simply removing `'b` so they both use `'a`:
|
||||
|
||||
```
|
||||
fn transmute_lifetime<'a, T>(t: &'a (T,)) -> &'a T {
|
||||
match (&t,) { // ok!
|
||||
((u,),) => u,
|
||||
}
|
||||
}
|
||||
```
|
||||
"##,
|
||||
|
||||
E0496: r##"
|
||||
A lifetime name is shadowing another lifetime name. Erroneous code example:
|
||||
|
||||
|
|
@ -2116,8 +2157,6 @@ rejected in your own crates.
|
|||
E0488, // lifetime of variable does not enclose its declaration
|
||||
E0489, // type/lifetime parameter not in scope here
|
||||
E0490, // a value of type `..` is borrowed for too long
|
||||
E0495, // cannot infer an appropriate lifetime due to conflicting
|
||||
// requirements
|
||||
E0623, // lifetime mismatch where both parameters are anonymous regions
|
||||
E0628, // generators cannot have explicit parameters
|
||||
E0631, // type mismatch in closure arguments
|
||||
|
|
|
|||
|
|
@ -489,10 +489,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self.incremental_verify_ich::<Q>(&result, dep_node, dep_node_index);
|
||||
}
|
||||
|
||||
if unlikely!(self.sess.opts.debugging_opts.query_dep_graph) {
|
||||
self.dep_graph.mark_loaded_from_cache(dep_node_index, true);
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
|
|
@ -570,10 +566,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
drop(prof_timer);
|
||||
profq_msg!(self, ProfileQueriesMsg::ProviderEnd);
|
||||
|
||||
if unlikely!(self.sess.opts.debugging_opts.query_dep_graph) {
|
||||
self.dep_graph.mark_loaded_from_cache(dep_node_index, false);
|
||||
}
|
||||
|
||||
if unlikely!(!diagnostics.is_empty()) {
|
||||
if dep_node.kind != crate::dep_graph::DepKind::Null {
|
||||
self.queries.on_disk_cache
|
||||
|
|
@ -1191,37 +1183,6 @@ pub fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool {
|
|||
return false
|
||||
}
|
||||
|
||||
macro_rules! def_id {
|
||||
() => {
|
||||
if let Some(def_id) = dep_node.extract_def_id(tcx) {
|
||||
def_id
|
||||
} else {
|
||||
// Return from the whole function.
|
||||
return false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
macro_rules! krate {
|
||||
() => { (def_id!()).krate }
|
||||
};
|
||||
|
||||
macro_rules! force_ex {
|
||||
($tcx:expr, $query:ident, $key:expr) => {
|
||||
{
|
||||
$tcx.force_query::<crate::ty::query::queries::$query<'_>>(
|
||||
$key,
|
||||
DUMMY_SP,
|
||||
*dep_node
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
macro_rules! force {
|
||||
($query:ident, $key:expr) => { force_ex!(tcx, $query, $key) }
|
||||
};
|
||||
|
||||
rustc_dep_node_force!([dep_node, tcx]
|
||||
// These are inputs that are expected to be pre-allocated and that
|
||||
// should therefore always be red or green already.
|
||||
|
|
@ -1240,7 +1201,19 @@ pub fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool {
|
|||
bug!("force_from_dep_node: encountered {:?}", dep_node)
|
||||
}
|
||||
|
||||
DepKind::Analysis => { force!(analysis, krate!()); }
|
||||
DepKind::Analysis => {
|
||||
let def_id = if let Some(def_id) = dep_node.extract_def_id(tcx) {
|
||||
def_id
|
||||
} else {
|
||||
// Return from the whole function.
|
||||
return false
|
||||
};
|
||||
tcx.force_query::<crate::ty::query::queries::analysis<'_>>(
|
||||
def_id.krate,
|
||||
DUMMY_SP,
|
||||
*dep_node
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
true
|
||||
|
|
|
|||
|
|
@ -96,10 +96,12 @@ pub fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
|
|||
}
|
||||
|
||||
// Currently stack probes seem somewhat incompatible with the address
|
||||
// sanitizer. With asan we're already protected from stack overflow anyway
|
||||
// so we don't really need stack probes regardless.
|
||||
if let Some(Sanitizer::Address) = cx.sess().opts.debugging_opts.sanitizer {
|
||||
return
|
||||
// sanitizer and thread sanitizer. With asan we're already protected from
|
||||
// stack overflow anyway so we don't really need stack probes regardless.
|
||||
match cx.sess().opts.debugging_opts.sanitizer {
|
||||
Some(Sanitizer::Address) |
|
||||
Some(Sanitizer::Thread) => return,
|
||||
_ => {},
|
||||
}
|
||||
|
||||
// probestack doesn't play nice either with `-C profile-generate`.
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ impl StyledBuffer {
|
|||
|
||||
pub fn prepend(&mut self, line: usize, string: &str, style: Style) {
|
||||
self.ensure_lines(line);
|
||||
let string_len = string.len();
|
||||
let string_len = string.chars().count();
|
||||
|
||||
// Push the old content over to make room for new content
|
||||
for _ in 0..string_len {
|
||||
|
|
|
|||
|
|
@ -495,7 +495,11 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
|
|||
dep_node_force_stream.extend(quote! {
|
||||
DepKind::#name => {
|
||||
if let Some(key) = RecoverKey::recover($tcx, $dep_node) {
|
||||
force_ex!($tcx, #name, key);
|
||||
$tcx.force_query::<crate::ty::query::queries::#name<'_>>(
|
||||
key,
|
||||
DUMMY_SP,
|
||||
*$dep_node
|
||||
);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,6 +314,34 @@ type A3 = fn(i16); // ok!
|
|||
```
|
||||
"##,
|
||||
|
||||
E0567: r##"
|
||||
Generics have been used on an auto trait.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0567
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
||||
auto trait Generic<T> {} // error!
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
|
||||
Since an auto trait is implemented on all existing types, the
|
||||
compiler would not be able to infer the types of the trait's generic
|
||||
parameters.
|
||||
|
||||
To fix this issue, just remove the generics:
|
||||
|
||||
```
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
||||
auto trait Generic {} // ok!
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
"##,
|
||||
|
||||
E0571: r##"
|
||||
A `break` statement with an argument appeared in a non-`loop` loop.
|
||||
|
||||
|
|
@ -531,7 +559,6 @@ Switch to the Rust 2018 edition to use `async fn`.
|
|||
;
|
||||
E0226, // only a single explicit lifetime bound is permitted
|
||||
E0472, // asm! is unsupported on this target
|
||||
E0567, // auto traits can not have generic parameters
|
||||
E0568, // auto traits can not have super traits
|
||||
E0666, // nested `impl Trait` is illegal
|
||||
E0667, // `impl Trait` in projections
|
||||
|
|
|
|||
|
|
@ -461,16 +461,36 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
err.span_label(span, "this is an associated function, not a method");
|
||||
}
|
||||
if static_sources.len() == 1 {
|
||||
if let SelfSource::MethodCall(expr) = source {
|
||||
err.span_suggestion(expr.span.to(span),
|
||||
"use associated function syntax instead",
|
||||
format!("{}::{}",
|
||||
self.ty_to_string(actual),
|
||||
item_name),
|
||||
Applicability::MachineApplicable);
|
||||
let ty_str = if let Some(CandidateSource::ImplSource(
|
||||
impl_did,
|
||||
)) = static_sources.get(0) {
|
||||
// When the "method" is resolved through dereferencing, we really want the
|
||||
// original type that has the associated function for accurate suggestions.
|
||||
// (#61411)
|
||||
let ty = self.impl_self_ty(span, *impl_did).ty;
|
||||
match (&ty.peel_refs().kind, &actual.peel_refs().kind) {
|
||||
(ty::Adt(def, _), ty::Adt(def_actual, _)) if def == def_actual => {
|
||||
// Use `actual` as it will have more `substs` filled in.
|
||||
self.ty_to_value_string(actual.peel_refs())
|
||||
}
|
||||
_ => self.ty_to_value_string(ty.peel_refs()),
|
||||
}
|
||||
} else {
|
||||
err.help(&format!("try with `{}::{}`",
|
||||
self.ty_to_string(actual), item_name));
|
||||
self.ty_to_value_string(actual.peel_refs())
|
||||
};
|
||||
if let SelfSource::MethodCall(expr) = source {
|
||||
err.span_suggestion(
|
||||
expr.span.to(span),
|
||||
"use associated function syntax instead",
|
||||
format!("{}::{}", ty_str, item_name),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else {
|
||||
err.help(&format!(
|
||||
"try with `{}::{}`",
|
||||
ty_str,
|
||||
item_name,
|
||||
));
|
||||
}
|
||||
|
||||
report_candidates(span, &mut err, static_sources);
|
||||
|
|
@ -586,6 +606,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
None
|
||||
}
|
||||
|
||||
/// Print out the type for use in value namespace.
|
||||
fn ty_to_value_string(&self, ty: Ty<'tcx>) -> String {
|
||||
match ty.kind {
|
||||
ty::Adt(def, substs) => format!("{}", ty::Instance::new(def.did, substs)),
|
||||
_ => self.ty_to_string(ty),
|
||||
}
|
||||
}
|
||||
|
||||
fn suggest_use_candidates(&self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
mut msg: String,
|
||||
|
|
|
|||
|
|
@ -163,6 +163,25 @@ fn the_banished() {} // ok!
|
|||
```
|
||||
"##,
|
||||
|
||||
E0551: r##"
|
||||
An invalid meta-item was used inside an attribute.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0551
|
||||
#[deprecated(note)] // error!
|
||||
fn i_am_deprecated() {}
|
||||
```
|
||||
|
||||
Meta items are the key-value pairs inside of an attribute. To fix this issue,
|
||||
you need to give a value to the `note` key. Example:
|
||||
|
||||
```
|
||||
#[deprecated(note = "because")] // ok!
|
||||
fn i_am_deprecated() {}
|
||||
```
|
||||
"##,
|
||||
|
||||
E0552: r##"
|
||||
A unrecognized representation attribute was used.
|
||||
|
||||
|
|
@ -473,7 +492,6 @@ features in the `-Z allow_features` flag.
|
|||
// rustc_deprecated attribute must be paired with either stable or unstable
|
||||
// attribute
|
||||
E0549,
|
||||
E0551, // incorrect meta item
|
||||
E0553, // multiple rustc_const_unstable attributes
|
||||
// E0555, // replaced with a generic attribute input check
|
||||
E0584, // file for module `..` found at both .. and ..
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ LL | bar(foo, x)
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -19,3 +19,4 @@ LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -18,4 +18,5 @@ LL | auto trait MyTrait { fn foo() {} }
|
|||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0380`.
|
||||
Some errors have detailed explanations: E0380, E0567.
|
||||
For more information about an error, try `rustc --explain E0380`.
|
||||
|
|
|
|||
|
|
@ -209,4 +209,5 @@ LL | | }
|
|||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Some errors have detailed explanations: E0308, E0495.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -54,5 +54,5 @@ LL | #[deprecated(since = "a", since = "b", note = "c")]
|
|||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0538, E0541, E0550, E0565.
|
||||
Some errors have detailed explanations: E0538, E0541, E0550, E0551, E0565.
|
||||
For more information about an error, try `rustc --explain E0538`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | invoke(&x, |a, b| if a > b { a } else { b });
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -19,3 +19,4 @@ LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -18,3 +18,4 @@ LL | | }
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -22,3 +22,4 @@ LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@ LL | x
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | trait T<'a> {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@ LL | trait Foo<'a> {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -94,4 +94,5 @@ LL | impl<'a> Publisher<'a> for MyStruct<'a> {
|
|||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Some errors have detailed explanations: E0308, E0495.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | self.boom();
|
|||
| -----^^^^
|
||||
| | |
|
||||
| | this is an associated function, not a method
|
||||
| help: use associated function syntax instead: `&Obj::boom`
|
||||
| help: use associated function syntax instead: `Obj::boom`
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
note: the candidate is defined in an impl for the type `Obj`
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ LL | ((u,),) => u,
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -42,3 +42,4 @@ LL | Box::new(self.in_edges(u).map(|e| e.target()))
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | impl Foo<'_> {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -20,3 +20,4 @@ LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -50,3 +50,4 @@ LL | impl<'a> FromTuple<'a> for C<'a> {
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ LL | <Foo<'a>>::C
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ LL | T::C
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -50,3 +50,4 @@ LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | x.borrowed()
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | x.borrowed()
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -48,4 +48,5 @@ LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
|
|||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
Some errors have detailed explanations: E0495, E0621.
|
||||
For more information about an error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -26,3 +26,4 @@ LL | let p: &'static mut usize = &mut self.cats_chased;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ LL | let p: &'static mut usize = &mut self.food;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -46,3 +46,4 @@ LL | impl<'a,'b> Foo<'b> for &'a i64 {
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ LL | impl<'a> Foo for &'a i32 {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ LL | box B(&*v) as Box<dyn X>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ LL | box B(&*v) as Box<dyn X>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait +
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ LL | s.f(|p| p)
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ LL | with(|o| o)
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -30,3 +30,4 @@ LL | | }
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | let z = with(|y| { select(x, y) });
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -57,4 +57,5 @@ LL | fn nested<'x>(x: &'x isize) {
|
|||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0312`.
|
||||
Some errors have detailed explanations: E0312, E0495.
|
||||
For more information about an error, try `rustc --explain E0312`.
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ LL | fn bar<'a, 'b>()
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ LL | with(|o| o)
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ LL | with(|o| o)
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ LL | let y = f();
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -61,5 +61,5 @@ LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dum
|
|||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0478.
|
||||
Some errors have detailed explanations: E0308, E0478, E0495.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -111,5 +111,5 @@ LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
|
|||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0366, E0367.
|
||||
Some errors have detailed explanations: E0308, E0366, E0367, E0495.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
use std::cell::RefCell;
|
||||
|
||||
struct HasAssocMethod;
|
||||
|
||||
impl HasAssocMethod {
|
||||
fn hello() {}
|
||||
}
|
||||
fn main() {
|
||||
let shared_state = RefCell::new(HasAssocMethod);
|
||||
let state = shared_state.borrow_mut();
|
||||
state.hello();
|
||||
//~^ ERROR no method named `hello` found for type `std::cell::RefMut<'_, HasAssocMethod>`
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
error[E0599]: no method named `hello` found for type `std::cell::RefMut<'_, HasAssocMethod>` in the current scope
|
||||
--> $DIR/suggest-assoc-fn-call-with-turbofish-through-deref.rs:11:11
|
||||
|
|
||||
LL | state.hello();
|
||||
| ------^^^^^
|
||||
| | |
|
||||
| | this is an associated function, not a method
|
||||
| help: use associated function syntax instead: `HasAssocMethod::hello`
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
note: the candidate is defined in an impl for the type `HasAssocMethod`
|
||||
--> $DIR/suggest-assoc-fn-call-with-turbofish-through-deref.rs:6:5
|
||||
|
|
||||
LL | fn hello() {}
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
struct GenericAssocMethod<T>(T);
|
||||
|
||||
impl<T> GenericAssocMethod<T> {
|
||||
fn default_hello() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = GenericAssocMethod(33i32);
|
||||
x.default_hello();
|
||||
//~^ ERROR no method named `default_hello` found for type `GenericAssocMethod<i32>`
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
error[E0599]: no method named `default_hello` found for type `GenericAssocMethod<i32>` in the current scope
|
||||
--> $DIR/suggest-assoc-fn-call-with-turbofish.rs:9:7
|
||||
|
|
||||
LL | struct GenericAssocMethod<T>(T);
|
||||
| -------------------------------- method `default_hello` not found for this
|
||||
...
|
||||
LL | x.default_hello();
|
||||
| --^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | this is an associated function, not a method
|
||||
| help: use associated function syntax instead: `GenericAssocMethod::<i32>::default_hello`
|
||||
|
|
||||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
|
||||
note: the candidate is defined in an impl for the type `GenericAssocMethod<_>`
|
||||
--> $DIR/suggest-assoc-fn-call-with-turbofish.rs:4:5
|
||||
|
|
||||
LL | fn default_hello() {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
|
|
@ -20,3 +20,4 @@ LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -24,3 +24,4 @@ LL | Box::new(items.iter())
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0495`.
|
||||
|
|
|
|||
|
|
@ -105,5 +105,5 @@ LL | <IndirectEvil>::static_evil(b)
|
|||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0312, E0478.
|
||||
Some errors have detailed explanations: E0312, E0478, E0495.
|
||||
For more information about an error, try `rustc --explain E0312`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue