Commit Graph

211392 Commits

Author SHA1 Message Date
Camille GILLOT fb7d25e978 Separate lifetime ident from resolution in HIR. 2022-11-23 19:33:06 +00:00
Oli Scherer 6c2719a6d6 Bump the const eval step limit 2022-11-23 16:55:57 +00:00
est31 9abd785543 Add regression test for issue 99938
That issue was a dupe of 99852, but it's always better to
have multiple regression tests rather than one.
2022-11-23 17:48:00 +01:00
bors d121aa3b55 Auto merge of #104776 - Dylan-DPC:rollup-rf4c2u0, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #104269 (Fix hang in where-clause suggestion with `predicate_can_apply`)
 - #104286 (copy doc output files by format)
 - #104509 (Use obligation ctxt instead of dyn TraitEngine)
 - #104721 (Remove more `ref` patterns from the compiler)
 - #104744 (rustdoc: give struct fields CSS `display: block`)
 - #104751 (Fix an ICE parsing a malformed attribute.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-23 16:29:17 +00:00
Maybe Waffle 20f3de5ab1 Use nicer spans for `deref_into_dyn_supertrait` 2022-11-23 16:12:51 +00:00
Thom Chiovoloni 54a6d4edbc
Add `#![deny(unsafe_op_in_unsafe_fn)]` in liballoc tests 2022-11-23 08:10:17 -08:00
Maybe Waffle 0d4a5c725a Make `deref_into_dyn_supertrait` lint the impl and not the usage 2022-11-23 15:40:27 +00:00
Maybe Waffle 11a5386256 Move `get_associated_type` from `clippy` to `rustc_lint` 2022-11-23 15:40:27 +00:00
Laurențiu Nicola 37c3521597 ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
Dylan DPC 5d7b68c82b
Rollup merge of #104751 - nnethercote:fix-104620, r=petrochenkov
Fix an ICE parsing a malformed attribute.

Fixes #104620.

r? `@petrochenkov`
2022-11-23 20:32:38 +05:30
Dylan DPC a39ed5c3f6
Rollup merge of #104744 - notriddle:notriddle/struct-fields-display-block, r=GuillaumeGomez
rustdoc: give struct fields CSS `display: block`

Fixes #104737
2022-11-23 20:32:37 +05:30
Dylan DPC c03026a7c6
Rollup merge of #104721 - WaffleLapkin:deref-harder, r=oli-obk
Remove more `ref` patterns from the compiler

r? `@oli-obk`
Previous PR: https://github.com/rust-lang/rust/pull/104500
2022-11-23 20:32:37 +05:30
Dylan DPC 0a791381c3
Rollup merge of #104509 - spastorino:use-obligation-ctxt, r=lcnr
Use obligation ctxt instead of dyn TraitEngine

r? `@lcnr`
2022-11-23 20:32:36 +05:30
Dylan DPC d3e9191875
Rollup merge of #104286 - ozkanonur:fix-doc-bootstrap-recompilation, r=jyn514
copy doc output files by format

This pr provides copying doc outputs by checking output format without removing output directory on each trigger.

Resolves #103785
2022-11-23 20:32:36 +05:30
Dylan DPC bd91c94a5d
Rollup merge of #104269 - compiler-errors:hang-in-where-clause-sugg, r=lcnr
Fix hang in where-clause suggestion with `predicate_can_apply`

Using `predicate_may_hold` during error reporting causes an evaluation overflow, which (because we use `evaluate_obligation_no_overflow`) then causes the predicate to need to be re-evaluated locally, which results in a hang.

... but since the "add a where clause" suggestion is best-effort, just throw any overflow errors. No need for 100% accuracy.

r? `@lcnr` who has been thinking about overflows... Let me know if you want more context about this issue, and as always, feel free to reassign.

Fixes #104225
2022-11-23 20:32:35 +05:30
Oli Scherer 46b37e20af OpaqueCast projections are always overlapping, they can't possibly be disjoint 2022-11-23 14:37:13 +00:00
Santiago Pastorino 409203a315
Use ObligationCtxt::normalize 2022-11-23 11:32:49 -03:00
Guillaume Gomez aa73e29799 Improve accessibility:
* Set aria-label attribute on search input
 * Put anchor text directly into the DOM and not in the CSS
2022-11-23 15:08:00 +01:00
bors 80b3c6dbde Auto merge of #103947 - camsteffen:place-clones, r=cjgillot
Reduce `PlaceBuilder` cloning

