about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-08-04Rollup merge of #114355 - compiler-errors:resolve_vars_early, r=lcnrMatthias Krüger-7/+3
resolve before canonicalization in new solver, ICE if unresolved Fold the values with a resolver before canonicalization instead of making it happen within canonicalization. This allows us to filter trivial region constraints from the external constraints. r? ``@lcnr``
2023-08-04Rollup merge of #114253 - fmease:compute-variances-for-lazy-ty-aliases, ↵Matthias Krüger-1/+1
r=oli-obk Compute variances for lazy type aliases Fixes #114221. CC ``@oli-obk`` r? types
2023-08-04Rollup merge of #114022 - oli-obk:tait_ice_alias_field_projection, r=cjgillotMatthias Krüger-0/+6
Perform OpaqueCast field projection on HIR, too. fixes #105819 This is necessary for closure captures in 2021 edition, as they capture individual fields, not the full mentioned variables. So it may try to capture a field of an opaque (because the hidden type is known to be something with a field). See https://github.com/rust-lang/rust/pull/99806 for when and why we added OpaqueCast to MIR.
2023-08-03Auto merge of #108955 - Nilstrieb:dont-use-me-pls, r=oli-obkbors-0/+1
Add `internal_features` lint Implements https://github.com/rust-lang/compiler-team/issues/596 Also requires some more test blessing for codegen tests etc `@jyn514` had the idea of just `allow`ing the lint by default in the test suite. I'm not sure whether this is a good idea, but it's definitely one worth considering. Additional input encouraged.
2023-08-03Placeholder nitMichael Goulet-6/+2
2023-08-03resolve before canonicalization, ICE if unresolvedMichael Goulet-1/+1
2023-08-03Rework upcastingMichael Goulet-8/+15
2023-08-03Rollup merge of #114372 - RalfJung:const-pointer-as-int, r=oli-obkMatthias Krüger-60/+77
const validation: point at where we found a pointer but expected an integer Instead of validation just printing "unable to turn pointer into bytes", make this a regular validation error that says where in the value the bad pointer was found. Also distinguish "expected integer, got pointer" from "expected pointer, got partial pointer or mix of pointers". To avoid duplicating things too much I refactored the diagnostics for validity a bit, so that "got uninit, expected X" and "got pointer, expected X" can share the "X" part. Also all the errors emitted for validation are now grouped under `const_eval_validation` so that they are in a single group in the ftl file. r? `@oli-obk`
2023-08-03rewrite stack dependent overflow handlinglcnr-2/+102
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-03avoid more `ty::Binder:dummy`lcnr-0/+13
2023-08-03Rollup merge of #114363 - RalfJung:interpret-not-miri, r=jackh726Matthias Krüger-2/+2
avoid 'miri' when refering to the shared interpreter This is basically the rustc source code version of https://github.com/rust-lang/rustc-dev-guide/pull/1471.
2023-08-03Compute variances for lazy type aliasesLeón Orell Valerian Liehr-1/+1
2023-08-02Auto merge of #107254 - chenyukang:yukang/fix-107113-wrong-sugg-in-macro, ↵bors-1/+14
r=estebank Avoid wrong code suggesting for attribute macro Fixes #107113 r? `@estebank`
2023-08-02const validation: point at where we found a pointer but expected an integerRalf Jung-60/+77
2023-08-02Remove constness from `TraitPredicate`Deadbeef-89/+6
2023-08-02avoid 'miri' when refering to the shared interpreterRalf Jung-2/+2
2023-08-02Rollup merge of #114079 - compiler-errors:closure-upvars, r=oli-obkNilstrieb-19/+13
Use `upvar_tys` in more places, make it return a list Just a cleanup that fell out of a PR that I was gonna write, but that PR kinda got stuck.
2023-08-02Replace old private-in-public diagnostic with type privacy lintsBryanskiy-3/+0
2023-08-02Auto merge of #114333 - RalfJung:dangling-ptr-offset, r=oli-obkbors-2/+2
Miri: fix error on dangling pointer inbounds offset We used to claim that the pointer was "dereferenced", but that is just not true. Can be reviewed commit-by-commit. The first commit is an unrelated rename that didn't seem worth splitting into its own PR. r? `@oli-obk`
2023-08-02fix RedundantLocals clippy caused by async and awaityukang-0/+9
2023-08-02Fix #107113, avoid suggest for macro attributesyukang-1/+5
2023-08-02Rollup merge of #114314 - compiler-errors:sized-crit, r=lcnrMatthias Krüger-13/+5
Tweaks to `adt_sized_constraint` fixes a comment, but also some other nits. r? lcnr
2023-08-02Rollup merge of #114301 - ↵Matthias Krüger-28/+1
compiler-errors:dont-error-on-missing-region-outlives, r=spastorino Don't check unnecessarily that impl trait is RPIT We have this random `return_type_impl_trait` function to detect if a function returns an RPIT which is used in outlives suggestions, but removing it doesn't actually change any diagnostics. Let's just remove it. Also, suppress a spurious outlives error from a ReError. Fixes #114274
2023-08-01Use upvar_tys in more places, make it a listMichael Goulet-19/+13
2023-08-01Fix a commentMichael Goulet-10/+2
2023-08-01Convert adt_sized_constraint to early-binder, use listMichael Goulet-3/+3
2023-08-01properly track why we checked whether a pointer is in-boundsRalf Jung-2/+2
also simplify the in-bounds checking in Miri's borrow trackers
2023-08-01Make coverage counter IDs count up from 0, not 1Zalathar-14/+14
Operand types are now tracked explicitly, so there is no need to reserve ID 0 for the special always-zero counter. As part of the renumbering, this change fixes an off-by-one error in the way counters were counted by the `coverageinfo` query. As a result, functions should now have exactly the number of counters they actually need, instead of always having an extra counter that is never used.
2023-08-01Make coverage expression IDs count up from 0, not down from `u32::MAX`Zalathar-13/+16
Operand types are now tracked explicitly, so there is no need for expression IDs to avoid counter IDs by descending from `u32::MAX`. Instead they can just count up from 0, and can be used directly as indices when necessary.
2023-08-01Replace `ExpressionOperandId` with enum `Operand`Zalathar-49/+26
Because the three kinds of operand are now distinguished explicitly, we no longer need fiddly code to disambiguate counter IDs and expression IDs based on the total number of counters/expressions in a function. This does increase the size of operands from 4 bytes to 8 bytes, but that shouldn't be a big deal since they are mostly stored inside boxed structures, and the current coverage code is not particularly size-optimized anyway.
2023-08-01Add some line comments to enum `CoverageKind`Zalathar-0/+4
The actual motivation here is to prevent `rustfmt` from suddenly reformatting these enum variants onto a single line, when they become slightly shorter in the future. But there's no harm in adding some helpful documentation at the same time.
2023-07-31Don't check unnecessarily that impl trait is RPITMichael Goulet-28/+1
2023-07-31Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorinoMatthias Krüger-13/+0
Map RPITIT's opaque type bounds back from projections to opaques An RPITIT in a program's AST is eventually translated into both a projection GAT and an opaque. The opaque is used for default trait methods, like: ``` trait Foo { fn bar() -> impl Sized { 0i32 } } ``` The item bounds for both the projection and opaque are identical, and both have a *projection* self ty. This is mostly okay, since we can normalize this projection within the default trait method body to the opaque, but it does two things: 1. it leads to bugs in places where we don't normalize item bounds, like `deduce_future_output_from_obligations` 2. it leads to extra match arms that are both suspicious looking and also easy to miss This PR maps the opaque type bounds of the RPITIT's *opaque* back to the opaque's self type to avoid this quirk. Then we can fix the UI test for #108304 (1.) and also remove a bunch of match arms (2.). Fixes #108304 r? `@spastorino`
2023-07-31Rollup merge of #114169 - lcnr:unsize, r=compiler-errorsMatthias Krüger-1/+14
refactor builtin unsize handling, extend comments r? `@compiler-errors`
2023-07-31We don't need impl_trait_in_trait_parent_fn anymoreMichael Goulet-13/+0
2023-07-30Rollup merge of #114068 - matthiaskrgr:fmt_args_rustc_1, r=WaffleLapkinMatthias Krüger-278/+249
inline format!() args up to and including rustc_middle (2) r? `@WaffleLapkin`
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-278/+249
2023-07-30Rollup merge of #114203 - fee1-dead-contrib:effects/pp-no-host, r=oli-obkfee1-dead-2/+29
Effects: don't print `host` param in diagnostics r? ``@oli-obk``
2023-07-29Implement assumed_wf_types for RPITITs' implementationsMichael Goulet-0/+7
2023-07-29Effects: don't print `host` param in diagnosticsDeadbeef-2/+29
2023-07-29Allow explicit `#[repr(Rust)]`Catherine Flores-0/+1
2023-07-29Rollup merge of #113773 - compiler-errors:err-layout-bail, r=cjgillotMatthias Krüger-2/+10
Don't attempt to compute layout of type referencing error Leads to more ICEs and strange diagnostics than are worth it. Fixes #113760
2023-07-28Auto merge of #114181 - matthiaskrgr:rollup-14m8s7f, r=matthiaskrgrbors-2/+7
Rollup of 7 pull requests Successful merges: - #114099 (privacy: no nominal visibility for assoc fns ) - #114128 (When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist) - #114138 (Adjust spans correctly for fn -> method suggestion) - #114146 (Skip reporting item name when checking RPITIT GAT's associated type bounds hold) - #114147 (Insert RPITITs that were shadowed by missing ADTs that resolve to [type error]) - #114155 (Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`) - #114164 (Add regression test for `--cap-lints allow` and trait bounds warning) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-1/+1
2023-07-28privacy: no nominal visibility for assoc fnsDavid Wood-2/+7
When `staged_api` is enabled, effective visibilities are computed earlier and this can trigger an ICE in some cases. In particular, if a impl of a trait method has a visibility then an error will be reported for that, but when privacy invariants are being checked, the effective visibility will still be greater than the nominal visbility and that will trigger a `span_bug!`. However, this invariant - that effective visibilites are limited to nominal visibility - doesn't make sense for associated functions. Signed-off-by: David Wood <david@davidtw.co>
2023-07-28refactor builtin unsize handling, extend commentslcnr-1/+14
2023-07-27Don't attempt to compute layout of type referencing errorMichael Goulet-2/+10
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-88/+12
2023-07-26Auto merge of #113893 - mdibaiee:type-name-spill-flag, r=compiler-errorsbors-2/+7
new unstable option: -Zwrite-long-types-to-disk This option guards the logic of writing long type names in files and instead using short forms in error messages in rustc_middle/ty/error behind a flag. The main motivation for this change is to disable this behaviour when running ui tests. This logic can be triggered by running tests in a directory that has a long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/ This means ui tests can fail depending on how long the path to their file is. Some ui tests actually rely on this behaviour for their assertions, so for those we enable the flag manually.