Skip to content

Rollup of 5 pull requests #116112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 10 additions & 33 deletions compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
Original file line number Diff line number Diff line change
@@ -158,16 +158,15 @@ fn calculate_debuginfo_offset<
L: DebugInfoOffsetLocation<'tcx, Bx>,
>(
bx: &mut Bx,
local: mir::Local,
var: &PerLocalVarDebugInfo<'tcx, Bx::DIVariable>,
projection: &[mir::PlaceElem<'tcx>],
base: L,
) -> DebugInfoOffset<L> {
let mut direct_offset = Size::ZERO;
// FIXME(eddyb) use smallvec here.
let mut indirect_offsets = vec![];
let mut place = base;

for elem in &var.projection[..] {
for elem in projection {
match *elem {
mir::ProjectionElem::Deref => {
indirect_offsets.push(Size::ZERO);
@@ -188,23 +187,15 @@ fn calculate_debuginfo_offset<
} => {
let offset = indirect_offsets.last_mut().unwrap_or(&mut direct_offset);
let FieldsShape::Array { stride, count: _ } = place.layout().fields else {
span_bug!(
var.source_info.span,
"ConstantIndex on non-array type {:?}",
place.layout()
)
bug!("ConstantIndex on non-array type {:?}", place.layout())
};
*offset += stride * index;
place = place.project_constant_index(bx, index);
}
_ => {
// Sanity check for `can_use_in_debuginfo`.
debug_assert!(!elem.can_use_in_debuginfo());
span_bug!(
var.source_info.span,
"unsupported var debuginfo place `{:?}`",
mir::Place { local, projection: var.projection },
)
bug!("unsupported var debuginfo projection `{:?}`", projection)
}
}
}
@@ -407,7 +398,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let Some(dbg_loc) = self.dbg_loc(var.source_info) else { return };

let DebugInfoOffset { direct_offset, indirect_offsets, result: _ } =
calculate_debuginfo_offset(bx, local, &var, base.layout);
calculate_debuginfo_offset(bx, &var.projection, base.layout);

// When targeting MSVC, create extra allocas for arguments instead of pointing multiple
// dbg_var_addr() calls into the same alloca with offsets. MSVC uses CodeView records
@@ -425,7 +416,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {

if should_create_individual_allocas {
let DebugInfoOffset { direct_offset: _, indirect_offsets: _, result: place } =
calculate_debuginfo_offset(bx, local, &var, base);
calculate_debuginfo_offset(bx, &var.projection, base);

// Create a variable which will be a pointer to the actual value
let ptr_ty = Ty::new_ptr(
@@ -532,23 +523,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let fragment = if let Some(ref fragment) = var.composite {
let var_layout = self.cx.layout_of(var_ty);

let mut fragment_start = Size::ZERO;
let mut fragment_layout = var_layout;

for elem in &fragment.projection {
match *elem {
mir::ProjectionElem::Field(field, _) => {
let i = field.index();
fragment_start += fragment_layout.fields.offset(i);
fragment_layout = fragment_layout.field(self.cx, i);
}
_ => span_bug!(
var.source_info.span,
"unsupported fragment projection `{:?}`",
elem,
),
}
}
let DebugInfoOffset { direct_offset, indirect_offsets, result: fragment_layout } =
calculate_debuginfo_offset(bx, &fragment.projection, var_layout);
debug_assert!(indirect_offsets.is_empty());

if fragment_layout.size == Size::ZERO {
// Fragment is a ZST, so does not represent anything. Avoid generating anything
@@ -559,7 +536,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// DWARF is concerned, it's not really a fragment.
None
} else {
Some(fragment_start..fragment_start + fragment_layout.size)
Some(direct_offset..direct_offset + fragment_layout.size)
}
} else {
None
5 changes: 4 additions & 1 deletion compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
@@ -1134,7 +1134,10 @@ fn report_trait_method_mismatch<'tcx>(
&mut diag,
&cause,
trait_err_span.map(|sp| (sp, Cow::from("type in trait"))),
Some(infer::ValuePairs::Sigs(ExpectedFound { expected: trait_sig, found: impl_sig })),
Some(infer::ValuePairs::PolySigs(ExpectedFound {
expected: ty::Binder::dummy(trait_sig),
found: ty::Binder::dummy(impl_sig),
})),
terr,
false,
false,
11 changes: 4 additions & 7 deletions compiler/rustc_hir_analysis/src/check/mod.rs
Original file line number Diff line number Diff line change
@@ -573,10 +573,7 @@ pub fn check_function_signature<'tcx>(
let norm_cause = ObligationCause::misc(cause.span, local_id);
let actual_sig = ocx.normalize(&norm_cause, param_env, actual_sig);

let expected_ty = Ty::new_fn_ptr(tcx, expected_sig);
let actual_ty = Ty::new_fn_ptr(tcx, actual_sig);

match ocx.eq(&cause, param_env, expected_ty, actual_ty) {
match ocx.eq(&cause, param_env, expected_sig, actual_sig) {
Ok(()) => {
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
@@ -595,9 +592,9 @@ pub fn check_function_signature<'tcx>(
&mut diag,
&cause,
None,
Some(infer::ValuePairs::Sigs(ExpectedFound {
expected: tcx.liberate_late_bound_regions(fn_id, expected_sig),
found: tcx.liberate_late_bound_regions(fn_id, actual_sig),
Some(infer::ValuePairs::PolySigs(ExpectedFound {
expected: expected_sig,
found: actual_sig,
})),
err,
false,
23 changes: 22 additions & 1 deletion compiler/rustc_infer/src/infer/at.rs
Original file line number Diff line number Diff line change
@@ -478,7 +478,28 @@ impl<'tcx> ToTrace<'tcx> for ty::FnSig<'tcx> {
a: Self,
b: Self,
) -> TypeTrace<'tcx> {
TypeTrace { cause: cause.clone(), values: Sigs(ExpectedFound::new(a_is_expected, a, b)) }
TypeTrace {
cause: cause.clone(),
values: PolySigs(ExpectedFound::new(
a_is_expected,
ty::Binder::dummy(a),
ty::Binder::dummy(b),
)),
}
}
}

impl<'tcx> ToTrace<'tcx> for ty::PolyFnSig<'tcx> {
fn to_trace(
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
b: Self,
) -> TypeTrace<'tcx> {
TypeTrace {
cause: cause.clone(),
values: PolySigs(ExpectedFound::new(a_is_expected, a, b)),
}
}
}

9 changes: 3 additions & 6 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
@@ -1660,7 +1660,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
_ => (false, Mismatch::Fixed("type")),
}
}
ValuePairs::Sigs(infer::ExpectedFound { expected, found }) => {
ValuePairs::PolySigs(infer::ExpectedFound { expected, found }) => {
OpaqueTypesVisitor::visit_expected_found(self.tcx, expected, found, span)
.report(diag);
(false, Mismatch::Fixed("signature"))
@@ -2232,15 +2232,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
ret => ret,
}
}
infer::Sigs(exp_found) => {
infer::PolySigs(exp_found) => {
let exp_found = self.resolve_vars_if_possible(exp_found);
if exp_found.references_error() {
return None;
}
let (exp, fnd) = self.cmp_fn_sig(
&ty::Binder::dummy(exp_found.expected),
&ty::Binder::dummy(exp_found.found),
);
let (exp, fnd) = self.cmp_fn_sig(&exp_found.expected, &exp_found.found);
Some((exp, fnd, None, None))
}
}
Original file line number Diff line number Diff line change
@@ -35,14 +35,14 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
&& let (Subtype(sup_trace), Subtype(sub_trace)) = (&sup_origin, &sub_origin)
&& let CompareImplItemObligation { trait_item_def_id, .. } = sub_trace.cause.code()
&& sub_trace.values == sup_trace.values
&& let ValuePairs::Sigs(ExpectedFound { expected, found }) = sub_trace.values
&& let ValuePairs::PolySigs(ExpectedFound { expected, found }) = sub_trace.values
{
// FIXME(compiler-errors): Don't like that this needs `Ty`s, but
// all of the region highlighting machinery only deals with those.
let guar = self.emit_err(
var_origin.span(),
Ty::new_fn_ptr(self.cx.tcx,ty::Binder::dummy(expected)),
Ty::new_fn_ptr(self.cx.tcx,ty::Binder::dummy(found)),
Ty::new_fn_ptr(self.cx.tcx, expected),
Ty::new_fn_ptr(self.cx.tcx, found),
*trait_item_def_id,
);
return Some(guar);
Original file line number Diff line number Diff line change
@@ -616,9 +616,13 @@ fn foo(&self) -> Self::T { String::new() }
for item in &items[..] {
if let hir::AssocItemKind::Type = item.kind {
let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity();

if self.infcx.can_eq(param_env, assoc_ty, found) {
diag.span_label(item.span, "expected this associated type");
if let hir::Defaultness::Default { has_value: true } = tcx.defaultness(item.id.owner_id)
&& self.infcx.can_eq(param_env, assoc_ty, found)
{
diag.span_label(
item.span,
format!("associated type is `default` and may be overridden"),
);
return true;
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
@@ -383,7 +383,7 @@ pub enum ValuePairs<'tcx> {
Aliases(ExpectedFound<ty::AliasTy<'tcx>>),
TraitRefs(ExpectedFound<ty::TraitRef<'tcx>>),
PolyTraitRefs(ExpectedFound<ty::PolyTraitRef<'tcx>>),
Sigs(ExpectedFound<ty::FnSig<'tcx>>),
PolySigs(ExpectedFound<ty::PolyFnSig<'tcx>>),
ExistentialTraitRef(ExpectedFound<ty::PolyExistentialTraitRef<'tcx>>),
ExistentialProjection(ExpectedFound<ty::PolyExistentialProjection<'tcx>>),
}
5 changes: 4 additions & 1 deletion compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
@@ -2333,7 +2333,10 @@ impl CheckAttrVisitor<'_> {
&mut diag,
&cause,
None,
Some(ValuePairs::Sigs(ExpectedFound { expected: expected_sig, found: sig })),
Some(ValuePairs::PolySigs(ExpectedFound {
expected: ty::Binder::dummy(expected_sig),
found: ty::Binder::dummy(sig),
})),
terr,
false,
false,
58 changes: 34 additions & 24 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -214,6 +214,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
module: None,
}
} else {
let mut span_label = None;
let item_span = path.last().unwrap().ident.span;
let (mod_prefix, mod_str, module, suggestion) = if path.len() == 1 {
debug!(?self.diagnostic_metadata.current_impl_items);
@@ -224,32 +225,41 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
&& let FnKind::Fn(_, _, sig, ..) = fn_kind
&& let Some(items) = self.diagnostic_metadata.current_impl_items
&& let Some(item) = items.iter().find(|i| {
if let AssocItemKind::Fn(..) | AssocItemKind::Const(..) = &i.kind
&& i.ident.name == item_str.name
// don't suggest if the item is in Fn signature arguments
// issue #112590
i.ident.name == item_str.name
// Don't suggest if the item is in Fn signature arguments (#112590).
&& !sig.span.contains(item_span)
{
debug!(?item_str.name);
return true
}
false
})
{
let self_sugg = match &item.kind {
AssocItemKind::Fn(fn_) if fn_.sig.decl.has_self() => "self.",
_ => "Self::",
};

Some((
item_span.shrink_to_lo(),
match &item.kind {
AssocItemKind::Fn(..) => "consider using the associated function",
AssocItemKind::Const(..) => "consider using the associated constant",
_ => unreachable!("item kind was filtered above"),
},
self_sugg.to_string()
))
let sp = item_span.shrink_to_lo();
match &item.kind {
AssocItemKind::Fn(fn_)
if !sig.decl.has_self() && fn_.sig.decl.has_self() => {
// Ensure that we only suggest `self.` if `self` is available,
// you can't call `fn foo(&self)` from `fn bar()` (#115992).
// We also want to mention that the method exists.
span_label = Some((
item.ident.span,
"a method by that name is available on `Self` here",
));
None
}
AssocItemKind::Fn(fn_) if fn_.sig.decl.has_self() => Some((
sp,
"consider using the method on `Self`",
"self.".to_string(),
)),
AssocItemKind::Fn(_) => Some((
sp,
"consider using the associated function on `Self`",
"Self::".to_string(),
)),
AssocItemKind::Const(..) => Some((
sp,
"consider using the associated constant on `Self`",
"Self::".to_string(),
)),
_ => None
}
} else {
None
};
@@ -314,7 +324,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
msg: format!("cannot find {expected} `{item_str}` in {mod_prefix}{mod_str}"),
fallback_label,
span: item_span,
span_label: None,
span_label,
could_be_expr: false,
suggestion,
module,
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/default-settings.goml
Original file line number Diff line number Diff line change
@@ -5,4 +5,4 @@
go-to: "file://" + |DOC_PATH| + "/settings/index.html"
// Wait a bit to be sure the default theme is applied.
// If the theme isn't applied, the command will time out.
wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"})
wait-for-css: ("body", {"background-color": "#0f1419"})
4 changes: 2 additions & 2 deletions tests/ui/associated-types/defaults-specialization.stderr
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:35:18
|
LL | default type Ty = bool;
| ----------------------- expected this associated type
| ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> bool { true }
| ^^^^
@@ -76,7 +76,7 @@ error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:44:29
|
LL | default type Ty = bool;
| ----------------------- expected this associated type
| ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> Self::Ty { true }
| -------- ^^^^ expected associated type, found `bool`
4 changes: 2 additions & 2 deletions tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ error[E0308]: `#[panic_handler]` function has wrong type
LL | fn panic(info: PanicInfo) -> () {}
| ^^^^^^^^^ expected `&PanicInfo<'_>`, found `PanicInfo<'_>`
|
= note: expected signature `fn(&PanicInfo<'_>) -> !`
found signature `fn(PanicInfo<'_>)`
= note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !`
found signature `for<'a> fn(PanicInfo<'a>)`

error: aborting due to previous error

4 changes: 2 additions & 2 deletions tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ error[E0308]: `#[panic_handler]` function has wrong type
LL | fn panic(info: &'static PanicInfo) -> !
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected fn pointer `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
found fn pointer `for<'a> fn(&'static PanicInfo<'a>) -> _`
= note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
found signature `for<'a> fn(&'static PanicInfo<'a>) -> _`

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ error[E0308]: `#[panic_handler]` function has wrong type
LL | fn panic() -> ! {
| ^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected signature `fn(&PanicInfo<'_>) -> _`
= note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
found signature `fn() -> _`

error: aborting due to previous error
4 changes: 2 additions & 2 deletions tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ error[E0308]: `#[panic_handler]` function has wrong type
LL | fn panic(info: &PanicInfo<'static>) -> !
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected fn pointer `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
found fn pointer `for<'a> fn(&'a PanicInfo<'static>) -> _`
= note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
found signature `for<'a> fn(&'a PanicInfo<'static>) -> _`

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct Foo {
field: u32,
}

impl Foo {
fn field(&self) -> u32 {
self.field
}

fn new() -> Foo {
field; //~ ERROR cannot find value `field` in this scope
Foo { field } //~ ERROR cannot find value `field` in this scope
}
}
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0425]: cannot find value `field` in this scope
--> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:11:9
|
LL | fn field(&self) -> u32 {
| ----- a method by that name is available on `Self` here
...
LL | field;
| ^^^^^ a field by this name exists in `Self`

error[E0425]: cannot find value `field` in this scope
--> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:12:15
|
LL | fn field(&self) -> u32 {
| ----- a method by that name is available on `Self` here
...
LL | Foo { field }
| ^^^^^ a field by this name exists in `Self`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
2 changes: 1 addition & 1 deletion tests/ui/resolve/issue-103474.stderr
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ error[E0425]: cannot find function `first` in this scope
LL | first()
| ^^^^^ not found in this scope
|
help: consider using the associated function
help: consider using the method on `Self`
|
LL | self.first()
| +++++
4 changes: 2 additions & 2 deletions tests/ui/resolve/issue-2356.stderr
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ error[E0425]: cannot find function `static_method` in this scope
LL | static_method();
| ^^^^^^^^^^^^^ not found in this scope
|
help: consider using the associated function
help: consider using the associated function on `Self`
|
LL | Self::static_method();
| ++++++
@@ -102,7 +102,7 @@ error[E0425]: cannot find function `grow_older` in this scope
LL | grow_older();
| ^^^^^^^^^^ not found in this scope
|
help: consider using the associated function
help: consider using the associated function on `Self`
|
LL | Self::grow_older();
| ++++++
2 changes: 1 addition & 1 deletion tests/ui/self/class-missing-self.stderr
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ error[E0425]: cannot find function `sleep` in this scope
LL | sleep();
| ^^^^^ not found in this scope
|
help: consider using the associated function
help: consider using the method on `Self`
|
LL | self.sleep();
| +++++
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ error[E0308]: mismatched types
--> $DIR/specialization-default-types.rs:15:9
|
LL | default type Output = Box<T>;
| ----------------------------- expected this associated type
| ----------------------------- associated type is `default` and may be overridden
LL | default fn generate(self) -> Self::Output {
| ------------ expected `<T as Example>::Output` because of return type
LL | Box::new(self)
2 changes: 1 addition & 1 deletion tests/ui/suggestions/assoc-const-without-self.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ error[E0425]: cannot find value `A_CONST` in this scope
LL | A_CONST
| ^^^^^^^ not found in this scope
|
help: consider using the associated constant
help: consider using the associated constant on `Self`
|
LL | Self::A_CONST
| ++++++
8 changes: 8 additions & 0 deletions tests/ui/suggestions/assoc_fn_without_self.rs
Original file line number Diff line number Diff line change
@@ -17,4 +17,12 @@ impl S {
bar(); //~ ERROR cannot find function `bar` in this scope
baz(2, 3); //~ ERROR cannot find function `baz` in this scope
}
fn d(&self) {
fn c() {
foo(); //~ ERROR cannot find function `foo` in this scope
}
foo(); //~ ERROR cannot find function `foo` in this scope
bar(); //~ ERROR cannot find function `bar` in this scope
baz(2, 3); //~ ERROR cannot find function `baz` in this scope
}
}
49 changes: 43 additions & 6 deletions tests/ui/suggestions/assoc_fn_without_self.stderr
Original file line number Diff line number Diff line change
@@ -4,39 +4,76 @@ error[E0425]: cannot find function `foo` in this scope
LL | foo();
| ^^^ not found in this scope
|
help: consider using the associated function
help: consider using the associated function on `Self`
|
LL | Self::foo();
| ++++++

error[E0425]: cannot find function `bar` in this scope
--> $DIR/assoc_fn_without_self.rs:17:9
|
LL | fn bar(&self) {}
| --- a method by that name is available on `Self` here
...
LL | bar();
| ^^^ not found in this scope

error[E0425]: cannot find function `baz` in this scope
--> $DIR/assoc_fn_without_self.rs:18:9
|
LL | baz(2, 3);
| ^^^ not found in this scope
|
help: consider using the associated function on `Self`
|
LL | Self::baz(2, 3);
| ++++++

error[E0425]: cannot find function `foo` in this scope
--> $DIR/assoc_fn_without_self.rs:14:13
|
LL | foo();
| ^^^ not found in this scope

error[E0425]: cannot find function `foo` in this scope
--> $DIR/assoc_fn_without_self.rs:24:9
|
LL | foo();
| ^^^ not found in this scope
|
help: consider using the associated function on `Self`
|
LL | Self::foo();
| ++++++

error[E0425]: cannot find function `bar` in this scope
--> $DIR/assoc_fn_without_self.rs:25:9
|
LL | bar();
| ^^^ not found in this scope
|
help: consider using the associated function
help: consider using the method on `Self`
|
LL | self.bar();
| +++++

error[E0425]: cannot find function `baz` in this scope
--> $DIR/assoc_fn_without_self.rs:18:9
--> $DIR/assoc_fn_without_self.rs:26:9
|
LL | baz(2, 3);
| ^^^ not found in this scope
|
help: consider using the associated function
help: consider using the associated function on `Self`
|
LL | Self::baz(2, 3);
| ++++++

error[E0425]: cannot find function `foo` in this scope
--> $DIR/assoc_fn_without_self.rs:14:13
--> $DIR/assoc_fn_without_self.rs:22:13
|
LL | foo();
| ^^^ not found in this scope

error: aborting due to 4 previous errors
error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0425`.