Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #83096

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
"intra_doc_link_resolution_failure",
"use `rustdoc::broken_intra_doc_links` instead",
);
store.register_removed("rustdoc", "use `rustdoc::all` instead");

store.register_removed("unknown_features", "replaced by an error");
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,9 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
match &mut fields {
Fields::Vec(pats) => {
for (i, pat) in new_pats {
pats[i] = pat
if let Some(p) = pats.get_mut(i) {
*p = pat;
}
}
}
Fields::Filtered { fields, .. } => {
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_typeck/src/astconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let mut bounds = Bounds::default();

self.add_bounds(param_ty, ast_bounds, &mut bounds);
bounds.trait_bounds.sort_by_key(|(t, _, _)| t.def_id());

bounds.implicitly_sized = if let SizedByDefault::Yes = sized_by_default {
if !self.is_unsized(ast_bounds, span) { Some(span) } else { None }
Expand Down Expand Up @@ -1318,8 +1317,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

// De-duplicate auto traits so that, e.g., `dyn Trait + Send + Send` is the same as
// `dyn Trait + Send`.
auto_traits.sort_by_key(|i| i.trait_ref().def_id());
auto_traits.dedup_by_key(|i| i.trait_ref().def_id());
// We remove duplicates by inserting into a `FxHashSet` to avoid re-ordering
// the bounds
let mut duplicates = FxHashSet::default();
auto_traits.retain(|i| duplicates.insert(i.trait_ref().def_id()));
debug!("regular_traits: {:?}", regular_traits);
debug!("auto_traits: {:?}", auto_traits);

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn assert_failed_inner(
Some(args) => panic!(
r#"assertion failed: `(left {} right)`
left: `{:?}`,
right: `{:?}: {}`"#,
right: `{:?}`: {}"#,
op, left, right, args
),
None => panic!(
Expand Down
6 changes: 2 additions & 4 deletions library/std/src/sys/wasi/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,11 @@ fn open_parent(p: &Path) -> io::Result<(ManuallyDrop<WasiFd>, PathBuf)> {
);
return Err(io::Error::new(io::ErrorKind::Other, msg));
}
let len = CStr::from_ptr(buf.as_ptr().cast()).to_bytes().len();
buf.set_len(len);
buf.shrink_to_fit();
let relative = CStr::from_ptr(relative_path).to_bytes().to_vec();

return Ok((
ManuallyDrop::new(WasiFd::from_raw(fd as u32)),
PathBuf::from(OsString::from_vec(buf)),
PathBuf::from(OsString::from_vec(relative)),
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ crate fn render<T: Print, S: Print>(
{style_files}\
<script id=\"default-settings\"{default_settings}></script>\
<script src=\"{static_root_path}storage{suffix}.js\"></script>\
<script src=\"{static_root_path}crates{suffix}.js\"></script>\
<script src=\"{root_path}crates{suffix}.js\"></script>\
<noscript><link rel=\"stylesheet\" href=\"{static_root_path}noscript{suffix}.css\"></noscript>\
{css_extension}\
{favicon}\
Expand Down
6 changes: 5 additions & 1 deletion src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,11 @@ function defocusSearchBar() {
search_input.removeAttribute('disabled');

var crateSearchDropDown = document.getElementById("crate-search");
crateSearchDropDown.addEventListener("focus", loadSearch);
// `crateSearchDropDown` can be null in case there is only crate because in that case, the
// crate filter dropdown is removed.
if (crateSearchDropDown) {
crateSearchDropDown.addEventListener("focus", loadSearch);
}
var params = getQueryStringParams();
if (params.search !== undefined) {
loadSearch();
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ crate fn register_lints(_sess: &Session, lint_store: &mut LintStore) {
lint_store.register_lints(&**RUSTDOC_LINTS);
lint_store.register_group(
true,
"rustdoc",
None,
"rustdoc::all",
Some("rustdoc"),
RUSTDOC_LINTS.iter().map(|&lint| LintId::of(lint)).collect(),
);
for lint in &*RUSTDOC_LINTS {
Expand Down
31 changes: 31 additions & 0 deletions src/test/incremental/issue-82920-predicate-order-miscompile.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// revisions: rpass1 rpass2

trait MyTrait: One + Two {}
impl<T> One for T {
fn method_one(&self) -> usize {
1
}
}
impl<T> Two for T {
fn method_two(&self) -> usize {
2
}
}
impl<T: One + Two> MyTrait for T {}

fn main() {
let a: &dyn MyTrait = &true;
assert_eq!(a.method_one(), 1);
assert_eq!(a.method_two(), 2);
}

// Re-order traits 'One' and 'Two' between compilation
// sessions

#[cfg(rpass1)]
trait One { fn method_one(&self) -> usize; }

trait Two { fn method_two(&self) -> usize; }

#[cfg(rpass2)]
trait One { fn method_one(&self) -> usize; }
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/check-fail.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// compile-flags: -Z unstable-options --check

#![deny(missing_docs)]
#![deny(rustdoc)]
#![deny(rustdoc::all)]

//! ```rust,testharness
//~^ ERROR
Expand Down
12 changes: 6 additions & 6 deletions src/test/rustdoc-ui/check-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ LL | pub fn foo() {}
note: the lint level is defined here
--> $DIR/check-fail.rs:4:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc::all)]`

error: unknown attribute `testharness`. Did you mean `test_harness`?
--> $DIR/check-fail.rs:6:1
Expand All @@ -35,9 +35,9 @@ LL | | //! ```
note: the lint level is defined here
--> $DIR/check-fail.rs:4:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc)]`
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc::all)]`
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function

error: unknown attribute `testharness`. Did you mean `test_harness`?
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![warn(missing_docs)]
//~^ WARN
//~^^ WARN
#![warn(rustdoc)]
#![warn(rustdoc::all)]

pub fn foo() {}
//~^ WARN
Expand Down
16 changes: 8 additions & 8 deletions src/test/rustdoc-ui/check.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ warning: missing documentation for the crate
LL | / #![warn(missing_docs)]
LL | |
LL | |
LL | | #![warn(rustdoc)]
LL | | #![warn(rustdoc::all)]
LL | |
LL | | pub fn foo() {}
| |_______________^
Expand All @@ -26,9 +26,9 @@ warning: no documentation found for this crate's top-level module
note: the lint level is defined here
--> $DIR/check.rs:7:9
|
LL | #![warn(rustdoc)]
| ^^^^^^^
= note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc)]`
LL | #![warn(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc::all)]`
= help: The following guide may be of use:
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html

Expand All @@ -38,17 +38,17 @@ warning: missing code example in this documentation
LL | / #![warn(missing_docs)]
LL | |
LL | |
LL | | #![warn(rustdoc)]
LL | | #![warn(rustdoc::all)]
LL | |
LL | | pub fn foo() {}
| |_______________^
|
note: the lint level is defined here
--> $DIR/check.rs:7:9
|
LL | #![warn(rustdoc)]
| ^^^^^^^
= note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc)]`
LL | #![warn(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc::all)]`

warning: missing code example in this documentation
--> $DIR/check.rs:9:1
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/lint-group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! println!("sup");
//! ```

#![deny(rustdoc)]
#![deny(rustdoc::all)]

/// what up, let's make an [error]
///
Expand Down
24 changes: 12 additions & 12 deletions src/test/rustdoc-ui/lint-group.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LL | /// wait, this doesn't have a doctest?
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc::all)]`

error: documentation test in private item
--> $DIR/lint-group.rs:19:1
Expand All @@ -24,9 +24,9 @@ LL | | /// ```
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc)]`
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc::all)]`