Some API tweaks with an eye towards reducing clones.
2022-11-23 13:13:50 +00:00
Santiago Pastorino 859b147d4f
Pass ObligationCtxt from enter_canonical_trait_query and use ObligationCtxt API 2022-11-23 09:36:03 -03:00
Santiago Pastorino 5b3a06a3c2
Call fully_solve_obligations instead of repeating code 2022-11-23 09:36:00 -03:00
Santiago Pastorino ad094cdceb
Use ObligationCtxt intead of dyn TraitEngine 2022-11-23 09:24:42 -03:00
bors 4e0d0d757e Auto merge of #102750 - the8472:opt-field-order, r=wesleywiser
optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones

```rust
use std::ptr::addr_of;
use std::mem;

struct Foo {
    word: u32,
    byte: u8,
    ary: [u8; 4]
}

fn main() {
    let foo: Foo = unsafe { mem::zeroed() };

    println!("base: {:p}\nword: {:p}\nbyte: {:p}\nary:  {:p}", &foo, addr_of!(foo.word), addr_of!(foo.byte), addr_of!(foo.ary));
}
```

prints

```
base: 0x7fffc1a8a668
word: 0x7fffc1a8a668
byte: 0x7fffc1a8a66c
ary:  0x7fffc1a8a66d
```

I.e. the `u8` in the middle causes the array to sit at an odd offset, which might prevent optimizations, especially on architectures where unaligned loads are costly.

Note that this will make field ordering niche-dependent, i.e. a `Bar<T>` with `T=char` and `T=u32` may result in different field order, this may break some code that makes invalid assumptions about `repr(Rust)` types.
2022-11-23 10:01:48 +00:00
bors 3f2b2eee8f Auto merge of #104758 - Manishearth:rollup-rh1tfum, r=Manishearth
Rollup of 6 pull requests

Successful merges:

 - #103488 (Allow opaque types in trait impl headers and rely on coherence to reject unsound cases)
 - #104359 (Refactor must_use lint into two parts)
 - #104612 (Lower return type outside async block creation)
 - #104621 (Fix --extern library finding errors)
 - #104647 (enable fuzzy_provenance_casts lint in liballoc and libstd)
 - #104750 (Bump `fd-lock` in `bootstrap` again)

Failed merges:

 - #104732 (Refactor `ty::ClosureKind` related stuff)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-23 06:48:56 +00:00
Michael Goulet 9decfff6f8 Add fatal overflow test 2022-11-23 05:35:49 +00:00
Michael Goulet a884a9e634 Drive-by: Don't manually call evaluate_obligation_no_overflow 2022-11-23 04:42:38 +00:00
Michael Goulet cbe9328018 Do not need to account for overflow in predicate_can_apply 2022-11-23 04:42:38 +00:00
Manish Goregaokar 42afb70f2f
Rollup merge of #104750 - mati865:bump-fd-lock-again, r=jyn514
Bump `fd-lock` in `bootstrap` again

Followup to https://github.com/rust-lang/rust/pull/103778
Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.
2022-11-22 22:54:41 -05:00
Manish Goregaokar 316bda89e4
Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc
enable fuzzy_provenance_casts lint in liballoc and libstd

r? ````@thomcc````
2022-11-22 22:54:41 -05:00
Manish Goregaokar 54b6292855
Rollup merge of #104621 - YC:master, r=davidtwco
Fix --extern library finding errors

- `crate_name` is not specified/passed to `metadata_crate_location_unknown_type`
c493bae0d8/compiler/rustc_error_messages/locales/en-US/metadata.ftl (L274-L275)
- `metadata_lib_filename_form` is missing `$`
- Add additional check to ensure that library is file

Testing
1. Create file `a.rs`
```rust
extern crate t;
fn main() {}
```
1. Create empty file `x`
1. Create empty directory `y`
1. Run
```sh
$ rustc -o a a.rs --extern t=x
$ rustc -o a a.rs --extern t=y
```
Both currently panic with stable.
2022-11-22 22:54:40 -05:00
Manish Goregaokar 36815c6e3b
Rollup merge of #104612 - Swatinem:async-ret-y, r=estebank
Lower return type outside async block creation

This allows feeding a different output type to async blocks with a different `ImplTraitContext`. Spotted this while working on #104321
2022-11-22 22:54:39 -05:00
Manish Goregaokar a673364c54
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
Refactor must_use lint into two parts

Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.

Also fixes an integer overflow in the array length pluralization
calculation.

fixes #104352
2022-11-22 22:54:39 -05:00
Manish Goregaokar 53eab246db
Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases

r? ````@lcnr````

fixes #99840
2022-11-22 22:54:38 -05:00
bors 008bc1d587 Auto merge of #104752 - weihanglo:update-cargo, r=weihanglo
Update cargo

7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5 2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000

- Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368)
- Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186)
- Update mod.rs (rust-lang/cargo#11395)
- Fix typo `try use` -> `try to use` (rust-lang/cargo#11394)
- Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377)
- Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194)
- chore: Upgrade miow (rust-lang/cargo#11391)
2022-11-23 03:17:56 +00:00
Michael Goulet 024bb8c7fb Pass ParamEnv down instead of using ParamEnv of a module 2022-11-23 02:06:03 +00:00
Michael Goulet 1e7f6a7e0d Pass InferCtxt to DropRangeVisitor so we can resolve vars 2022-11-23 01:48:03 +00:00
Nicholas Nethercote 7c3f631ddf Fix an ICE parsing a malformed attribute.
Fixes #104620.
2022-11-23 12:11:14 +11:00
Weihang Lo 8a808dc5b4
Update cargo
7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5
2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000

- Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368)
- Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186)
- Update mod.rs (rust-lang/cargo#11395)
- Fix typo `try use` -> `try to use` (rust-lang/cargo#11394)
- Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377)
- Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194)
- chore: Upgrade miow (rust-lang/cargo#11391)
2022-11-23 01:02:04 +00:00
bors 604d52108e Auto merge of #104743 - JohnTitor:rollup-9z9u7yd, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #101368 (Forbid inlining `thread_local!`'s `__getit` function on Windows)
 - #102293 (Add powerpc64-ibm-aix as Tier-3 target)
 - #104717 (Add failing test for projections used as const generic)
 - #104720 (rustdoc: remove no-op CSS `.popover::before / a.test-arrow { display: inline-block }`)
 - #104722 (Speed up mpsc_stress test)
 - #104724 (Fix `ClosureKind::to_def_id`)
 - #104728 (Use `tcx.require_lang_item` instead of unwrapping lang items)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-22 23:43:13 +00:00
Mateusz Mikuła cd22ce6bd9 Bump `fd-lock` in `bootstrap` again
Followup to https://github.com/rust-lang/rust/pull/103778
Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.
2022-11-23 00:12:57 +01:00
The 8472 c1f392dbc0 add tests for field ordering optimization 2022-11-22 23:12:26 +01:00
The 8472 a9128d8927 fix tests, update size asserts 2022-11-22 23:12:26 +01:00
The 8472 97d8a9bdd3 also sort fields by niche sizes to retain optimizations 2022-11-22 23:12:26 +01:00
The 8472 a3450d060d group fields based on largest power of two dividing its size 2022-11-22 23:12:26 +01:00
The 8472 9f0cb566ea optimize field ordering by grouping power-of-two arrays with larger types 2022-11-22 23:12:26 +01:00
Michael Howell 1c80a5655f rustdoc: make struct fields `display: block` 2022-11-22 15:10:33 -07:00
Vadim Petrochenkov 5fc359f1ef resolve: Don't use constructor def ids in the map for field names
Also do some minor cleanup to insertion of those field names
2022-11-23 00:53:50 +03:00
Yuki Okushi 3ec1ca0516
Rollup merge of #104728 - WaffleLapkin:require-lang-items-politely, r=compiler-errors
Use `tcx.require_lang_item` instead of unwrapping lang items

I clearly remember esteban telling me that there is `require_lang_item` but he was from a phone atm and I couldn't find it, so I didn't use it. Stumbled on it today, so here we are :)
2022-11-23 06:40:24 +09:00
Yuki Okushi dcbfb9776d
Rollup merge of #104724 - WaffleLapkin:to_def_idn't, r=compiler-errors
Fix `ClosureKind::to_def_id`

`Fn` and `FnOnce` were mixed up in https://github.com/rust-lang/rust/pull/99131.
2022-11-23 06:40:24 +09:00
Yuki Okushi 0115969dd3
Rollup merge of #104722 - mejrs:stress, r=ChrisDenton
Speed up mpsc_stress test

See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/mpsc_stress for context

r? windows
2022-11-23 06:40:23 +09:00