rust/src/librustdoc
Matthias Krüger 3cd0a109a8
Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk
Store the laziness of type aliases in their `DefKind`

Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not.

With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*:

Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates.

As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions.

---

This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold.

`@rustbot` label F-lazy_type_alias
r? `@oli-obk`
2023-08-08 03:30:56 +02:00
..
clean Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
doctest pass unused_extern_crates in librustdoc::doctest::make_test 2023-04-25 17:20:58 +03:00
formats Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
html Rollup merge of #114475 - GuillaumeGomez:migrate-gui-test-color-27, r=notriddle 2023-08-04 19:47:38 -07:00
json Render generic const items in rustdoc 2023-07-28 22:21:42 +02:00
passes Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
theme Spelling librustdoc 2023-04-16 21:44:12 -04:00
askama.toml Remove unneeded minus sign in jinja tags 2023-03-06 11:38:15 +01:00
Cargo.toml rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets 2023-03-14 20:28:00 +01:00
config.rs Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
core.rs Auto merge of #113734 - cjgillot:no-crate-lint, r=petrochenkov 2023-08-05 07:20:16 +00:00
docfs.rs Update docsfs module documentation 2023-03-15 16:47:14 +01:00
doctest.rs Remove a bool for color in favor of the WriteColor trait wrapping colored and uncolored printing 2023-07-31 09:34:36 +00:00
error.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
externalfiles.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
fold.rs clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
lib.rs Don't require each rustc_interface tool to opt-in to parallel_rustc support 2023-07-11 22:55:23 -05:00
lint.rs Add rustdoc::unescaped_backtick lint 2023-04-29 13:13:25 +02:00
markdown.rs Turn MarkdownWithToc into a struct with named fields 2023-02-06 16:31:17 +01:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
scrape_examples.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
theme.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
visit.rs clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
visit_ast.rs Move inherits_doc_hidden and should_ignore_res into clean/utils.rs 2023-07-29 14:39:10 +02:00
visit_lib.rs Correctly handle --document-hidden-items 2023-07-14 17:25:09 +02:00

For more information about how librustdoc works, see the rustc dev guide.