error: missing code example in this documentation
--> $DIR/lint-group.rs:26:1
Expand All @@ -43,9 +43,9 @@ LL | /// what up, let's make an [error]
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc)]`
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc::all)]`
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: unclosed HTML tag `unknown`
Expand All @@ -57,9 +57,9 @@ LL | /// <unknown>
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc)]`
LL | #![deny(rustdoc::all)]
| ^^^^^^^^^^^^
= note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc::all)]`

error: aborting due to 5 previous errors

3 changes: 3 additions & 0 deletions src/test/rustdoc-ui/unknown-renamed-lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#![deny(non_autolinks)]
//~^ ERROR renamed to `rustdoc::non_autolinks`

#![deny(rustdoc)]
//~^ ERROR removed: use `rustdoc::all` instead

// Explicitly don't try to handle this case, it was never valid
#![deny(rustdoc::intra_doc_link_resolution_failure)]
//~^ ERROR unknown lint
10 changes: 8 additions & 2 deletions src/test/rustdoc-ui/unknown-renamed-lints.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ error: lint `non_autolinks` has been renamed to `rustdoc::non_autolinks`
LL | #![deny(non_autolinks)]
| ^^^^^^^^^^^^^ help: use the new name: `rustdoc::non_autolinks`

error: lint `rustdoc` has been removed: use `rustdoc::all` instead
--> $DIR/unknown-renamed-lints.rs:15:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^

error: unknown lint: `rustdoc::intra_doc_link_resolution_failure`
--> $DIR/unknown-renamed-lints.rs:16:9
--> $DIR/unknown-renamed-lints.rs:19:9
|
LL | #![deny(rustdoc::intra_doc_link_resolution_failure)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Compilation failed, aborting rustdoc

error: aborting due to 6 previous errors
error: aborting due to 7 previous errors

2 changes: 1 addition & 1 deletion src/test/rustdoc/inline_cross/impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use impl_trait_aux::func2;

// @has impl_trait/fn.func3.html
// @has - '//pre[@class="rust fn"]' "func3("
// @has - '//pre[@class="rust fn"]' "_x: impl Clone + Iterator<Item = impl Iterator<Item = u8>>)"
// @has - '//pre[@class="rust fn"]' "_x: impl Iterator<Item = impl Iterator<Item = u8>> + Clone)"
// @!has - '//pre[@class="rust fn"]' 'where'
pub use impl_trait_aux::func3;

Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc/unit-return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pub fn f0<F: FnMut(u8) + Clone>(f: F) {}
// @has 'foo/fn.f1.html' '//*[@class="rust fn"]' 'F: FnMut(u16) + Clone'
pub fn f1<F: FnMut(u16) -> () + Clone>(f: F) {}

// @has 'foo/fn.f2.html' '//*[@class="rust fn"]' 'F: Clone + FnMut(u32)'
// @has 'foo/fn.f2.html' '//*[@class="rust fn"]' 'F: FnMut(u32) + Clone'
pub use unit_return::f2;

// @has 'foo/fn.f3.html' '//*[@class="rust fn"]' 'F: Clone + FnMut(u64)'
// @has 'foo/fn.f3.html' '//*[@class="rust fn"]' 'F: FnMut(u64) + Clone'
pub use unit_return::f3;
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
error[E0277]: `<<Self as Case1>::C as Iterator>::Item` is not an iterator
--> $DIR/bad-bounds-on-assoc-in-trait.rs:27:5
|
LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<<Self as Case1>::C as Iterator>::Item` is not an iterator
|
= help: the trait `Iterator` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
help: consider further restricting the associated type
|
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Iterator {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
--> $DIR/bad-bounds-on-assoc-in-trait.rs:27:36
|
Expand All @@ -27,6 +15,23 @@ help: consider further restricting the associated type
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: `<<Self as Case1>::C as Iterator>::Item` is not an iterator
--> $DIR/bad-bounds-on-assoc-in-trait.rs:27:43
|
LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<<Self as Case1>::C as Iterator>::Item` is not an iterator
|
::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
LL | pub trait Iterator {
| ------------------ required by this bound in `Iterator`
|
= help: the trait `Iterator` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
help: consider further restricting the associated type
|
LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Iterator {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
--> $DIR/bad-bounds-on-assoc-in-trait.rs:27:93
|
Expand Down
Loading