| Age | Commit message (Collapse) | Author | Lines |
|
It's identical to `TyCtxt::get_all_attrs` except it takes `DefId`
instead of `impl Into<DefIf>`.
|
|
The fields are public, so this doesn't need a method, normal
deconstruction and/or field access is good enough.
|
|
It's only used in `rustc_infer`.
|
|
It's only used there.
|
|
|
|
It's only used in `rustc_hir_typeck`.
|
|
Next to all the other `EarlyParamRegion` pieces.
|
|
It's not used in `rustc_middle`, and `rustc_trait_selection` is a better
place for it.
|
|
It's not used in `rustc_middle`, and `rustc_resolve` is a better place
for it.
|
|
|
|
Remove eval_always from check_private_in_public.
This PR attempts to avoid re-computing `check_private_in_public` query. First by marking the query as non-`eval_always`, and by reducing the amount of accesses to HIR as much as possible.
Latest perf https://github.com/rust-lang/rust/pull/116316#issuecomment-3094672105 shows that we manage it. The cost is extra dep-graph bookkeeping.
|
|
|
|
Pick the largest niche even if the largest niche is wrapped around
fixes rust-lang/rust#144388
r? `@scottmcm`
|
|
|
|
|
|
Raw Pointers are Constant PatKinds too
raw pointers can be matched on with a const pattern:
```rust
const FOO: *const u8 = core::ptr::null();
fn foo(a: *const u8) {
match a {
FOO => (),
_ => todo!(),
}
}
```
as far as I can tell this is represented with a `PatKind::Constant`: https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs#L333-L337
|
|
|
|
|
|
|
|
|
|
This is dead code.
|
|
|
|
Some `let chains` clean-up
Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one
r? compiler
|
|
|
|
miri: for ABI mismatch errors, say which argument is the problem
|
|
r=jdonszelmann,traviscross
Port the proc macro attributes to the new attribute parsing infrastructure
Ports `#[proc_macro]`, `#[proc_macro_attribute]`, `#[proc_macro_derive]` and `#[rustc_builtin_macro]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163
I've split this PR into commits for reviewability, and left some comments to clarify things
I did 4 related attributes in one PR because they share a lot of their code and logic, and doing them separately is kind of annoying as I need to leave both the old and new parsing in place then.
r? ``@oli-obk``
cc ``@jdonszelmann``
|
|
|
|
Preintern some `TyKind::Bound` values
The new trait solver produces a lot of these.
r? `@compiler-errors`
|
|
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
Small cleanup: Use LocalKey<Cell> methods more
|
|
Because doc code does not get automatically formatted, some doc code has
creative placements of comments that automatic formatting can't handle.
Reformat those comments to make the resulting code support standard Rust
formatting without breaking; this is generally an improvement to
readability as well.
Some comments are not indented to the prevailing indent, and are instead
aligned under some bit of code. Indent them to the prevailing indent,
and put spaces *inside* the comments to align them with code.
Some comments span several lines of code (which aren't the line the
comment is about) and expect alignment. Reformat them into one comment
not broken up by unrelated intervening code.
Some comments are placed on the same line as an opening brace, placing
them effectively inside the subsequent block, such that formatting would
typically format them like a line of that block. Move those comments to
attach them to what they apply to.
Some comments are placed on the same line as a one-line braced block,
effectively attaching them to the closing brace, even though they're
about the code inside the block. Reformat to make sure the comment will
stay on the same line as the code it's commenting.
|
|
We already do the same thing for bound regions. This is a small perf win
for the new trait solver.
|
|
- Cover `DebruijnIndex(2)`, for slightly better coverage.
- Rename some things, to account for other region things that were
renamed.
|
|
|
|
|
|
Ensure we codegen the main fn
This fixes two bugs. The one that was identified in the linked issue is that when we have a `main` function, mono collection didn't consider it as an extra collection root.
The other is that since CGU partitioning doesn't know about the call edges between the entrypoint functions, naively it can put them in different CGUs and mark them all as internal. Which would result in LLVM just deleting all of them. There was an existing hack to exclude `lang = "start"` from internalization, which I've extended to include `main`.
Fixes https://github.com/rust-lang/rust/issues/144052
|
|
Unquerify extern_mod_stmt_cnum.
Based on https://github.com/rust-lang/rust/pull/143247
r? `````@ghost````` for perf
|
|
|
|
|
|
|
|
|
|
Unquerify maybe_unused_trait_imports.
Based on https://github.com/rust-lang/rust/pull/143247
r? ```@ghost``` for perf
|
|
|
|
Mitigate `#[align]` name resolution ambiguity regression with a rename
Mitigates beta regression rust-lang/rust#143834 after a beta backport.
### Background on the beta regression
The name resolution regression arises due to rust-lang/rust#142507 adding a new feature-gated built-in attribute named `#[align]`. However, unfortunately even [introducing new feature-gated unstable built-in attributes can break user code](https://www.github.com/rust-lang/rust/issues/134963) such as
```rs
macro_rules! align {
() => {
/* .. */
};
}
pub(crate) use align; // `use` here becomes ambiguous
```
### Mitigation approach
This PR renames `#[align]` to `#[rustc_align]` to mitigate the beta regression by:
1. Undoing the introduction of a new built-in attribute with a common name, i.e. `#[align]`.
2. Renaming `#[align]` to `#[rustc_align]`. The renamed attribute being `rustc_align` will not introduce new stable breakages, as attributes beginning with `rustc` are reserved and perma-unstable. This does mean existing nightly code using `fn_align` feature will additionally need to specify `#![feature(rustc_attrs)]`.
This PR is very much a short-term mitigation to alleviate time pressure from having to fully fix the current limitation of inevitable name resolution regressions that would arise from adding any built-in attributes. Long-term solutions are discussed in [#t-lang > namespacing macro attrs to reduce conflicts with new adds](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/namespacing.20macro.20attrs.20to.20reduce.20conflicts.20with.20new.20adds/with/529249622).
### Alternative mitigation options
[Various mitigation options were considered during the compiler triage meeting](https://github.com/rust-lang/rust/issues/143834#issuecomment-3084415277), and those consideration are partly reproduced here:
- Reverting the PR doesn't seem very minimal/trivial, and carries risks of its own.
- Rename to a less-common but aim-to-stabilization name is itself not safe nor convenient, because (1) that risks introducing new regressions (i.e. ambiguity against the new name), and (2) lang would have to FCP the new name hastily for the mitigation to land timely and have a chance to be backported. This also makes the path towards stabilization annoying.
- Rename the attribute to a rustc attribute, which will be perma-unstable and does not cause new ambiguities in stable code.
- This alleviates the time pressure to address *this* regression, or for lang to have to rush an FCP for some new name that can still break user code.
- This avoids backing out a whole implementation.
### Review advice
This PR is best reviewed commit-by-commit.
- Commit 1 adds a test `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` which demonstrates the current name resolution regression re. `align`. This test fails against current master.
- Commit 2 carries out the renames and test reblesses. Notably, commit 2 will cause `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` to change from fail (nameres regression) to pass.
This PR, if the approach still seems acceptable, will need a beta-backport to address the beta regression.
|
|
Don't consider unstable fields always-inhabited
This reverts the hack in https://github.com/rust-lang/rust/pull/133889 now that `Pin`'s field is no longer public.
Fixes https://github.com/rust-lang/rust/issues/143468.
r? ```@compiler-errors```
|
|
This reverts the hack in https://github.com/rust-lang/rust/pull/133889
now that `Pin`'s field is no longer public.
|
|
|
|
Remove pretty print hack for async blocks
I introduced this hack 3 years ago, but it's not needed anymore, probably due to https://github.com/rust-lang/rust/pull/104321.
|
|
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- rust-lang/rust#142673 (Show the offset, length and memory of uninit read errors)
- rust-lang/rust#142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- rust-lang/rust#143382 (stabilize `const_slice_reverse`)
- rust-lang/rust#143928 (opt-dist: make llvm builds optional)
- rust-lang/rust#143961 (Correct which exploit mitigations are enabled by default)
- rust-lang/rust#144050 (Fix encoding of link_section and no_mangle cross crate)
- rust-lang/rust#144059 (Refactor `CrateLoader` into the `CStore`)
- rust-lang/rust#144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
|