Skip to content

Flag failure functions as inline(never) - #11550

Merged
bors merged 1 commit into
rust-lang:masterfrom
alexcrichton:noinline
Jan 15, 2014
Merged

Flag failure functions as inline(never)#11550
bors merged 1 commit into
rust-lang:masterfrom
alexcrichton:noinline

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

The failure functions are generic, meaning they're candidates for getting
inlined across crates. This has been happening, leading to monstrosities like
that found in #11549. I have verified that the codegen is much better now that
we're not inlining the failure path (the slow path).

@huonw

huonw commented Jan 15, 2014

Copy link
Copy Markdown
Contributor

Is this something we can have a codegen test for?

@alexcrichton

Copy link
Copy Markdown
Member Author

Hm, maybe! I'm not entirely sure how they work though. Do we have ratcheting turned on?

@thestinger

Copy link
Copy Markdown
Contributor

@alexcrichton: can you try marking them as #[cold] instead? I don't really understand why they'd be inlined because I can't actually get LLVM to inline a noreturn function not marked alwaysinline.

Are we not marking them noreturn?

@alexcrichton

Copy link
Copy Markdown
Member Author

I looked into adding #[cold], but oddly enough it was still inlined. We do appear to be adding noreturn, however.

The failure functions are generic, meaning they're candidates for getting
inlined across crates. This has been happening, leading to monstrosities like
that found in rust-lang#11549. I have verified that the codegen is *much* better now that
we're not inlining the failure path (the slow path).
bors added a commit that referenced this pull request Jan 15, 2014
The failure functions are generic, meaning they're candidates for getting
inlined across crates. This has been happening, leading to monstrosities like
that found in #11549. I have verified that the codegen is *much* better now that
we're not inlining the failure path (the slow path).
@bors bors closed this Jan 15, 2014
@bors
bors merged commit 86c60b6 into rust-lang:master Jan 15, 2014
@alexcrichton
alexcrichton deleted the noinline branch January 16, 2014 01:52
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 21, 2023
…assocfn, r=dswij

`impl_trait_in_params` now supports impls and traits

Before this PR, the lint `impl_trait_in_params`. This PR gives the lint support for functions in impls and traits. (Also, some pretty heavy refactor)

fixes rust-lang#11548
changelog:[`impl_trait_in_params`] now supports `impl` blocks and functions in traits
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
11550: Refactor autoderef/method resolution r=flodiebold a=flodiebold

- don't return the receiver type from method resolution; instead just
 return the autorefs/autoderefs that happened and repeat them. This
 ensures all the effects like trait obligations and whatever we learned
 about type variables from derefing them are actually applied. Also, it
 allows us to get rid of `decanonicalize_ty`, which was just wrong in
 principle.

 - Autoderef itself now directly works with an inference table. Sadly
 this has the effect of making it harder to use as an iterator, often
 requiring manual `while let` loops. (rustc works around this by using
 inner mutability in the inference context, so that things like unifying
 types don't require a unique reference.)

 - We now record the adjustments (autoref/deref) for method receivers
 and index expressions, which we didn't before.

 - Removed the redundant crate parameter from method resolution, since
 the trait_env contains the crate as well.

 - in the HIR API, the methods now take a scope to determine the trait env.
 `Type` carries a trait env, but I think that's probably a bad decision
 because it's easy to create it with the wrong env, e.g. by using
 `Adt::ty`. This mostly didn't matter so far because
 `iterate_method_candidates` took a crate parameter and ignored
 `self.krate`, but the trait env would still have been wrong in those
 cases, which I think would give some wrong results in some edge cases.

Fixes rust-lang#10058.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants