Commit Graph

197056 Commits

Author SHA1 Message Date
Matthias Krüger
2059391eb2
Rollup merge of #100072 - oToToT:patch-1, r=michaelwoerister
linker-plugin-lto.md: Correct the name of example c file

The final output is linked with `cmain.o`, but we use `main.o` in the example.
This patch changes the name to `cmain.c` and `cmain.o` as the "C/C++ code as a dependency in Rust" section.
2022-08-10 00:00:27 +02:00
Matthias Krüger
cf7a9ae869
Rollup merge of #100040 - ChrisDenton:broken-pipe, r=davidtwco
Error on broken pipe but do not backtrace or ICE

Windows will report a broken pipe as a normal error which in turn `println!` will panic on. Currently this causes rustc to produce a backtrace and ICE. However, this is not a bug with rustc so a backtrace is overly verbose and ultimately unhelpful to the user.

Kind of fixes #98700. Although this is admittedly a bit of a hack because at panic time all we have is a string to inspect. On zulip it was suggested that libstd might someday provide a way to indicate a soft panic but that day isn't today.
2022-08-10 00:00:26 +02:00
Matthias Krüger
0dc39c7bd9
Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
rustdoc-json: Remove doc FIXME for Import::id and explain

Also add some test and refactor related code a bit.

``@rustbot`` labels +A-rustdoc-json +T-rustdoc
2022-08-10 00:00:24 +02:00
Matthias Krüger
02fc0faa9a
Rollup merge of #98775 - notriddle:notriddle/mobile-sidebar-scroll-lock, r=jsha
rustdoc: improve scroll locking in the rustdoc mobile sidebars

This PR prevents the main content area from scrolling while the mobile sidebar is open on documentation pages (porting the scroll locking behavior from the source sidebar to the regular sidebar), and also fixes some bad behavior where opening a "mobile" sidebar, and growing the viewport so that the "desktop" mode without scroll locking is activated, could potentially leave the page stuck.

This does not affect the behavior on larger screens. Only small ones, where the sidebar covers up the main content.

Split out from #98772
2022-08-10 00:00:23 +02:00
Vincenzo Palazzo
23bd7cbcb1 docs: remove repetition
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-09 21:54:05 +00:00
bors
34a6cae28e Auto merge of #100150 - notriddle:notriddle/implementors-js, r=GuillaumeGomez
rustdoc: use a more compact encoding for implementors/trait.*.js

The exact amount that this reduces the size of an implementors file depends on whether most of the impls are synthetic or not. For `Send`, it reduces the file from 128K to 112K, while for `Clone` it went from 64K to 44K.
2022-08-09 20:00:58 +00:00
Santiago Pastorino
750a04ea7f
Add docs for get_remapped_def_id 2022-08-09 16:39:02 -03:00
Santiago Pastorino
457ff7c56c
Iterate def_ids map backwards to try first the latest mappings (it's a stack) 2022-08-09 16:33:19 -03:00
shourya5
0d8bcc3dc5 added some comments 2022-08-10 00:55:07 +05:30
Eric Holk
0fd4db3716 Update rustdoc-json test 2022-08-09 12:06:54 -07:00
Santiago Pastorino
e6478a3724
Add regression test for issue 100187 2022-08-09 15:42:59 -03:00
Michael Goulet
d2667e4b71 Move folding into just projection cases 2022-08-09 18:19:58 +00:00
Daniel Paoliello
fda5144ceb Add error if link_ordinal used without raw-dylib 2022-08-09 11:02:41 -07:00
Noah Lev
31a051870b Address review comments 2022-08-09 10:44:52 -07:00
Takayuki Maeda
6d85bb9535 suggest a missing semicolon before an array 2022-08-10 02:29:28 +09:00
shourya5
9e553108c7 replaced resume_unwind with process::exit to fix
bootstrap panic when running x fmt --check.
running x fmt --check
2022-08-09 22:55:57 +05:30
Eric Holk
c18f22058b Rename integer log* methods to ilog*
This reflects the concensus from the libs team as reported at
https://github.com/rust-lang/rust/issues/70887#issuecomment-1209513261

Co-authored-by: Yosh Wuyts <github@yosh.is>
2022-08-09 10:20:49 -07:00
b-naber
52830efdcc fix 2022-08-09 19:12:33 +02:00
Jakob Degen
6ae1c0327a Mention unit-test in MIR opt test README 2022-08-09 09:58:46 -07:00
bors
63e4312e6b Auto merge of #99217 - lcnr:implied-bounds-pre-norm, r=lcnr
consider unnormalized types for implied bounds

extracted, and slightly modified, from #98900

The idea here is that generally, rustc is split into things which can assume its inputs are well formed[^1], and things which have verify that themselves.

Generally most predicates should only deal with well formed inputs, e.g. a `&'a &'b (): Trait` predicate should be able to assume that `'b: 'a` holds. Normalization can loosen wf requirements (see #91068) and must therefore not be used in places which still have to check well formedness. The only such place should hopefully be `WellFormed` predicates

fixes #87748 and #98543

r? `@jackh726` cc `@rust-lang/types`

[^1]: These places may still encounter non-wf inputs and have to deal with them without causing an ICE as we may check for well formedness out of order.
2022-08-09 16:39:43 +00:00
Guillaume Gomez
c634852cfb Add test for impl blocks containing only private items 2022-08-09 16:44:39 +02:00
bors
6d3f1beae1 Auto merge of #100318 - Dylan-DPC:rollup-18tzp6q, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #96478 (Implement `#[rustc_default_body_unstable]`)
 - #99787 (Rustdoc-Json: Document HRTB's on DynTrait)
 - #100181 (add method to get the mutability of an AllocId)
 - #100221 (Don't document impossible to call default trait items on impls)
 - #100228 (Don't ICE while suggesting updating item path.)
 - #100301 (Avoid `&str` to `String` conversions)
 - #100305 (Suggest adding an appropriate missing pattern excluding comments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-09 13:51:33 +00:00
Guillaume Gomez
dd816a9c2e Prevent impl blocks containing only private items to be documented by default 2022-08-09 15:49:30 +02:00
lcnr
8691b96eee test implied bounds + nested proj oblig 2022-08-09 14:42:06 +02:00
Guillaume Gomez
5ed55f7b16 remove Clean trait implementation for ast::Module 2022-08-09 14:21:32 +02:00
Dylan DPC
467e7aae0f
Rollup merge of #100305 - TaKO8Ki:suggest-adding-appropriate-missing-pattern-excluding-comments, r=compiler-errors
Suggest adding an appropriate missing pattern excluding comments

fixes #100272
2022-08-09 17:34:57 +05:30
Dylan DPC
d7f414d540
Rollup merge of #100301 - TaKO8Ki:avoid-&str-to-String-conversions, r=compiler-errors
Avoid `&str` to `String` conversions

This patch removes the recently added unnecessary `&str` to `String` conversions.

follow-up to #99718
2022-08-09 17:34:56 +05:30
Dylan DPC
fac84e8bb6
Rollup merge of #100228 - luqmana:suggestion-ice, r=estebank
Don't ICE while suggesting updating item path.

When an item isn't found, we may suggest an appropriate import to `use`. Along with that, we also suggest updating the path to work with the `use`. Unfortunately, if the code in question originates from a macro, the span used to indicate which part of the path needs updating may not be suitable and cause an ICE (*). Since, such code is not adjustable directly by the user without modifying the macro, just skip the suggestion in such cases.

(*) The ICE happens because the emitter want to indicate to the user what code to delete by referencing a certain span. But in this case, said span has `lo == hi == 0` which means it thinks it's a dummy span. Adding a space before the proc macro attribute is enough to stop it from ICE'ing but even then the suggestion doesn't really make any sense:
```
help: if you import `DataStore`, refer to it directly
  |
1 -  #[dbstruct::dbstruct]
1 +  #[dbstruct::dbstruct]
```

Since suggestions are best-effort, I just gated this one on `can_be_used_for_suggestions` which catches cases like this.

Fixes #100199
2022-08-09 17:34:55 +05:30
Dylan DPC
d910e5376b
Rollup merge of #100221 - compiler-errors:impossible-trait-items, r=lcnr,notriddle,camelid
Don't document impossible to call default trait items on impls

Closes #100176

This only skips documenting _default_ trait items on impls, not ones that are written inside the impl block. This is a conservative approach, since I think we should document all items written in an impl block (I guess unless hidden or whatever), but the existence of this new query I added makes this easy to extend to other rustdoc cases.
2022-08-09 17:34:54 +05:30
Dylan DPC
7efe24c3ed
Rollup merge of #100181 - RalfJung:alloc-ref-mutability, r=jackh726
add method to get the mutability of an AllocId

Miri needs this for https://github.com/rust-lang/miri/issues/2463.
2022-08-09 17:34:52 +05:30
Dylan DPC
e41be25f06
Rollup merge of #99787 - aDotInTheVoid:rdj-dyn, r=camelid,notriddle,GuillaumeGomez
Rustdoc-Json: Document HRTB's on DynTrait

Closes https://github.com/rust-lang/rust/issues/99118

Probably best reviewed commit by commit.

`@rustbot` modify labels: +A-rustdoc-json

cc `@Enselic`

r? `@CraftSpider`
2022-08-09 17:34:51 +05:30
Dylan DPC
1dc4858914
Rollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011
Implement `#[rustc_default_body_unstable]`

This PR implements a new stability attribute — `#[rustc_default_body_unstable]`.

`#[rustc_default_body_unstable]` controls the stability of default bodies in traits.
For example:
```rust
pub trait Trait {
    #[rustc_default_body_unstable(feature = "feat", isssue = "none")]
    fn item() {}
}
```
In order to implement `Trait` user needs to either
- implement `item` (even though it has a default implementation)
- enable `#![feature(feat)]`

This is useful in conjunction with [`#[rustc_must_implement_one_of]`](https://github.com/rust-lang/rust/pull/92164), we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way — making implementation of only `PartialEq::ne` unstable.

r? `@Aaron1011`
cc `@nrc` (iirc you were interested in this wrt `read_buf`), `@danielhenrymantilla` (you were interested in the related `#[rustc_must_implement_one_of]`)
P.S. This is my first time working with stability attributes, so I'm not sure if I did everything right 😅
2022-08-09 17:34:50 +05:30
Kjetil Kjeka
22930b7b25 Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target 2022-08-09 13:29:18 +02:00
bors
cc4dd6fc9f Auto merge of #100089 - JakobDegen:no-invalidate-visitor, r=tmiasko
Add option to `mir::MutVisitor` to not invalidate CFG.

This also applies that option to some uses of the visitor. I had considered a design more similar to #100087 in which we detect if the CFG needs to be invalidated, but that is more difficult with the visitor API and so I decided against it. Another alternative to this design is to offer an API for "saving" and "restoring" CFG caches across arbitrary code. Such an API is more general, and so we may eventually want it anyway, but it seems overkill for this use case.

r? `@tmiasko`
2022-08-09 11:05:42 +00:00
lcnr
f25cb83296 don't normalize wf predicates
this allows us to soundly use unnormalized projections for wf
2022-08-09 12:54:32 +02:00
Michael Goulet
ca7e3c4a83 Keep going if normalized projection has unevaluated consts in QueryNormalizer 2022-08-09 09:41:28 +00:00
Mary
a725250806 Add support for link-flavor rust-lld for macOS
Also refactor iOS, watchOS and tvOS common code.
2022-08-09 11:04:48 +02:00
Jakob Degen
7547084ff6 Add option to mir::MutVisitor to not invalidate CFG.
This also applies that option to some uses of the visitor
2022-08-09 01:51:10 -07:00
bors
5af97e8b0b Auto merge of #100304 - matthiaskrgr:rollup-gs56vlw, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #100163 (Refactor: remove an unnecessary string search)
 - #100212 (Remove more Clean trait implementations)
 - #100238 (Further improve error message for E0081)
 - #100268 (Add regression test for #79148)
 - #100294 (Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part)
 - #100303 (⬆️ rust-analyzer)

Failed merges:

 - #100281 (Remove more Clean trait implementations)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-09 08:03:08 +00:00
Eric Huss
2462bd17a0 compiletest: Add warning and comment about running tests without RUSTC 2022-08-08 22:51:16 -07:00
Takayuki Maeda
56ec5bec1e suggest adding an appropriate missing pattern excluding comments 2022-08-09 14:27:26 +09:00
Matthias Krüger
cacd37ac3c
Rollup merge of #100303 - lnicola:rust-analyzer-2022-08-09, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-08-09 07:06:02 +02:00
Matthias Krüger
e20fabb6d5
Rollup merge of #100294 - theli-ua:master, r=thomcc
Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part

Rather than suggesting to calculate manually
2022-08-09 07:06:01 +02:00
Matthias Krüger
89835a018e
Rollup merge of #100268 - TaKO8Ki:add-regression-test-for-79148, r=Mark-Simulacrum
Add regression test for #79148

closes #79148
2022-08-09 07:05:59 +02:00
Matthias Krüger
d63d2bd67f
Rollup merge of #100238 - Bryysen:master, r=cjgillot
Further improve error message for E0081

Closes #97533
2022-08-09 07:05:58 +02:00
Matthias Krüger
65cc68b3fd
Rollup merge of #100212 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Remove more Clean trait implementations

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`
2022-08-09 07:05:56 +02:00
Matthias Krüger
a1829bbed0
Rollup merge of #100163 - TaKO8Ki:remove-unnecessary-string-search, r=wesleywiser
Refactor: remove an unnecessary string search
2022-08-09 07:05:55 +02:00
bors
8d1fa7105b Auto merge of #100205 - cjgillot:noice-doc, r=camelid
Avoid ICE in rustdoc when using `Fn` bounds

Fixes https://github.com/rust-lang/rust/issues/100143
2022-08-09 05:05:46 +00:00
Laurențiu Nicola
f1e801be71 ⬆️ rust-analyzer 2022-08-09 07:23:57 +03:00
bors
f7e2cb4470 Auto merge of #9308 - daxpedda:missing-const-for-fn, r=Jarcho
Use `check_proc_macro` for `missing_const_for_fn`

This uses `@Jarcho's` #8694 implementation to fix `missing_const_for_fn` linting in proc-macros.
I'm not 100% sure what I'm doing here, any feedback is appreciated.

Previously: https://github.com/Jarcho/rust-clippy/pull/1.
Fixes #8854.

changelog: [`missing_const_for_fn`]: No longer lints in proc-macros
2022-08-09 03:44:21 +00:00